@import url(/fw/fonts/fonts.css);

/* The Antwire look shared by every game: a dark table, light panels, chunky
   buttons with a hard drop shadow, Montserrat for text and a display face
   for numbers and headings. A game re-skins it in /static/css/game.css by
   overriding the tokens below (and adds its own table styles); the layout
   and the components stay the same everywhere. */
:root {
  /* page */
  --bg: #16131f;
  --bg-image:
    radial-gradient(ellipse 70% 55% at 50% 0%, rgba(120, 90, 220, .25), transparent 70%),
    linear-gradient(180deg, #1f1a2e, var(--bg) 60%, #0e0c15);
  --hero-ink: #f1ecff;
  /* panels */
  --surface: #ffffff;
  --surface-2: #f3f0fa;
  --ink: #1d1830;
  --muted: #6d6585;
  --line: #e3def0;
  --field: #ffffff;
  --link: #4b3bd1;
  /* buttons */
  --btn: #3a3352;
  --btn-ink: #ffffff;
  --btn-shadow: #15111f;
  --accent: #ffcc00;
  --accent-2: #ffdd4d;
  --accent-ink: #2a1f00;
  --accent-dk: #b38600;
  /* bars on the table (info bar, dock, top bar) */
  --bar: rgba(10, 8, 16, .82);
  --bar-ink: #ece8f8;
  --bar-line: rgba(255, 204, 0, .25);
  --chip: rgba(0, 0, 0, .35);
  --turn-glow: rgba(255, 204, 0, .45);
  /* table area */
  --table: radial-gradient(ellipse at center, #2c4a3a, #1a2c23);
  /* states */
  --good: #12a03c;
  --bad: #e2231a;
  --win: #fff1c2;
  --radius: 14px;
  --font: Montserrat, system-ui, sans-serif;
  --display: Anton, Impact, 'Arial Narrow', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  background: var(--bg-image);
  background-color: var(--bg);
  background-attachment: fixed;
  color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45;
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 800; }
p { margin: 0 0 .5rem; }
a { color: var(--link); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center-text, .center { text-align: center; }

/* ---------------------------------------------------------------- logo */
.logo { display: inline-flex; align-items: center; gap: .25em; font-family: var(--display); line-height: 1; white-space: nowrap; user-select: none; color: var(--accent); letter-spacing: .02em; }
.hero-logo { font-size: clamp(2.8rem, 12vw, 5.4rem); }
.brand-logo { font-size: 1.35rem; }
.mini-logo { font-size: 1rem; }

/* ---------------------------------------------------------------- topbar */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bar); color: var(--bar-ink); flex-wrap: wrap; backdrop-filter: blur(6px); border-bottom: 1px solid var(--bar-line); }
.topbar a, .topbar .linkbtn { color: var(--bar-ink); text-decoration: none; font-weight: 600; }
.brand { display: flex; align-items: center; padding: 4px 8px; }
.topbar nav { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; box-shadow: none; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 4px; color: var(--ink); }
input, select { width: 100%; padding: 11px 12px; border: 2px solid var(--line); border-radius: 10px; font: inherit; background: var(--field); color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
button, .btn { font: inherit; font-weight: 800; border: 0; border-radius: 10px; padding: 11px 18px; cursor: pointer; background: var(--btn); color: var(--btn-ink); text-decoration: none; display: inline-block; box-shadow: 0 3px 0 var(--btn-shadow); transition: transform .08s, filter .15s; }
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-shadow); }
button:disabled { opacity: .45; cursor: default; }
.btn-accent { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-dk); }
.btn-accent:active { box-shadow: 0 1px 0 var(--accent-dk); }
.btn-ghost { background: var(--field); color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn-ghost:active { box-shadow: inset 0 0 0 2px var(--line); }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.sso-btn::before { content: '🔑 '; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 900; font-size: 1.4rem; text-align: center; }

/* ---------------------------------------------------------------- layout */
.panel { background: linear-gradient(180deg, var(--surface), var(--surface-2)); border-radius: var(--radius); padding: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--surface); border-left: 5px solid var(--link); }
.notice.err { border-left-color: var(--bad); }
.notice.ok { border-left-color: var(--good); }
.pill { display: inline-block; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); margin-right: 4px; }
.pill.off { color: var(--muted); }
.pill.gold { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.dot.lobby-avatar { width: 18px; height: 18px; }
.dot.big { width: 26px; height: 26px; }
.copybox { display: flex; gap: 6px; }
.copybox input { font-size: .85rem; }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; border-left: 5px solid var(--accent); z-index: 2000; max-width: calc(100vw - 32px); font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: toast-in .25s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }
.spinner { width: 14px; height: 14px; border: 3px solid rgba(255,255,255,.35); border-top-color: var(--accent); border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 8px; animation: spin 0.9s linear infinite; }
.panel .spinner { border-color: var(--line); border-top-color: var(--accent-dk); }
@keyframes spin { to { transform: rotate(360deg); } }
.wait { color: var(--muted); font-weight: 600; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 3000; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg) translateX(40px); } }

/* ---------------------------------------------------------------- home */
.hero { text-align: center; margin: 10px 0 26px; color: var(--hero-ink); }
.subtitle { font-size: 1.1rem; font-weight: 600; color: var(--hero-ink); opacity: .9; margin: 16px auto 0; max-width: 640px; }
main > h2 { color: var(--hero-ink); } /* page titles on the dark page (admin, account) */
.rules { padding-left: 1.3rem; margin: 0 0 1rem; }
.rules li { margin-bottom: .55rem; }
.rules li::marker { color: var(--accent-dk); font-weight: 900; }

/* ---------------------------------------------------------------- lobby */
.lobby { margin-top: 8px; }
.code-text { font-size: clamp(2.4rem, 10vw, 3.4rem); font-family: var(--display); letter-spacing: .12em; color: var(--ink); }
.qr { width: 180px; height: 180px; display: block; margin: 0 auto; border-radius: 12px; }
.players .tags { margin-top: 2px; }
.lobby-wrap main { padding-bottom: 40px; }
.grid-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lobby .watchers { margin: 0; }
.admin-game { margin-top: 16px; }

/* ---------------------------------------------------------------- table frame */
body.in-game { overflow: hidden; overscroll-behavior: none; }
.game { height: 100svh; display: flex; flex-direction: column; color: var(--bar-ink); user-select: none; -webkit-user-select: none; }
.game-main { flex: 1; min-height: 0; position: relative; overflow: hidden; background: var(--table); }
.slot-top { flex: none; padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); background: var(--bar); border-bottom: 1px solid var(--bar-line); z-index: 5; }
.slot-dock { flex: none; z-index: 5; }
.tinfo { display: flex; align-items: center; gap: 10px; height: 36px; font-weight: 700; font-size: .88rem; white-space: nowrap; }
.tlogo { display: flex; }
.clock-num { font-family: var(--display); font-size: 1.15rem; color: var(--bar-ink); }
.clock-num.low { color: #ff8c6b; animation: hurry .5s ease-in-out infinite alternate; }
@keyframes hurry { to { filter: brightness(1.6); } }
.menu-btn { background: rgba(255,255,255,.1); color: var(--bar-ink); box-shadow: none; padding: 6px 12px; font-size: 1.1rem; }
.watch-badge { padding: 2px 9px; border-radius: 99px; background: rgba(255,255,255,.1); color: var(--bar-ink); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.watch-badge.me { box-shadow: inset 0 0 0 1px var(--accent); }
.strip { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 0; scrollbar-width: none; }
.chip { flex: none; min-width: 110px; background: var(--chip); border: 2px solid rgba(255,255,255,.1); border-radius: 10px; padding: 4px 9px; border-left: 5px solid var(--pc); transition: background .2s, box-shadow .2s; }
.chip.me .chip-name { text-decoration: underline; text-decoration-color: var(--pc); text-underline-offset: 3px; }
.chip.turn { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); box-shadow: 0 0 12px var(--turn-glow); }
.chip.gone, .chip.off { opacity: .5; }
.chip.gain { animation: gain .8s ease-out; }
@keyframes gain { 30% { background: var(--pc); transform: scale(1.06); } }
.chip-top { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: .82rem; }
.chip-name { max-width: 11em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 1px; }
.chip-score { font-family: var(--display); font-size: 1.25rem; color: var(--bar-ink); }

/* the dock: status line + the game's buttons */
.dock-wrap { position: relative; }
.dock { display: flex; align-items: center; gap: 12px; padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: var(--bar); border-top: 1px solid var(--bar-line); }
.dock.mine { border-top-color: var(--accent); box-shadow: 0 -6px 18px var(--turn-glow); }
.dock-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.status { margin: 0; color: var(--bar-ink); font-weight: 700; min-height: 1.3em; font-size: .92rem; }
.dock-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ctl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 10px 8px; font-size: .92rem; }
.ctl.go { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 3px 0 var(--accent-dk); }
.ctl.ghosty { background: rgba(255,255,255,.1); box-shadow: none; flex: 0 1 auto; }
.over-again { position: absolute; right: 12px; bottom: calc(100% + 12px); z-index: 6; }

/* bubbles: big words flying over the table ("+3", "Your turn!") */
.bubble { position: fixed; z-index: 1700; transform: translate(-50%, -50%); font-family: var(--display); font-size: 2rem; color: #fff; white-space: nowrap; pointer-events: none;
  -webkit-text-stroke: 3px #000; paint-order: stroke fill; text-shadow: 2px 3px 0 #000; animation: bubble 2s ease-out forwards; letter-spacing: .03em; }
@keyframes bubble { 0% { opacity: 0; scale: .3; } 15% { opacity: 1; scale: 1.15; } 25% { scale: 1; } 75% { opacity: 1; translate: 0 -12px; } 100% { opacity: 0; translate: 0 -34px; } }
@keyframes pop { 0% { scale: 1.12; } 100% { scale: 1; } }
@keyframes fade-in { from { opacity: 0; } }

/* menu + overlays */
.menu { position: fixed; right: 12px; top: calc(max(8px, env(safe-area-inset-top)) + 44px); z-index: 1200; background: var(--surface); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; min-width: 220px; box-shadow: 0 12px 30px rgba(0,0,0,.5); animation: pop .2s; }
.menu button { background: none; box-shadow: none; color: var(--ink); text-align: left; padding: 10px 12px; font-weight: 700; }
.menu button:hover { background: var(--surface-2); }
.overlay { position: fixed; inset: 0; z-index: 1300; background: rgba(8, 6, 12, .66); display: grid; place-items: center; padding: 16px; animation: fade-in .3s; backdrop-filter: blur(3px); }
.modal { width: min(500px, 100%); max-height: calc(100svh - 32px); overflow: auto; color: var(--ink); animation: pop .35s; user-select: text; }
.overlay.clear { background: transparent; backdrop-filter: none; }
.over { text-align: center; }
.over h2 { font-size: 1.9rem; color: var(--ink); }
.over-avatars { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin-bottom: 8px; }
.over .seat-form, .over .seat-form + * { margin-top: 10px; }
.scores li { text-align: left; }
.scores li.win { background: var(--win); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.place { width: 2em; color: var(--accent-dk); }
.pts { font-family: var(--display); font-size: 1.4rem; }
.log { list-style: none; padding: 0; margin: 0 0 12px; font-size: .88rem; max-height: 60svh; overflow: auto; }
.log li { padding: 5px 0; border-bottom: 1px solid var(--line); }

/* moving the table to another Antwire game (hub.js) */
.move-box { border-top: 1px solid var(--line); padding-top: .6rem; margin-top: .4rem; text-align: left; }
.move-box summary { cursor: pointer; font-weight: 700; }
.move-box p { margin: .4rem 0; }
.move-games { display: flex; flex-wrap: wrap; gap: .4rem; }
.move-page { max-width: 480px; margin: 2rem auto; }

@media (max-width: 520px) {
  .watch-badge .wtxt { display: none; }
  .chip { min-width: 92px; }
  .grid-opts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
