/* Glass Hands — 404.zero, in the TWOZERO design language (layout, type and greys from twozero.ai).
   Palette: greys and black, ONE red (#C92A1D) for what you press and what is live, white sparingly.
   Panels are smoky frosted glass over the concrete wall; sheets carry a faint concrete grain.
   Space Grotesk for display (bold, tight tracking), PT Mono for everything else, uppercase labels. */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-hover: #222222;
  --fg1: #e8e8e8;
  --fg-hi: #ffffffd1;
  --fg2: #888888;
  --fg-faint: #5f5f5f;
  --hairline: #ffffff14;
  --hairline-strong: #ffffff29;
  --ghost: #ffffff2e;
  --border: #2a2a2a;
  --glass: #1c1c1c66;                /* frosted panels: smoky transparent grey over the live picture */
  --glass-hi: #3a3a3a80;
  --glass-strong: #ffffffd9;
  --red: #c92a1d;
  --red-hover: #d93122;
  --red-dim: #a7261a;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --frost: blur(18px) saturate(0);
  --scrim: #0a0a0abf;
  --edge: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 28%, #1c1c1c 70%, #171717 100%);
  --r-control: 8px;
  --r-card: 20px;
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "PT Mono", "Courier New", monospace;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg1); font-family: var(--mono);
  font-size: 14px; overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
a { color: inherit; }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; background: var(--bg); }
#veil { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.8s var(--ease);
  background: linear-gradient(90deg, #0a0a0af0 0%, #0a0a0acc 38%, #0a0a0a59 70%, #0a0a0a33 100%); }
body.is-landing #veil { opacity: 1; }
@media (max-width: 640px) { #veil { background: linear-gradient(180deg, #0a0a0acc 0%, #0a0a0ab3 60%, #0a0a0a80 100%); } }   /* text spans the width */

.hi { color: var(--red); }
.label { margin: 0; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--fg2); }

button, .btn { font: inherit; color: var(--fg1); cursor: pointer; border: 0; background: none; -webkit-appearance: none; appearance: none; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  border-radius: var(--r-control); font-family: var(--mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  text-decoration: none; white-space: nowrap; transition: background 0.2s var(--ease), border-color 0.2s var(--ease); }
.btn.solid { background: var(--red); color: #fff; }
.btn.solid:hover { background: var(--red-hover); }
.btn.ghost { border: 1px solid var(--ghost); background: var(--glass); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.btn.ghost:hover { border-color: #ffffff52; background: var(--glass-hi); }
.btn.wide { width: 100%; }

/* ---------- status strip ---------- */
#status { position: fixed; z-index: 5; top: 0; left: 0; right: 0; height: calc(24px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0; display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 1px;
  color: var(--fg2); background: var(--glass); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost);
  border-bottom: 1px solid var(--hairline); white-space: nowrap; overflow: hidden; }
#status b { font-weight: 400; color: var(--fg1); }
#status .grow { flex: 1; }
#status .sep { color: var(--fg-faint); }
.led { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--fg-faint); }
.led.live { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ---------- header ---------- */
#top { position: fixed; z-index: 4; top: calc(24px + env(safe-area-inset-top)); left: 0; right: 0; height: 56px;
  display: flex; justify-content: space-between; align-items: center; padding: 0 16px; pointer-events: none; }
#top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: -0.4px; text-decoration: none; }
.mark { width: 16px; height: 16px; background: var(--red); }
.tools { display: flex; gap: 6px; }
.tool { width: 36px; height: 36px; border-radius: var(--r-control); display: grid; place-items: center; font-size: 11px;
  letter-spacing: 1px; background: var(--glass); border: 1px solid var(--ghost); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost);
  transition: background 0.2s, border-color 0.2s; }
.tool:hover { background: var(--glass-hi); border-color: #ffffff52; }

/* ---------- landing hero ---------- */
#landing { position: fixed; z-index: 3; left: 0; top: calc(80px + env(safe-area-inset-top)); bottom: 0;
  width: min(640px, 100vw); padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: center; overflow-y: auto; overscroll-behavior: contain;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
#landing > * { flex: 0 0 auto; }
body:not(.is-landing) #landing { opacity: 0; pointer-events: none; transform: translateX(-12px); }
@media (max-height: 760px) { #landing { justify-content: flex-start; } }
#landing .label { margin-bottom: 18px; }
h1 { margin: 0 0 18px; font-family: var(--display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(56px, 15vw, 112px); line-height: 0.92; letter-spacing: -1.3px; color: var(--fg1); }
/* the title is glass: WebGL draws it (and the veil) as glass letters refracting the picture, like the blinds;
   the h1 only holds the place. Without WebGL it falls back to a faint clear title. */
#title { color: #ffffff2e; }
body.glass-title #title { color: transparent; -webkit-text-fill-color: transparent; }
body.glass-title #veil { display: none; }
.lede { margin: 0 0 26px; max-width: 460px; font-size: 14px; line-height: 1.6; color: var(--fg2); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; }
.cta.row .btn { flex: 1; }
.rows { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 6px; max-width: 460px; }
.rows li { display: flex; gap: 14px; align-items: baseline; padding: 10px 12px; font-size: 12px; line-height: 1.5;
  background: var(--glass); border: 1px solid var(--hairline-strong); border-radius: 4px; color: var(--fg1);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.rows .k { flex: 0 0 auto; min-width: 88px; color: var(--fg2); }
@media (max-width: 480px) { .rows li { padding: 8px 10px; font-size: 11px; } .rows .k { min-width: 64px; } .lede { font-size: 13px; } }
.rows.big li { flex-direction: column; gap: 4px; }
.rows.big .k { color: var(--fg1); text-transform: uppercase; letter-spacing: 1px; font-size: 11px; }
.rows.big li > span:last-child { color: var(--fg2); }
.fine { margin: 18px 0 0; max-width: 460px; font-size: 11px; line-height: 1.6; color: var(--fg-faint); }
.made { display: inline-block; margin-top: 6px; color: var(--fg2); text-decoration: none; letter-spacing: 1px; text-transform: uppercase; }
.made:hover { color: var(--red-hover); }

/* ---------- coach marks ---------- */
#coach { position: fixed; z-index: 3; left: 50%; top: calc(96px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 4px; white-space: nowrap; font-size: 11px;
  letter-spacing: 1px; text-transform: uppercase; background: var(--glass); border: 1px solid var(--hairline-strong);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); opacity: 0; transition: opacity 0.6s var(--ease); pointer-events: none; max-width: calc(100vw - 32px); overflow: hidden; }
#coach i { width: 4px; height: 4px; background: var(--red); }
body.coaching #coach { opacity: 1; }

/* ---------- toast ---------- */
#toast { position: fixed; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
  max-width: min(420px, calc(100vw - 32px)); padding: 14px 18px; border-radius: var(--r-control); text-align: left;
  font-size: 13px; line-height: 1.55; background: #1a1a1acc; border: 1px solid var(--hairline-strong);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); box-shadow: 0 6px 18px #0000004d; opacity: 0; transition: opacity 0.3s var(--ease); pointer-events: none; }
#toast::before { content: "▸ "; color: var(--red); }
#toast.on { opacity: 1; }

/* ---------- recording timer ---------- */
#recbar { position: fixed; z-index: 5; left: 50%; top: calc(34px + env(safe-area-inset-top)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 4px; font-size: 11px; letter-spacing: 1.5px;
  background: var(--glass); border: 1px solid var(--red-dim); color: var(--fg1);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
#recbar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.2; } }

/* ---------- sheets ---------- */
.sheet { position: fixed; z-index: 6; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 96px); overflow: auto; padding: 20px;
  background: var(--grain), #161616c7; border: 1px solid var(--hairline-strong); border-radius: var(--r-card); box-shadow: 0 6px 18px #0000004d;
  -webkit-backdrop-filter: blur(24px) saturate(0); backdrop-filter: blur(24px) saturate(0); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.keys { margin: 14px 0; font-size: 11px; line-height: 1.6; color: var(--fg-faint); }
#clip { display: block; width: 100%; max-height: 60dvh; object-fit: contain; border-radius: var(--r-control); background: #000;
  margin-bottom: 14px; border: 1px solid var(--hairline); }

/* ---------- dock ---------- */
#dock { position: fixed; z-index: 3; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 12px; transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
body.is-landing #dock { opacity: 0; pointer-events: none; transform: translateY(12px); }
.seg { display: flex; gap: 2px; padding: 3px; border-radius: var(--r-control); background: var(--glass); border: 1px solid var(--ghost);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.seg button { padding: 9px 14px; border-radius: 5px; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #c4c4c4;
  transition: background 0.2s, color 0.2s; }
.seg button:hover { color: var(--fg1); }
.seg button.on { background: var(--glass-strong); color: #0a0a0a; }
.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; width: min(340px, calc(100vw - 32px)); }
.chip { justify-self: start; height: 40px; padding: 0 12px; border-radius: var(--r-control); font-size: 11px; letter-spacing: 1px;
  text-transform: uppercase; background: var(--glass); border: 1px solid var(--ghost);
  -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.chip.on { border-color: #ffffffb3; color: #fff; background: var(--glass-hi); }
.chip.icon { justify-self: end; width: 40px; padding: 0; display: grid; place-items: center; }
.recbtn { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; border: 2px solid #ffffffcc;
  background: var(--glass); -webkit-backdrop-filter: var(--frost); backdrop-filter: var(--frost); }
.recbtn span { width: 52px; height: 52px; border-radius: 50%; background: var(--red); transition: all 0.25s var(--ease); }
.recbtn:hover span { background: var(--red-hover); }
.recbtn.on span { width: 24px; height: 24px; border-radius: 4px; }

@media (max-width: 480px) { .hide-s { display: none; } }
@media (hover: none) and (pointer: coarse) { .keys { display: none; } }   /* no keyboard on a phone */
@media (max-width: 620px) {                        /* six looks: two rows of three on a phone */
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); width: min(360px, calc(100vw - 32px)); }
  .seg button { padding: 9px 6px; }
}
@media (min-width: 900px) {
  #landing { padding: 0 80px; width: min(760px, 100vw); }
  h1 { font-size: 120px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
