:root {
  --bg: #1d140d;
  --bg2: #2a1d13;
  --panel: rgba(43, 30, 20, 0.92);
  --panel-2: rgba(62, 44, 29, 0.95);
  --line: rgba(232, 196, 140, 0.22);
  --text: #f3e6cf;
  --muted: #c4ad8a;
  --gold: #e9b949;
  --gold-2: #ffd77a;
  --green: #74b72a;
  --danger: #e2553b;
  --food: #71b526;
  --earth: #b15214;
  --stone: #9f9f9f;
  --larva: #f7f3e8;
  --c0: #f5d90a; --c1: #1f7bff; --c2: #e8231c; --c3: #5b5b5b;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --serif: Georgia, 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', serif;
  --sans: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(116, 183, 42, 0.16), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(233, 185, 73, 0.12), transparent 60%),
    linear-gradient(160deg, #24180f, #160f09 70%);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: var(--gold-2); }
button { font-family: inherit; }
img { -webkit-user-drag: none; user-select: none; }

/* ---------- generic ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(255, 215, 122, 0.35);
  background: linear-gradient(180deg, #5b3f24, #3d2a18); color: var(--text); cursor: pointer;
  font-size: 14px; font-weight: 600; letter-spacing: .3px; transition: transform .12s, box-shadow .12s, background .2s, opacity .2s;
  box-shadow: 0 2px 0 rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,.35); background: linear-gradient(180deg, #6d4c2c, #47311c); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #f0c45a, #c98f1f); color: #2b1a07; border-color: #ffe39b; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffd36f, #d99c25); }
.btn.green { background: linear-gradient(180deg, #8cc63f, #4f8a1c); color: #102006; border-color: #c8ef8c; }
.btn.danger { background: linear-gradient(180deg, #e66a4c, #a8331d); border-color: #ffb39e; }
.btn.ghost { background: transparent; border-color: var(--line); box-shadow: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 6px 9px; }
.btn.sel { outline: 2px solid var(--gold-2); outline-offset: 1px; }
.input, select.input {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0,0,0,.28); color: var(--text); font-size: 15px; outline: none; transition: border .2s, box-shadow .2s;
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(233,185,73,.18); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
h1, h2, h3 { font-family: var(--serif); margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.badge.live { background: rgba(116,183,42,.2); border-color: rgba(116,183,42,.5); }
.badge.wait { background: rgba(233,185,73,.18); border-color: rgba(233,185,73,.5); }
.badge.done { background: rgba(255,255,255,.06); }
.swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.cube { display: inline-block; width: 14px; height: 14px; border-radius: 3px; box-shadow: inset -2px -2px 0 rgba(0,0,0,.25), inset 2px 2px 0 rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.5); vertical-align: -2px; }
.cube.food { background: var(--food); } .cube.earth { background: var(--earth); } .cube.stone { background: var(--stone); } .cube.larva { background: var(--larva); border-radius: 50% 50% 45% 45%; }
.res { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.res img { height: 18px; }

.boot { height: 100vh; display: grid; place-items: center; align-content: center; gap: 24px; }
.boot img { width: 260px; filter: drop-shadow(0 6px 18px rgba(0,0,0,.6)); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toasts & modal ---------- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 220px; max-width: 360px; padding: 10px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: toastIn .25s ease-out; font-size: 14px; }
.toast.error { border-color: rgba(226,85,59,.7); background: linear-gradient(180deg, rgba(120,32,20,.95), rgba(70,22,14,.95)); }
.toast.turn { border-color: rgba(233,185,73,.8); background: linear-gradient(180deg, rgba(110,80,20,.95), rgba(64,44,12,.95)); font-weight: 700; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(8,5,2,.62); z-index: 900; display: grid; place-items: center; animation: fade .2s; backdrop-filter: blur(2px); }
.modal { width: min(720px, 94vw); max-height: 88vh; overflow: auto; padding: 22px 24px; }
.modal h2 { margin-bottom: 12px; color: var(--gold-2); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal.rules { font-size: 14.5px; line-height: 1.65; }
.modal.rules h3 { color: var(--gold); margin: 14px 0 4px; font-size: 17px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth::before { content: ''; position: absolute; inset: -40px; background: url(../img/main_board_full.jpg) center/cover; filter: blur(6px) brightness(.45) saturate(1.1); transform: scale(1.06); z-index: -1; }
.auth-card { width: min(420px, 94vw); padding: 30px 30px 26px; text-align: center; }
.auth-card .logo { width: 250px; margin: -6px auto 4px; display: block; filter: drop-shadow(0 6px 14px rgba(0,0,0,.6)); }
.auth-card form { display: grid; gap: 12px; margin-top: 18px; text-align: left; }
.auth-card label { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.auth-card .switch { margin-top: 14px; font-size: 13.5px; }
.auth-card .switch a { cursor: pointer; }
.auth .ants { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; opacity: .7; font-size: 13px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: linear-gradient(180deg, rgba(20,13,8,.96), rgba(32,22,14,.9)); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; min-height: 56px; }
.topbar .logo { height: 38px; cursor: pointer; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.topbar .who { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---------- lobby ---------- */
.lobby { max-width: 1240px; margin: 0 auto; padding: 22px 18px 40px; display: grid; grid-template-columns: 1fr 360px; gap: 20px; }
@media (max-width: 980px) { .lobby { grid-template-columns: 1fr; } }
.lobby .hero { grid-column: 1 / -1; display: flex; align-items: center; gap: 20px; padding: 20px 24px; overflow: hidden; position: relative; }
.lobby .hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 420px; height: 260px; background: url(../img/tiles/t6_2.png) no-repeat center/120px, url(../img/tiles/t5_1.png) no-repeat 30% 60%/90px, url(../img/tiles/t9.png) no-repeat 75% 70%/80px; opacity: .35; transform: rotate(12deg); pointer-events: none; }
.lobby .hero h1 { font-size: 30px; color: var(--gold-2); }
.lobby .hero p { margin: 6px 0 0; color: var(--muted); }
.section-title { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; font-family: var(--serif); font-size: 19px; color: var(--gold-2); }
.game-list { display: grid; gap: 12px; }
.game-item { padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; transition: transform .15s, border-color .15s; }
.game-item:hover { transform: translateY(-1px); border-color: rgba(233,185,73,.45); }
.game-item .title { font-weight: 700; font-size: 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.game-item .seats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.seat-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font-size: 12.5px; }
.seat-chip img { width: 20px; height: 20px; }
.seat-chip.open { border-style: dashed; color: var(--muted); }
.create { padding: 18px; display: grid; gap: 12px; align-content: start; }
.create label { font-size: 13px; color: var(--muted); display: grid; gap: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { background: transparent; color: var(--text); border: 0; padding: 8px 12px; cursor: pointer; font-weight: 600; }
.seg button.on { background: linear-gradient(180deg, #f0c45a, #c98f1f); color: #2b1a07; }
.seat-row { display: grid; grid-template-columns: 28px 1fr 120px; gap: 8px; align-items: center; }
.seat-row img { width: 26px; }
.exp-toggle { display: grid !important; grid-template-columns: 20px 1fr 96px; align-items: center; gap: 10px !important; padding: 10px; border-radius: 10px; border: 1px dashed rgba(233,185,73,.5); background: rgba(233,185,73,.06); cursor: pointer; }
.exp-toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.exp-toggle span { display: grid; gap: 2px; color: var(--text); }
.exp-toggle img { width: 96px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.leader { padding: 16px; }
.reg-extra { display: grid; gap: 12px; }
.stats-card, .online-card { padding: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats-grid .stat { padding: 8px 2px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid var(--line); }
.stats-grid .stat b { display: block; font-family: var(--serif); font-size: 22px; color: var(--gold-2); }
.stats-grid .stat span { font-size: 11.5px; color: var(--muted); }
.player-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 190px; overflow: auto; }
.player-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font-size: 13px; }
.player-chip.me { border-color: var(--gold); color: var(--gold-2); }
.player-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: #7ddc3a; box-shadow: 0 0 6px #7ddc3a; }
.leader table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leader td { padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }

/* ---------- game layout ---------- */
.game { display: grid; grid-template-columns: minmax(420px, auto) minmax(520px, 1fr); gap: 14px; padding: 12px 14px 18px; align-items: start; }
@media (max-width: 1100px) { .game { grid-template-columns: 1fr; } }
.board-wrap { position: sticky; top: 68px; height: calc(100vh - 82px); min-height: 560px; display: flex; justify-content: center; }
@media (max-width: 1100px) { .board-wrap { position: relative; top: 0; height: auto; } }
.board-card { position: relative; padding: 8px; height: 100%; aspect-ratio: 650 / 875; max-width: 100%; }
@media (max-width: 1100px) { .board-card { height: auto; width: min(100%, 720px); } }
.board-svg { width: 100%; height: 100%; display: block; border-radius: 8px; user-select: none; }
.side { display: grid; gap: 12px; min-width: 0; }

.status-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; }
.season-chip { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 17px; color: var(--gold-2); }
.season-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-size: 18px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.season-icon.s0 { background: #4f8a1c; } .season-icon.s1 { background: #d9a418; } .season-icon.s2 { background: #b0391a; } .season-icon.s3 { background: #3a78a8; }
.phase-steps { display: flex; gap: 4px; flex-wrap: wrap; }
.phase-steps .st { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(0,0,0,.25); color: var(--muted); border: 1px solid transparent; }
.phase-steps .st.on { background: rgba(233,185,73,.2); color: var(--gold-2); border-color: rgba(233,185,73,.6); font-weight: 700; }
.phase-steps .st.past { color: #8d7a5f; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.15); }
.dice { display: flex; gap: 6px; align-items: center; }
.die { width: 30px; height: 30px; border-radius: 7px; background: #fbf7ee; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 4px; box-shadow: 0 2px 0 rgba(0,0,0,.4); position: relative; }
.die i { width: 5px; height: 5px; border-radius: 50%; background: #1b1209; place-self: center; }
.die.g { background: #a8e05f; } .die.y { background: #ffe27a; } .die.r { background: #ff8f78; }
.die.used { opacity: .35; } .die.cur { outline: 2px solid var(--gold-2); outline-offset: 2px; }

.action-panel { padding: 14px 16px; position: relative; overflow: hidden; }
.action-panel.mine { border-color: rgba(233,185,73,.75); box-shadow: 0 0 0 1px rgba(233,185,73,.35), 0 0 28px rgba(233,185,73,.18), var(--shadow); }
.action-panel.mine::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--gold-2), #b97f18); }
.action-panel h3 { font-size: 18px; color: var(--gold-2); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.action-panel .tip { font-size: 13px; color: var(--muted); margin: 2px 0 10px; }
.action-panel .grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.opt { text-align: left; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.22); color: var(--text); cursor: pointer; display: flex; gap: 10px; align-items: center; transition: all .15s; font-size: 13.5px; }
.opt:hover:not(:disabled) { border-color: var(--gold); background: rgba(233,185,73,.12); }
.opt:disabled { opacity: .4; cursor: not-allowed; }
.opt.sel { border-color: var(--gold-2); background: rgba(233,185,73,.2); box-shadow: 0 0 0 1px var(--gold-2) inset; }
.opt img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.opt b { display: block; font-size: 14px; }
.opt small { color: var(--muted); }
.events-row { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 6px 0 10px; }
.ev-btn { display: grid; justify-items: center; gap: 2px; padding: 6px 2px 5px; border-radius: 10px; border: 1px solid rgba(120, 80, 30, .5); background: linear-gradient(180deg, #f3e3c2, #d9c196); cursor: pointer; color: #3a2510; transition: all .15s; position: relative; }
.ev-btn img { width: 26px; height: 35px; }
.ev-btn span { font-size: 11px; line-height: 1.1; text-align: center; font-weight: 700; }
.ev-btn em { position: absolute; top: -7px; right: -5px; font-style: normal; font-size: 10.5px; background: #3b250c; color: #ffd77a; border-radius: 999px; padding: 0 5px; font-weight: 700; }
.ev-btn:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); }
.ev-btn.sel { background: linear-gradient(180deg, #ffe58f, #f0b93c); border-color: #fff2b0; box-shadow: 0 0 0 2px var(--gold-2), 0 0 14px rgba(233,185,73,.6); }
.ev-btn.die-face { outline: 2px dashed rgba(255,255,255,.55); outline-offset: 2px; }
.ev-btn:disabled { opacity: .3; cursor: not-allowed; }
.alloc { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 640px) { .alloc { grid-template-columns: repeat(2, 1fr); } .events-row { grid-template-columns: repeat(4, 1fr); } }
.alloc .box { padding: 8px; border-radius: 10px; background: rgba(0,0,0,.22); border: 1px solid var(--line); text-align: center; }
.alloc .box .lbl { font-size: 12.5px; color: var(--muted); }
.alloc .box .val { font-size: 22px; font-weight: 800; margin: 2px 0; font-variant-numeric: tabular-nums; }
.alloc .box .nurses { display: flex; justify-content: center; gap: 2px; min-height: 18px; }
.alloc .box .nurses img { width: 16px; }
.stepper { display: inline-flex; gap: 4px; }
.stepper button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); font-size: 17px; cursor: pointer; line-height: 1; }
.stepper button:hover:not(:disabled) { background: rgba(233,185,73,.2); }
.stepper button:disabled { opacity: .35; }
.preview { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(116,183,42,.12); border: 1px solid rgba(116,183,42,.35); font-size: 13.5px; }
.actions-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.shape-list { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.shape-btn { width: 76px; height: 76px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25); cursor: pointer; display: grid; place-items: center; position: relative; padding: 4px; transition: all .15s; }
.shape-btn img { max-width: 62px; max-height: 62px; }
.shape-btn .n { position: absolute; right: 4px; bottom: 2px; font-size: 11px; font-weight: 800; color: var(--gold-2); }
.shape-btn:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); }
.shape-btn.sel { border-color: var(--gold-2); background: rgba(233,185,73,.2); box-shadow: 0 0 14px rgba(233,185,73,.35); }
.shape-btn:disabled { opacity: .3; cursor: not-allowed; }
.mp { display: inline-flex; gap: 4px; }
.mp i { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 6px rgba(233,185,73,.6); }
.mp i.off { background: rgba(255,255,255,.12); box-shadow: none; }
.waiting { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.dots::after { content: '…'; animation: dots 1.2s steps(4) infinite; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { width: 0; } 100% { width: 1.2em; } }

/* ---------- player board ---------- */
.pboard-card { padding: 10px; }
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tab { padding: 6px 12px 6px 8px; border-radius: 9px 9px 4px 4px; background: rgba(0,0,0,.25); border: 1px solid var(--line); cursor: pointer; display: flex; gap: 6px; align-items: center; font-size: 13.5px; color: var(--text); }
.tab.on { background: rgba(233,185,73,.18); border-color: rgba(233,185,73,.6); font-weight: 700; }
.tab .bar { width: 10px; height: 10px; border-radius: 3px; }
.pboard { position: relative; width: 100%; aspect-ratio: 1004 / 572; background: url(../img/player_board.jpg) center/100% 100% no-repeat; border-radius: 10px; box-shadow: inset 0 0 0 3px var(--pc, transparent), 0 6px 18px rgba(0,0,0,.45); container-type: inline-size; overflow: hidden; }
.pb { position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; }
.pb.count { min-width: 3.2cqw; height: 3.2cqw; padding: 0 .7cqw; border-radius: 999px; background: rgba(20,12,6,.82); border: .25cqw solid rgba(255,215,122,.65); color: #fff; font-weight: 800; font-size: 2.1cqw; font-variant-numeric: tabular-nums; box-shadow: 0 .4cqw .8cqw rgba(0,0,0,.45); }
.pb.nurse img { width: 3.6cqw; height: 3.6cqw; filter: drop-shadow(0 .2cqw .3cqw rgba(0,0,0,.6)); }
.pb.slot { width: 4.4cqw; height: 4.4cqw; border-radius: 1cqw; cursor: default; }
.pb.slot.click { cursor: pointer; }
.pb.slot .at-ico { position: absolute; font-size: 2.4cqw; opacity: .55; pointer-events: none; }
.pb.slot .at-nurse { position: relative; width: 3.6cqw; height: 3.6cqw; filter: drop-shadow(0 .2cqw .3cqw rgba(0,0,0,.6)); }
.pb.slot.click:hover { box-shadow: 0 0 0 .3cqw var(--gold-2); background: rgba(255,215,122,.15); }
.pb.evcube { width: 2.8cqw; height: 2.8cqw; border-radius: .5cqw; background: var(--pc); border: .25cqw solid #1a0f05; box-shadow: inset -.4cqw -.4cqw 0 rgba(0,0,0,.3), inset .3cqw .3cqw 0 rgba(255,255,255,.35), 0 .3cqw .8cqw rgba(0,0,0,.8); transition: left .35s ease; z-index: 3; pointer-events: none; }
.pb.evslot { width: 3.2cqw; height: 3.4cqw; border-radius: .6cqw; cursor: pointer; z-index: 4; }
.pb.evslot:hover { box-shadow: 0 0 0 .3cqw var(--gold-2); }
.pb.pcube .cube { width: 2.5cqw; height: 2.5cqw; }
.pb-upgrade { position: absolute; border-radius: 1.2cqw; box-shadow: 0 .4cqw 1cqw rgba(0,0,0,.6), 0 0 0 .25cqw rgba(255,215,122,.8); pointer-events: auto; }
.up-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.up-choice button { display: grid; gap: 6px; padding: 8px; border-radius: 12px; border: 2px solid var(--line); background: rgba(0,0,0,.25); color: var(--text); cursor: pointer; text-align: left; transition: all .15s; }
.up-choice button:hover { border-color: var(--gold); transform: translateY(-2px); }
.up-choice button.sel { border-color: var(--gold-2); background: rgba(233,185,73,.18); box-shadow: 0 0 14px rgba(233,185,73,.4); }
.up-choice img { width: 100%; border-radius: 8px; }
.up-choice b { color: var(--gold-2); }
.up-choice small { color: var(--muted); line-height: 1.45; }
.pb.disc { width: 4.6cqw; height: 4.6cqw; border-radius: 50%; background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.5), transparent 40%), var(--pc); box-shadow: 0 .3cqw .6cqw rgba(0,0,0,.6), inset 0 0 0 .3cqw rgba(0,0,0,.25); transition: top .4s ease; }
.pb.worker img { width: 5cqw; filter: drop-shadow(0 .3cqw .4cqw rgba(0,0,0,.6)); }
.pb.room { pointer-events: auto; border-radius: 1.2cqw; cursor: pointer; }
.pb.room.can { box-shadow: 0 0 0 .35cqw rgba(116,183,42,.9), 0 0 2cqw rgba(116,183,42,.5); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 .35cqw rgba(160,230,80,1), 0 0 3cqw rgba(116,183,42,.8); } }
.pb.cubes { display: flex; flex-wrap: wrap; gap: .4cqw; width: 9cqw; justify-content: center; }
.pb.cubes .cube { width: 2.2cqw; height: 2.2cqw; }
.pb.larvae { display: grid; grid-template-columns: repeat(3, 2.2cqw); gap: .5cqw 1.5cqw; }
.pb.larvae .cube { width: 2.1cqw; height: 2.1cqw; }
.pb.ants { display: flex; flex-wrap: wrap; gap: .2cqw; justify-content: center; }
.pb.ants img { width: 3.2cqw; filter: drop-shadow(0 .2cqw .3cqw rgba(0,0,0,.6)); }
.pb.label { font-size: 1.7cqw; color: #fff; background: rgba(0,0,0,.55); padding: .2cqw .8cqw; border-radius: .6cqw; white-space: nowrap; font-weight: 700; }
.pstock { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; padding: 8px 10px; background: rgba(0,0,0,.2); border-radius: 10px; border: 1px solid var(--line); }
.pstock .it { position: relative; display: inline-flex; align-items: center; gap: 2px; }
.pstock .it img.tile { height: 34px; }
.pstock .it .n { font-weight: 800; font-size: 13px; color: var(--gold-2); }
.pstock .sep { width: 1px; height: 26px; background: var(--line); }
.prey-row { display: inline-flex; gap: 2px; }
.prey-row img { width: 24px; height: 24px; }

/* ---------- scoreboard ---------- */
.players { padding: 10px; display: grid; gap: 6px; }
.prow { display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: rgba(0,0,0,.2); border: 1px solid transparent; transition: all .2s; cursor: pointer; }
.prow:hover { border-color: var(--line); }
.prow.active { border-color: rgba(233,185,73,.7); background: rgba(233,185,73,.1); }
.prow .bar { align-self: stretch; border-radius: 4px; }
.prow .nm { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.prow .nm img { height: 18px; }
.prow .stats { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; margin-top: 3px; color: var(--muted); }
.prow .stats .res { color: var(--text); font-weight: 600; }
.prow .score { font-family: var(--serif); font-size: 26px; font-weight: 800; color: var(--gold-2); min-width: 44px; text-align: right; }
.prow .score.bump { animation: bump .6s ease; }
@keyframes bump { 40% { transform: scale(1.35); color: #fff; } }
.score-label { font-family: var(--serif); font-weight: 700; color: var(--gold-2); white-space: nowrap; font-size: 15px; }
.score-track { position: relative; height: 26px; margin: 4px 4px 2px; border-radius: 999px; background: linear-gradient(90deg, rgba(116,183,42,.25), rgba(233,185,73,.25), rgba(226,85,59,.25)); border: 1px solid var(--line); }
.score-track .mk { position: absolute; top: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; transform: translateY(-50%); box-shadow: 0 2px 4px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.4); transition: left .6s ease; }
.score-track .tick { position: absolute; top: 100%; font-size: 10px; color: var(--muted); transform: translateX(-50%); }

/* ---------- log / chat ---------- */
.logbox { padding: 10px 12px; }
.logbox .tabs { margin-bottom: 6px; }
.log-list { max-height: 260px; overflow: auto; font-size: 13px; line-height: 1.55; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.log-list .ln { padding: 2px 6px; border-radius: 6px; }
.log-list .ln.sys { color: var(--gold); font-family: var(--serif); text-align: center; margin: 4px 0; }
.log-list .ln b { font-weight: 700; }
.chat-form { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- board svg ---------- */
.hex { fill: transparent; stroke: none; }
.hex.inactive { fill: rgba(250, 245, 235, .62); }
.hex.hl { fill: rgba(140, 230, 70, .28); stroke: #b6ff6a; stroke-width: 2.4; stroke-dasharray: 5 3; cursor: pointer; animation: dash 1.2s linear infinite; }
.hex.hl:hover { fill: rgba(170, 255, 90, .5); }
.hex.hl.warn { fill: rgba(255, 140, 60, .25); stroke: #ffb35a; }
.hex.hl.warn:hover { fill: rgba(255, 160, 80, .45); }
.hex.hl.hunt { fill: rgba(255, 80, 60, .25); stroke: #ff7a5a; }
.hex.hover-cell { fill: rgba(255, 255, 255, .18); }
.hex.ghost { fill: rgba(255, 230, 120, .5); stroke: #fff2b0; stroke-width: 2.5; pointer-events: none; }
.hex.ghost.cand { fill: rgba(255, 255, 255, .0); stroke: rgba(255, 240, 170, .7); stroke-width: 1.5; stroke-dasharray: 3 3; }
.hex.path { fill: rgba(255,255,255,.14); pointer-events: none; }
@keyframes dash { to { stroke-dashoffset: -16; } }
.tile-img { transition: opacity .25s; filter: drop-shadow(0 2px 2px rgba(0,0,0,.55)); }
.tile-new { animation: tileIn .5s ease-out; }
@keyframes tileIn { from { opacity: 0; } }
.token { filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.worker-token { filter: drop-shadow(0 0 6px rgba(255,255,160,.9)); animation: bob 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.obj-card { cursor: default; transition: filter .2s; }
.obj-card.can { cursor: pointer; filter: drop-shadow(0 0 8px #ffe27a) drop-shadow(0 0 4px #ffe27a); }
.obj-card.can:hover { filter: drop-shadow(0 0 12px #fff2b0) brightness(1.12); }
.at-hex { fill: transparent; }
.at-hex.can { fill: rgba(140, 230, 70, .22); stroke: #b6ff6a; stroke-width: 3; stroke-dasharray: 6 4; cursor: pointer; animation: dash 1.2s linear infinite; }
.at-hex.can:hover { fill: rgba(170, 255, 90, .4); }
.board-tip { position: absolute; pointer-events: none; z-index: 20; background: rgba(20,12,6,.92); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12.5px; max-width: 240px; box-shadow: var(--shadow); }

.gameover { text-align: center; }
.gameover .rank { display: grid; gap: 8px; margin-top: 14px; }
.gameover .rk { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; background: rgba(0,0,0,.25); font-size: 16px; }
.gameover .rk.win { background: rgba(233,185,73,.2); border: 1px solid var(--gold); }
.gameover .rk .pos { font-family: var(--serif); font-size: 22px; color: var(--gold-2); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 950; overflow: hidden; }
.confetti i { position: absolute; width: 10px; height: 14px; top: -20px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(233,185,73,.25); border-radius: 9px; }
::-webkit-scrollbar-track { background: transparent; }
