/* Tokens copied by VALUE from Wedding Invitation.html's :root — this is a
 * deliberate, small duplication for a two-page zero-build site. If the
 * palette ever changes there, update it here too. */
:root {
  --ink: #1a0a0e;
  --ink-soft: #7a1a30;
  --ink-faint: rgba(122, 26, 48, 0.35);
  --ink-line: rgba(122, 26, 48, 0.18);
  --paper: #f6e7d3;
  --paper-deep: #ecddd8;
  --paper-soft: #faf3f0;
  --accent: #5a1422;
  --good: #2e6b3e;
  --bad: #a1332a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; margin: 0 0 .3em; }
.mono { font-family: 'JetBrains Mono', monospace; }

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

button {
  font-family: 'Frank Ruhl Libre', serif;
  cursor: pointer;
  border: 1px solid var(--ink-line);
  background: var(--paper-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: .7em 1.6em;
  font-size: 1rem;
  transition: background .15s, transform .1s;
}
button:hover { background: #fff; }
button:active { transform: scale(.97); }
button.primary { background: var(--accent); color: var(--paper-soft); border-color: var(--accent); }
button.primary:hover { background: var(--ink-soft); }
button:disabled { opacity: .5; cursor: not-allowed; }

input[type=text] {
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid var(--ink-line);
  background: var(--paper-soft);
  color: var(--ink);
  border-radius: 10px;
  padding: .6em .8em;
  font-size: 1.1rem;
}

/* ---------- header (matches Wedding Invitation.html's .nav) ---------- */
.gheader {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 231, 211, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ink-line);
}
.gheader-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 20px;
  height: 56px;
}
.gheader .brand {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 25px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.gheader .brand .amp { font-weight: 500; color: var(--ink-soft); margin: 0 1px; }
.gheader .back {
  font-family: 'JetBrains Mono', monospace;
  font-size: .85rem;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  padding: .4em 1em;
}
.gheader .back:hover { background: #fff; }

/* ---------- decorative scattered background icons ---------- */
.bg-icons {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-icons img {
  position: absolute;
  opacity: .08;
}
main { position: relative; z-index: 1; }

/* ---------- screens ---------- */
main { max-width: 900px; margin: 0 auto; padding: 24px 18px 60px; }
[data-screen] { display: none; }
[data-screen].active { display: block; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.row { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }

.subtitle { color: var(--ink-soft); font-size: 1.1rem; margin-bottom: 1.2em; }

.game-logo-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.game-logo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  box-shadow: 0 3px 14px rgba(26, 10, 14, 0.25);
}
.nav-game-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  vertical-align: -4px;
  margin-right: 6px;
}

/* ---------- mode select ---------- */
.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 20px; }
@media (max-width: 640px) { .mode-cards { grid-template-columns: 1fr; } }
.mode-card {
  background: var(--paper-soft);
  border: 1px solid var(--ink-line);
  border-radius: 18px;
  padding: 22px;
  text-align: left;
  cursor: pointer;
}
.mode-card:hover { border-color: var(--accent); }
.mode-card h2 { color: var(--accent); font-size: 1.3rem; }
.mode-card p { color: var(--ink-soft); margin: 0; }

/* ---------- card board (shared: solo + multiplayer) ---------- */
.board {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 20px 0;
}
.card-slot {
  position: relative;
  width: min(42vw, 320px);
  aspect-ratio: 1 / 1;
}
.card-slot img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  box-shadow: 0 4px 18px rgba(26, 10, 14, 0.25);
  user-select: none;
  -webkit-user-drag: none;
}
.card-slot .hit-flash {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.card-slot .hit-flash.show { animation: hitflash .5s ease-out; }
@keyframes hitflash {
  0% { opacity: .9; box-shadow: 0 0 0 0 var(--good-flash, var(--good)); }
  100% { opacity: 0; box-shadow: 0 0 0 24px transparent; }
}
.card-slot.wrong .hit-flash.show { --good-flash: var(--bad); }

.vs {
  font-family: 'JetBrains Mono', monospace;
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--accent);
}

/* Phones: stack the two cards instead of squeezing them side by side, make
 * them big enough to comfortably tap, and turn "spot it" into a divider
 * that spans the column instead of a cramped inline label. */
@media (max-width: 640px) {
  .board { flex-direction: column; gap: 16px; }
  .card-slot { width: min(62vw, 285px); }
  .vs {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 78%;
    max-width: 320px;
  }
  .vs::before, .vs::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ink-line);
  }
}

/* ---------- HUD ---------- */
.hud { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.hud .timer { font-family: 'JetBrains Mono', monospace; font-size: 1.4rem; color: var(--accent); }
.timer-wrap { position: relative; display: inline-flex; align-items: baseline; }

.penalty-flash {
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 1rem;
  color: var(--bad);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.penalty-flash.show { animation: penaltypop 1.1s ease-out; }
@keyframes penaltypop {
  0%   { opacity: 0; transform: translateY(2px) scale(.9); }
  15%  { opacity: 1; transform: translateY(-2px) scale(1.05); }
  30%  { opacity: 1; transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) scale(1); }
}
.hud .progress { font-family: 'JetBrains Mono', monospace; color: var(--ink-soft); }

#solo-change-btn, #mp-lobby-leave-btn, #mp-play-leave-btn, #mp-refresh-btn, #mp-end-leave-btn {
  margin-top: 8px;
  font-size: .85rem;
  padding: .5em 1.2em;
  color: var(--ink-soft);
  border-color: var(--ink-line);
}
/* Same size as its neighbor above (mp-end-leave-btn) so neither button
 * reads as "the important one" by size alone -- color is the only signal
 * that tells Leave room and Home apart, on purpose, to avoid a mis-tap. */
#mp-end-home-btn {
  margin-top: 8px;
  font-size: .85rem;
  padding: .5em 1.2em;
}

.final-banner {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  text-align: center;
  margin: 0;
}

/* ---------- leaderboard ---------- */
table.leaderboard { width: 100%; border-collapse: collapse; margin-top: 12px; }
table.leaderboard th, table.leaderboard td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink-line);
  font-size: .95rem;
}
table.leaderboard th { font-family: 'JetBrains Mono', monospace; color: var(--ink-soft); font-weight: 500; }
table.leaderboard tr.me { background: var(--paper-deep); }

/* ---------- multiplayer lobby ---------- */
.room-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3rem;
  letter-spacing: .15em;
  color: var(--accent);
  background: var(--paper-soft);
  border: 1px dashed var(--ink-line);
  border-radius: 14px;
  padding: .3em .5em;
  display: inline-block;
}
.player-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.player-list { list-style: none; padding: 0; margin: 14px 0; }
.player-list li {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink-line);
  display: flex;
  justify-content: space-between;
}
.error-msg { color: var(--bad); font-size: .95rem; min-height: 1.2em; }

.loading-bar {
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px auto;
}
.loading-bar > div { height: 100%; background: var(--accent); width: 0%; transition: width .15s; }
