:root {
  --ink: #0a0a0e;
  --ink2: #121218;
  --paper: #ece7db;
  --paper2: #e3ddcd;
  --acid: #d6ff4a;
  --violet: #9c8cff;
  --rose: #ff5470;
  --mist: rgba(236, 231, 219, 0.58);
  --mist2: rgba(236, 231, 219, 0.34);
  --hair: rgba(236, 231, 219, 0.14);
  --hairP: rgba(10, 10, 14, 0.18);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Space Grotesk", system-ui, sans-serif;
  --ease: cubic-bezier(0.19, 1, 0.22, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--ink); min-height: 100%; }
body {
  color: var(--paper);
  font-family: var(--sans);
  font-weight: 340;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button, input { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
::selection { background: var(--acid); color: var(--ink); }
.hidden { display: none !important; }
kbd {
  font: inherit;
  font-size: 0.92em;
  border: 1px solid var(--hair);
  border-bottom-width: 2px;
  padding: 0 0.35em;
  border-radius: 4px;
}

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

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 54px);
  position: relative;
  z-index: 2;
}
.brand {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 19px;
  letter-spacing: -0.015em;
}
.brand .dot {
  display: inline-block;
  width: 0.38em;
  height: 0.38em;
  margin-left: 0.14em;
  border-radius: 50%;
  background: var(--acid);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.nav {
  display: flex;
  gap: clamp(14px, 2.4vw, 28px);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mist2);
}
.nav a:hover { color: var(--paper); }
.nav .here { color: var(--acid); }
.local {
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--mist2);
}

.view { position: relative; z-index: 1; }
.create { padding: 8px clamp(18px, 4vw, 54px) 72px; }

.hero { max-width: 760px; padding: 12px 0 42px; }
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--mist2);
  margin-bottom: 16px;
}
.eyebrow.tight { margin-bottom: 4px; }
h1 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(56px, 10vw, 96px);
  letter-spacing: -0.03em;
  line-height: 0.92;
  margin-bottom: 18px;
}
.lede {
  max-width: 52ch;
  color: var(--mist);
  font-size: clamp(15px, 1.4vw, 17px);
  line-height: 1.65;
}

.stage {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 21px;
  align-items: start;
}
.sheet {
  background: var(--paper);
  color: var(--ink);
  border-radius: 13px;
  min-height: 420px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.35s var(--ease), box-shadow 0.35s, aspect-ratio 0.25s;
  width: 100%;
}
.sheet.has-media {
  min-height: 0;
  max-height: min(72vh, 720px);
}
.sheet:hover, .sheet:focus-visible { transform: translateY(-2px); }
.sheet.hot { box-shadow: 0 0 0 2px var(--acid); }
.sheet-empty, .sheet-preview { min-height: 420px; }
.sheet.has-media .sheet-preview { min-height: 0; }
.sheet-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 8px;
}
.sheet-mark { width: 64px; height: 64px; opacity: 0.45; margin-bottom: 8px; }
.sheet-title { font-family: var(--serif); font-size: 28px; font-weight: 500; }
.sheet-sub { color: rgba(10, 10, 14, 0.55); font-size: 14px; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.sheet-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
.sheet-preview img,
.sheet-preview video {
  width: 100%;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  max-height: min(62vh, 620px);
  object-fit: contain;
  background: #111;
}
.sheet-preview video.hidden,
.sheet-preview img.hidden { display: none; }
.finish-play {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  border-radius: 4px;
  pointer-events: none;
  background: #111;
}
.finish-play img,
.finish-play video {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}
.media-well {
  position: fixed;
  left: -2400px;
  top: 0;
  width: 720px;
  height: 540px;
  overflow: hidden;
  opacity: 1;
  pointer-events: none;
}
.media-well img,
.media-well video {
  width: 720px;
  height: auto;
  max-width: none;
}
.preview-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  font-size: 13px;
}
.text-btn {
  letter-spacing: 0.16em;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

.console {
  border: 1px solid var(--hair);
  border-radius: 13px;
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(13, 13, 19, 0.55);
}
.console-kicker {
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--acid);
}
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.chip span { color: var(--mist2); font-size: 10px; letter-spacing: 0.14em; }
.chip.on, .chip[aria-pressed="true"] {
  background: var(--acid);
  color: var(--ink);
  border-color: var(--acid);
}
.chip.on span, .chip[aria-pressed="true"] span { color: rgba(10, 10, 14, 0.55); }
.custom { display: flex; gap: 12px; }
.custom label {
  flex: 1;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mist2);
}
.custom input {
  width: 100%;
  margin-top: 6px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--hair);
  padding: 6px 0;
  font-size: 18px;
  color: var(--paper);
}
.custom input:focus { outline: none; border-bottom-color: var(--acid); }
.count {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
}
.opts { display: flex; flex-direction: column; gap: 10px; }
.tog {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--mist);
  cursor: pointer;
}
.tog input { accent-color: var(--acid); width: 16px; height: 16px; margin-top: 3px; }
.privacy { font-size: 12px; color: var(--mist2); line-height: 1.6; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.3s var(--ease);
}
.btn.xl { width: 100%; padding: 16px; font-size: 12px; }
.btn.acid { background: var(--acid); color: var(--ink); }
.btn.acid:hover { transform: translateY(-1px); }
.btn.acid:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.ink { background: var(--ink); color: var(--paper); }
.sheet .btn.ink { background: var(--ink); }
.sheet .btn.ghost { border-color: var(--hairP); color: var(--ink); }
.btn.ghost { border: 1px solid var(--hair); color: var(--paper); }
.btn.ghost:hover { background: var(--paper); color: var(--ink); }
.btn.ghost[aria-pressed="true"] { background: var(--acid); color: var(--ink); border-color: var(--acid); }

.samples-wrap { margin-top: 48px; }
.slabel {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mist2);
  margin-bottom: 16px;
}
.samples {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.sample {
  text-align: left;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--hair);
  background: var(--ink2);
  transition: border-color 0.3s, transform 0.3s var(--ease);
}
.sample img { height: 180px; width: 100%; object-fit: cover; }
.sample span {
  display: block;
  padding: 12px 14px 14px;
  font-family: var(--serif);
  font-size: 16px;
}
.sample span i {
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--acid);
  margin-left: 8px;
  vertical-align: middle;
}
.sample:hover { border-color: var(--acid); transform: translateY(-3px); }

.play { display: flex; flex-direction: column; min-height: calc(100svh - 88px); }
.play.hidden { display: none !important; }
.playbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 clamp(18px, 4vw, 54px) 12px;
}
.play-name { font-family: var(--serif); font-size: 20px; }
.meters {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--mist);
  display: flex;
  align-items: center;
  gap: 12px;
}
.dot-sep {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acid);
}
.play-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#rotateBtn { letter-spacing: 0.14em; }
.zoom-ctrl { display: flex; align-items: center; gap: 2px; }
.zoom-ctrl .btn { min-width: 38px; padding-left: 12px; padding-right: 12px; }
.zoom-read {
  min-width: 52px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--mist);
  padding: 8px 6px;
  border-radius: 999px;
}
.zoom-read:hover { color: var(--acid); }
.table {
  flex: 1;
  margin: 0 clamp(10px, 2vw, 28px) 16px;
  min-height: 520px;
  height: calc(100svh - 168px);
  position: relative;
  user-select: none;
  overscroll-behavior: none;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(214, 255, 74, 0.04), transparent 50%),
    var(--ink2);
  border: 1px solid var(--hair);
  border-radius: 13px;
  overflow: hidden;
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
#board.dragging { cursor: grabbing; }
.hint {
  position: absolute;
  left: 16px;
  bottom: 12px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--mist2);
  pointer-events: none;
}

.winbar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: rgba(10, 10, 14, 0.78);
  border: 1px solid rgba(214, 255, 74, 0.35);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  pointer-events: auto;
}
.winbar p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--acid);
}
.winbar .win-actions { margin: 0; }
.win, .cam {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.win-card, .cam-card {
  width: min(480px, 100%);
  background: var(--paper);
  color: var(--ink);
  border-radius: 16px;
  padding: 36px 32px;
}
.win-card h2, .cam-card .eyebrow { margin-bottom: 8px; }
.win-card h2 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: 36px;
  letter-spacing: -0.02em;
}
.win-stats { color: rgba(10, 10, 14, 0.62); margin: 12px 0 24px; }
.win-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cam-card video {
  width: 100%;
  background: #111;
  border-radius: 10px;
  margin: 12px 0;
  min-height: 200px;
}
.cam-note { font-size: 13px; color: rgba(10, 10, 14, 0.6); margin-bottom: 18px; }

footer.site {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 28px clamp(18px, 4vw, 54px) 36px;
  color: var(--mist2);
  font-size: 11px;
  letter-spacing: 0.12em;
}
footer.site a:hover { color: var(--acid); }

@media (max-width: 980px) {
  .nav { display: none; }
  .stage, .samples { grid-template-columns: 1fr; }
  .sheet:not(.has-media), .sheet-empty { min-height: 320px; }
}
@media (max-width: 640px) {
  .local { display: none; }
  h1 { font-size: 56px; }
  .playbar { padding-bottom: 10px; }
  .table { min-height: 68svh; }
  footer.site { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    transition-duration: 0.01s !important;
  }
  .brand .dot { animation: none; }
}
