/* Meridian 2026 — Lisbon. Light theme: warm paper / black ink / #FEDB1D yellow / Inter Tight. */
@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;800;900&display=swap");

:root {
  --bg: #f4f3ee;
  --panel: #ffffff;
  --ink: #101010;
  --muted: #686868;
  --yellow: #fedb1d;
  --yellow-deep: #e9c400;
  --yellow-ink: #6b5c00;   /* readable "yellow" for text on light bg */
  --line: #e2e0d8;
  --red: #c9303c;
  --radius: 14px;
  /* legacy aliases */
  --gold: var(--yellow);
  --teal: var(--yellow);
  --violet: var(--yellow);
}

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

body {
  font-family: "Inter Tight", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Meridian "track line" motif — light greys with one yellow line. */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.stars::before {
  content: "";
  position: absolute;
  inset: -40vh -25vw 45vh -25vw;
  border: 1.5px solid #e6e4dc;
  border-radius: 0 0 999px 999px;
  box-shadow: 0 26px 0 -1px #eceae2, 0 54px 0 -1px var(--yellow);
}
.stars::after {
  content: "";
  position: absolute;
  inset: 70vh -20vw -50vh -20vw;
  border: 1.5px solid #e9e7df;
  border-radius: 999px 999px 0 0;
  box-shadow: 0 -24px 0 -1px #efede5;
}

main { position: relative; z-index: 1; width: min(680px, 92vw); padding: 24px 0 60px; }
main.home { display: flex; flex-direction: column; min-height: calc(100vh - 70px); justify-content: center; }

header.site { text-align: center; padding: 40px 0 14px; }
header.site .brandmark {
  height: clamp(52px, 11vw, 78px);
  display: block; margin: 0 auto 22px;
  filter: invert(1);   /* brand SVG is white; render black on light bg */
}
header.site h1 {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.06;
}
header.site .sub { color: var(--muted); margin-top: 10px; font-weight: 500; }

/* Yellow reads poorly as text on light backgrounds — use it as a highlighter. */
.gold, .teal { background: var(--yellow); color: var(--ink); padding: 0 0.14em; border-radius: 4px; }

a { color: var(--yellow-ink); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 18px;
  box-shadow: 0 2px 14px rgba(20, 18, 4, 0.05);
}
.card h2 { font-weight: 800; letter-spacing: -0.01em; }

/* Home: two equal game cards, fully tappable */
.games { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 34px; }
@media (min-width: 640px) { .games { grid-template-columns: 1fr 1fr; } }
.game-card {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--panel);
  border: 1px solid #ddd;
  border-radius: 16px;
  padding: 30px 26px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 2px 14px rgba(20, 18, 4, 0.06);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.game-card:hover, .game-card:active {
  border-color: var(--yellow-deep);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(20, 18, 4, 0.1);
}
.game-card h2 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.01em; }
.game-card p { color: var(--muted); line-height: 1.5; flex-grow: 1; }
.game-card .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.game-card .meta span {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #4c4c4c; background: #f3f2ec; border: 1px solid #e0ded6;
  padding: 5px 11px; border-radius: 999px;
}
.game-card .btn { display: block; width: 100%; text-align: center; margin-top: 4px; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--yellow);
  border: 0;
  border-radius: 10px;
  padding: 14px 30px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(233, 196, 0, 0.35);
}
.btn:hover { transform: translateY(-2px); background: #ffe345; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--ink); color: #fff; box-shadow: none; }
.btn.secondary:hover { background: #2b2b2b; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid #c8c6be; box-shadow: none; }
.btn.ghost:hover { border-color: var(--yellow-deep); }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; color: var(--muted);
}
.pill b { color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.dot.on { background: var(--yellow-deep); }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mt { margin-top: 16px; }

.status { min-height: 1.4em; margin-top: 12px; color: var(--muted); font-weight: 500; }
.status.err { color: var(--red); }

/* Wheel */
#wheelWrap { position: relative; width: min(380px, 88vw); margin: 10px auto; }
#wheelWrap canvas { width: 100%; height: auto; display: block; }
#pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 26px solid var(--ink);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.25));
  z-index: 2;
}

/* Result modal */
.modal {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(16, 15, 8, 0.5); z-index: 10; padding: 20px;
}
.modal.show { display: flex; }
.modal .inner {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid var(--yellow);
  border-radius: 16px;
  padding: 34px 30px; text-align: center; max-width: 420px; width: 100%;
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .prize { font-size: 1.9rem; font-weight: 900; letter-spacing: -0.01em; margin: 10px 0; }
.code {
  font-family: ui-monospace, "SF Mono", monospace; font-size: 1.15rem; letter-spacing: 1px;
  color: var(--ink);
  background: #fff7cf; border: 1.5px dashed var(--yellow-deep); border-radius: 10px;
  padding: 10px 14px; display: inline-block; margin: 10px 0; user-select: all;
}

/* Trivia */
.progress { display: flex; gap: 5px; margin-bottom: 16px; }
.progress span { flex: 1; height: 6px; border-radius: 3px; background: #e7e5dd; }
.progress span.done { background: var(--yellow-deep); }
.progress span.bad { background: #c6c4bc; }
.progress span.now { background: var(--ink); }

.qtext { font-size: 1.18rem; font-weight: 600; line-height: 1.4; margin: 6px 0 18px; letter-spacing: -0.01em; }
.choices { display: grid; gap: 10px; }
.choice {
  font: inherit; font-weight: 600; text-align: left; color: var(--ink);
  background: #fafaf6; border: 1.5px solid #ddd; border-radius: 10px;
  padding: 13px 16px; cursor: pointer; transition: border-color 0.12s, background 0.12s;
}
.choice:hover:not(:disabled) { border-color: var(--yellow-deep); background: #fffdf0; }
.choice:disabled { cursor: default; opacity: 0.95; }
.choice.correct { background: #fff3b0; border-color: var(--yellow-deep); }
.choice.wrong { background: #ffe9ea; border-color: #e08790; color: var(--red); }

.timerbar { height: 8px; border-radius: 4px; background: #e7e5dd; overflow: hidden; margin-bottom: 14px; }
.timerbar i { display: block; height: 100%; background: var(--yellow); transition: width 0.25s linear; }

.funfact {
  margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--yellow-deep);
  background: #fff8d4; border-radius: 0 10px 10px 0; color: #55490a; font-size: 0.95rem;
}

.scoreline { font-size: 1.05rem; margin-top: 14px; font-weight: 600; }
.bigscore { font-size: 2.8rem; font-weight: 900; letter-spacing: -0.02em; }

footer { color: #9a988f; font-size: 0.8rem; padding: 20px; text-align: center; position: relative; z-index: 1; }
footer a { color: var(--muted); }

@media (max-width: 480px) {
  main { width: 92vw; }
  header.site { padding-top: 28px; }
  .game-card { padding: 26px 20px; }
  .btn { padding: 15px 24px; }
}
