:root {
  --bg: #fdf8ef; --ink: #17141f; --ink-2: #5c5568; --muted: #8a8494;
  --line: #17141f; --card: #ffffff; --accent: #6d28d9; --accent-ink: #ffffff;
  --accent-2: #fbbf24; --shadow: 4px 4px 0 #17141f; --shadow-sm: 2px 2px 0 #17141f;
  --radius: 12px;
}

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

body { margin: 0; background: var(--bg); color: var(--ink); overflow-x: hidden;
  font: 15px/1.5 'Space Grotesk', system-ui, -apple-system, sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; border-bottom: 2px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px;
  letter-spacing: -0.01em; }
.brand .logo { width: 30px; height: 30px; flex: none; border-radius: 8px;
  background-color: var(--accent); border: 2px solid var(--ink); box-shadow: var(--shadow-sm);
  background-repeat: no-repeat; background-position: center; background-size: 15px 15px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M4 4l7 16 2.2-6.8L20 11 4 4z' stroke='%23ffffff' stroke-width='2.6' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.brand .tag { font-size: 11px; color: var(--ink); font-weight: 700; background: var(--accent-2);
  border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border: 2px solid var(--ink); cursor: pointer;
  font: inherit; font-weight: 700; font-size: 14px; padding: 10px 18px; border-radius: 10px;
  box-shadow: var(--shadow-sm); transition: transform 0.08s ease, box-shadow 0.08s ease; }
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.btn-ghost { background: var(--card); border: 2px solid var(--line); font: inherit; cursor: pointer;
  padding: 10px 18px; border-radius: 10px; color: var(--ink-2); box-shadow: var(--shadow-sm);
  transition: transform 0.08s ease, box-shadow 0.08s ease; }
.btn-ghost:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }

.tabs { display: flex; gap: 8px; padding: 12px 32px; border-bottom: 2px solid var(--line);
  overflow-x: auto; }
.tab { color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700;
  padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  background: var(--card); border: 2px solid var(--line); }
.tab.active { color: var(--bg); background: var(--ink); box-shadow: var(--shadow-sm); }

.zone-label { font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  margin: 0 0 14px; color: var(--ink); }
.zone-label span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-2);
  margin-left: 8px; font-size: 12px; }

.rail-wrap { padding: 24px 32px 20px; border-bottom: 2px solid var(--line); background: #f6eddc; }
.rail { display: flex; gap: 14px; overflow-x: auto; overflow-y: visible;
  padding: 14px 4px 8px; scroll-snap-type: x proximity; }
.slot { position: relative; flex: none; scroll-snap-align: start; }

/* Task 10 renders only the bare numeric rank on `.slot .rank` (no ordinal/star text) and
   keys `data-rank` on `.slot` — the medal labels below are generated entirely from that
   attribute. data-ctr/data-meter (the slot's pooled score) ARE provided by the server and
   are rendered by board.js, not here — CSS alone can't turn a data-meter percentage into a
   bar width. */
.slot .rank { position: absolute; top: -12px; left: 12px; z-index: 2; background: var(--card);
  color: var(--ink); border: 2px solid var(--ink); font-size: 11px; font-weight: 800;
  padding: 2px 10px; border-radius: 999px; font-family: inherit; }
.slot .rank::before { content: "#"; }
/* Amber/grey/tan are medal colors for 1st/2nd/3rd only — every other rank stays the plain
   white default above, so the medals still read as exceptional rather than decoration. */
.slot[data-rank="1"] .rank { background: var(--accent-2); }
.slot[data-rank="2"] .rank { background: #e5e7eb; }
.slot[data-rank="3"] .rank { background: #f2d3b3; }
.slot[data-rank="1"] .rank, .slot[data-rank="2"] .rank, .slot[data-rank="3"] .rank { font-size: 0; }
.slot[data-rank="1"] .rank::before { content: "★ 1st"; font-size: 11px; }
.slot[data-rank="2"] .rank::before { content: "2nd"; font-size: 11px; }
.slot[data-rank="3"] .rank::before { content: "3rd"; font-size: 11px; }

/* .meter/.ctr are appended by board.js from data-ctr/data-meter, as direct children of
   .slot (not inside .card) because the CTR is the SLOT's pooled score across all its
   variants — it must stay put no matter which variant a visitor's A/B pick shows. */
.slot .meter { display: block; height: 10px; background: var(--card); border: 2px solid var(--ink);
  border-radius: 999px; overflow: hidden; margin: 9px 4px 0; }
.slot .meter span { display: block; height: 100%; background: var(--accent); }
.slot .ctr { display: block; font-size: 11px; font-weight: 800; color: var(--accent);
  margin: 5px 4px 0; font-variant-numeric: tabular-nums; }

.card { display: block; position: relative; text-decoration: none; color: inherit;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { transform: translateY(-4px); }
.card:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.card-rail { width: 200px; }
.card-rail .cover { width: 100%; height: 100px; object-fit: cover; display: block; }
.cover-empty { background: linear-gradient(135deg, #e8edf7, #ccd6ea); height: 100px; }
.card .meta { display: flex; align-items: center; gap: 7px; padding: 10px 12px; }
.card .fav { width: 16px; height: 16px; border-radius: 4px; flex: none; border: 2px solid var(--ink); }
.fav-fallback { display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: 800; }
.card .name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; flex: 1; min-width: 0; }
.card .cat { margin-left: auto; font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--ink); background: var(--bg); border: 2px solid var(--line);
  padding: 2px 7px; border-radius: 999px; text-transform: uppercase; flex: none; }
.card .sentence { display: block; padding: 0 12px 12px; font-size: 13px; color: var(--ink-2); }

.report { position: absolute; right: 8px; top: 8px; z-index: 2; width: 22px; height: 22px;
  border-radius: 50%; border: 2px solid var(--ink); background: rgba(255,255,255,0.9);
  color: var(--ink-2); font-size: 12px; font-weight: 700; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.card:hover .report { opacity: 1; }
/* Touch devices never fire :hover, so the report affordance would otherwise be unreachable. */
@media (hover: none) { .report { opacity: 0.85; } }

.spot-wrap { padding: 24px 32px 40px; }
.spot-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card-spot .cover { width: 100%; height: 150px; object-fit: cover; display: block; }
.card-spot .cover-empty { height: 150px; }
/* Server-rendered as spotGrid's only child (see includes/board-cache.php), so it is visible
   with no JS at all; board.js re-appends it after moving the sampled picks in, keeping it last. */
.card-cta { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; min-height: 200px; padding: 24px; text-align: center; cursor: pointer;
  font-family: inherit; border: 2px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--accent); color: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card-cta:hover { transform: translateY(-4px); }
.card-cta:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.card-cta .plus { width: 40px; height: 40px; border: 2px solid #fff; border-radius: 10px;
  display: grid; place-items: center; font-size: 22px; font-weight: 700; line-height: 1; color: #fff; }
.card-cta strong { font-size: 17px; font-weight: 700; }
.card-cta span { font-size: 12px; color: #ddd6fe; }

.foot { display: flex; gap: 18px; padding: 18px 32px; border-top: 2px solid var(--line);
  background: #f6eddc; color: var(--ink-2); font-size: 13px; align-items: center; }
.foot a { color: var(--ink-2); text-decoration: none; font-weight: 600; }
.foot a:hover { color: var(--accent); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(23, 20, 31, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--card); border: 2px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 24px; width: 460px; max-width: 100%;
  max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 14px; font-size: 20px; font-weight: 700; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.modal input[type="text"], .modal input[type="email"], .modal select, .modal input[type="file"] {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: inherit;
  border: 2px solid var(--line); border-radius: 6px; background: var(--bg); }
.modal input:focus-visible, .modal select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.modal .agree { display: flex; gap: 8px; font-weight: 500; font-size: 12px; color: var(--ink-2); }
.modal .agree input { margin-top: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.form-error { color: #c0392b; font-size: 13px; font-weight: 600; }
.hp { position: absolute; left: -9999px; }

.success-page { max-width: 520px; margin: 12vh auto; padding: 0 20px; text-align: center; }
.success-page h1 { font-size: 28px; font-weight: 700; margin: 0 0 12px; }
.success-page .btn-primary { display: inline-block; text-decoration: none; margin-top: 16px; }

/* Legal/document pages: full site chrome (header/footer) around plain long-form text, kept
   to a readable measure. Deliberately restrained — no cards, no medals, no hero. */
.doc-page { max-width: 68ch; margin: 0 auto; padding: 48px 24px 64px; }
.doc-page h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 8px; }
.doc-page h2 { font-size: 19px; font-weight: 700; margin: 32px 0 10px; }
.doc-page p { line-height: 1.7; margin: 0 0 16px; }
.doc-page a { color: var(--accent); text-decoration: underline; }

@media (max-width: 900px) {
  .top, .tabs, .rail-wrap, .spot-wrap, .foot { padding-left: 16px; padding-right: 16px; }
  .spot-grid { grid-template-columns: 1fr; }
  .card-rail { width: 168px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .btn-primary, .btn-ghost, .report, .card-cta { transition: none; }
}
