/* Empires — party game styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #14101c;
  --bg2: #1e1729;
  --card: #251c33;
  --card-edge: #3a2d4f;
  --gold: #e8b64c;
  --gold-soft: #f3d48a;
  --ink: #f2ecff;
  --ink-dim: #a99cc4;
  --good: #4cd97b;
  --bad: #f06262;
  --accent: #8f6ff0;
}

html, body {
  height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 50% -10%, #2b2140 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 20px 18px 28px;
}

/* ---------- typography ---------- */
h1.logo {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 52px;
  letter-spacing: 6px;
  text-align: center;
  color: var(--gold);
  text-shadow: 0 2px 24px rgba(232, 182, 76, .35);
  margin: 24px 0 4px;
}
.tagline {
  text-align: center;
  color: var(--ink-dim);
  margin-bottom: 30px;
  font-size: 15px;
}
h2 {
  font-family: Georgia, serif;
  font-size: 26px;
  color: var(--gold-soft);
  margin-bottom: 14px;
  text-align: center;
}
.sub {
  color: var(--ink-dim);
  text-align: center;
  font-size: 15px;
  line-height: 1.45;
  margin-bottom: 18px;
}
.crown { filter: drop-shadow(0 0 6px rgba(232,182,76,.6)); }

/* ---------- buttons ---------- */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 14px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--card-edge);
  transition: transform .06s ease;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: #2b1d05;
  border: none;
  box-shadow: 0 4px 18px rgba(232, 182, 76, .3);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--card-edge);
  color: var(--ink-dim);
}
.btn.danger { background: #3d2030; border-color: #5c2c40; color: #ff9c9c; }
.btn:disabled { opacity: .4; cursor: default; }
.btn.small { padding: 10px 14px; font-size: 15px; width: auto; display: inline-block; }

/* ---------- inputs ---------- */
input[type="text"], input[type="number"] {
  width: 100%;
  padding: 15px 16px;
  font-size: 18px;
  border-radius: 14px;
  border: 1px solid var(--card-edge);
  background: var(--bg2);
  color: var(--ink);
  outline: none;
  margin-bottom: 12px;
}
input:focus { border-color: var(--gold); }
input::placeholder { color: #6e6187; }

label.field-label {
  display: block;
  color: var(--ink-dim);
  font-size: 14px;
  margin: 4px 2px 6px;
}

/* ---------- cards & lists ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
}
.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 17px;
}
.player-row:last-child { border-bottom: none; }
.player-row .x {
  background: none;
  color: var(--bad);
  font-size: 20px;
  padding: 4px 10px;
}
.pill {
  display: inline-block;
  background: var(--bg2);
  border: 1px solid var(--card-edge);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--ink-dim);
  margin: 2px;
}
.pill.gold { color: var(--gold); border-color: var(--gold); }

/* ---------- memorize ---------- */
.timer-big {
  font-size: 56px;
  font-weight: 700;
  text-align: center;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 10px;
}
.name-list { list-style: none; margin: 8px 0 16px; }
.name-list li {
  font-family: Georgia, serif;
  font-size: 24px;
  text-align: center;
  padding: 11px 8px;
  border-bottom: 1px solid rgba(232,182,76,.15);
  color: var(--ink);
}
.name-list li:last-child { border-bottom: none; }

/* ---------- play ---------- */
.turn-banner {
  text-align: center;
  padding: 18px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #2d2342, #251c33);
  border: 1px solid var(--accent);
  margin-bottom: 16px;
}
.turn-banner .who {
  font-family: Georgia, serif;
  font-size: 30px;
  color: var(--gold-soft);
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.grid .btn { margin-bottom: 0; padding: 14px 8px; font-size: 16px; }
.grid .btn.selected {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(232,182,76,.1);
}

.empire {
  margin-bottom: 10px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--card-edge);
  border-radius: 14px;
}
.empire .leader { font-size: 17px; font-weight: 600; }
.empire .members { margin-top: 4px; }

/* ---------- reveal / result ---------- */
.result {
  text-align: center;
  padding: 30px 16px;
}
.result .verdict {
  font-family: Georgia, serif;
  font-size: 44px;
  margin-bottom: 12px;
}
.result.correct .verdict { color: var(--good); }
.result.wrong .verdict { color: var(--bad); }
.result .detail { font-size: 18px; line-height: 1.5; color: var(--ink); }
.result .detail b { color: var(--gold-soft); }

/* ---------- misc ---------- */
.spacer { flex: 1; }
.footer-note {
  text-align: center;
  color: #57496f;
  font-size: 12px;
  margin-top: 18px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.topbar button {
  background: none;
  color: var(--ink-dim);
  font-size: 15px;
  padding: 8px 10px;
}
.code-big {
  font-family: Georgia, serif;
  font-size: 54px;
  letter-spacing: 10px;
  text-align: center;
  color: var(--gold);
  margin: 8px 0;
}
#qr {
  display: flex;
  justify-content: center;
  margin: 10px 0;
}
#qr canvas, #qr img {
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.status-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.ok { background: var(--good); }
.status-dot.wait { background: var(--gold); }

.rules p { margin-bottom: 12px; line-height: 1.55; font-size: 15.5px; }
.rules b { color: var(--gold-soft); }

details.options { margin-bottom: 14px; }
details.options summary {
  cursor: pointer;
  color: var(--ink-dim);
  font-size: 15px;
  padding: 8px 2px;
}
.opt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  font-size: 15px;
  gap: 10px;
}
.opt-row select {
  font: inherit;
  background: var(--bg2);
  color: var(--ink);
  border: 1px solid var(--card-edge);
  border-radius: 10px;
  padding: 8px 10px;
}

/* confetti */
.confetti {
  position: fixed;
  top: -20px;
  font-size: 22px;
  animation: fall linear forwards;
  pointer-events: none;
  z-index: 99;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); opacity: .8; }
}

.shake { animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
