/* Lumary palette: Midnight, Charcoal, TealTwo, Apple, Fushia (errors), Ice, Concrete.
   Layout: one centred column, max 620px; game board is the hero. */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=Inter:wght@400;500;600&display=swap");
:root {
  --midnight: #022a44; --charcoal: #2f3131; --teal: #43a2a7; --apple: #c2db67; --fushia: #a62477;
  --ice: #f2f4f5; --concrete: #ccd4da; --panel: #fbfcfc;
  --bg: var(--ice); --fg: var(--charcoal); --head: var(--midnight); --muted: #5f6b73; --line: var(--concrete);
  --p1: var(--teal); --p1-soft: #d3ebec; --p2: var(--midnight); --p2-soft: #cdd8e0;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #071a28; --panel: #0d2536; --fg: #e6ecef; --head: #f2f4f5; --muted: #93a4b0; --line: #24425a;
          --p1: #5fc2c7; --p1-soft: #143d45; --p2: #c2db67; --p2-soft: #2c3a17; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body);
       padding: 20px max(16px, env(safe-area-inset-right)) 40px max(16px, env(safe-area-inset-left)); }
main { max-width: 620px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
a { color: var(--teal); }
h1 { font: 800 2.2rem/1 var(--display); color: var(--head); margin: 0; letter-spacing: -0.02em; }
h2 { font: 700 1.2rem/1.2 var(--display); color: var(--head); margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
header { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.back { font-size: 0.85rem; text-decoration: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; }
label.small { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
input, select, button { font: inherit; }
input[type=text], select { background: var(--bg); color: var(--fg); border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 10px; }
input.code { text-transform: uppercase; letter-spacing: 0.15em; width: 9ch; }
.btn { border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer; background: var(--teal); color: #fff; }
.btn.dark { background: var(--midnight); }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.armed { background: var(--fushia); color: #fff; box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.err { color: var(--fushia); margin: 0; font-size: 0.9rem; }
.note { color: var(--muted); font-size: 0.85rem; margin: 0; text-align: center; }
.share { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.share .code { font: 800 1.4rem var(--display); letter-spacing: 0.18em; color: var(--head); }
.share .lnk { flex: 1 1 220px; min-width: 0; font-size: 0.8rem; color: var(--muted); word-break: break-all; user-select: all; }
#status { text-align: center; font-weight: 600; margin: 0; min-height: 1.5em; color: var(--head); }
[hidden] { display: none !important; }

/* identity bar */
.idbar { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; }
.idbar input { flex: 1 1 160px; min-width: 0; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
/* chat (lobby + tables) */
.tchat .msgs, .msgs { height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--bg); border-radius: 10px; }
.msg { max-width: 80%; padding: 7px 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); overflow-wrap: anywhere; align-self: flex-start; }
.msg.mine { align-self: flex-end; background: var(--teal); color: #fff; border-color: var(--teal); }
.msg .t { display: block; font-size: .7rem; opacity: .7; margin-top: 2px; }
.send { display: flex; gap: 8px; } .send input { flex: 1 1 auto; min-width: 0; }
.empty { color: var(--muted); font-size: .9rem; margin: 0; }

.idbar .alerts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
/* chat speech bubbles over the game */
#bubbles { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.bubble { pointer-events: auto; position: relative; max-width: 100%; text-align: left; font: inherit; color: var(--fg); background: var(--panel); border: 2px solid var(--teal); border-radius: 16px; padding: 8px 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; overflow-wrap: anywhere; transition: opacity .3s, transform .3s; }
.bubble b { display: block; font-size: .75rem; color: var(--teal); }
.bubble::after { content: ''; position: absolute; left: var(--tail, 22px); bottom: -9px; border: 8px solid transparent; border-top-color: var(--teal); border-bottom: 0; }
.bubble.at { position: absolute; z-index: 50; max-width: min(260px, 80vw); border-radius: 18px; background: #fff; color: var(--charcoal); font-size: .9rem; font-weight: 600; padding: 7px 12px; }
.bubble.at.below::after { bottom: auto; top: -9px; border-top: 0; border-bottom: 8px solid var(--teal); }
.bubble.out { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: no-preference) { .bubble { animation: pop .25s ease-out; } @keyframes pop { from { opacity: 0; transform: scale(.85); } } }
/* quick comments, pinned to the bottom of the screen */
.quickbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(242,244,245,.94); backdrop-filter: blur(6px); border-top: 1px solid var(--line); scrollbar-width: none; justify-content: safe center; }
.quickbar::-webkit-scrollbar { display: none; }
.qc { flex: none; font: 600 .85rem var(--body); color: var(--midnight); background: #fff; border: 1.5px solid var(--teal); border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.qc:hover { background: var(--teal); color: #fff; }
.qc:disabled { opacity: .45; cursor: default; }
body.has-quick { padding-bottom: 64px; }

/* Fun Mode */
#whatnext .funnext { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--apple); margin-bottom: 8px; }
#whatnext .funnext .small { color: var(--midnight); font-weight: 600; }
