/* Faux Real — dark, editorial, mobile-first */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Signature theme: a warm near-black (not pure #000 — softer on the eye and
     lets the images be the brightest thing on screen). */
  --bg: #10121a;
  --panel: #191d29;
  --panel2: #212736;
  --line: #2c3444;
  --text: #eef1f6;
  --dim: #9aa4b6;
  --real: #37d67a;
  --fake: #f8516b;
  --accent: #7c9cff;
  --gold: #f5b73d;
  --btn-ink: #0b1020;   /* text on the accent button */
  --stage: #05060a;     /* image backing — stays dark in BOTH themes so photos pop */
  --radius: 14px;
  font-size: 16px;
}

/* Light theme follows the OS setting (App Store convention). The image "stage"
   stays dark in both, so a light UI never washes out the photos being judged. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f2ef; --panel: #ffffff; --panel2: #ecebe6; --line: #dcdad2;
    --text: #14181f; --dim: #5c6470; --real: #12a150; --fake: #e11d48;
    --accent: #4353d6; --gold: #9a6a12; --btn-ink: #ffffff;
  }
}
:root[data-theme="dark"] {
  --bg: #10121a; --panel: #191d29; --panel2: #212736; --line: #2c3444;
  --text: #eef1f6; --dim: #9aa4b6; --real: #37d67a; --fake: #f8516b;
  --accent: #7c9cff; --gold: #f5b73d; --btn-ink: #0b1020;
}
:root[data-theme="light"] {
  --bg: #f3f2ef; --panel: #ffffff; --panel2: #ecebe6; --line: #dcdad2;
  --text: #14181f; --dim: #5c6470; --real: #12a150; --fake: #e11d48;
  --accent: #4353d6; --gold: #9a6a12; --btn-ink: #ffffff;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  display: flex; flex-direction: column; min-height: 100dvh;
  /* respect iPhone notch + home indicator */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand h1 { font-size: 1.15rem; letter-spacing: .02em; font-style: italic; }
.brand-mark {
  width: 14px; height: 14px; border-radius: 4px; align-self: center;
  background: linear-gradient(90deg, var(--real) 50%, var(--fake) 50%);
  display: inline-block;
}
.puzzle-no { color: var(--dim); font-size: .8rem; }
.topnav { display: flex; gap: 6px; }
.iconbtn {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 10px; font-size: .9rem; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 40px; min-width: 40px;
}
.iconbtn:hover { border-color: var(--accent); }
.iconbtn.pro { color: var(--gold); font-weight: 700; letter-spacing: .05em; font-size: .75rem; }

/* ---------- layout ---------- */
.game { flex: 1; width: 100%; max-width: 900px; margin: 0 auto; padding: 14px; }
.progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.progress .dot {
  width: 34px; height: 6px; border-radius: 3px; background: var(--panel2);
  border: 1px solid var(--line);
}
.progress .dot.done-win { background: var(--real); border-color: var(--real); }
.progress .dot.done-loss { background: var(--fake); border-color: var(--fake); }
.progress .dot.now { background: var(--accent); border-color: var(--accent); }

.round-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 6px; }
.subject {
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
  padding: 4px 12px; border-radius: 999px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
}
.ask { font-size: 1.02rem; flex: 1 1 100%; min-width: 0; text-align: left; overflow-wrap: break-word; }
.ask em { color: var(--real); font-style: normal; font-weight: 700; }
.howto-strip {
  font-size: .85rem; color: var(--dim); margin: 0 0 12px;
  padding: 8px 12px; border-radius: 10px; background: var(--panel);
  border: 1px solid var(--line);
}
.howto-strip b { color: var(--text); }

/* ---------- duel cards ---------- */
.duel { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; }
@media (max-width: 560px) { .duel { grid-template-columns: 1fr; } }
/* the VS chip makes any screenshot instantly legible as a game */
.duel::after {
  content: "VS"; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); z-index: 5; pointer-events: none;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--bg); color: var(--text); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-style: italic; letter-spacing: .04em; font-size: .95rem;
  box-shadow: 0 2px 14px rgba(0,0,0,.35);
}

.cardwrap { position: relative; }
.card {
  position: relative; width: 100%; margin: 0; padding: 0; display: block;
  color: inherit; font: inherit; text-align: left; -webkit-appearance: none; appearance: none;
  background: var(--panel); border: 2px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.card:hover { border-color: var(--accent); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.card.correct { border-color: var(--real); box-shadow: 0 0 0 3px color-mix(in srgb, var(--real) 40%, transparent); animation: verdictflash .5s ease-out; }
.card.wrong { border-color: var(--fake); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fake) 40%, transparent); animation: verdictflash .5s ease-out; }
@keyframes verdictflash { 0% { filter: brightness(1.7) saturate(1.4); } 100% { filter: brightness(1); } }
@media (prefers-reduced-motion: reduce) { .card.correct, .card.wrong { animation: none; } }
.card img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  background: var(--stage); user-select: none; -webkit-user-drag: none;
}
.card img.fit-contain { object-fit: contain; }
.textcard {
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  padding: 8% 10%; text-align: center; white-space: pre-line;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(1rem, 2.4vw, 1.35rem); line-height: 1.5;
  background: radial-gradient(120% 120% at 50% 0%, var(--panel2), var(--panel));
}
.src-note {
  margin-top: 14px; padding: 10px 12px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line);
  font-size: .82rem; color: var(--dim);
}
.src-note b { color: var(--text); }
.card .tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  background: rgba(10,12,18,.75); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 9px; font-weight: 700;
}
.zoom {
  position: absolute; bottom: 10px; right: 10px; z-index: 3;
  background: rgba(10,12,18,.78); color: #fff; border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px; cursor: zoom-in; font-size: 1rem;
  min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center;
}
.zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.zoom[hidden] { display: none; }

/* hotspot tells — pulsing markers on the AI image, revealed only post-guess */
.spot {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border: 2px solid var(--fake); border-radius: 50%; z-index: 4; cursor: pointer;
  background: color-mix(in srgb, var(--fake) 22%, transparent);
  animation: spotpulse 1.6s ease-out infinite;
}
@keyframes spotpulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--fake) 55%, transparent); }
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) { .spot { animation: none; } }
.verdict {
  position: absolute; inset: auto 0 0 0; padding: 8px 52px 8px 12px; text-align: left;
  font-weight: 800; letter-spacing: .12em; font-size: .85rem;
  background: rgba(10,12,18,.82);
}
.verdict.real { color: var(--real); }
.verdict.ai { color: var(--fake); }

/* ---------- actions / reveal ---------- */
.actionrow { display: flex; gap: 10px; margin-top: 12px; align-items: stretch; }
.mainbtn {
  flex: 1; background: var(--accent); color: var(--btn-ink); font-weight: 800;
  border: 0; border-radius: 12px; padding: 14px 18px; font-size: 1rem; cursor: pointer;
  min-height: 48px;   /* Apple HIG tap target */
}
.mainbtn:disabled { background: var(--panel2); color: var(--dim); cursor: not-allowed; }
.mainbtn.share { background: var(--real); }

/* confidence commit: two options so a lucky guess ≠ a calibrated one */
.commit { flex: 2; display: flex; gap: 8px; align-items: stretch; }
.pickprompt {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--dim); font-size: .92rem; border: 1px dashed var(--line); border-radius: 12px;
}
.mainbtn.confident { background: var(--accent); }
.mainbtn.hunch { background: transparent; color: var(--text); border: 1px solid var(--accent); }
.mainbtn.hunch:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.mainbtn[hidden] { display: none; }
.ghostbtn {
  background: transparent; color: var(--dim); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; cursor: pointer; font-size: .9rem;
}
.ghostbtn:hover { color: var(--text); border-color: var(--accent); }
.adtag {
  background: #f5b73d; color: #201500; border-radius: 5px; font-size: .65rem;
  font-weight: 800; padding: 1px 5px; vertical-align: middle; margin-left: 4px;
}
.hint-out { margin-top: 8px; color: var(--gold); font-size: .9rem; text-align: center; }

.reveal { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.reveal-headline { font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.calibline { font-size: .95rem; margin-bottom: 6px; font-weight: 600; }
.calibline.good { color: var(--real); }
.calibline.warn { color: var(--gold); }
.crowdline { color: var(--dim); margin-bottom: 12px; }
.crowdline b { color: var(--text); }
.sim-tag {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--dim); border: 1px solid var(--line); border-radius: 5px;
  padding: 0 5px; margin-left: 6px; cursor: help; white-space: nowrap;
}
.tellbox { background: var(--panel2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.tell-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--accent); margin-bottom: 4px; }
.tell-title .tell-sub { color: var(--dim); letter-spacing: .04em; }
.tell-caveat { font-size: .76rem; color: var(--dim); margin-top: 8px; font-style: italic; }
/* "Trace it" receipt — borrowed from Verity: provenance as an action, not a vibe */
.tracebox { background: var(--panel2); border-left: 3px solid var(--real); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.trace-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--real); margin-bottom: 4px; }
#traceTip { font-size: .9rem; }
.trace-boundary { font-size: .76rem; color: var(--dim); margin-top: 8px; }
.trace-boundary b { color: var(--text); }
.howto-hero { font-size: 1.5rem; line-height: 1.3; font-weight: 800; margin: 4px 0 14px; color: var(--text); }
.howto-hero em { font-style: normal; color: var(--real); }
.howto-quick { list-style: none; padding: 0 !important; display: grid; gap: 8px; font-size: .95rem; color: var(--text) !important; }
.howto-quick li { margin: 0; }
.small-note { font-size: .74rem !important; }
.deeper { display: grid; gap: 4px; margin-top: 12px; }
.deeper .prov { margin-bottom: 0; }
.prov { color: var(--dim); font-size: .8rem; margin-bottom: 12px; }
.prov summary { cursor: pointer; margin-bottom: 6px; }
.prov a { color: var(--accent); }

/* ---------- summary ---------- */
.summary { text-align: center; padding-top: 8px; }
.summary h2 { font-size: 1.6rem; margin-bottom: 12px; }
.scoregrid { display: flex; gap: 8px; justify-content: center; font-size: 1.9rem; margin-bottom: 20px; }
@keyframes pop { 0% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.25); } 100% { transform: scale(1); opacity: 1; } }
.scoregrid span { display: inline-block; animation: pop .35s cubic-bezier(.2, 1.4, .4, 1) backwards; }
.scoregrid span:nth-child(1) { animation-delay: .05s; }
.scoregrid span:nth-child(2) { animation-delay: .15s; }
.scoregrid span:nth-child(3) { animation-delay: .25s; }
.scoregrid span:nth-child(4) { animation-delay: .35s; }
.scoregrid span:nth-child(5) { animation-delay: .45s; }
.prohook { color: var(--gold); font-size: .9rem; margin-bottom: 10px; }
.percentile { max-width: 460px; margin: 0 auto 18px; }
.pct-bar {
  position: relative; height: 14px; border-radius: 7px; overflow: visible;
  background: var(--panel2); border: 1px solid var(--line);
}
.pct-fill { height: 100%; border-radius: 7px; background: linear-gradient(90deg, #3b4b7a, var(--accent)); width: 0; transition: width 1s ease-out; }
.pct-you {
  position: absolute; top: -22px; transform: translateX(-50%);
  font-size: .65rem; font-weight: 800; letter-spacing: .1em; color: var(--gold);
  transition: left 1s ease-out;
}
.pct-you::after { content: "▼"; display: block; text-align: center; }
.pct-line { margin-top: 10px; font-size: 1.05rem; }
.pct-line b { color: var(--gold); }
.pct-note { color: var(--dim); font-size: .72rem; margin-top: 6px; }
.sum-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.sum-actions .mainbtn { flex: 0 1 220px; }
.countdown { color: var(--dim); font-size: .85rem; margin-bottom: 18px; }
.countdown span { color: var(--text); font-variant-numeric: tabular-nums; }

.procard {
  max-width: 460px; margin: 0 auto; text-align: left;
  background: linear-gradient(160deg, var(--panel), var(--panel2));
  border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-radius: var(--radius); padding: 16px;
}
.procard-title { font-size: 1.05rem; margin-bottom: 8px; }
.procard-title b { color: var(--gold); }
.procard ul { list-style: none; color: var(--dim); font-size: .9rem; display: grid; gap: 5px; margin-bottom: 12px; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(5,6,10,.92); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
[hidden] { display: none !important; }
.overlay img { max-width: 100%; max-height: 92dvh; border-radius: 8px; }
#zoomOverlay { cursor: zoom-out; }
.closebtn {
  position: absolute; top: 14px; right: 14px; background: var(--panel);
  color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  width: 38px; height: 38px; font-size: 1rem; cursor: pointer; z-index: 2;
}
.modal-card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); max-width: 520px; width: 100%; max-height: 85dvh;
  overflow: auto; padding: 22px;
}
.modal-card h3 { margin-bottom: 10px; }
.modal-card p, .modal-card li { color: var(--dim); font-size: .92rem; line-height: 1.5; }
.modal-card ul, .modal-card ol { padding-left: 18px; display: grid; gap: 6px; margin: 10px 0; }
.modal-card .statrow { display: flex; justify-content: space-around; text-align: center; margin: 14px 0; color: var(--text); }
.modal-card .statrow div b { display: block; font-size: 1.5rem; }
.modal-card .statrow div span { font-size: .7rem; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.calib { display: flex; gap: 10px; margin: 8px 0 4px; }
.calib-cell { flex: 1; text-align: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 6px; }
.calib-cell b { display: block; font-size: 1.4rem; color: var(--text); }
.calib-cell span { font-size: .68rem; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.calib-verdict { font-size: .82rem; color: var(--gold); margin-top: 6px; }
.calib-empty { font-size: .82rem; background: var(--panel2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.sharecard { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; margin: 8px 0; }
.duelline { font-weight: 700; color: var(--text); }
.duelline b { color: var(--gold); }
.ratingline { text-align: center; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; color: var(--text) !important; }
.ratingline b { color: var(--gold); }
.rating-chip { font-size: .85rem; color: var(--dim); }
.rating-chip b { color: var(--gold); }
.histo { display: grid; gap: 4px; margin-top: 10px; }
.histo .hrow { display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 8px; font-size: .8rem; color: var(--dim); }
.histo .hbar { height: 12px; border-radius: 6px; background: var(--accent); min-width: 2px; }
.credit-item { border-bottom: 1px solid var(--line); padding: 8px 0; }
.credit-item a { color: var(--accent); }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--accent); color: var(--text);
  border-radius: 10px; padding: 10px 18px; z-index: 90; font-size: .9rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}

.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: inherit; text-decoration: underline; padding: 0; }

.foot {
  color: var(--dim); font-size: .72rem; text-align: center; padding: 14px;
  border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* inline source evidence (Verity borrow) — visible trust without a tap */
.srcline { font-size: .8rem; color: var(--dim); margin: 10px 0 2px; }
.srcline b { color: var(--text); font-weight: 600; }

/* fusion polish: glass on CHROME only (modals, toast, pro card) \u2014 never on or
   behind the images being judged; the pictures stay the brightest thing on screen */
.modal-card { background: color-mix(in srgb, var(--panel) 78%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.toast { background: color-mix(in srgb, var(--panel2) 80%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.procard { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ---------- iPhone-native touch behaviors ---------- */
html { -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  overscroll-behavior: none; touch-action: manipulation; }
button, .card, .zoom, .spot { touch-action: manipulation; }
.card, .card img, .textcard, .tag, .verdict, .brand-mark { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
/* settings sheet rows */
.setlist { display: grid; gap: 8px; margin: 12px 0; }
.setrow { display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 52px; padding: 0 16px; font-size: 1rem;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer; }
.setrow:hover { border-color: var(--accent); }
.setrow b { color: var(--gold); font-weight: 700; }

/* Expert Mode: middle confidence chip */
.mainbtn.fair { background: color-mix(in srgb, var(--accent) 55%, var(--panel2)); color: var(--text); }

/* App Store CTA on the summary screen — shown at peak satisfaction, after the
   player has finished the day's duels. Web is the low-friction first touch;
   this is the second touch that converts a fan into an install.
   Uses theme tokens so it reads correctly in light AND dark. */
.appcta {
  display: flex; align-items: center; gap: 14px;
  margin: 18px 0 4px; padding: 14px 16px;
  border-radius: 18px; text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  transition: transform .12s ease, border-color .12s ease;
}
.appcta:active { transform: scale(.985); }
.appcta:hover { border-color: var(--accent); }
.appcta-mark {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 11px;
  background:
    radial-gradient(circle at 50% 50%, #eef1f6 0 5px, transparent 5.5px),
    radial-gradient(circle at 50% 50%, #10121a 0 12px, transparent 12.5px),
    linear-gradient(90deg, var(--real) 0 50%, var(--fake) 50% 100%);
}
.appcta-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.appcta-txt b { color: var(--text); font-size: .98rem; }
.appcta-txt small { color: var(--dim); font-size: .8rem; }
.appcta-arrow { margin-left: auto; color: var(--accent); font-size: 1.15rem; }
