/* PromptGym — built on the Arjun Uvacha mark: navy for action, maroon for accent.
   Semantic pass/fail colours stay separate from the brand so a green tick never
   reads as decoration. */
:root {
  color-scheme: light dark;
  --navy: #0a4260;
  --navy-soft: #e7eff4;
  --maroon: #722929;
  --maroon-soft: #f6ecec;

  --bg: #f7f7f5;
  --surface: #ffffff;
  --fg: #1b1d1f;
  --muted: #62676b;
  --line: #e3e4e1;
  --line-strong: #cfd1cd;

  --accent: var(--navy);
  --accent-fg: #ffffff;
  --accent-soft: var(--navy-soft);

  --pass: #17784a;
  --pass-soft: #e5f3eb;
  --partial: #9a6a0b;
  --partial-soft: #fbf1dc;
  --fail: #b3362b;
  --err: #8a6d1f;
  /* Highlighter yellow, for the terms the landing page is about. */
  --highlight: rgba(250, 204, 21, .42);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .05), 0 1px 3px rgba(16, 24, 32, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 32, .16);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy-soft: #13303f;
    --maroon-soft: #3a1f1f;
    --bg: #121416;
    --surface: #1b1e21;
    --fg: #e8e9e6;
    --muted: #9ba1a5;
    --line: #2c3034;
    --line-strong: #3b4045;
    /* The logo navy is too dark to read as text on a dark surface. */
    --accent: #6fa9cb;
    --accent-fg: #0b1a22;
    --accent-soft: var(--navy-soft);
    --maroon: #d98a86;
    --pass: #56c28b;
    --pass-soft: #163325;
    --partial: #e0b155;
    --partial-soft: #3a2f16;
    --fail: #ef8178;
    --err: #d9b45c;
    --highlight: rgba(250, 204, 21, .34);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1, h2, h3 { letter-spacing: -0.015em; }
.muted { color: var(--muted); font-size: .875rem; }
.fine { font-size: .8rem; line-height: 1.5; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────────────────────────── header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 82rem; margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.brand-mark { display: block; line-height: 0; border-radius: 8px; }
.brand-mark img { width: 40px; height: 40px; display: block; }
.brand-text { display: flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.02em; }
.brand-by { font-size: .75rem; color: var(--muted); }

/* account */
.account { display: flex; align-items: center; }
.account-loading { font-size: .85rem; color: var(--muted); }
.account-guest { display: flex; align-items: center; gap: .75rem; }
.guest-note { font-size: .8rem; color: var(--muted); }

.google-btn {
  display: inline-flex; align-items: center; gap: .6rem;
  font: 500 .875rem/1 inherit; font-family: inherit;
  padding: .55rem .95rem .55rem .75rem;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 999px;
  cursor: pointer; box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s;
}
.google-btn:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(16, 24, 32, .12); }
.google-btn:disabled { opacity: .6; cursor: progress; }
.google-g { width: 18px; height: 18px; flex: none; }

.account-user { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .25rem .6rem .25rem .25rem;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: .875rem; cursor: pointer;
}
.user-chip:hover { border-color: var(--line-strong); }
.user-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.chevron { width: 12px; height: 12px; color: var(--muted); }

.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: inline-grid; place-items: center; overflow: hidden;
  background: var(--maroon-soft); color: var(--maroon);
  font-weight: 600; font-size: .85rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; font-size: .72rem; }

.user-menu {
  position: absolute; right: 0; top: calc(100% + .4rem); min-width: 13rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: .4rem; z-index: 30;
}
.user-menu-label { margin: .35rem .55rem .5rem; font-size: .8rem; color: var(--muted); }
.user-menu-label strong { color: var(--fg); font-weight: 600; }
.user-menu-item {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: .875rem; padding: .5rem .55rem;
  background: none; border: 0; border-radius: 6px; color: var(--fg); cursor: pointer;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-sep { height: 1px; margin: .35rem .2rem; background: var(--line); }

.toast {
  max-width: 82rem; margin: .75rem auto 0; padding: .7rem 1rem;
  width: calc(100% - 3rem);
  background: var(--partial-soft); color: var(--partial);
  border: 1px solid color-mix(in srgb, var(--partial) 35%, transparent);
  border-radius: var(--radius-sm); font-size: .875rem;
}

/* ───────────────────────────── layout */
.shell {
  max-width: 82rem; margin: 0 auto; padding: 1.75rem 1.5rem 4rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 2rem; align-items: start;
}
.sidebar {
  position: sticky; top: 5.25rem;
  display: grid; gap: 1rem;
  max-height: calc(100vh - 6.5rem); overflow-y: auto;
}
@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
}

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ───────────────────────────── list view */
.lede { margin: 0; color: var(--muted); font-size: 1.02rem; max-width: 60ch; }

/* The first fold: the line, the mechanic, one button — and beside them, the
   thing the line is about. */
.hero {
  margin: .5rem 0 1.75rem;
}
.hero-copy { max-width: 44rem; }
.hero-title {
  margin: 0; font-size: 2.45rem; line-height: 1.12; letter-spacing: -0.028em; font-weight: 750;
  text-wrap: balance;
}
/* The turn. Same weight, the brand's accent, on its own line: the sentence that
   takes back what the first one granted. */
.hero-turn { display: block; color: var(--maroon); }
.hero-sub { margin: .9rem 0 0; color: var(--muted); font-size: 1.1rem; line-height: 1.55; max-width: 38rem; text-wrap: pretty; }
.hero-cta { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-top: 1.4rem; }
.hero-btn { font-size: 1rem; padding: .78rem 1.35rem; border-radius: 10px; }
.hero-note { font-size: .85rem; color: var(--muted); }

/* Arjun's own note, in the first person: set apart from the pitch so it reads
   as him talking rather than as more marketing. */
.hero-note-personal {
  margin: 1rem 0 0; padding-left: .85rem; max-width: 36rem;
  border-left: 3px solid color-mix(in srgb, var(--maroon) 55%, transparent);
  font-size: .95rem; line-height: 1.6; color: var(--fg); text-wrap: pretty;
}

.hero-eval {
  margin: .85rem 0 0; max-width: 38rem;
  font-size: .9rem; line-height: 1.6; color: var(--muted); text-wrap: pretty;
}
/* A highlighter stroke on the words the page is about: evals, prompts, agents.
   Full-strength ink even inside a muted paragraph, so the term is what the eye
   lands on; a band rather than an underline, so it never reads as a link. */
mark.hl {
  color: var(--fg); font-weight: 650; padding: 0 .15em; margin: 0 -.05em;
  border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone;
  background: linear-gradient(transparent 38%, var(--highlight) 38%);
}


.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr)); gap: 1rem;
}
.card {
  display: flex; flex-direction: column; gap: .55rem; height: 100%;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 1.1rem 1.15rem 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(16, 24, 32, .09); transform: translateY(-1px); }
.card.passed { border-top: 3px solid var(--pass); }
.card.partial { border-top: 3px solid var(--partial); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-title { margin: .1rem 0 0; font-size: 1.05rem; font-weight: 650; line-height: 1.3; }
.card-summary { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; flex: 1; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding-top: .6rem; margin-top: .2rem; border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--muted);
}

.type-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .02em;
  padding: .2rem .55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.type-chip.debug { background: var(--maroon-soft); color: var(--maroon); }
.type-chip.golf { background: var(--partial-soft); color: var(--partial); }

.status {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .75rem; font-weight: 600; white-space: nowrap;
}
.status.passed { color: var(--pass); }
.status.partial { color: var(--partial); }
.status.new { color: var(--muted); font-weight: 500; }

.difficulty { display: inline-flex; align-items: center; gap: .45rem; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); display: block; }
.dots i.on { background: var(--maroon); }

.meter { position: relative; height: 5px; border-radius: 999px; background: var(--line); overflow: visible; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--partial); }
.meter > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .45; border-radius: 1px; }

/* standing: your rank, or the nudge to get one */
.standing {
  margin: 0 0 1.5rem; padding: 1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.standing-rank {
  flex: none; min-width: 3.4rem; height: 3.4rem; padding: 0 .6rem; border-radius: 14px;
  display: grid; place-items: center; font-weight: 750; font-size: 1.35rem; letter-spacing: -0.03em;
  background: var(--maroon-soft); color: var(--maroon);
}
.standing-rank.zero { background: var(--bg); color: var(--muted); font-size: 1.1rem; }
.standing-text { flex: 1; min-width: 12rem; }
.standing-text strong { display: block; font-size: 1rem; }
.standing-text span { font-size: .875rem; color: var(--muted); }
.standing-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.standing.nudge { border-color: color-mix(in srgb, var(--maroon) 30%, var(--line)); }
.view-board-btn { display: none; }
@media (max-width: 960px) { .view-board-btn { display: inline-flex; } }

.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--line); border-radius: 999px; }
.seg {
  font: inherit; font-size: .85rem; font-weight: 500; padding: .35rem .95rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer;
}
.seg.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); font-weight: 600; }
.gallery-link { text-decoration: none; }

/* a locked card: visible, clearly not playable yet, and one click from playable */
.card.locked { background: color-mix(in srgb, var(--surface) 60%, var(--bg)); box-shadow: none; }
.card.locked .card-title, .card.locked .card-summary { opacity: .6; }
.card.locked:hover { border-color: var(--maroon); transform: none; }
.card.locked:hover .unlock-cta { filter: brightness(1.12); }
.status.locked { color: var(--maroon); }
.unlock-cta {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  padding: .38rem .8rem; border-radius: 999px;
  background: var(--maroon); color: #fff; font-size: .78rem; font-weight: 650;
  box-shadow: 0 1px 2px rgba(114, 41, 41, .25);
}
.unlock-cta svg { width: 12px; height: 12px; }

/* the last card: a promise, not a challenge */
.card.coming-soon {
  cursor: default; align-items: center; justify-content: center; text-align: center;
  background: transparent; box-shadow: none; border: 1.5px dashed var(--line-strong);
  color: var(--muted); min-height: 11rem;
}
.card.coming-soon:hover { transform: none; border-color: var(--line-strong); box-shadow: none; }
.card.coming-soon .card-title { color: var(--fg); opacity: .8; }
.coming-soon-idea { margin-top: .35rem; }
.coming-soon-idea .text-btn { font-size: inherit; font-weight: 600; color: var(--maroon); }
.coming-soon-mark { font-size: 1.5rem; line-height: 1; color: var(--maroon); opacity: .7; }
.model-hint { font-size: .78rem; }

.list-empty {
  grid-column: 1 / -1; padding: 2rem 1rem; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
}

/* nudges in the scorecard */
.nudge-box {
  margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--radius-sm);
  background: var(--maroon-soft); border: 1px solid color-mix(in srgb, var(--maroon) 25%, transparent);
  display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; font-size: .9rem;
}
.nudge-box p { margin: 0; flex: 1; min-width: 14rem; }
.nudge-box strong { color: var(--maroon); }

.view-nav { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.view-nav .back-link { margin-bottom: 1.25rem; }
.view-nav-link { text-decoration: none; }
.editor-head-right { display: inline-flex; align-items: baseline; gap: .9rem; }

/* ───────────────────────────── play view */
.back-link {
  background: none; border: 0; padding: 0; margin: 0 0 1.25rem;
  color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer;
}
.back-link:hover { color: var(--accent); }
.play-head { margin-bottom: 1.5rem; }
.play-tags { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; font-size: .8rem; color: var(--muted); }
.play-head h1 { font-size: 1.9rem; margin: 0 0 .35rem; }

.text-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: .875rem; font-weight: 600; color: var(--accent);
}
a.text-btn { text-decoration: none; }
.text-btn:hover { text-decoration: underline; }

.brief {
  position: relative; padding: 1.1rem 1.25rem 1.15rem 1.4rem; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brief::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--maroon);
}
.brief-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .45rem; }
.brief-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--maroon);
}
.brief-body { margin: 0; font-size: 1rem; line-height: 1.6; }

.frame {
  margin-bottom: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); overflow: hidden;
}
.frame-part { padding: .85rem 1.1rem; }
.frame-part + .frame-part { border-top: 1px dashed var(--line); }
.frame-label { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.frame-label strong { font-size: .8rem; font-weight: 700; }
.frame-label span { font-size: .75rem; color: var(--muted); }
.frame pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font: 13px/1.55 var(--mono); color: var(--fg);
}
.frame-part.context { background: var(--accent-soft); }
.frame-prose p { margin: 0; font-size: .95rem; line-height: 1.6; max-width: 70ch; }
.frame-prose p + p { margin-top: .5rem; }

.editor-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .4rem; }
.editor-head label { font-weight: 650; font-size: .95rem; }
textarea {
  width: 100%; display: block;
  font: 13.5px/1.6 var(--mono);
  padding: .9rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); resize: vertical;
  box-shadow: inset 0 1px 2px rgba(16, 24, 32, .04);
}
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.editor-foot { display: flex; align-items: center; gap: .65rem; margin-top: .7rem; flex-wrap: wrap; }
.inline-label { font-size: .85rem; color: var(--muted); }
select {
  font: inherit; font-size: .875rem; padding: .45rem .55rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
}
.primary {
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: var(--radius-sm); padding: .6rem 1.15rem;
}
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: .5; cursor: not-allowed; }
.secondary {
  font: inherit; font-size: .875rem; cursor: pointer; background: var(--surface); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .45rem .8rem;
}
.secondary:hover { border-color: var(--accent); }
.over-limit { color: var(--fail); font-weight: 600; }

#run-status { margin: 1rem 0; min-height: 1.4rem; }
.notice {
  padding: .75rem 1rem; font-size: .875rem;
  border: 1px solid color-mix(in srgb, var(--err) 45%, transparent); border-radius: var(--radius-sm);
  background: var(--partial-soft); color: var(--err);
}
.error-box { border-color: color-mix(in srgb, var(--fail) 45%, transparent); background: transparent; color: var(--fail); }

/* ───────────────────────────── scorecard */
.total {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.total .score { font-size: 2.3rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; }
.verdict-pass { color: var(--pass); font-weight: 650; }
.verdict-fail { color: var(--fail); font-weight: 650; }

.bars { margin: 1rem 0; display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 9rem 1fr 3rem; gap: .6rem; align-items: center; font-size: .85rem; }
.bar { height: .5rem; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--pass); border-radius: 999px; }

.case {
  border: 1px solid var(--line); border-left-width: 3px; border-radius: var(--radius-sm);
  background: var(--surface); padding: .8rem 1rem; margin-top: .6rem;
}
.case.passed { border-left-color: var(--pass); }
.case.failed { border-left-color: var(--fail); }
.case.errored { border-left-color: var(--err); }
.case h4 { margin: 0 0 .4rem; font-size: .9rem; display: flex; gap: .5rem; align-items: center; }
.case pre {
  margin: .35rem 0 0; padding: .55rem .65rem; overflow-x: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  font: 12px/1.5 var(--mono); white-space: pre-wrap;
}
.case ul { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .85rem; }
.badge {
  font-size: .7rem; border: 1px solid var(--line); border-radius: 999px;
  padding: .05rem .5rem; color: var(--muted); font-weight: 500;
}
.share { margin: 0 0 1rem; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.share code { font-size: .78rem; word-break: break-all; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-size: .85rem; }
#result-card .total { margin-bottom: .75rem; }
#result-card .primary { margin-top: 1rem; }

/* ───────────────────────────── shared result page */
#result-card .prompt-block,
.share-prompt {
  margin: .4rem 0 0; padding: .75rem .9rem; white-space: pre-wrap; word-break: break-word;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font: 13px/1.6 var(--mono); max-height: 22rem; overflow: auto;
}
.byline { display: flex; align-items: center; gap: .55rem; font-size: .85rem; color: var(--muted); margin: .25rem 0 .9rem; flex-wrap: wrap; }
.byline strong { color: var(--fg); font-weight: 600; }
.locked-prompt {
  margin-top: .4rem; padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .85rem;
  background: var(--bg); border: 1px dashed var(--line-strong); color: var(--muted);
}
.result-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }

/* ───────────────────────────── gallery */
.gallery-controls { display: flex; gap: .9rem; flex-wrap: wrap; align-items: flex-end; margin: 1.25rem 0 1rem; }
.control { display: flex; flex-direction: column; gap: .25rem; font-size: .75rem; color: var(--muted); font-weight: 600; }
.control-check { display: inline-flex; align-items: center; gap: .4rem; font-size: .875rem; padding-bottom: .45rem; cursor: pointer; }
.shares { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.share-row {
  padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .9rem; align-items: center;
}
.share-row.yours { border-left: 3px solid var(--accent); }
.share-top { display: flex; align-items: center; gap: .5rem; min-width: 0; flex-wrap: wrap; }
.share-title { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-level { font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 .45rem; }
.share-score { grid-row: span 2; text-align: right; }
.share-score b { display: block; font-size: 1.25rem; letter-spacing: -0.02em; line-height: 1.1; }
.share-score b.pass { color: var(--pass); }
.share-score small { color: var(--muted); font-size: .72rem; }
.share-meta { display: flex; align-items: center; gap: .45rem; font-size: .78rem; color: var(--muted); flex-wrap: wrap; min-width: 0; }
.share-meta strong { color: var(--fg); font-weight: 500; }
.share-line {
  grid-column: 1 / -1; display: flex; align-items: center; gap: .6rem; min-width: 0; margin-top: .2rem;
  font: 12.5px/1.5 var(--mono); color: var(--fg);
}
.share-line code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; }
.share-line.locked { font-family: inherit; font-size: .8rem; color: var(--muted); }
.share-row .share-prompt { grid-column: 1 / -1; }
.share-actions { display: inline-flex; gap: .7rem; flex: none; font-family: ui-sans-serif, system-ui, sans-serif; }
.share-actions .text-btn { font-size: .78rem; }
.danger { color: var(--fail); }

/* ───────────────────────────── tooltip */
.tip { position: relative; display: inline-flex; }
.tip-btn {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); font: 600 .72rem/1 Georgia, serif; font-style: italic; cursor: help;
}
/* Fixed, not absolute: the sidebar scrolls on its own, and anything absolutely
   positioned inside it is clipped to its box. The page places it on open. */
.tip-body {
  position: fixed; top: 0; left: 0; z-index: 60; width: 17.5rem;
  padding: .8rem .9rem; border-radius: var(--radius-sm); font-size: .8rem; line-height: 1.5;
  background: var(--fg); color: var(--bg); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-3px); transition: opacity .15s, transform .15s, visibility .15s;
}
.tip-body ol { margin: .4rem 0; padding-left: 1.1rem; }
.tip-body li { margin: .15rem 0; }
.tip-body span { opacity: .75; }
.tip:hover .tip-body, .tip.open .tip-body, .tip-btn:focus-visible + .tip-body { opacity: 1; visibility: visible; transform: none; }

.board-guest { margin-top: .6rem; padding: .75rem; border-radius: 8px; background: var(--bg); font-size: .82rem; color: var(--muted); }
.board-guest .google-btn { margin-top: .55rem; font-size: .8rem; padding: .45rem .8rem .45rem .6rem; }

/* ───────────────────────────── terms and footer */
.prose { max-width: 42rem; }
.prose h1 { font-size: 1.8rem; margin: 0 0 .25rem; }
.prose h2 { font-size: 1.05rem; margin: 1.75rem 0 .5rem; }
.prose p, .prose li { line-height: 1.65; }
.prose ul { padding-left: 1.2rem; }
.site-footer {
  max-width: 82rem; margin: 0 auto; padding: 1.5rem 1.5rem 2.5rem;
  border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted);
}

/* ───────────────────────────── leaderboard */
.board-panel { padding: 1.1rem 1.1rem .9rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.panel-head h2 { margin: 0; font-size: 1rem; }
.board-list { list-style: none; margin: 0; padding: 0; }
.board-row {
  display: grid; grid-template-columns: 1.6rem 26px minmax(0, 1fr) auto; align-items: center; gap: .55rem;
  padding: .45rem .35rem; border-radius: 6px; font-size: .875rem;
}
.board-row + .board-row { border-top: 1px solid var(--line); }
.board-row.you { background: var(--accent-soft); border-top-color: transparent; }
.board-rank { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .8rem; text-align: right; }
.board-row.top .board-rank { color: var(--maroon); font-weight: 700; }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-name small { color: var(--muted); }
.board-score { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.board-score small { display: block; font-weight: 400; color: var(--muted); font-size: .7rem; }
#board-you { margin-top: .5rem; }
#board-you .board-row { border: 1px dashed var(--line-strong); }
.board-more { display: block; width: 100%; text-align: center; margin-top: .7rem; padding: .5rem; border-radius: 6px; }
.board-more:hover { background: var(--bg); text-decoration: none; }

/* ───────────────────────────── drawers */
.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(10, 14, 18, .38); animation: fade .18s ease-out;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(30rem, 100vw); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: slide-in .22s ease-out;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 1.1rem; }
.drawer-close {
  width: 2rem; height: 2rem; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--bg); color: var(--fg); font-size: 1.25rem; line-height: 1;
}
.drawer-close:hover { background: var(--line); }
.drawer-body { padding: 1.25rem 1.4rem 2rem; overflow-y: auto; }
.drawer-body h3 { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 1.6rem 0 .7rem; }
.drawer-body h3:first-child { margin-top: 0; }

.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin: 0 0 .5rem; }
.fact { padding: .75rem .85rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.fact b { display: block; font-size: 1.3rem; letter-spacing: -0.02em; }
.fact span { font-size: .78rem; color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.checks li { display: grid; grid-template-columns: 1.3rem 1fr; gap: .5rem; font-size: .9rem; line-height: 1.5; }
.checks li::before {
  content: "✓"; width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--pass-soft); color: var(--pass); font-size: .7rem; font-weight: 700; margin-top: .1rem;
}
.checks.rules li::before { content: "!"; background: var(--maroon-soft); color: var(--maroon); }

.weights { display: grid; gap: .8rem; }
.weight-row { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; align-items: baseline; }
.weight-row strong { font-size: .88rem; font-weight: 600; }
.weight-row em { font-style: normal; font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted); }
.weight-row p { grid-column: 1 / -1; margin: 0; font-size: .8rem; color: var(--muted); }
.weight-row .bar { grid-column: 1 / -1; height: .4rem; }
.weight-row .bar > span { background: var(--accent); }

.callout {
  margin-top: 1.5rem; padding: .85rem 1rem; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line); font-size: .85rem; color: var(--muted);
}
.callout strong { color: var(--fg); }

@keyframes slide-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .drawer, .backdrop { animation: none; }
  .card { transition: none; }
  .card:hover { transform: none; }
}

@media (max-width: 560px) {
  .header-inner { padding: .6rem 1rem; }
  .shell { padding: 1.25rem 1rem 3rem; }
  .guest-note { display: none; }
  .play-head h1 { font-size: 1.5rem; }
  .hero-title { font-size: 1.62rem; }
  .hero-sub { font-size: 1rem; }
  .hero-btn { width: 100%; }
  .feedback-fab span { display: none; }
  .feedback-fab { padding: .75rem; }
  .user-name { max-width: 7rem; }
  .toast { width: calc(100% - 2rem); }
  .facts { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 6.5rem 1fr 2.5rem; }
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ───────────────────────────── feedback */
.feedback-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 30;
  display: inline-flex; align-items: center; gap: .45rem;
  font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
  padding: .65rem 1rem; border-radius: 999px;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
}
.feedback-fab:hover { border-color: var(--accent); color: var(--accent); }
.feedback-fab svg { width: 1.1rem; height: 1.1rem; }
.feedback-intro { margin: 0 0 1rem; line-height: 1.55; }
.feedback-form textarea {
  width: 100%; resize: vertical; min-height: 9rem;
  font: inherit; font-size: .925rem; line-height: 1.5; padding: .7rem .8rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--fg);
}
.feedback-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.feedback-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .6rem; }
.feedback-context { margin: .9rem 0 0; font-size: .8rem; line-height: 1.5; }
.feedback-status { margin: .6rem 0 0; font-size: .875rem; }
.feedback-status:empty { display: none; }
.feedback-status.error { color: var(--fail); }
.feedback-done p { margin: 0 0 .6rem; line-height: 1.55; }
.feedback-done .secondary { margin-top: .6rem; }
/* The floating button must not sit on top of the footer's last line. */
.site-footer { padding-bottom: 5rem; }

/* "Make my prompt public" on a passing scorecard */
.public-toggle { display: inline-flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: .55rem; cursor: pointer; font-size: .9rem; font-weight: 600; margin: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative; flex: none; width: 2.3rem; height: 1.3rem; border-radius: 999px;
  background: var(--line-strong); transition: background .15s;
}
.switch-track::after {
  content: ""; position: absolute; top: .15rem; left: .15rem; width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s;
}
.switch input:checked + .switch-track { background: var(--pass); }
.switch input:checked + .switch-track::after { transform: translateX(1rem); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .6; }
.info { position: relative; display: inline-flex; }
.info-body {
  position: absolute; bottom: calc(100% + .5rem); left: 50%; z-index: 20;
  width: min(18rem, 80vw); transform: translate(-50%, 4px);
  padding: .65rem .8rem; border-radius: var(--radius-sm);
  background: var(--fg); color: var(--bg); font-size: .8rem; font-weight: 400; line-height: 1.5;
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: opacity .12s, transform .12s;
}
.info:hover .info-body, .info.open .info-body, .info .tip-btn:focus-visible + .info-body {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.public-view { font-size: .85rem; }
/* On a phone the (i) sits too near the edge to centre anything on it: the
   explanation spans the toggle's row instead. */
@media (max-width: 560px) {
  .public-toggle { position: relative; }
  .public-toggle .info { position: static; }
  .public-toggle .info-body { left: 0; right: 0; width: auto; transform: translateY(4px); }
  .public-toggle .info:hover .info-body, .public-toggle .info.open .info-body,
  .public-toggle .info .tip-btn:focus-visible + .info-body { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-track::after, .info-body { transition: none; } }
