:root {
  --ink: #f4f1e9;
  --muted: #92928e;
  --line: rgba(244, 241, 233, 0.13);
  --panel: #0d0e13;
  --background: #08090d;
  --accent: #efff8a;
  --accent-2: #a48cff;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.grain {
  position: fixed;
  z-index: 50;
  inset: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.topbar {
  position: relative;
  z-index: 10;
  height: 66px;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 9, 13, 0.88);
  backdrop-filter: blur(16px);
}

.brand,
.source-link {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.08em;
  font: 500 11px/1 "DM Mono", monospace;
}

.brand {
  padding-left: 24px;
  border-right: 1px solid var(--line);
}

.brand-mark {
  width: 17px;
  height: 17px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  box-shadow: inset 6px 0 0 var(--accent-2);
}

.source-link {
  justify-content: flex-end;
  padding-right: 24px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  transition: color 180ms ease;
}

.source-link:hover {
  color: var(--accent);
}

.topbar-note {
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.12em;
  font: 300 10px/1 "DM Mono", monospace;
}

main {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  min-height: calc(100vh - 103px);
}

.scene-nav,
.control-panel {
  position: relative;
  z-index: 5;
  background: var(--panel);
}

.scene-nav {
  border-right: 1px solid var(--line);
  padding: 28px 0;
}

.scene-nav-label,
.control-label,
.control-group > label {
  display: block;
  color: #6f706d;
  letter-spacing: 0.14em;
  font: 400 9px/1 "DM Mono", monospace;
}

.scene-nav-label {
  padding: 0 24px 21px;
}

.scene-option {
  position: relative;
  width: 100%;
  min-height: 86px;
  display: grid;
  grid-template-columns: 36px 1fr 22px;
  align-items: center;
  gap: 9px;
  padding: 16px 22px;
  border: 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
}

.scene-option:last-of-type {
  border-bottom: 1px solid var(--line);
}

.scene-option::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 180ms ease;
}

.scene-option:hover,
.scene-option.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.025);
}

.scene-option.is-active::before {
  transform: scaleY(1);
}

.scene-number {
  align-self: start;
  padding-top: 4px;
  color: #666763;
  font: 400 9px/1 "DM Mono", monospace;
}

.scene-option strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.scene-option small {
  display: block;
  color: #71726f;
  font: 300 10px/1 "DM Mono", monospace;
}

.scene-arrow {
  opacity: 0;
  transform: translateX(-5px);
  color: var(--accent);
  transition: opacity 180ms ease, transform 180ms ease;
}

.scene-option.is-active .scene-arrow,
.scene-option:hover .scene-arrow {
  opacity: 1;
  transform: translateX(0);
}

.coordinates {
  position: absolute;
  bottom: 26px;
  left: 24px;
  display: grid;
  gap: 5px;
  color: #4f504d;
  font: 300 9px/1 "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.stage {
  position: relative;
  min-height: 690px;
  overflow: hidden;
  isolation: isolate;
  background: #0b0c11;
}

#art-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-vignette {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(8, 9, 13, 0.2), transparent 25%, transparent 75%, rgba(8, 9, 13, 0.3)),
    radial-gradient(circle at center, transparent 35%, rgba(8, 9, 13, 0.33) 100%);
}

.stage-index {
  position: absolute;
  z-index: 2;
  top: 25px;
  right: 25px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.45);
  font: 300 9px/1 "DM Mono", monospace;
}

.stage-line {
  width: 34px;
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
}

.scene-copy {
  position: absolute;
  z-index: 2;
  left: clamp(28px, 6vw, 82px);
  bottom: clamp(74px, 10vh, 112px);
  width: min(470px, calc(100% - 56px));
  pointer-events: none;
}

.eyebrow {
  margin-bottom: 22px;
  color: var(--accent);
  letter-spacing: 0.14em;
  font: 400 10px/1 "DM Mono", monospace;
}

h1 {
  margin: 0;
  font-size: clamp(66px, 8.2vw, 118px);
  font-weight: 500;
  line-height: 0.79;
  letter-spacing: -0.078em;
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.28);
}

.scene-copy p {
  max-width: 390px;
  margin: 34px 0 0 4px;
  color: rgba(244, 241, 233, 0.68);
  font-size: 12px;
  line-height: 1.7;
}

.interaction-hint {
  position: absolute;
  z-index: 2;
  right: 25px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.48);
  font: 300 8px/1 "DM Mono", monospace;
  letter-spacing: 0.08em;
}

.hint-icon {
  width: 14px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 8px;
}

.hint-icon::after {
  content: "";
  display: block;
  width: 2px;
  height: 4px;
  margin: 3px auto;
  border-radius: 2px;
  background: currentColor;
  animation: nudge 1.8s ease-in-out infinite;
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(5px); opacity: 1; }
}

.control-panel {
  padding: 26px 24px;
  border-left: 1px solid var(--line);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 27px;
  color: #868783;
  letter-spacing: 0.12em;
  font: 400 9px/1 "DM Mono", monospace;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.control-group {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.range-wrap {
  display: grid;
  grid-template-columns: 1fr 34px;
  align-items: center;
  gap: 14px;
  margin-top: 17px;
}

input[type="range"] {
  width: 100%;
  height: 1px;
  appearance: none;
  background: linear-gradient(90deg, var(--accent) 0 68%, #34353a 68% 100%);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  appearance: none;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.range-wrap output {
  color: var(--ink);
  text-align: right;
  font: 400 11px/1 "DM Mono", monospace;
}

.palette-picker {
  display: flex;
  gap: 9px;
  margin-top: 16px;
}

.palette {
  width: 53px;
  height: 30px;
  display: flex;
  padding: 4px;
  border: 1px solid transparent;
  background: #191a20;
  cursor: pointer;
  transition: border-color 160ms ease;
}

.palette span {
  flex: 1;
  background: var(--swatch);
}

.palette.is-active {
  border-color: rgba(255, 255, 255, 0.65);
}

.actions {
  display: grid;
  gap: 8px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.action-button {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border: 1px solid var(--line);
  color: #c8c7c0;
  background: transparent;
  letter-spacing: 0.09em;
  font: 400 9px/1 "DM Mono", monospace;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.action-button:hover {
  border-color: rgba(255, 255, 255, 0.36);
  color: white;
}

.action-button--primary {
  margin-top: 5px;
  border-color: var(--accent);
  color: #101108;
  background: var(--accent);
}

.action-button--primary:hover {
  border-color: white;
  color: #101108;
  background: white;
}

kbd {
  color: #6f706d;
  background: transparent;
  font: 300 8px/1 "DM Mono", monospace;
}

.action-button--primary kbd {
  color: rgba(16, 17, 8, 0.5);
}

.edition {
  position: absolute;
  bottom: 24px;
  margin: 0;
  color: #4d4e4b;
  font: 300 8px/1.7 "DM Mono", monospace;
  letter-spacing: 0.08em;
}

footer {
  position: relative;
  z-index: 10;
  height: 37px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-top: 1px solid var(--line);
  color: #4f504d;
  background: var(--background);
  font: 300 8px/1 "DM Mono", monospace;
  letter-spacing: 0.09em;
}

@media (max-width: 1050px) {
  .topbar,
  main {
    grid-template-columns: 210px minmax(0, 1fr) 230px;
  }

  .scene-option {
    padding-inline: 16px;
  }

  .scene-copy {
    left: 40px;
  }
}

@media (max-width: 820px) {
  .topbar {
    height: 58px;
    grid-template-columns: 1fr auto;
  }

  .brand {
    border-right: 0;
  }

  .topbar-note {
    display: none;
  }

  .source-link {
    padding-inline: 18px;
  }

  main {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .scene-nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    order: 1;
    padding: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .scene-nav-label,
  .coordinates,
  .scene-arrow,
  .scene-option small {
    display: none;
  }

  .scene-option {
    min-height: 64px;
    grid-template-columns: 28px 1fr;
    border-top: 0;
    border-right: 1px solid var(--line);
    border-bottom: 0 !important;
  }

  .scene-option::before {
    inset: auto 0 0;
    width: auto;
    height: 2px;
    transform: scaleX(0);
  }

  .scene-option.is-active::before {
    transform: scaleX(1);
  }

  .scene-option strong {
    margin: 0;
    font-size: 11px;
  }

  .stage {
    order: 2;
    min-height: 72vh;
  }

  .control-panel {
    position: static;
    order: 3;
    display: grid;
    grid-template-columns: 0.8fr 1fr 1.2fr;
    gap: 24px;
    padding: 24px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .status-row {
    align-items: flex-start;
    padding: 4px 0;
  }

  .control-group,
  .actions {
    padding: 0;
    border-top: 0;
  }

  .control-group:nth-of-type(2) {
    display: none;
  }

  .edition {
    display: none;
  }
}

@media (max-width: 560px) {
  .brand {
    padding-left: 16px;
  }

  .source-link {
    font-size: 0;
  }

  .source-link span {
    font-size: 15px;
  }

  .scene-option {
    min-width: 0;
    display: flex;
    justify-content: center;
    padding: 12px 5px;
  }

  .scene-number {
    display: none;
  }

  .scene-option strong {
    font-size: 9px;
  }

  .stage {
    min-height: 66vh;
  }

  .scene-copy {
    left: 22px;
    bottom: 67px;
    width: calc(100% - 44px);
  }

  h1 {
    font-size: clamp(61px, 21vw, 88px);
  }

  .scene-copy p {
    max-width: 300px;
    font-size: 11px;
  }

  .interaction-hint {
    right: auto;
    left: 24px;
  }

  .control-panel {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .status-row {
    display: none;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .action-button--primary {
    grid-column: 1 / -1;
  }

  footer span:first-child {
    display: none;
  }

  footer {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hint-icon::after {
    animation: none;
  }
}
