/* hex.css — the Hexanomics 3D interface: the HUD over the island (HexHud.js) and the lobby
   (HexLobby.js). Dark plum panels with a gold trim, illustrated cards, round ornate buttons.
   Every HUD block is laid out at a 1600×900 reference and scaled from its screen corner by
   --k (HexHud.resize): the interface keeps its proportions from a phone to 4K. */

:root {
    --k: 1;
    --panel: rgba(33, 26, 38, 0.9);
    --panel-2: rgba(51, 41, 58, 0.94);
    --panel-3: rgba(70, 57, 78, 0.95);
    --edge: #c9a45c;
    --edge-2: #e8cd8f;
    --edge-dim: rgba(201, 164, 92, 0.45);
    --text: #f3e9d4;
    --text-dim: #b9ab93;
    --accent: #7c64ba;
    --accent-2: #a68ce6;
    --good: #73c25d;
    --bad: #da5d4d;
    --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
    --sans: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

.hud, .lobby { position: fixed; inset: 0; pointer-events: none; font-family: var(--sans); color: var(--text); z-index: 10; }
.hud *, .lobby * { box-sizing: border-box; }
.hud button, .lobby button, .hud input, .lobby input, .lobby select { font-family: inherit; }
.hud.hidden, .lobby.hidden, .hidden { display: none !important; }
.hud [data-hint], .hud button, .hud .card, .hud input, .hud select { pointer-events: auto; }

/* --- Scaled anchors ------------------------------------------------------------------- */
.anchor { position: absolute; transform: scale(var(--k)); }
.anchor.tl { left: 14px; top: 14px; transform-origin: 0 0; }
.anchor.tr { right: 14px; top: 14px; transform-origin: 100% 0; }
.anchor.bl { left: 14px; bottom: 14px; transform-origin: 0 100%; }
.anchor.br { right: 14px; bottom: 14px; transform-origin: 100% 100%; }
.anchor.bc { left: 50%; bottom: 8px; transform: translateX(-50%) scale(var(--k)); transform-origin: 50% 100%; }
.anchor.ml { left: 10px; top: 50%; transform: translateY(-50%) scale(var(--k)); transform-origin: 0 50%; }
.anchor.mr { right: 14px; top: 50%; transform: translateY(-50%) scale(var(--k)); transform-origin: 100% 50%; }
.anchor.tc { left: 50%; top: 14px; transform: translateX(-50%) scale(var(--k)); transform-origin: 50% 0; }
.anchor.cc { left: 50%; top: 50%; transform: translate(-50%, -50%) scale(var(--k)); transform-origin: 50% 50%; }

/* --- Panels ---------------------------------------------------------------------------- */
.panel {
    background: linear-gradient(180deg, var(--panel-2), var(--panel));
    border: 2px solid var(--edge);
    border-radius: 10px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 233, 184, 0.12), 0 8px 24px rgba(16, 10, 22, 0.45);
    pointer-events: auto;
}
.panel.thin { border-width: 1px; border-color: var(--edge-dim); }
.title {
    font-family: var(--serif); font-variant: small-caps; letter-spacing: 0.04em; font-weight: 600;
    color: var(--edge-2); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}
.dim { color: var(--text-dim); }

/* --- Buttons --------------------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 8px 18px; border-radius: 8px; cursor: pointer;
    color: var(--text); font-size: 15px; font-weight: 600; letter-spacing: 0.02em;
    background: linear-gradient(180deg, #5a4866, #3a2d44);
    border: 1px solid var(--edge); box-shadow: inset 0 1px 0 rgba(255, 235, 190, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4);
    transition: filter 0.15s, transform 0.08s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.off { opacity: 0.42; filter: grayscale(0.6); cursor: default; pointer-events: none; }
.btn.gold { background: linear-gradient(180deg, #d8b468, #9c7432); color: #2a1c0c; border-color: #f4dda0; text-shadow: 0 1px 0 rgba(255, 240, 200, 0.5); }
.btn.green { background: linear-gradient(180deg, #5f9a4c, #3a6a2d); border-color: #a9d68d; }
.btn.red { background: linear-gradient(180deg, #a44a3c, #6e2a22); border-color: #e09a8c; }
.btn.ghost { background: rgba(255, 255, 255, 0.06); border-color: var(--edge-dim); }
.btn.small { min-height: 30px; padding: 4px 12px; font-size: 13px; }
.btn svg { width: 18px; height: 18px; }

.icon-btn {
    width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
    background: radial-gradient(circle at 50% 35%, #5d4b6a, #2c2234 75%);
    border: 2px solid var(--edge-dim); color: var(--edge-2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 230, 180, 0.2);
    transition: border-color 0.15s, filter 0.15s;
}
.icon-btn:hover { border-color: var(--edge); filter: brightness(1.2); }
.icon-btn.on { border-color: var(--edge); box-shadow: 0 0 12px rgba(232, 205, 143, 0.55); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .badge { position: absolute; transform: translate(14px, -14px); }

.badge {
    min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #2a1c0c; background: linear-gradient(180deg, #f1d58e, #c39a4a);
    border: 1px solid #fff0c0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* --- Turn panel (top left) ------------------------------------------------------------------ */
.turn { width: 360px; padding: 12px 14px 12px; }
.turn .row { display: flex; align-items: center; gap: 10px; }
.turn .who { font-size: 20px; }
.turn .msg { margin-top: 8px; font-size: 15px; line-height: 1.35; min-height: 20px; }
.turn .msg.act { color: #fff7da; text-shadow: 0 0 10px rgba(255, 210, 120, 0.35); }
.turn .goals { margin-top: 10px; display: grid; gap: 6px; }
.goal {
    display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 6px;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(201, 164, 92, 0.25); font-size: 14px;
}
.goal .ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, 0.3); color: var(--edge-2); }
.goal .ico svg { width: 16px; height: 16px; }
.goal .val { margin-left: auto; font-weight: 700; color: var(--edge-2); }
.turn .cancel { margin-left: auto; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: 0 0 6px rgba(0, 0, 0, 0.5); flex: none; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--edge-2); }
.timer.low { color: #ff9b84; }

/* --- Players (top right) — quest rows ---------------------------------------------------------- */
.players { display: grid; gap: 8px; width: 380px; }
.player {
    position: relative; display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px;
    padding: 6px 10px 6px 6px; border-radius: 28px 10px 10px 28px;
    background: linear-gradient(90deg, rgba(28, 22, 32, 0.92), rgba(44, 35, 50, 0.86));
    border: 1px solid rgba(201, 164, 92, 0.35); box-shadow: 0 4px 14px rgba(12, 8, 16, 0.35);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.player.current { border-color: var(--edge); box-shadow: 0 0 0 1px rgba(232, 205, 143, 0.4), 0 0 18px rgba(232, 205, 143, 0.35); transform: translateX(-6px); }
.player.pick { cursor: pointer; border-color: #f7e2a6; box-shadow: 0 0 16px rgba(255, 220, 140, 0.7); animation: pulse 1.1s infinite; }
.player.nopick { opacity: 0.45; }
.player .ava {
    width: 52px; height: 52px; border-radius: 50%; background-size: cover; background-position: 50% 20%;
    border: 3px solid #888; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
}
.player .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.player .name .me { color: var(--edge-2); font-weight: 600; font-size: 12px; margin-left: 4px; }
.player .stats { display: flex; gap: 10px; margin-top: 4px; font-size: 13px; color: var(--text-dim); }
.player .stats span { display: inline-flex; align-items: center; gap: 3px; }
.player .stats svg { width: 14px; height: 14px; }
.player .stats .hot { color: #ffd27a; }
.player .stats .warn { color: #ff8f7a; }
.player .vp {
    width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 800;
    font-family: var(--serif); color: #2a1c0c; background: radial-gradient(circle at 40% 35%, #f6e1a8, #c1953f);
    border: 2px solid #fff0c4; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.45);
}
.player .tag { position: absolute; left: 44px; bottom: -4px; font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--edge-dim); color: var(--text-dim); }
.player .tag.timer { color: var(--edge-2); }

/* --- Left menu ----------------------------------------------------------------------------- */
.menu { display: grid; gap: 10px; }
.menu .icon-btn { position: relative; }

/* --- Bottom bar ------------------------------------------------------------------------------- */
.bar { position: relative; width: 1180px; height: 186px; }
.bar .frame {
    position: absolute; left: 70px; right: 70px; bottom: 0; height: 150px; border-radius: 14px 14px 6px 6px;
    background: linear-gradient(180deg, rgba(56, 44, 64, 0.95), rgba(29, 22, 34, 0.96));
    border: 2px solid var(--edge); border-bottom-width: 3px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 235, 190, 0.18), 0 10px 30px rgba(10, 6, 14, 0.55);
}
.bar .progress {
    position: absolute; left: 96px; right: 96px; top: 22px; height: 12px; border-radius: 6px;
    background: rgba(0, 0, 0, 0.55); border: 1px solid var(--edge-dim); overflow: hidden;
}
.bar .progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #5b4596, var(--accent-2)); box-shadow: 0 0 10px rgba(166, 140, 230, 0.6); transition: width 0.5s; }
.bar .score {
    position: absolute; left: 50%; top: 0; transform: translateX(-50%); height: 30px; min-width: 200px; padding: 0 22px;
    display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 15px;
    background: linear-gradient(180deg, #3f3260, #241c3a); border: 2px solid var(--edge);
    font-family: var(--serif); font-size: 16px; color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.bar .score b { color: var(--edge-2); }
.bar .score .sep { width: 1px; height: 16px; background: var(--edge-dim); }
.round-btn {
    position: absolute; bottom: 4px; width: 150px; height: 150px; border-radius: 50%; cursor: pointer; pointer-events: auto;
    display: grid; place-items: center; color: var(--edge-2);
    background: radial-gradient(circle at 50% 40%, #5a476a 0%, #30253a 62%, #1d1624 100%);
    border: 4px solid var(--edge);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.55), inset 0 0 0 6px rgba(201, 164, 92, 0.18), inset 0 0 0 9px rgba(0, 0, 0, 0.35), 0 10px 26px rgba(0, 0, 0, 0.55);
    transition: filter 0.15s, box-shadow 0.2s;
}
.round-btn:hover { filter: brightness(1.15); }
.round-btn.off { cursor: default; filter: grayscale(0.4) brightness(0.8); }
.round-btn.hot { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.55), inset 0 0 0 6px rgba(201, 164, 92, 0.25), 0 0 26px rgba(255, 214, 120, 0.85); animation: glow 1.4s infinite; }
.round-btn.left { left: 0; }
.round-btn.right { right: 0; }
.round-btn .lbl { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-family: var(--serif); font-variant: small-caps; font-size: 15px; color: var(--text); text-shadow: 0 1px 2px #000; }
.round-btn .cnt { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); }
.round-btn svg.big { width: 54px; height: 54px; margin-top: -18px; }
.dice { display: flex; gap: 8px; margin-top: -20px; }
.die {
    width: 40px; height: 40px; border-radius: 9px; background: linear-gradient(160deg, #fffaf0, #e2d6bd);
    border: 1px solid #8c7a5a; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), inset 0 -2px 0 rgba(0, 0, 0, 0.12);
    display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 5px;
}
.die.red { background: linear-gradient(160deg, #e45b4c, #a5322a); border-color: #6b1f1a; }
.die i { width: 7px; height: 7px; border-radius: 50%; background: #2b2018; place-self: center; visibility: hidden; }
.die.red i { background: #fff6e8; }
.die i.on { visibility: visible; }
.die.event { width: 30px; height: 30px; padding: 4px; display: grid; place-items: center; grid-template: none; }
.die.event svg { width: 20px; height: 20px; }
.dice.rolling .die { animation: roll 0.55s ease-out; }
.sum { position: absolute; top: 20px; right: 20px; }

.bar .content { position: absolute; left: 172px; right: 172px; bottom: 10px; height: 118px; display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.res { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: 250px; align-self: center; }
.res.ck { grid-template-columns: repeat(4, 1fr); width: 220px; }
.chip {
    position: relative; height: 52px; border-radius: 8px; overflow: hidden; cursor: default;
    border: 1px solid rgba(255, 230, 180, 0.35); background-size: cover; background-position: center;
    box-shadow: inset 0 -18px 18px -6px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.45);
    transition: transform 0.12s, border-color 0.12s, opacity 0.2s;
}
.chip.pick { cursor: pointer; border-color: var(--edge); }
.chip.pick:hover { transform: translateY(-3px); }
.chip.zero { opacity: 0.42; filter: grayscale(0.5); }
.chip b { position: absolute; right: 5px; bottom: 2px; font-size: 18px; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000, 0 0 6px #000; }
.chip.bump { animation: bump 0.45s; }
.cards { display: flex; gap: 8px; align-items: flex-end; }
.card {
    position: relative; width: 84px; height: 112px; border-radius: 8px; cursor: pointer;
    background: linear-gradient(180deg, #3b2f46, #1f1827); border: 2px solid #8a6f43;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, filter 0.15s;
}
.card:hover { transform: translateY(-8px); border-color: var(--edge-2); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.6), 0 0 14px rgba(232, 205, 143, 0.4); z-index: 2; }
.card.off { filter: grayscale(0.8) brightness(0.62); cursor: default; }
.card.off:hover { transform: none; }
.card.selected { border-color: #fff2c2; box-shadow: 0 0 18px rgba(255, 220, 140, 0.8); transform: translateY(-8px); }
.card .art { position: absolute; left: 5px; right: 5px; top: 19px; bottom: 23px; border-radius: 4px; background-size: cover; background-position: center; background-repeat: no-repeat; }
.card .art.fit { background-size: contain; background-color: rgba(0, 0, 0, 0.25); }
.card .name { position: absolute; left: 0; right: 0; top: 2px; text-align: center; font-family: var(--serif); font-variant: small-caps; font-size: 12.5px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 3px; }
.card .cost { position: absolute; left: 3px; right: 3px; bottom: 3px; display: flex; justify-content: center; gap: 2px; }
.card .cost i { width: 15px; height: 15px; border-radius: 50%; background-size: cover; background-position: center; border: 1px solid rgba(255, 240, 200, 0.7); }
.card .count { position: absolute; top: -10px; right: -8px; }
.card .sub { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 11px; color: var(--text-dim); }
.card.dev .art { top: 5px; bottom: 5px; left: 4px; right: 4px; }
.card.dev .name { display: none; }
.card.dev.usable { border-color: #c9a45c; }
.sep-v { width: 1px; align-self: stretch; margin: 6px 2px; background: linear-gradient(180deg, transparent, var(--edge-dim), transparent); }

/* --- Info panel (bottom right) -------------------------------------------------------------------- */
.info { width: 340px; padding: 12px 14px; pointer-events: none; transition: opacity 0.2s; }
.info.empty { opacity: 0; }
.info .head { display: flex; align-items: center; gap: 10px; }
.info .head .pic { width: 48px; height: 48px; border-radius: 50%; background-size: cover; background-position: center; border: 2px solid var(--edge); flex: none; }
.info .head .title { font-size: 19px; }
.info .body { margin-top: 8px; font-size: 13.5px; line-height: 1.45; color: var(--text); }
.info .body .g { color: #9fdf86; }
.info .body .r { color: #ff9a86; }
.info .body .y { color: #ffd581; }

/* --- Number chips over the tiles -------------------------------------------------------------------- */
.chips { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.num {
    position: absolute; left: 0; top: 0; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 9px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: linear-gradient(180deg, rgba(36, 30, 40, 0.88), rgba(20, 16, 24, 0.9));
    border: 1px solid rgba(255, 238, 200, 0.45); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
    font-family: var(--serif); font-weight: 700; font-size: 21px; line-height: 1; color: #f5ecd6;
    will-change: transform; transition: opacity 0.25s;
}
.num.red { color: #ff7a64; }
.num .pips { display: flex; gap: 2px; margin-top: 3px; }
.num .pips i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.num.robbed { filter: grayscale(1) brightness(0.65); }
.num.robbed::after { content: ''; position: absolute; inset: -3px; border-radius: 11px; border: 2px solid rgba(20, 16, 24, 0.9); }
.num.hit { animation: hit 1.6s ease-out; }
.port {
    position: absolute; left: 0; top: 0; height: 30px; padding: 0 10px 0 4px; border-radius: 15px; display: flex; align-items: center; gap: 6px;
    background: rgba(26, 22, 32, 0.82); border: 1px solid rgba(255, 238, 200, 0.4); font-weight: 700; font-size: 14px; color: #f5ecd6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); will-change: transform;
}
.port i { width: 22px; height: 22px; border-radius: 50%; background-size: cover; background-position: center; border: 1px solid rgba(255, 240, 200, 0.7); }
.port i.any { background: radial-gradient(circle at 40% 35%, #f6e1a8, #b88a3a); display: grid; place-items: center; font-style: normal; color: #2a1c0c; font-size: 14px; }
.floaty { position: fixed; left: 0; top: 0; width: 40px; height: 54px; border-radius: 6px; background-size: cover; background-position: center; border: 1px solid rgba(255, 240, 200, 0.7); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5); pointer-events: none; z-index: 30; }

/* --- Confirm bubble over a picked spot --------------------------------------------------------------- */
.confirm { position: fixed; left: 0; top: 0; display: flex; gap: 6px; padding: 6px; border-radius: 26px; z-index: 25; pointer-events: auto;
    background: rgba(28, 22, 32, 0.92); border: 1px solid var(--edge); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5); transform: translate(-50%, -100%); }
.confirm .icon-btn { width: 40px; height: 40px; }
.confirm .yes { color: #b6f09c; border-color: rgba(150, 220, 120, 0.7); }
.confirm .no { color: #ffb2a4; border-color: rgba(230, 140, 120, 0.6); }

/* --- Toasts ------------------------------------------------------------------------------------------ */
.toasts { display: grid; gap: 8px; justify-items: center; }
.toast { padding: 10px 20px; border-radius: 22px; font-size: 16px; background: rgba(28, 22, 32, 0.92); border: 1px solid var(--edge); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); animation: toast-in 0.25s ease-out; }
.toast.bad { border-color: #e48c7c; color: #ffd0c6; }
.toast.big { font-family: var(--serif); font-size: 26px; padding: 12px 34px; color: var(--edge-2); }

/* --- Offers (right, under the players) ----------------------------------------------------------------- */
.right-col { display: grid; gap: 14px; justify-items: end; }
.offers { display: grid; gap: 10px; width: 380px; max-height: calc(100vh / var(--k) - 520px); overflow-y: auto; }
.offers:empty { display: none; }
.offer .lbl { font-size: 11px; color: var(--text-dim); margin-bottom: 2px; }
.offer { padding: 10px 12px; }
.offer .row { display: flex; align-items: center; gap: 8px; }
.offer .side { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; min-height: 34px; }
.offer .side .chip { width: 30px; height: 40px; }
.offer .side .chip b { font-size: 13px; right: 3px; }
.offer .arrow { color: var(--edge-2); font-size: 20px; padding: 0 4px; }
.offer .who { font-size: 13px; color: var(--text-dim); }
.offer .acc { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.offer .acc .ava { width: 30px; height: 30px; border-radius: 50%; background-size: cover; border: 2px solid #666; opacity: 0.45; }
.offer .acc .ava.yes { opacity: 1; border-color: #9fe07f; cursor: pointer; box-shadow: 0 0 8px rgba(160, 230, 120, 0.7); }
.offer .acc .ava.no { opacity: 0.25; }
.offer .btns { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }

/* --- Modals -------------------------------------------------------------------------------------------- */
.modal-wrap { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(14, 10, 20, 0.35); pointer-events: auto; z-index: 40; }
.modal { position: relative; min-width: 420px; max-width: 760px; padding: 18px 22px 18px; transform: scale(var(--k)); }
.modal h2 { margin: 0 0 6px; font-size: 24px; }
.modal p { margin: 4px 0 12px; color: var(--text-dim); font-size: 14px; }
.modal .close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; }
.modal .grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; align-items: center; }
.modal .foot .grow { flex: 1; color: var(--text-dim); font-size: 14px; }
.pickcard { position: relative; width: 78px; cursor: pointer; text-align: center; }
.pickcard .art { width: 78px; height: 104px; border-radius: 7px; background-size: cover; background-position: center; border: 2px solid #8a6f43; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5); }
.pickcard.off { opacity: 0.35; cursor: default; }
.pickcard .n { position: absolute; top: -8px; right: -8px; }
.pickcard .have { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.pickcard .ctl { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.pickcard .ctl button { width: 28px; height: 26px; border-radius: 6px; border: 1px solid var(--edge-dim); background: rgba(255, 255, 255, 0.07); color: var(--text); cursor: pointer; font-size: 16px; line-height: 1; }
.pickcard.chosen .art { border-color: #fff0c0; box-shadow: 0 0 14px rgba(255, 220, 140, 0.8); }
.trade-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.trade-cols h3 { margin: 0 0 8px; font-size: 16px; }
.ratio { position: absolute; left: 4px; top: 4px; font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.7); color: #ffe39a; }
.players-pick { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.players-pick .p { width: 110px; text-align: center; cursor: pointer; }
.players-pick .p .ava { width: 90px; height: 90px; margin: 0 auto 6px; border-radius: 50%; background-size: cover; background-position: 50% 20%; border: 4px solid #888; }
.players-pick .p.off { opacity: 0.35; cursor: default; }
.bigcard { width: 200px; height: 304px; border-radius: 12px; background-size: cover; background-position: center; border: 3px solid var(--edge); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); margin: 0 auto; }
.rank { display: grid; gap: 8px; margin: 10px 0; }
.rank .r { display: grid; grid-template-columns: 34px 46px 1fr auto; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(201, 164, 92, 0.25); }
.rank .r.win { border-color: var(--edge); box-shadow: 0 0 14px rgba(232, 205, 143, 0.4); }
.rank .pos { font-family: var(--serif); font-size: 22px; color: var(--edge-2); text-align: center; }
.rank .ava { width: 46px; height: 46px; border-radius: 50%; background-size: cover; border: 3px solid #888; }

/* --- Chat ------------------------------------------------------------------------------------------------ */
.chat { width: 380px; height: 300px; display: flex; flex-direction: column; padding: 10px; }
.chat .lines { flex: 1; overflow-y: auto; font-size: 13.5px; line-height: 1.45; padding-right: 4px; }
.chat .lines div { margin-bottom: 3px; word-wrap: break-word; }
.chat input { margin-top: 8px; height: 36px; border-radius: 8px; padding: 0 12px; border: 1px solid var(--edge-dim); background: rgba(0, 0, 0, 0.35); color: var(--text); outline: none; font-size: 14px; }
.chat input:focus { border-color: var(--edge); }
.spark { position: fixed; pointer-events: none; z-index: 30; font-family: var(--serif); font-weight: 700; font-size: 20px; color: #ffe39a; text-shadow: 0 2px 4px #000; }

/* --- Lobby ------------------------------------------------------------------------------------------------ */
.lobby { display: grid; place-items: center; pointer-events: none; }
.lobby .shade { position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 60%, rgba(20, 14, 26, 0) 30%, rgba(20, 14, 26, 0.55) 100%); }
.lobby .box { position: relative; transform: scale(var(--k)); pointer-events: auto; }
.logo { text-align: center; margin-bottom: 18px; }
.logo .t { font-family: var(--serif); font-variant: small-caps; font-size: 64px; letter-spacing: 0.06em; color: #fbecc6; text-shadow: 0 2px 0 #7a5a26, 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 40px rgba(255, 220, 150, 0.35); line-height: 1; }
.logo .s { margin-top: 6px; font-family: var(--serif); font-size: 18px; letter-spacing: 0.3em; color: #e8d6b0; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }
.menu-box { width: 460px; padding: 22px 24px; display: grid; gap: 12px; }
.menu-box .btn { width: 100%; min-height: 50px; font-size: 17px; }
.menu-box .row2 { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--text-dim); }
.field input, .field select {
    height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--edge-dim); background: rgba(0, 0, 0, 0.35);
    color: var(--text); font-size: 16px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--edge); }
.field select option { background: #2b2233; }
.hr { height: 1px; background: linear-gradient(90deg, transparent, var(--edge-dim), transparent); margin: 4px 0; }
.who-am-i { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-dim); }
.who-am-i b { color: var(--text); font-size: 16px; }
.room { width: 920px; padding: 20px 22px; display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
.room h2 { margin: 0; font-size: 28px; }
.room .code { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.room .code b { font-family: var(--serif); font-size: 30px; letter-spacing: 0.18em; color: var(--edge-2); }
.slots { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 44px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 10px 6px 6px; border-radius: 24px 8px 8px 24px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(201, 164, 92, 0.25); }
.slot .ava { width: 44px; height: 44px; border-radius: 50%; background-size: cover; background-position: 50% 20%; border: 3px solid #888; }
.slot.empty { opacity: 0.45; }
.slot .ready { font-size: 13px; color: var(--good); }
.slot .wait { font-size: 13px; color: var(--text-dim); }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.settings .wide { grid-column: span 2; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: #c9a45c; }
.room .chat { width: auto; height: 190px; padding: 8px; margin-top: 12px; background: rgba(0, 0, 0, 0.25); border-radius: 8px; border: 1px solid var(--edge-dim); }
.busy { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--edge-dim); border-top-color: var(--edge-2); animation: spin 0.8s linear infinite; }
.foot-note { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 8px; }

/* --- Animations ---------------------------------------------------------------------------------------- */
@keyframes pulse { 0%, 100% { box-shadow: 0 0 8px rgba(255, 220, 140, 0.5); } 50% { box-shadow: 0 0 20px rgba(255, 220, 140, 0.95); } }
@keyframes glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.25); } }
@keyframes roll { 0% { transform: rotate(-200deg) scale(0.6); } 70% { transform: rotate(15deg) scale(1.1); } 100% { transform: rotate(0) scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes hit { 0% { box-shadow: 0 0 0 0 rgba(255, 220, 120, 0.9); transform: scale(1); } 30% { box-shadow: 0 0 22px 8px rgba(255, 220, 120, 0.8); } 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-height: 520px) {
    .info { display: none; }
}

/* A phone held upright: the board and the HUD need the long side across. */
.rotate { display: none; }
@media (orientation: portrait) and (max-width: 760px) {
    .rotate {
        display: flex; position: fixed; left: 12px; right: 12px; top: 12px; z-index: 60; gap: 10px; align-items: center;
        padding: 10px 14px; border-radius: 10px; background: rgba(28, 22, 32, 0.92); border: 1px solid var(--edge);
        color: var(--text); font-size: 14px; pointer-events: none;
    }
    .rotate svg { width: 26px; height: 26px; color: var(--edge-2); flex: none; }
}
