:root {
  --bg: #1e130c;
  --card: #f5ebd4;
  --card-2: #ebe0c4;
  --ink: #24160d;
  --muted: #6c5642;
  --border: rgba(74, 46, 22, 0.24);
  --accent: #9e2a2b;
  --accent-2: #c58f1c;
  --green: #2c7a47;
  --danger: #b52b27;
  --shadow: 0 14px 36px rgba(10, 5, 2, 0.42);
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "Libre Franklin", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

[data-theme="dark"] {
  --card: #241a14;
  --card-2: #2f221a;
  --ink: #f3e6cf;
  --muted: #b8a38c;
  --border: rgba(235, 200, 145, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font-sans); }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at center, transparent 52%, rgba(12, 6, 3, 0.6) 100%); }

/* Loader */
#loader { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #1d120b; color: #f5e6c4; transition: opacity .35s; }
#loader.done { opacity: 0; pointer-events: none; }
.wordmark { font-family: var(--font-serif); font-weight: 900; letter-spacing: .08em; margin: 0; }
.loader-mark { font-size: 3rem; color: #f5e6c4; }
.loader-bar { width: 200px; height: 6px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; margin: 14px 0 8px; }
.loader-bar span { display: block; height: 100%; width: 65%; background: linear-gradient(90deg, #9e2a2b, #d8a63e); animation: loadslide 1.2s infinite ease-in-out; }
@keyframes loadslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(220%); } }

/* Generic cards & buttons */
.card { background: var(--card); color: var(--ink); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--card-2); color: var(--ink); font: 700 .9rem var(--font-sans); padding: 9px 14px; border-radius: 10px; cursor: pointer; transition: transform .1s, background .15s; }
.btn:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #b33330, #8a201d); color: #fbf2de; border-color: #6b1412; }
.btn.gold { background: linear-gradient(180deg, #d6a02c, #a87614); color: #1f1205; border-color: #825808; }
.btn.good { background: linear-gradient(180deg, #358f54, #256b3d); color: #f6fff8; border-color: #194d2b; }
.btn.danger { background: linear-gradient(180deg, #c73732, #96221e); color: #fff; border-color: #6e1512; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: .8rem; border-radius: 8px; }
.btn.big { width: 100%; padding: 12px 18px; font-size: 1rem; }

.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.28); }
.icon-btn:hover { filter: brightness(1.08); }
.icon-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.icon-btn.danger:hover { background: var(--danger); color: #fff; }
.ic { width: 18px; height: 18px; display: block; }

/* Screens */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 18px; overflow-y: auto; }
.home-card { width: 100%; max-width: 410px; overflow: hidden; }
.lid { background: linear-gradient(135deg, #8c2220, #5a1312); color: #f7e9ca; padding: 22px 24px 16px; text-align: center; border-bottom: 3px solid #d6a43e; }
.lid .wordmark { font-size: 2.35rem; }
.lid-sub { margin: 4px 0 0; font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; opacity: .88; }
.home-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.tagline { margin: 0; font-size: .92rem; color: var(--muted); text-align: center; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; font-weight: 700; color: var(--muted); }
.field input, .field select { padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--card-2); color: var(--ink); font: 600 .95rem var(--font-sans); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .16em; text-align: center; font-size: 1.05rem; }
.fineprint { margin: 4px 0 0; font-size: .76rem; color: var(--muted); text-align: center; }

/* Lobby */
.lobby-card { width: 100%; max-width: 960px; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: linear-gradient(135deg, #6e1b18, #44100f); color: #f6e7c6; border-bottom: 2px solid #d6a43e; flex-wrap: wrap; }
.ticket-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; opacity: .8; }
.code { font: 800 1.8rem var(--font-mono); letter-spacing: .22em; }
.lobby-share { display: flex; gap: 8px; }
.lobby-share .btn { color: #f6e7c6; border-color: rgba(255,255,255,.3); }
.lobby-body { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 18px 20px; overflow-y: auto; }
.lobby-col h3 { margin: 0 0 10px; font-family: var(--font-serif); font-size: 1.05rem; display: flex; align-items: center; justify-content: space-between; }
.lobby-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 7px; }
.lobby-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--border); font-size: .88rem; }
.lobby-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.lobby-meta { font-size: .74rem; color: var(--muted); }
.mini-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 12px; }
.mini-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 10px; border: 2px solid var(--border); background: var(--card-2); color: var(--ink); cursor: pointer; font-size: .76rem; font-weight: 700; }
.mini-opt svg { width: 24px; height: 24px; }
.mini-opt.active { border-color: var(--accent); background: rgba(158, 42, 43, 0.14); }
.color-sex-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.color-picker { display: flex; gap: 7px; }
.color-opt { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.color-opt.active { border-color: var(--ink); transform: scale(1.15); }
.sex-picker { display: flex; gap: 5px; }
.sex-picker .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.packs-picker { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.pack-row { display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; border-radius: 9px; background: var(--card-2); border: 1px solid var(--border); font-size: .8rem; cursor: pointer; }
.pack-row small { display: block; color: var(--muted); font-weight: 500; font-size: .72rem; }
.host-note { margin: 0 0 8px; font-size: .78rem; color: var(--muted); }
.toggle { display: flex; align-items: flex-start; gap: 8px; font-size: .82rem; font-weight: 600; margin-top: 8px; cursor: pointer; }
.toggle small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; }
.lobby-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--card-2); }
.lobby-foot .btn.big { width: auto; min-width: 190px; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#hud > * { pointer-events: auto; }

.hud-players { position: fixed; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 7px; width: 235px; max-height: calc(100vh - 210px); overflow-y: auto; }
.p-card { position: relative; background: var(--card); border: 2px solid var(--border); border-radius: 12px; padding: 8px 10px; box-shadow: 0 6px 18px rgba(0,0,0,.32); cursor: pointer; transition: border-color .2s; }
.p-card.active { border-color: #e3af3a; box-shadow: 0 0 0 2px rgba(227, 175, 58, 0.35), 0 8px 20px rgba(0,0,0,.4); }
.p-card.dead { opacity: .65; border-style: dashed; }
.p-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.p-name { font-weight: 800; font-size: .88rem; display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-lv { font-family: var(--font-serif); font-weight: 900; font-size: .95rem; background: var(--accent-2); color: #241305; padding: 2px 7px; border-radius: 7px; }
.p-stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: .74rem; color: var(--muted); margin-top: 4px; }
.p-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font-size: .68rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--border); }
.tag.curse { background: rgba(158, 42, 43, 0.16); color: var(--accent); border-color: rgba(158, 42, 43, 0.35); }

/* Emote bubble accanto alla scheda giocatore */
.emote-bubble { position: fixed; z-index: 65; width: 76px; height: 76px; pointer-events: none; animation: emotepop .22s cubic-bezier(.2,1.4,.4,1); filter: drop-shadow(0 6px 12px rgba(0,0,0,.45)); }
.emote-bubble img { width: 100%; height: 100%; object-fit: contain; }
@keyframes emotepop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.hud-tools { position: fixed; top: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: 390px; }

/* Center stage (Combattimento / Reazioni / Maledizioni / Saccheggio) */
.center-stage { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); width: min(540px, calc(100vw - 520px)); min-width: 310px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; z-index: 25; }
.center-stage > * { pointer-events: auto; }
.combat-banner { background: var(--card); border: 2px solid var(--accent); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.combat-banner.winning { border-color: var(--green); }
.combat-score { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--font-serif); }
.score-side { display: flex; flex-direction: column; }
.score-side.right { text-align: right; }
.score-num { font-size: 1.65rem; font-weight: 900; line-height: 1; }
.score-num.hero { color: var(--green); }
.score-num.mon { color: var(--danger); }
.combat-monsters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.m-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card-2); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-size: .78rem; font-weight: 700; cursor: pointer; }
.m-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; border: 1px solid rgba(74,46,22,.35); background: #f3e7cc; }
.react-bar-wrap { height: 7px; border-radius: 99px; background: rgba(0,0,0,.15); overflow: hidden; margin: 8px 0 6px; }
.react-bar { height: 100%; background: linear-gradient(90deg, #358f54, #d6a02c); transition: width .18s linear; }
.combat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Side panel */
.side-panel { position: fixed; top: 60px; right: 12px; width: 310px; max-height: calc(100vh - 360px); display: flex; flex-direction: column; overflow: hidden; }
.side-panel.collapsed { display: none; }
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--card-2); }
.tabs button { flex: 1; border: none; background: transparent; color: var(--muted); padding: 9px 6px; font: 700 .8rem var(--font-sans); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); background: var(--card); }
.tab-body { overflow-y: auto; padding: 10px 12px; flex: 1; font-size: .82rem; }
.pane { display: none; }
.pane.active { display: block; }
.badge { display: inline-block; min-width: 16px; padding: 1px 5px; border-radius: 99px; background: var(--accent); color: #fff; font-style: normal; font-size: .68rem; }

.gear-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--border); margin-bottom: 6px; }
.gear-item.backpack { opacity: .8; border-style: dashed; }
.log-entry { padding: 4px 0; border-bottom: 1px dashed var(--border); font-size: .78rem; line-height: 1.35; }
.log-entry.combat { color: #b53a28; font-weight: 600; }
.log-entry.victory { color: var(--green); font-weight: 700; }
.log-entry.curse, .log-entry.death { color: #8c2455; font-weight: 600; }
.log-entry.ability { color: #2b5d8c; font-weight: 600; }

/* Chat */
.chat-box { position: fixed; bottom: 12px; left: 12px; width: 250px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.chat-head { width: 100%; border: none; background: var(--card-2); color: var(--ink); padding: 7px 10px; font: 700 .8rem var(--font-sans); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.chat-head .chev { margin-left: auto; transition: transform .2s; }
.chat-box.closed .chat-body { display: none; }
.chat-box.closed .chev { transform: rotate(180deg); }
.chat-list { height: 130px; overflow-y: auto; padding: 6px 9px; font-size: .78rem; display: flex; flex-direction: column; gap: 4px; }
.chat-form { display: flex; gap: 5px; padding: 6px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; background: var(--card-2); color: var(--ink); font-size: .8rem; }

/* Bottom HUD & Hand Tray */
.hud-bottom { position: fixed; bottom: 6px; left: 274px; right: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 22; }
.hud-bottom > * { pointer-events: auto; }
.turn-info { background: rgba(28, 17, 11, 0.9); color: #f6e7c6; padding: 5px 14px; border-radius: 99px; font-size: .84rem; font-weight: 700; border: 1px solid rgba(214, 164, 62, 0.5); max-width: 100%; text-align: center; }
.action-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }

.hand-tray { display: flex; align-items: flex-end; gap: 10px; width: 100%; max-width: 100%; padding: 22px 16px 8px; margin-top: -14px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: rgba(214,164,62,.55) transparent; }
.hand-tray::-webkit-scrollbar { height: 6px; }
.hand-tray::-webkit-scrollbar-thumb { background: rgba(214,164,62,.55); border-radius: 99px; }

/* Centratura sicura: centrato se ci sta, MAI tagliato a sinistra se trabocca */
.hand-card:first-child { margin-left: auto; }
.hand-card:last-child { margin-right: auto; }

.hand-card { position: relative; width: 162px; height: 242px; flex: 0 0 162px; padding: 0; font-family: var(--font-sans); border-radius: 11px; overflow: hidden; border: 2px solid #593b24; background: linear-gradient(160deg, #f7eed9, #e5d2ae); color: #24140b; cursor: pointer; display: flex; flex-direction: column; text-align: left; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; box-shadow: 0 8px 20px rgba(0,0,0,.5); user-select: none; }
.hand-card.deck-treasure { background: linear-gradient(160deg, #fbf0cf, #e8ca86); }
.hand-card:hover { transform: translateY(-14px); z-index: 20; border-color: #f3c458; box-shadow: 0 16px 32px rgba(0,0,0,.68); }
.hand-card.playable { border-color: #49c470; box-shadow: 0 0 0 2px rgba(73, 196, 112, 0.35), 0 8px 20px rgba(0,0,0,.5); }
.hand-card.full-img { padding: 0; background: #1e130c; }
.hand-card.full-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hc-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 5px 8px; color: #fdf5e2; font-size: .66rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; flex-shrink: 0; }
.hc-badge { font-family: var(--font-serif); font-size: .88rem; font-weight: 900; background: rgba(0,0,0,.26); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.hc-body { padding: 6px 8px 5px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow: hidden; }
.hc-title { font-family: var(--font-serif); font-size: .86rem; font-weight: 800; line-height: 1.15; color: #1d1008; }
.hc-art { width: 100%; height: 88px; border-radius: 7px; overflow: hidden; border: 1.5px solid rgba(74, 42, 18, 0.35); background: #f3e7cc; flex-shrink: 0; }
.hc-art img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hc-tags { display: flex; flex-wrap: wrap; gap: 3px; }
.hc-tag { font-size: .62rem; font-weight: 800; padding: 1px 5px; border-radius: 4px; background: rgba(74, 42, 18, 0.13); color: #5c2e14; text-transform: uppercase; }
.hc-tag.restrict { background: rgba(158, 42, 43, 0.16); color: #8c1c1c; }
.hc-text { font-size: .7rem; line-height: 1.24; color: #2d1b10; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.hc-text strong { color: #8c1c1c; }
.hc-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 8px 5px; border-top: 1px solid rgba(58, 36, 22, 0.2); font-size: .68rem; font-weight: 800; color: #4a2d15; background: rgba(58, 36, 22, 0.06); flex-shrink: 0; }
.hc-gold { color: #8a5b08; }

/* Anteprima ingrandita al passaggio del mouse (mai tagliata!) */
.card-preview { position: fixed; z-index: 68; pointer-events: none; width: 264px; min-height: 368px; border-radius: 14px; overflow: hidden; border: 3px solid #f0c259; background: linear-gradient(160deg, #faf1de, #e6d2aa); color: #24140b; box-shadow: 0 22px 52px rgba(0,0,0,.78); display: flex; flex-direction: column; }
.card-preview.modal-preview { position: static; pointer-events: auto; width: 230px; min-height: 330px; flex-shrink: 0; box-shadow: 0 10px 26px rgba(0,0,0,.38); }
.card-preview.deck-treasure { background: linear-gradient(160deg, #fdf3d4, #e7c880); }
.card-preview .hc-head { padding: 8px 12px; font-size: .76rem; }
.card-preview .hc-badge { font-size: 1.15rem; padding: 2px 8px; }
.card-preview .hc-body { padding: 10px 12px; gap: 7px; }
.card-preview .hc-title { font-size: 1.14rem; }
.card-preview .hc-art { height: 152px; border-radius: 9px; }
.card-preview .hc-tag { font-size: .72rem; padding: 2px 7px; }
.card-preview .hc-text { font-size: .85rem; line-height: 1.35; -webkit-line-clamp: 10; }
.card-preview .hc-foot { padding: 7px 12px; font-size: .8rem; }
.card-preview.full-img img { width: 100%; display: block; }

/* Floating Audio/Gfx/Emote popovers */
.audio-fab { position: fixed; bottom: 14px; right: 14px; z-index: 30; }
.gfx-fab { position: fixed; bottom: 14px; right: 60px; z-index: 30; }
body.in-game .audio-fab, body.in-game .gfx-fab { display: none; }
.audio-pop, .gfx-pop { position: fixed; top: 58px; right: 12px; width: 250px; padding: 12px 14px; z-index: 70; display: flex; flex-direction: column; gap: 9px; }
.ap-row, .gp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .82rem; font-weight: 600; }
.ap-toggle { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--card-2); color: var(--ink); padding: 4px 8px; border-radius: 7px; cursor: pointer; font-size: .78rem; font-weight: 700; min-width: 92px; }
.ap-toggle[aria-pressed="false"] { opacity: .45; }
.gp-title { font-family: var(--font-serif); font-weight: 800; font-size: .95rem; }
.gp-row select { padding: 4px 7px; border-radius: 7px; border: 1px solid var(--border); background: var(--card-2); color: var(--ink); }

.emote-pop { position: fixed; top: 58px; right: 12px; width: min(360px, calc(100vw - 24px)); padding: 10px; z-index: 75; }
.emote-tabs { display: flex; gap: 4px; margin-bottom: 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.emote-tab { flex: 1; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 4px; cursor: pointer; }
.emote-tab[aria-selected="true"] { background: var(--card-2); border-color: var(--accent); }
.emote-tab img { width: 28px; height: 28px; object-fit: contain; display: block; margin: auto; }
.emote-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; max-height: 240px; overflow-y: auto; }
.emote-opt { border: 1px solid transparent; background: var(--card-2); border-radius: 8px; padding: 4px; cursor: pointer; }
.emote-opt:hover { border-color: var(--accent); transform: scale(1.08); }
.emote-opt img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }

/* Host Grog il Locandiere */
.host { position: fixed; bottom: 268px; left: 16px; z-index: 45; display: flex; align-items: flex-end; gap: 10px; max-width: 340px; cursor: pointer; transition: opacity .3s, transform .3s; }
.host.out { opacity: 0; transform: translateY(10px); }
.host-face { width: 64px; height: 64px; flex-shrink: 0; }
.host-face .m0, .host-face .m1, .host-face .m2 { display: none; }
.host-face[data-mouth="0"] .m0 { display: block; }
.host-face[data-mouth="1"] .m1 { display: block; }
.host-face[data-mouth="2"] .m2 { display: block; }
.host-bubble { background: var(--card); border: 2px solid #d6a43e; border-radius: 14px 14px 14px 4px; padding: 8px 12px; box-shadow: var(--shadow); }
.host-name { font-family: var(--font-serif); font-weight: 800; font-size: .78rem; color: var(--accent); }
.host-text { margin: 2px 0 0; font-size: .82rem; line-height: 1.3; }

/* Modals & Toasts */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10, 5, 2, 0.65); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--card); color: var(--ink); border: 2px solid var(--border); border-radius: 16px; max-width: 520px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 18px 20px; box-shadow: var(--shadow); }
.modal-card-view { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.modal-card-view img { width: 185px; border-radius: 10px; box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

#toasts { position: fixed; bottom: 280px; right: 16px; z-index: 95; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: #261810; color: #f6e7c6; border-left: 4px solid #d6a43e; padding: 9px 14px; border-radius: 9px; font-size: .84rem; font-weight: 600; box-shadow: var(--shadow); }
.toast.error { border-left-color: #d9433b; }
#conn-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 100; background: #9e2a2b; color: #fff; padding: 7px 16px; border-radius: 0 0 10px 10px; font-weight: 700; font-size: .84rem; }
#fps { position: fixed; top: 10px; left: 260px; z-index: 60; background: rgba(0,0,0,.65); color: #b7f5a6; padding: 3px 8px; border-radius: 6px; font: 700 .75rem var(--font-mono); }

@media (max-width: 900px) {
  .lobby-body { grid-template-columns: 1fr; }
  .hud-players { flex-direction: row; width: calc(100vw - 24px); overflow-x: auto; max-height: none; }
  .p-card { min-width: 155px; }
  .center-stage { top: 94px; width: calc(100vw - 24px); }
  .side-panel { width: calc(100vw - 24px); top: 58px; right: 12px; max-height: calc(100vh - 300px); }
  .chat-box { display: none; }
  .hud-bottom { left: 8px; right: 8px; }
  .hand-card { width: 132px; height: 186px; flex: 0 0 132px; }
  .card-preview { display: none !important; }
}
