/* Task page styling.
 *
 * Matches the Emulate marketing site (dewey-site: app/globals.css .dark theme):
 * same near-black surface, the same Emilio display font for titles and Host
 * Grotesk for body, and the same teal→indigo brand gradient. A viewer who
 * follows a share link and someone browsing emulate.com should feel like they
 * are in one product — the share page is hosted under the site's own domain.
 *
 * Token values are duplicated rather than imported: this page is deliberately
 * no-build, dependency-free JS/CSS so a share link never waits on a bundler.
 * Fonts are served self-contained from /task/fonts. If the site's tokens
 * change, mirror the .dark values here.
 */

@font-face {
  font-family: "Emilio";
  src: url("/task/fonts/EmilioTest-Light.otf") format("opentype");
  font-weight: 300 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Host Grotesk";
  src: url("/task/fonts/HostGrotesk-VariableFont_wght.ttf") format("truetype");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* Emulate site .dark theme (oklch, verbatim). */
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-raised: oklch(0.245 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --border: oklch(1 0 0 / 10%);
  --border-strong: oklch(1 0 0 / 18%);
  /* Teal → indigo accent ramp, travelling in hue (185 → 268). */
  --brand-from: oklch(0.53 0.13 185);
  --brand-via: oklch(0.52 0.15 225);
  --brand-to: oklch(0.5 0.2 268);
  --brand: oklch(0.78 0.12 197);
  --brand-ink: oklch(0.82 0.11 200);
  --brand-muted: oklch(0.78 0.12 197 / 15%);
  --danger: oklch(0.704 0.191 22.216);
  --warning: #fbbf24;
  --warning-muted: rgb(251 191 36 / 0.1);
  --success: #6ee7b7;
  --success-muted: rgb(110 231 183 / 0.1);
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  /* Primary (Emilio) — titles and headings. Secondary (Host Grotesk) — body. */
  --font-heading: "Emilio", "Host Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Host Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: var(--font-body);
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Masthead
   ------------------------------------------------------------------------ */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.masthead-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

/* The Emulate wordmark, mirroring the site's <Logo>: a rounded-square mark plus
   a light Emilio wordmark. Links back to the marketing site. */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  text-decoration: none;
  color: var(--foreground);
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--foreground);
  color: var(--background);
  flex: none;
}

.logo-mark svg { width: 16px; height: 16px; }

.logo-word {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1;
}

.logo-tm {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 9px;
  line-height: 1;
  color: var(--muted-foreground);
}

.logo:hover .logo-word { opacity: 0.85; }

.masthead h1 {
  font-family: var(--font-heading);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-state {
  font-size: 13px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.runtime-state .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
}

.runtime-state.ready .dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-muted);
}

/* --------------------------------------------------------------------------
   The verb spine. Three buttons, always rendered, whether or not the Dewey
   runtime is reachable — the unavailable ones explain themselves rather than
   vanishing.
   ------------------------------------------------------------------------ */

.verbs {
  display: flex;
  gap: 10px;
  padding: 18px 24px 0;
  max-width: 1400px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.verb {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  padding: 13px 17px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgb(255 255 255 / 0.04);
  color: var(--foreground);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.verb:hover { background: rgb(255 255 255 / 0.08); transform: translateY(-1px); }

.verb.active {
  border-color: rgb(255 255 255 / 0.12);
  background: linear-gradient(100deg, var(--brand-from), var(--brand-via), var(--brand-to));
  box-shadow: inset 0 1px rgb(255 255 255 / 0.22), 0 11px 28px rgb(0 119 169 / 0.18);
}

.verb.active .verb-hint { color: rgb(255 255 255 / 0.82); }

.verb-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.verb-hint { font-size: 12px; color: var(--muted-foreground); }

.verb.unavailable .verb-name::after {
  content: " · needs Dewey";
  font-weight: 500;
  font-size: 12px;
  color: var(--muted-foreground);
}

.verb.active.unavailable .verb-name::after { color: rgb(255 255 255 / 0.72); }

/* --------------------------------------------------------------------------
   Layout
   ------------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  padding: 18px 24px;
  max-width: 1400px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.player-shell { position: relative; }

#player {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 16px;
  display: block;
  border: 1px solid var(--border);
}

.fallback-banner {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 64px;
  background: rgb(10 10 10 / 0.94);
  border: 1px solid var(--border-strong);
  color: var(--foreground);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fallback-banner button {
  font: inherit;
  background: rgb(255 255 255 / 0.09);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  font-weight: 600;
}

.chapters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.chapters button {
  font: inherit;
  font-size: 13px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 0.04);
  cursor: pointer;
  color: var(--muted-foreground);
}

.chapters button.active {
  border-color: rgb(58 207 210 / 0.22);
  color: var(--brand-ink);
  background: var(--brand-muted);
}

/* --------------------------------------------------------------------------
   Panels
   ------------------------------------------------------------------------ */

.session-panel,
.verb-panel,
.receipt-panel,
.panel {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
}

.session-panel,
.verb-panel,
.receipt-panel { margin-top: 14px; font-size: 14px; line-height: 1.5; }

.verb-panel h3,
.receipt-panel h3 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.verb-panel p { color: var(--muted-foreground); margin-bottom: 13px; }
.verb-panel .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.verb-panel button,
.verb-panel a.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  color: var(--foreground);
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 20px;
  padding: 0 17px;
  cursor: pointer;
  text-decoration: none;
  background: linear-gradient(100deg, var(--brand-from), var(--brand-via), var(--brand-to));
  box-shadow: inset 0 1px rgb(255 255 255 / 0.22), 0 11px 28px rgb(0 119 169 / 0.18);
  transition: transform 160ms ease, background 160ms ease;
}

.verb-panel button:hover:not(:disabled),
.verb-panel a.button:hover { transform: translateY(-1px); }

.verb-panel button.secondary,
.verb-panel a.button.secondary {
  background: rgb(255 255 255 / 0.055);
  border-color: var(--border);
  box-shadow: none;
}

.verb-panel button.secondary:hover,
.verb-panel a.button.secondary:hover { background: rgb(255 255 255 / 0.095); }
.verb-panel button:disabled { opacity: 0.45; cursor: not-allowed; }

.verb-panel input,
.session-panel input {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  color: var(--foreground);
  background: rgb(255 255 255 / 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.session-panel strong { font-family: var(--font-heading); font-weight: 650; }

/* Completion receipt — the visible end of the verb set. */
.receipt-panel { border-left: 3px solid var(--success); }
.receipt-panel.unverified { border-left-color: var(--warning); }
.receipt-panel p { color: var(--muted-foreground); }
.receipt-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin-top: 10px; }
.receipt-panel dt { color: var(--muted-foreground); font-size: 12px; }

.receipt-panel dd {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  color: var(--muted-foreground);
}

/* --------------------------------------------------------------------------
   Sidebar: steps + transcript
   ------------------------------------------------------------------------ */

.sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-foreground);
  margin-bottom: 10px;
}

.steps { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.steps li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.steps li:hover { background: rgb(255 255 255 / 0.05); }
.steps li.active { background: var(--brand-muted); }

.step-index {
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  font-size: 12px;
  min-width: 18px;
}

.step-title { flex: 1; min-width: 0; }
.step-time { color: var(--muted-foreground); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Keycap chip for a keyboard-shortcut step (⌘C). Reads as "press these keys",
 * distinct from a clickable target. */
.step-shortcut {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  margin-left: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--foreground);
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  vertical-align: baseline;
  white-space: nowrap;
}

.step-state { font-size: 11px; font-weight: 700; }
.step-state.pass { color: var(--success); }
.step-state.fail { color: var(--danger); }
.step-state.undetermined { color: var(--warning); }

#transcript-search {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  color: var(--foreground);
  background: rgb(255 255 255 / 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 10px;
}

.transcript { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }

.transcript p {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}

.transcript p:hover { background: rgb(255 255 255 / 0.05); }
.transcript p.active { background: var(--brand-muted); }
.transcript p.hidden { display: none; }

.transcript .t {
  color: var(--muted-foreground);
  font-size: 12px;
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

.transcript mark { background: var(--brand-muted); color: var(--brand-ink); border-radius: 3px; }

/* --------------------------------------------------------------------------
   Screenshot step-through, for tasks recorded without a video
   ------------------------------------------------------------------------ */

.stills { position: relative; }

.stills img {
  width: 100%;
  display: block;
  border-radius: 16px;
  background: #000000;
  border: 1px solid var(--border);
}

.stills figcaption { margin-top: 10px; font-size: 14px; color: var(--muted-foreground); }

.still-marker {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(58 207 210 / 0.18);
  pointer-events: none;
}

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px 30px;
  color: var(--muted-foreground);
  font-size: 12px;
  max-width: 1400px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.foot-brand { color: var(--muted-foreground); }

.foot-brand a {
  font-family: var(--font-heading);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--foreground);
  text-decoration: none;
}

.foot-brand a:hover { opacity: 0.85; }

/* Session panel internals (classes assigned in runtime-probe.js / task.js, so
   every colour in this page stays defined here rather than inline). */

.session-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.session-detail { margin-top: 8px; color: var(--muted-foreground); }

.halt-button {
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--foreground);
  background: rgb(248 113 113 / 0.14);
  border: 1px solid rgb(248 113 113 / 0.32);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.halt-button:hover { background: rgb(248 113 113 / 0.22); }

.consent-note { margin: 10px 0 0; font-size: 13px; }

.verb-panel input.viewer-name { width: 180px; }
