:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #f8fafc;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 32%),
    linear-gradient(180deg, #020617 0%, #0f172a 45%, #111827 100%);
  color-scheme: dark;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --glass: rgba(15, 23, 42, 0.78);
  --border: rgba(148, 163, 184, 0.16);
  --accent: #7dd3fc;
  --accent-strong: #c084fc;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}

.glass-card {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 24px;
  backdrop-filter: blur(22px);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.hero {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.hero h1,
.stage h1,
.panel h2,
.info-card h2 {
  margin: 0;
  letter-spacing: -0.03em;
}

.hero__copy,
.stage__footer p,
.info-card p,
.error-banner,
.legend,
.control__hint {
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__actions,
.hero__stats,
.workspace-grid,
.info-grid,
.panel__header,
.stage__header,
.stage__footer,
.control__topline,
.preset-row,
.mode-switch {
  display: flex;
  gap: 12px;
}

.hero__actions,
.hero__stats,
.preset-row,
.mode-switch {
  flex-wrap: wrap;
}

.hero__stats article {
  flex: 1 1 120px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(30, 41, 59, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.hero__stats span,
.stage__footer strong,
.control__topline span,
.control__topline strong {
  display: block;
}

.hero__stats span {
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.85rem;
}

.hero__stats strong {
  margin-top: 8px;
  font-size: 1.4rem;
}

.primary-button,
.ghost-button,
.preset-chip,
.mode-switch__item {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.preset-chip:hover,
.mode-switch__item:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #020617;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 100%);
}

.ghost-button,
.preset-chip,
.mode-switch__item {
  color: #f8fafc;
  background: rgba(30, 41, 59, 0.64);
  border-color: rgba(148, 163, 184, 0.16);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.mode-switch {
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
}

.mode-switch__item {
  flex: 1;
}

.mode-switch__item.is-active {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.2), rgba(192, 132, 252, 0.24));
  border-color: rgba(125, 211, 252, 0.28);
}

.workspace-grid {
  display: grid;
  gap: 16px;
}

.stage,
.panel,
.info-card {
  padding: 18px;
}

.stage {
  display: grid;
  gap: 16px;
}

.stage__header,
.panel__header,
.stage__footer {
  align-items: center;
  justify-content: space-between;
}

.status-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.8);
  color: rgba(226, 232, 240, 0.78);
  font-size: 0.88rem;
}

.status-pill.is-live {
  color: #022c22;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.92), rgba(52, 211, 153, 0.92));
}

.stage__viewport {
  position: relative;
  overflow: hidden;
  min-height: min(72vh, 760px);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(2, 6, 23, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.stage__video {
  display: none;
}

.stage__canvas,
.stage__guides {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage__guides {
  pointer-events: none;
}

.guide {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px dashed rgba(226, 232, 240, 0.32);
  background: rgba(125, 211, 252, 0.04);
  display: grid;
  place-items: center;
}

.guide span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-size: 0.72rem;
}

.guide.is-active {
  border-color: rgba(125, 211, 252, 0.82);
  box-shadow: 0 0 0 1px rgba(125, 211, 252, 0.12), 0 0 48px rgba(125, 211, 252, 0.15);
}

.legend {
  align-items: center;
}

.legend span {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.panel {
  display: grid;
  gap: 16px;
}

.control-list {
  display: grid;
  gap: 14px;
}

.control {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.52);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.control__topline {
  justify-content: space-between;
  align-items: center;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

.error-banner {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(127, 29, 29, 0.3);
  border: 1px solid rgba(251, 113, 133, 0.24);
  color: #ffe4e6;
}

.info-grid {
  display: grid;
  gap: 16px;
}

.info-card {
  display: grid;
  gap: 8px;
}

@media (min-width: 900px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.85fr);
    align-items: start;
  }

  .info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 899px) {
  .stage__viewport {
    min-height: 62vh;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-inline: 12px;
  }

  .hero,
  .stage,
  .panel,
  .info-card {
    border-radius: 22px;
    padding: 16px;
  }

  .stage__viewport {
    min-height: 56vh;
  }
}
