/* Ludo: a board on a tablecloth, HUD chips that follow the board theme, dark cards. */
@font-face { font-family: "Unbounded"; font-weight: 700; font-display: swap; src: url("/assets/fonts/unbounded-700.woff2") format("woff2"); }
@font-face { font-family: "Unbounded"; font-weight: 800; font-display: swap; src: url("/assets/fonts/unbounded-800.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 500; font-display: swap; src: url("/assets/fonts/sora-500.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-weight: 700; font-display: swap; src: url("/assets/fonts/sora-700.woff2") format("woff2"); }

:root { --spawn: #31e981; --ink-on-spawn: #0b1a12; --font-display: "Unbounded", system-ui, sans-serif; --font-body: "Sora", system-ui, sans-serif; --fg: #f4f1ea; --fg-2: rgba(244, 241, 234, 0.72); --line: rgba(255, 255, 255, 0.14); --glass: rgba(10, 12, 30, 0.55); --glass-2: rgba(255, 255, 255, 0.08);
  --page: #1b1410; --hud-fg: #f4f1ea; --hud-glass: rgba(20, 14, 10, 0.55); --hud-line: rgba(255, 255, 255, 0.16); }
body[data-theme="classic"] { --page: #1b1410; }
body[data-theme="midnight"] { --page: #090b16; --hud-glass: rgba(12, 14, 34, 0.6); }
body[data-theme="royal"] { --page: #120d0a; --hud-glass: rgba(30, 20, 12, 0.6); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--fg); font-family: var(--font-body); font-weight: 500; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-font-smoothing: antialiased; touch-action: none; transition: background 0.4s; }
button { font: inherit; color: inherit; }
#game { position: fixed; inset: 0; display: block; touch-action: none; outline: 0; }
#game.can-act { cursor: pointer; }

.hud { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 12px 8px; pointer-events: none; color: var(--hud-fg); }
.hud-brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; pointer-events: auto; }
.hud-brand svg { width: 32px; height: 32px; display: block; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.hud-title { font-family: var(--font-display); font-size: 0.95rem; font-weight: 800; margin: 0; }
.hud-turn { display: flex; align-items: center; gap: 8px; background: var(--hud-glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--hud-line); border-radius: 999px; padding: 6px 14px 6px 10px; min-height: 36px; }
.hud-turn .dot { width: 14px; height: 14px; border-radius: 50%; background: #999; box-shadow: inset 0 -2px 3px rgba(0,0,0,.35), 0 0 0 2px rgba(255,255,255,.25); }
.hud-turn b { font-size: 0.9rem; font-weight: 700; white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
.hud-turn small { font-size: 0.72rem; color: var(--fg-2); white-space: nowrap; }
.hud-actions { margin-left: auto; display: flex; gap: 6px; pointer-events: auto; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--hud-line); background: var(--hud-glass); backdrop-filter: blur(10px); color: var(--hud-fg); display: grid; place-items: center; cursor: pointer; transition: transform 0.15s, background 0.15s; }
.icon-btn:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.14); }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
#btn-sound .ic-off { display: none; }
#btn-sound[aria-pressed="false"] .ic-on { display: none; }
#btn-sound[aria-pressed="false"] .ic-off { display: block; }

.banner { position: fixed; left: 50%; top: 64px; transform: translateX(-50%); z-index: 15; font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; color: #fff; background: rgba(20, 14, 10, 0.78); border: 1px solid rgba(255,255,255,.18); padding: 10px 18px; border-radius: 999px; text-shadow: 0 2px 10px rgba(0,0,0,.6); pointer-events: none; animation: banner-pop 0.28s cubic-bezier(.2,.9,.2,1.4); white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
.banner[hidden] { display: none; }
@keyframes banner-pop { from { transform: translateX(-50%) scale(0.7); opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(10px); z-index: 20; background: rgba(20, 20, 28, 0.92); border: 1px solid var(--line); color: var(--fg); padding: 10px 16px; border-radius: 999px; font-size: 0.88rem; font-weight: 700; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[hidden] { display: none; }

.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(5, 7, 20, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow: auto; }
.overlay[hidden] { display: none; }
.card { width: 100%; max-width: 460px; color: var(--fg); background: linear-gradient(180deg, rgba(40, 30, 26, 0.97), rgba(18, 13, 11, 0.99)); border: 1px solid var(--line); border-radius: 26px; padding: 24px 24px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); animation: pop 0.28s cubic-bezier(.2,.9,.2,1.2); max-height: calc(100dvh - 32px); overflow: auto; }
@keyframes pop { from { transform: scale(0.92) translateY(10px); opacity: 0; } }
.kicker { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--spawn); }
.card h2 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.1; }
.muted { color: var(--fg-2); margin: 0; line-height: 1.55; font-size: 0.95rem; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1.5px solid transparent; font-weight: 700; font-size: 0.95rem; cursor: pointer; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.btn-primary { background: var(--spawn); color: var(--ink-on-spawn); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(49, 233, 129, 0.35); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-ghost:hover { border-color: var(--fg); }
.btn[hidden] { display: none; }

.row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.lbl { flex: none; width: 84px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-2); }
.seg { display: flex; gap: 4px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 0.86rem; cursor: pointer; color: var(--fg-2); transition: background 0.15s, color 0.15s; }
.seg button.on { background: var(--spawn); color: var(--ink-on-spawn); }
.note { margin: -2px 0 8px 96px; font-size: 0.8rem; color: var(--fg-2); line-height: 1.5; }
.seats { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 12px 96px; }
.seat { display: flex; align-items: center; gap: 10px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 14px; padding: 7px 10px; }
.seat-dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 -3px 4px rgba(0,0,0,.35), 0 0 0 2px rgba(255,255,255,.2); flex: none; }
.seat-name { flex: 1; font-weight: 700; font-size: 0.9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-kind { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 0.78rem; font-weight: 700; cursor: pointer; color: var(--fg); }
.seat-kind.you { border-color: var(--spawn); color: var(--spawn); cursor: default; }
.seat-kind:not(.you):hover { border-color: var(--fg); }
.chk { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--fg-2); margin: 4px 0 0; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--spawn); margin: 0; }

.how { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.how li { display: flex; gap: 14px; align-items: flex-start; color: var(--fg-2); line-height: 1.5; font-size: 0.93rem; }
.how-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35); }
.how-ic svg { width: 26px; height: 26px; fill: currentColor; }
.ic-a { background: linear-gradient(180deg, #ff8a8a, #d12f3a); }
.ic-b { background: linear-gradient(180deg, #7fe0a8, #1f9a55); }
.ic-c { background: linear-gradient(180deg, #ffd166, #e0902e); }
.keys { margin: 16px 0 0; font-size: 0.78rem; color: var(--fg-2); line-height: 1.7; }
.card kbd { font-family: inherit; font-weight: 700; font-size: 0.78em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: var(--glass-2); margin: 0 1px; }
.card-win { text-align: center; }
.card-win .card-actions { justify-content: center; }
.ranking { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ranking li { display: flex; align-items: center; gap: 10px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 0.9rem; }
.ranking .seat-dot { width: 14px; height: 14px; }
.ranking .rk { font-family: var(--font-display); font-weight: 800; width: 28px; color: var(--fg-2); }
.ranking .nm { flex: 1; text-align: left; font-weight: 700; }
.ranking .st { color: var(--fg-2); font-size: 0.82rem; }

@media (max-width: 520px) {
  .hud { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .hud-title { display: none; }
  .hud-turn { padding: 5px 10px 5px 8px; min-height: 32px; }
  .hud-turn b { font-size: 0.82rem; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn svg { width: 16px; height: 16px; }
  .banner { top: 56px; font-size: 0.92rem; padding: 8px 14px; }
  .lbl { width: 70px; }
  .note, .seats { margin-left: 0; }
  .seg button { padding: 6px 11px; font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) { .card, .banner { animation: none; } }
