/* The eval site's one stylesheet. Colors come from the Kuku app's tokens
   (kuku-social src/kuku/design-tokens.colors.ts, export kuku-design-tokens-260719);
   names in comments are the token each value mirrors. Values marked GAP have no
   Kuku token and are this site's own. Pages use classes only: no per-page styles. */

:root {
  /* Kuku brand */
  --kuku-yellow: #FFDE3B;      /* Brand/Primary/600 */
  --kuku-yellow-press: #F6E937;/* Brand/Primary/500 */
  --kuku-cream: #FFFEE8;       /* Brand/Primary/50 */
  --kuku-pink: #FF68DC;        /* Brand/Secondary/200 */
  --kuku-cyan: #88E1FF;        /* Brand/Accent/200 */
  --kuku-violet: #AD57FF;      /* Brand/Accent 2/300 */
  --kuku-purple: #4233BE;      /* Neutral/Background/300 */
  --kuku-ink: #241960;         /* Neutral/Text/850, Neutral/Background/400 */
  --kuku-night: #1B1048;       /* Neutral/Background/500 */
  --kuku-green: #34C759;       /* Semantic/Success/400 */

  /* Light: cream page, white cards, Kuku ink text */
  --bg: var(--kuku-cream);
  --surface: #FFFFFF;
  --surface-sunk: #F4F1FF;              /* GAP */
  --text: var(--kuku-ink);
  --muted: #5B5285;                     /* GAP: 7.0:1 on white */
  --stroke: rgba(36, 25, 96, .16);      /* GAP */
  --accent: var(--kuku-purple);
  --on-accent: #FFFFFF;
  --cta: var(--kuku-yellow);
  --cta-press: var(--kuku-yellow-press);
  --on-cta: #000000;                    /* Neutral/Text/950 */
  --focus: var(--kuku-purple);
  --error-bg: #FFE8F8;                  /* GAP */
  --error-text: #8A0067;                /* GAP: 8.0:1 on --error-bg */
  --error-stroke: var(--kuku-pink);
  --ok-text: #146C2E;                   /* GAP */
  --tag-bg: #EAF8FF;                    /* GAP, from Accent/200 */
  --tag-text: #0B4F6C;                  /* GAP */
  --shadow: 0 1px 2px rgba(36, 25, 96, .06), 0 8px 24px rgba(36, 25, 96, .08);

  --radius-sm: 8px;   /* Radius/sm */
  --radius-md: 18px;  /* Radius/md */
  --radius-lg: 22px;  /* Radius/lg */
  --radius-full: 999px;
  --page-pad: 16px;   /* Layout/Page Padding L+R (iPhone) */
  --tap: 44px;        /* Component/Button Height/nav bar button: minimum target */
  --cta-h: 52px;      /* Component/Button Height/lg */

  --font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

/* Dark: the app's own purple */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--kuku-purple);
    --surface: var(--kuku-ink);
    --surface-sunk: var(--kuku-night);
    --text: #FFFFFF;                    /* Neutral/Text/100 */
    --muted: rgba(255, 255, 255, .8);   /* Neutral/Text/80 */
    --stroke: rgba(255, 255, 255, .2);  /* Neutral/Stroke/a20 */
    --accent: var(--kuku-yellow);
    --on-accent: #000000;
    --focus: var(--kuku-yellow);
    --error-bg: rgba(255, 104, 220, .16);
    --error-text: #FFD3F4;              /* GAP */
    --ok-text: #9BF0B3;                 /* GAP */
    --tag-bg: rgba(136, 225, 255, .16);
    --tag-text: var(--kuku-cyan);
    --shadow: 0 8px 32px rgba(9, 8, 36, .35);
    color-scheme: dark;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* component display rules must not unhide */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  font: 16px/1.5 var(--font); color: var(--text); background: var(--bg);
  overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--accent); font-weight: 600; }
img { max-width: 100%; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Page shell */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  width: 100%; max-width: 46rem; margin: 0 auto; padding: 16px var(--page-pad) 8px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px;
  border-radius: var(--radius-full); background: var(--surface); border: 1px solid var(--stroke);
  font-size: .875rem; color: var(--muted);
}
.chip:empty { display: none; }
.page { flex: 1; width: 100%; max-width: 46rem; margin: 0 auto; padding: 8px var(--page-pad) calc(32px + env(safe-area-inset-bottom)); }
.page-center { display: grid; place-items: center; }

/* Card */
.card {
  background: var(--surface); border: 1px solid var(--stroke); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow);
}
@media (min-width: 600px) { .card { padding: 32px; } }
.card > :last-child { margin-bottom: 0; }
.card section { border-top: 1px solid var(--stroke); margin-top: 24px; padding-top: 20px; }
.hero { max-width: 26rem; text-align: center; }
.mascot { display: block; width: 112px; height: auto; margin: 0 auto 12px; image-rendering: pixelated; }

/* Step indicator */
.steps { margin: 0 0 16px; }
.steps ol { list-style: none; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 6px; margin: 0; padding: 0; }
.steps li { font-size: .75rem; font-weight: 600; color: var(--muted); text-align: center; }
.steps li::before {
  content: ""; display: block; height: 6px; margin-bottom: 6px; border-radius: var(--radius-full);
  background: var(--stroke);
}
.steps li.is-done::before { background: var(--accent); opacity: .55; }
.steps li.is-current { color: var(--text); }
.steps li.is-current::before { background: var(--accent); }
.steps-note { margin: 10px 0 0; font-size: .875rem; color: var(--muted); text-align: center; }

/* Buttons */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 20px; border-radius: var(--radius-full);
  font: inherit; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none;
  color: var(--text); background: transparent; border: 1.5px solid var(--stroke);
  cursor: pointer; transition: transform .08s ease, background-color .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
}
button:hover:not(:disabled), .button:hover { border-color: var(--accent); }
button:active:not(:disabled), .button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, .button.primary {
  min-height: var(--cta-h); padding: 12px 28px; font-size: 1.05rem;
  background: var(--cta); border-color: var(--cta); color: var(--on-cta);
}
button.primary:hover:not(:disabled), .button.primary:hover { border-color: var(--cta); background: var(--cta-press); }
.card > button.primary, .actions button.primary { width: 100%; }
@media (min-width: 600px) { .card > button.primary, .actions button.primary { width: auto; min-width: 16rem; } }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Bottom action dock: stays reachable while the page scrolls on a phone */
.card section.actions {
  position: sticky; bottom: 0; z-index: 1; margin: 24px -20px -20px; padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stroke); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
@media (min-width: 600px) { .card section.actions { margin: 32px -32px -32px; padding: 20px 32px; } }

/* Notices */
.notice { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radius-md); border: 1.5px solid var(--stroke); background: var(--surface-sunk); }
.notice-error { border-color: var(--error-stroke); background: var(--error-bg); color: var(--error-text); font-weight: 600; }
.notice-waiting { text-align: center; padding: 24px 16px; }
.draft {
  display: inline-block; margin: 0 0 12px; padding: 2px 10px; border-radius: var(--radius-full);
  background: var(--kuku-pink); color: #000; font-size: .75rem; font-weight: 800; letter-spacing: .04em;
}
.status { min-height: 1.5em; margin: 8px 0 0; font-size: .9rem; }
.status:not(:empty)::before {
  content: ""; display: inline-block; width: .9em; height: .9em; margin-right: 8px; vertical-align: -.1em;
  border: 2px solid var(--stroke); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.agree { display: flex; align-items: flex-start; gap: 12px; margin: 20px 0; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface-sunk); font-weight: 600; }
.agree input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--accent); }
.agree label { cursor: pointer; }
textarea {
  display: block; width: 100%; min-height: 6rem; margin: 0 0 12px; padding: 12px 14px;
  font: inherit; color: var(--text); background: var(--surface-sunk);
  border: 1.5px solid var(--stroke); border-radius: var(--radius-md); resize: vertical;
}
textarea::placeholder { color: var(--muted); }
/* Text fields (the /admin invite box), in the same language as textarea */
input[type="email"], input[type="text"] {
  display: block; width: 100%; min-height: var(--tap); margin: 8px 0 12px; padding: 10px 14px;
  font: inherit; color: var(--text); background: var(--surface-sunk);
  border: 1.5px solid var(--stroke); border-radius: var(--radius-md);
}
input[type="email"]::placeholder, input[type="text"]::placeholder { color: var(--muted); }

/* Photo grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin: 12px 0 16px; }
.grid:empty { display: none; }
.thumb { position: relative; }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-sunk); }
.thumb button {
  position: absolute; top: 0; right: 0; width: var(--tap); height: var(--tap); min-height: 0; padding: 0;
  border: 0; background: transparent; color: #fff; font-size: 1.1rem;
}
.thumb button::before {
  content: ""; position: absolute; inset: 7px; z-index: -1; border-radius: 50%; background: rgba(0, 0, 0, .65); /* Neutral/Surface/a65 */
}
.thumb button { isolation: isolate; }

/* Stated-fact rating */
.fact { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--stroke); }
.fact:first-of-type { border-top: 1px solid var(--stroke); }
@media (min-width: 600px) { .fact { grid-template-columns: 1fr auto; align-items: center; gap: 16px; } }
.fact .kind {
  display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: var(--radius-full);
  background: var(--tag-bg); color: var(--tag-text); font-size: .75rem; font-weight: 700;
}
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choices button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.choices button.on::before { content: "✓"; }
.topbar p { margin: 0; }
.signin { display: flex; justify-content: center; min-height: var(--tap); margin-bottom: 12px; }
.notice-waiting .mascot, #view > .mascot { margin-top: 4px; }
.choices button { padding: 10px 12px; white-space: nowrap; }
.card .fact + section { border-top: 0; margin-top: 12px; }
.status:empty { min-height: 0; margin: 0; }

/* Waiting on the worker */
.working::before {
  content: ""; display: inline-block; width: .9em; height: .9em; margin-right: 8px; vertical-align: -.1em;
  border: 2px solid var(--stroke); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
.contact { margin-top: 16px; font-size: .9rem; }
#view > .mascot + h2, .notice-waiting h2 { text-align: center; }

/* What a Guess What is: the example with its reveal blur */
details { margin: 0 0 16px; border: 1.5px solid var(--stroke); border-radius: var(--radius-md); background: var(--surface-sunk); }
summary { min-height: var(--tap); display: flex; align-items: center; padding: 10px 16px; font-weight: 700; cursor: pointer; }
details[open] summary { border-bottom: 1px solid var(--stroke); }
details > .gw { padding: 16px; }
.gw-photo { max-width: 320px; margin: 4px 0 12px; overflow: hidden; border-radius: var(--radius-md); transition: filter .4s; }
.gw-photo svg { display: block; width: 100%; height: auto; }
.gw-photo.blurred { filter: blur(14px); }
.question { margin: 0 0 12px; font-size: 1.15rem; font-weight: 800; line-height: 1.3; }
.gw-replies { grid-template-columns: 1fr; margin-bottom: 12px; }
@media (min-width: 600px) { .gw-replies { grid-template-columns: repeat(3, 1fr); } }
.gw-replies button { white-space: normal; }

/* A Pair: the photo, two game cards, the pick */
.counter { margin-top: -4px; font-weight: 600; }
.photo { display: block; width: 100%; max-height: min(45vh, 420px); object-fit: contain; margin: 0 0 16px; border-radius: var(--radius-md); background: var(--surface-sunk); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 16px; }
@media (max-width: 480px) { .pair { grid-template-columns: 1fr; } }
.game { padding: 16px; border: 1.5px solid var(--stroke); border-radius: var(--radius-md); background: var(--surface-sunk); }
.game-label {
  display: inline-block; margin-bottom: 8px; padding: 1px 10px; border-radius: var(--radius-full);
  background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
}
.game .question { font-size: 1.05rem; }
.game ol { margin: 0; padding-left: 1.4em; }
.game li { margin: 4px 0; }
.picks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.picks button { padding: 10px 6px; }
