/* Fastlane pilot: tokens lifted from the v2 UI mock (dark, grain, bevel, Doto numbers) + the deck's light paper. */
:root {
  --h: 22;
  --accent: hsl(var(--h) 100% 55%);
  --accent-hi: hsl(calc(var(--h) + 12) 100% 66%);
  --page: #050505;
  --canvas: #0c0c0d;
  --raised: #151517;
  --raised-2: #1c1c1f;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.14);
  --text: #f2efea;
  --body: rgba(242,239,234,.86);
  --mid: rgba(242,239,234,.6);
  --dim: rgba(242,239,234,.4);
  --faint: rgba(242,239,234,.24);
  --bev-a: #232326; --bev-b: #161618; --bev-ha: #2a2a2e; --bev-hb: #19191c;
  --bev-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 0 0 1px rgba(255,255,255,.06), inset 0 -1px 0 rgba(0,0,0,.5), 0 3px 8px -3px #000;
  --dlg-a: #1a1a1d; --dlg-b: #111113;
  --dlg-shadow: inset 0 1px 0 rgba(255,255,255,.1), inset 0 0 0 1px rgba(255,255,255,.07), 0 30px 80px -24px #000;
  --scrim: rgba(0,0,0,.6);
  --card-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 30px 70px -30px #000, 0 2px 0 rgba(255,255,255,.04);
  --grain: .05; --grain-blend: overlay;
  --logo-filter: invert(1);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --font-body: "Inter", system-ui, sans-serif;
  --font-dots: "Doto", monospace;
  --r-card: 18px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --page: #FAFAF7;
  --canvas: #ffffff;
  --raised: #F3F2EC;
  --raised-2: #ECEAE2;
  --line: rgba(22,19,15,.09);
  --line-2: rgba(22,19,15,.16);
  --text: #16130F;
  --body: rgba(22,19,15,.86);
  --mid: rgba(22,19,15,.6);
  --dim: rgba(22,19,15,.42);
  --faint: rgba(22,19,15,.25);
  --bev-a: #ffffff; --bev-b: #F4F3ED; --bev-ha: #ffffff; --bev-hb: #ECEAE2;
  --bev-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px #E3E0D7, inset 0 -1px 0 rgba(22,19,15,.06), 0 2px 6px -3px rgba(22,19,15,.25);
  --dlg-a: #ffffff; --dlg-b: #F7F6F1;
  --dlg-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px #E3E0D7, 0 30px 80px -30px rgba(22,19,15,.45);
  --scrim: rgba(250,250,247,.7);
  --card-shadow: inset 0 0 0 1px rgba(22,19,15,.08), 0 30px 60px -30px rgba(22,19,15,.5);
  --grain: .035; --grain-blend: multiply;
  --logo-filter: none;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--page); color: var(--text);
  font-family: var(--font-body); font-size: 14.5px; line-height: 1.5; letter-spacing: -0.006em;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  transition: background .2s, color .2s;
}
body::before { /* page grain */
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: var(--noise); background-size: 140px; mix-blend-mode: var(--grain-blend); opacity: calc(var(--grain) * 6);
}
body > * { position: relative; z-index: 1; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.doto { font-family: var(--font-dots); font-variation-settings: "ROND" 70; font-weight: 900; letter-spacing: -.01em; }
.label { font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }

/* Dot-matrix icons (SVG circles on a 7x7 grid, drawn by dots() in JS) */
.di { width: 18px; height: 18px; display: block; fill: currentColor; flex-shrink: 0; }

/* Buttons: one quiet style, one bevel style. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 11px;
  font-size: 13.5px; font-weight: 500; color: var(--body); background: var(--raised);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255,255,255,.05);
  transition: background .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--raised-2); color: var(--text); }
.btn.bevel { background: linear-gradient(180deg, var(--bev-a), var(--bev-b)); box-shadow: var(--bev-shadow); }
.btn.bevel:hover { background: linear-gradient(180deg, var(--bev-ha), var(--bev-hb)); }
.btn.bevel:active { background: linear-gradient(180deg, var(--bev-b), var(--bev-a)); }
.btn.primary { color: #fff; background: linear-gradient(180deg, hsl(var(--h) 90% 56%), hsl(var(--h) 90% 46%));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), inset 0 0 0 1px rgba(255,255,255,.08), inset 0 -1px 0 rgba(0,0,0,.35), 0 4px 12px -4px hsl(var(--h) 100% 50% / .6); }
.btn.primary:hover { background: linear-gradient(180deg, hsl(var(--h) 92% 60%), hsl(var(--h) 90% 49%)); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.round { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn.icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; color: var(--mid); }
.btn.icon:hover { color: var(--text); }
kbd { font: 500 10.5px/1 var(--font-body); color: var(--dim); padding: 3px 5px; border-radius: 5px; box-shadow: inset 0 0 0 1px var(--line-2); letter-spacing: 0; }

/* Fields */
.field {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 0; outline: 0; resize: none;
  background: var(--canvas); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 2px rgba(0,0,0,.08);
}
.field:focus { box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 2px rgba(0,0,0,.08); }
.field::placeholder { color: var(--dim); }

/* Dialogs: centred, the ad stays in view beside the note */
.ov {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.ov.on { opacity: 1; pointer-events: auto; }
.dlg {
  position: relative; width: min(100%, 640px); display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 0;
  border-radius: 22px; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, var(--dlg-a), var(--dlg-b)); box-shadow: var(--dlg-shadow);
  transform: translateY(10px) scale(.985); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.ov.on .dlg { transform: none; }
.dlg::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; background-image: var(--noise); background-size: 120px; mix-blend-mode: var(--grain-blend); opacity: calc(var(--grain) * 7); }
.dlg.narrow { width: min(100%, 380px); grid-template-columns: 1fr; }
.dlg-media { position: relative; background: #000; display: grid; place-items: center; min-height: 240px; max-height: 70vh; }
.dlg-media img, .dlg-media video { width: 100%; height: 100%; max-height: 70vh; object-fit: contain; display: block; -webkit-user-drag: none; user-select: none; }
.dlg-media .pins { position: absolute; inset: 0; pointer-events: none; }
.dlg-media.pinnable { cursor: crosshair; }
.dlg-body { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dlg-body h2 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.dlg-body .field { flex: 1; min-height: 110px; }
.dlg-body .row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.dlg-body .row .hint { margin-right: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.dlg-body .pinned { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--mid); }
.dlg-body .pinned i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.dlg-body .pinned.on i { background: var(--accent-hi); box-shadow: 0 0 8px var(--accent); }
.dlg-body .pinned.on { color: var(--text); }
@media (max-width: 560px) {
  .dlg { grid-template-columns: 1fr; width: 100%; }
  .dlg-media { min-height: 0; max-height: 34vh; }
  .dlg-media img, .dlg-media video { max-height: 34vh; }
  .dlg-body { padding: 16px 16px 14px; }
}
@media (hover: none) { kbd, .hint { display: none !important; } }

/* Top bar shared by both pages */
.top { display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px; max-width: 980px; margin: 0 auto; width: 100%; }
.top .brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; min-height: 28px; }
.top .brand img { height: 28px; width: auto; display: block; filter: var(--logo-filter); }
.top .brand span { color: var(--mid); font-weight: 500; }
.top .spacer { flex: 1; }
.top .prog { font-size: 20px; color: var(--text); margin-right: 2px; }
.top .prog small { font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--dim); margin-left: 2px; }
.top .who { padding: 6px 12px; font-size: 13px; }

/* Bottom-right dither corner, the deck's Bayer ramp */
.dither { position: fixed; right: 0; bottom: 0; z-index: 0; pointer-events: none; opacity: .9; }
:root[data-theme="light"] .dither { opacity: .85; }

.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 50; transform: translate(-50%, 10px); padding: 9px 14px; border-radius: 12px;
  font-size: 13px; color: var(--text); background: var(--raised-2); box-shadow: inset 0 0 0 1px var(--line), 0 10px 30px -10px rgba(0,0,0,.5);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
