:root {
  --ink: #f1e6c8;
  --ink-dim: #bfae88;
  --gold: #e8c060;
  --gold-dk: #9a7430;
  --wood: #2a1d15;
  --wood-2: #3a291d;
  --wood-3: #4e3826;
  --edge: #120b08;
  --red: #e0533c;
  --green: #7fd86a;
  --blue: #8fc8ff;
  --purple: #c08aff;
  --panel: rgba(30, 21, 15, 0.92);
  --font: "Pixelify Sans", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0a10; color: var(--ink); font-family: var(--font); font-size: 15px; }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
img, canvas { image-rendering: pixelated; image-rendering: crisp-edges; }
button, input, select { font-family: var(--font); font-size: 15px; }
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- frames ---------- */
.frame {
  background: var(--panel);
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 2px var(--wood-3), inset 0 0 0 3px #6b4d32, 0 3px 0 rgba(0, 0, 0, 0.45);
  border-radius: 3px;
  padding: 10px;
}
.frame.small { padding: 6px 8px; }

.btn {
  background: linear-gradient(#6b4a2c, #4a321e);
  color: var(--ink);
  border: 2px solid var(--edge);
  box-shadow: inset 0 1px 0 #8f6a42, inset 0 -2px 0 #2c1d11, 0 2px 0 rgba(0, 0, 0, 0.5);
  padding: 8px 14px;
  border-radius: 3px;
  cursor: pointer;
  text-shadow: 0 1px 0 #000;
  transition: filter 0.1s, transform 0.05s;
}
.btn:hover { filter: brightness(1.18); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 1px 0 #8f6a42, inset 0 -1px 0 #2c1d11; }
.btn.big { font-size: 18px; padding: 11px 18px; width: 100%; }
.btn.gold { background: linear-gradient(#c89a3c, #8a6420); color: #fff8e0; }
.btn.ghost { background: transparent; box-shadow: none; border-color: #5b4330; }
.btn.danger { background: linear-gradient(#9c3a2a, #6a2216); }
.btn:disabled { filter: grayscale(0.8) brightness(0.7); cursor: not-allowed; }
.btn.sm { padding: 4px 8px; font-size: 13px; }
.btn.on { background: linear-gradient(#5f7a3a, #3d5222); }

input, select {
  background: #170f0a; color: var(--ink); border: 2px solid #5b4330; border-radius: 3px; padding: 7px 9px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); }

/* ---------- menu ---------- */
#menuBg { position: absolute; inset: 0; width: 100%; height: 100%; }
.menu-inner { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.logo {
  font-size: clamp(44px, 9vw, 92px); margin: 0; letter-spacing: 2px; color: var(--gold);
  text-shadow: 0 4px 0 #6a3e12, 0 8px 0 #2a160a, 0 0 30px rgba(255, 170, 60, 0.35);
}
.tagline { margin: 6px 0 22px; color: var(--ink-dim); text-shadow: 0 2px 0 #000; text-align: center; }
.menu-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; color: var(--ink-dim); font-size: 13px; }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; text-transform: uppercase; letter-spacing: 6px; text-align: center; font-size: 18px; min-width: 0; }
.error { color: var(--red); min-height: 18px; margin: 0; font-size: 13px; text-align: center; }
.foot { margin-top: 18px; color: #8d7d60; font-size: 13px; text-shadow: 0 1px 0 #000; text-align: center; }

/* ---------- lobby ---------- */
#lobby { background: radial-gradient(ellipse at top, #2d2018, #0d0a08 70%); overflow-y: auto; }
.lobby-inner { max-width: 1040px; margin: 0 auto; padding: 20px 16px 30px; }
.lobby-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lobby-head h2 { margin: 0; font-size: 30px; color: var(--gold); text-shadow: 0 3px 0 #3a2410; }
.room-code { font-size: 15px; color: var(--ink-dim); }
.room-code b { font-size: 26px; color: #fff; letter-spacing: 6px; background: #170f0a; padding: 2px 10px; border: 2px solid #5b4330; margin-left: 6px; user-select: text; -webkit-user-select: text; }
.hint { color: var(--ink-dim); font-size: 14px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 16px; }
.role-card { cursor: pointer; position: relative; transition: transform 0.1s; display: flex; flex-direction: column; gap: 6px; }
.role-card:hover { transform: translateY(-2px); }
.role-card .rc-head { display: flex; align-items: center; gap: 10px; }
.role-card .rc-head img { width: 54px; height: 54px; background: #150e09; border: 2px solid #5b4330; }
.role-card h4 { margin: 0; font-size: 19px; }
.role-card .rc-title { font-size: 12px; color: var(--ink-dim); }
.role-card p { margin: 0; font-size: 13px; line-height: 1.35; color: #d8c9a6; }
.role-card .rc-hero { font-size: 12px; color: var(--ink-dim); }
.role-card .rc-owner { margin-top: auto; font-size: 13px; padding: 4px 6px; background: #150e09; border-radius: 2px; text-align: center; }
.role-card.mine { box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 0 4px #6b4d32, 0 0 18px rgba(232, 192, 96, 0.25); }
.role-card.taken { opacity: 0.6; }
.role-card .primary-tag { position: absolute; top: 6px; right: 8px; font-size: 11px; color: #1a120c; background: var(--gold); padding: 1px 5px; border-radius: 2px; }
.lobby-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lobby-bottom h3 { margin: 0 0 8px; color: var(--gold); font-size: 17px; }
.lobby-players ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.lobby-players li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.lobby-players .dot { width: 10px; height: 10px; border-radius: 50%; }
.lobby-settings { display: flex; flex-direction: column; gap: 8px; }
.lobby-settings label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-dim); }
.lobby-settings select, .lobby-settings input { width: 60%; }
.lobby-actions { display: flex; gap: 12px; margin-top: 16px; }
.lobby-actions .btn.big { flex: 1; }
.lobby-actions .btn.ghost { width: 120px; }

/* ---------- game hud ---------- */
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud #banner, #hud #toast, #hud #eventsBox, #hud #logBox { pointer-events: none; }

#topbar { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; padding: 5px 12px; max-width: calc(100vw - 12px); }
#resBar { display: flex; gap: 12px; }
.res { display: flex; align-items: center; gap: 4px; font-size: 16px; min-width: 62px; }
.res img { width: 24px; height: 24px; }
.res .rate { font-size: 11px; color: var(--ink-dim); }
.res .rate.neg { color: var(--red); }
.res.flash { animation: flash 0.4s; }
@keyframes flash { 50% { color: var(--red); } }
#clock { display: flex; align-items: center; gap: 8px; padding: 0 8px; border-left: 2px solid #4e3826; border-right: 2px solid #4e3826; }
#clock img { width: 26px; height: 26px; }
.clock-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 110px; }
.clock-text b { font-size: 15px; }
.clock-text span { font-size: 12px; color: var(--ink-dim); }
.clock-bar { width: 100%; height: 4px; background: #150e09; margin-top: 2px; }
.clock-bar > div { height: 100%; background: var(--gold); }
#topRight { display: flex; gap: 6px; align-items: center; }

#playersBox { position: absolute; top: 6px; right: 6px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; min-width: 150px; }
.pl-row { display: flex; align-items: center; gap: 5px; }
.pl-row img { width: 16px; height: 16px; }
.pl-row .bell { margin-left: auto; font-size: 11px; color: var(--gold); }
.pl-row.off { opacity: 0.45; }

#leftPanel { position: absolute; top: 64px; left: 6px; width: 252px; max-height: calc(100vh - 270px); overflow-y: auto; padding: 8px; }
#roleTabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.role-tab { flex: 1; min-width: 52px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 4px 2px; font-size: 11px; cursor: pointer; background: #1a120c; border: 2px solid #3d2c1f; border-radius: 3px; color: var(--ink-dim); }
.role-tab img { width: 24px; height: 24px; }
.role-tab.active { border-color: var(--gold); color: var(--ink); background: #2d2016; }
.panel-title { font-size: 15px; color: var(--gold); margin: 6px 0 6px; display: flex; justify-content: space-between; align-items: baseline; }
.panel-title small { font-size: 11px; color: var(--ink-dim); }
.build-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.bbtn { position: relative; aspect-ratio: 1; background: #1a120c; border: 2px solid #4e3826; border-radius: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 2px; }
.bbtn img { width: 100%; height: 100%; object-fit: contain; }
.bbtn:hover { border-color: var(--gold); }
.bbtn.poor img { filter: grayscale(0.7) brightness(0.6); }
.bbtn.sel { border-color: #7fd86a; }
.bbtn .key { position: absolute; top: 0; left: 2px; font-size: 10px; color: var(--ink-dim); }
.mini-list { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.prio-row { display: flex; align-items: center; gap: 5px; background: #1a120c; padding: 3px 5px; border-radius: 2px; }
.prio-row img { width: 18px; height: 18px; }
.prio-row .n { color: var(--gold); width: 12px; }
.prio-row .sp { flex: 1; }
.prio-row button { padding: 0 6px; font-size: 12px; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row.sb { justify-content: space-between; }
.trade { display: grid; grid-template-columns: 1fr auto 1fr; gap: 4px; align-items: center; }
.trade select { padding: 3px; font-size: 13px; }
.muted { color: var(--ink-dim); font-size: 12px; line-height: 1.35; }
.poi-item { display: flex; align-items: center; gap: 6px; padding: 3px 4px; background: #1a120c; border-radius: 2px; cursor: pointer; }
.poi-item:hover { background: #2d2016; }
.poi-item img { width: 20px; height: 20px; }
.poi-item .st { margin-left: auto; font-size: 11px; color: var(--ink-dim); }
.tag { display: inline-block; font-size: 11px; padding: 1px 5px; background: #150e09; border-radius: 2px; color: var(--ink-dim); }

#heroBar { position: absolute; left: 6px; bottom: 6px; width: 252px; display: flex; flex-direction: column; gap: 6px; }
.hero-top { display: flex; gap: 8px; align-items: center; }
.hero-portrait { width: 54px; height: 54px; background: #150e09; border: 2px solid #5b4330; flex: none; }
.hero-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hero-info b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 7px; background: #150e09; border: 1px solid #000; position: relative; }
.bar > div { height: 100%; }
.bar.hp > div { background: linear-gradient(#8ef07a, #3f9a34); }
.bar.xp > div { background: linear-gradient(#ffe07a, #c08a20); }
.abil-row { display: flex; gap: 6px; }
.abil { flex: 1; position: relative; display: flex; align-items: center; gap: 5px; padding: 4px; background: #1a120c; border: 2px solid #4e3826; border-radius: 3px; cursor: pointer; font-size: 12px; overflow: hidden; }
.abil img { width: 24px; height: 24px; }
.abil .k { position: absolute; top: 0; right: 3px; font-size: 10px; color: var(--gold); }
.abil .cd { position: absolute; left: 0; bottom: 0; top: 0; background: rgba(0, 0, 0, 0.62); pointer-events: none; }
.abil .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; text-shadow: 0 1px 0 #000; pointer-events: none; }
.abil:hover { border-color: var(--gold); }
.mode-btn { width: 100%; }
.mode-btn.on { background: linear-gradient(#a8502c, #6a2c16); }
.interact-hint { font-size: 12px; color: var(--gold); text-align: center; }

#selPanel { position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px; width: min(520px, calc(100vw - 540px)); min-width: 320px; display: flex; gap: 10px; }
.sel-portrait { width: 64px; height: 64px; flex: none; background: #150e09; border: 2px solid #5b4330; display: flex; align-items: center; justify-content: center; }
.sel-portrait img { max-width: 100%; max-height: 100%; }
.sel-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sel-body h3 { margin: 0; font-size: 17px; display: flex; gap: 8px; align-items: baseline; }
.sel-body h3 small { font-size: 12px; color: var(--ink-dim); }
.sel-stats { font-size: 12px; color: var(--ink-dim); display: flex; gap: 10px; flex-wrap: wrap; }
.sel-actions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.cost { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.cost span { display: inline-flex; align-items: center; gap: 1px; }
.cost img { width: 14px; height: 14px; }
.cost .no { color: var(--red); }
.train-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; min-width: 64px; }
.train-btn img { width: 28px; height: 28px; }
.queue { display: flex; gap: 3px; align-items: center; }
.queue img { width: 20px; height: 20px; background: #150e09; border: 1px solid #4e3826; }
.unit-groups { display: flex; gap: 6px; flex-wrap: wrap; }
.unit-group { display: flex; align-items: center; gap: 2px; background: #150e09; padding: 2px 5px; border-radius: 2px; font-size: 13px; }
.unit-group img { width: 22px; height: 22px; }
.research-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.research-btn { display: flex; gap: 5px; align-items: center; padding: 3px 5px; text-align: left; font-size: 12px; }
.research-btn img { width: 20px; height: 20px; }
.research-btn.done { background: linear-gradient(#3d5222, #2b3a18); }

#miniWrap { position: absolute; right: 6px; bottom: 6px; padding: 4px; }
#minimap { display: block; width: 200px; height: 200px; cursor: pointer; }
#miniWrap.big #minimap { width: 320px; height: 320px; }

#logBox { position: absolute; right: 8px; bottom: 228px; width: 330px; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.log-line { font-size: 13px; background: rgba(15, 10, 8, 0.75); padding: 2px 7px; border-radius: 2px; text-shadow: 0 1px 0 #000; transition: opacity 1s; max-width: 100%; }
.log-line .who { font-weight: 700; }
#eventsBox { position: absolute; right: 8px; top: 120px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; width: 260px; }
.event-chip { background: rgba(30, 21, 15, 0.9); border: 1px solid #5b4330; padding: 4px 8px; font-size: 12px; border-radius: 3px; max-width: 100%; }
.event-chip b { color: var(--gold); }
.boon-strip { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; pointer-events: auto; }
.boon-strip img { width: 22px; height: 22px; background: #150e09; border: 1px solid #5b4330; }

#banner { position: absolute; top: 22%; left: 0; right: 0; text-align: center; opacity: 0; transition: opacity 0.6s; }
#banner.show { opacity: 1; }
#banner h1 { margin: 0; font-size: clamp(30px, 5vw, 54px); text-shadow: 0 4px 0 #000, 0 0 24px rgba(0, 0, 0, 0.8); }
#banner p { margin: 6px auto 0; font-size: 17px; max-width: 640px; color: #eadcb8; text-shadow: 0 2px 0 #000; padding: 0 12px; }

#toast { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); font-size: 15px; text-shadow: 0 2px 0 #000; opacity: 0; transition: opacity 0.3s; }
#toast.show { opacity: 1; }

#votePanel { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 540px)); min-width: 340px; }
.vote-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.vote-head b { color: var(--gold); font-size: 17px; }
.vote-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.boon-card { background: #1a120c; border: 2px solid #4e3826; border-radius: 3px; padding: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: transform 0.1s; }
.boon-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.boon-card.rare { border-color: #4f86c0; }
.boon-card.cursed { border-color: #8a4fc0; background: #1d1220; }
.boon-card.voted { box-shadow: 0 0 0 2px var(--gold); }
.boon-card .bc-head { display: flex; gap: 6px; align-items: center; }
.boon-card .bc-head img { width: 24px; height: 24px; }
.boon-card b { font-size: 14px; }
.boon-card p { margin: 0; font-size: 12px; color: #d8c9a6; }
.boon-card .rar { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); }
.boon-card .voters { font-size: 11px; color: var(--gold); min-height: 14px; }

#chatWrap { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); width: min(480px, 90vw); }
#chatWrap input { width: 100%; }

#tooltip { position: fixed; z-index: 30; max-width: 260px; font-size: 13px; pointer-events: none; padding: 7px 9px; }
#tooltip b { color: var(--gold); }
#tooltip p { margin: 4px 0 0; color: #d8c9a6; }

#modal { position: absolute; inset: 0; background: rgba(5, 3, 2, 0.6); display: flex; align-items: center; justify-content: center; z-index: 20; }
#modalBox { width: min(480px, 92vw); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
#modalBox h2 { margin: 0; color: var(--gold); }
#modalBox p { margin: 0; color: #e0d2ae; line-height: 1.4; }
#modalBox .opts { display: flex; flex-direction: column; gap: 7px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 14px; }
.stats-grid span:nth-child(odd) { color: var(--ink-dim); }

#help { position: fixed; inset: 0; z-index: 40; background: rgba(5, 3, 2, 0.75); display: flex; align-items: center; justify-content: center; padding: 16px; }
.help-box { width: min(860px, 100%); max-height: 90vh; overflow-y: auto; padding: 18px; }
.help-box h2 { margin: 0 0 8px; color: var(--gold); }
.help-box h3 { margin: 14px 0 6px; color: var(--gold); font-size: 16px; }
.help-box p, .help-box li { font-size: 14px; line-height: 1.45; color: #e0d2ae; }
.help-box kbd { background: #150e09; border: 1px solid #5b4330; border-bottom-width: 3px; padding: 0 5px; border-radius: 3px; font-family: var(--font); font-size: 12px; color: var(--ink); }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

#touchBar { position: absolute; bottom: 230px; right: 6px; display: flex; flex-direction: column; gap: 6px; }
#touchBar button { width: 56px; height: 44px; }

@media (max-width: 900px) {
  #leftPanel { width: 200px; max-height: calc(100vh - 250px); }
  #heroBar { width: 200px; }
  #selPanel { left: auto; right: 6px; transform: none; bottom: 170px; width: calc(100vw - 220px); min-width: 0; }
  #minimap { width: 140px; height: 140px; }
  #logBox { display: none; }
  #votePanel { width: calc(100vw - 16px); min-width: 0; top: 60px; }
  .vote-cards { grid-template-columns: 1fr; }
  #playersBox { display: none; }
  .res { min-width: 0; font-size: 13px; }
  .res .rate { display: none; }
  .lobby-bottom { grid-template-columns: 1fr; }
  .help-cols { grid-template-columns: 1fr; }
  #topbar { gap: 8px; padding: 4px 6px; }
  .clock-text { min-width: 80px; }
}

/* Pixaplay: the player bar on the menu (name, Pixels, Pass), its dialog and toasts */
.who { position: absolute; top: 12px; right: 14px; z-index: 3; display: flex; align-items: center; gap: 10px; font-size: 14px; color: #f1e6c8; }
.who .px { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.who .px i { width: 11px; height: 11px; background: #ff3d9a; transform: rotate(45deg); border-radius: 2px; display: inline-block; }
.who .badge { background: #ffd23f; color: #1a1400; font-weight: 800; font-size: 11px; padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; }
.who button { font: inherit; color: inherit; cursor: pointer; padding: 6px 14px; border-radius: 999px; border: 1px solid #ffffff30; background: #0008; }
.who button.go { background: #e8b04a; color: #2a1a06; border-color: transparent; font-weight: 700; }
dialog { background: #1b1612; color: #f1e6c8; border: 1px solid #ffffff22; border-radius: 14px; max-width: 320px; }
dialog::backdrop { background: #0009; }
dialog h2 { margin-top: 0; }
dialog .sheet { display: grid; gap: 10px; min-width: 240px; }
dialog button { font: inherit; padding: 8px 14px; border-radius: 999px; border: 0; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1b1612; color: #f1e6c8; border: 1px solid #ffffff22; padding: 10px 16px; border-radius: 999px; z-index: 50; }

/* the beta gate (Pixaplay Pass members only) */
.gate { text-align: center; max-width: 360px; } .gate h3 { margin: 0 0 6px; } .gate p { margin: 0 0 14px; opacity: .85; }

/* first steps: the goals, a chip in the right-hand column (tap: the next three) */
#hud #eventsBox .goal-chip { pointer-events: auto; cursor: pointer; max-width: 260px; white-space: normal; line-height: 1.3; }
.goal-chip small { opacity: .7; margin-left: 4px; }
.goal-chip.open { text-align: left; }
.goal-chip .goals-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.goal-chip .goals-head .x { margin-left: auto; padding: 0 4px; opacity: .8; }
.goal-chip .goal { padding: 1px 0; }
/* the research tree in each duty's panel */
.rtree { display: grid; gap: 4px; }
.rtier { display: grid; grid-template-columns: 22px 1fr 1fr; gap: 4px; align-items: stretch; }
.rtier .tag { align-self: center; text-align: center; }
.rbtn { display: flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1.1; text-align: left; white-space: normal; padding: 4px 5px; }
.rbtn img { width: 16px; height: 16px; flex: none; image-rendering: pixelated; }
.rbtn.done { border-color: #7fd86a; color: #bfeab0; opacity: 1; }
.rbtn.lost { opacity: .35; text-decoration: line-through; }
/* the game menu */
.menu-opts { display: grid; gap: 8px; min-width: 260px; }
.menu-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
/* saved runs on the main menu */
.saves { display: grid; gap: 6px; margin: 2px 0 4px; }
.saves .save { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.saves .save .btn { flex: 1; text-align: left; }
.saves .save small { opacity: .7; }
@media (max-width: 760px), (pointer: coarse) { #hud #eventsBox .goal-chip { max-width: 200px; font-size: 11px; } }
.rtree + * , .panel-title small { margin-left: 6px; }

.playing-as { margin: 0 0 2px; text-align: center; color: var(--ink-dim); font-size: 14px; }

/* what units are up to */
.unit-status { color: #9fe08a; font-size: 12.5px; margin: 2px 0 4px; }
.status-counts { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; color: #e8dcc0; margin: 4px 0; }
.status-counts span { background: #00000033; border-radius: 6px; padding: 1px 6px; }
.status-counts span.warn { color: #ffcf7a; }

/* ---------- the game browser ---------- */
.br-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(8, 6, 4, 0.72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.br-wrap.hidden { display: none; }
.br-box { background: #1e150f; width: min(640px, 100%); height: min(720px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.br-head { display: flex; align-items: center; justify-content: space-between; }
.br-head h2 { margin: 0; color: var(--gold); font-size: 22px; }
#brSearch { width: 100%; box-sizing: border-box; }
.br-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.br-chip { background: #1a120c; color: var(--ink-dim); border: 1px solid #5b4330; border-radius: 3px; padding: 4px 9px; font-size: 13px; cursor: pointer; }
.br-chip b { color: var(--ink); margin-left: 3px; }
.br-chip.on { background: var(--gold-dk); color: #1a0f06; border-color: var(--gold); }
.br-chip.on b { color: #1a0f06; }
.br-sort { margin-left: auto; display: flex; gap: 6px; }
.br-line { color: var(--ink-dim); font-size: 12px; }
.br-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -4px; padding: 0 4px; }
.br-room { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 6px; border-bottom: 1px solid #3a291d; }
.br-room.full { opacity: 0.6; }
.br-main { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; text-align: left; padding: 0; cursor: pointer; min-width: 0; }
.br-duties { display: grid; grid-template-columns: repeat(2, 18px); gap: 2px; flex: none; }
.br-duties img { width: 18px; height: 18px; image-rendering: pixelated; opacity: 0.22; filter: grayscale(1); }
.br-duties img.on { opacity: 1; filter: none; }
.br-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.br-name { font-size: 16px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.br-b { font-size: 11px; padding: 1px 5px; background: #150e09; border-radius: 2px; color: var(--ink-dim); }
.br-b.seats { color: var(--green); }
.br-b.fullb { color: var(--red); }
.br-b.lobby { color: var(--gold); }
.br-b.night { color: var(--purple); }
.br-join { min-width: 84px; }
.br-more { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ink-dim); padding: 2px 0 0 48px; }
.br-more b { color: var(--ink); }
.br-empty { text-align: center; color: var(--ink-dim); padding: 40px 0; }
.br-moreLoad { text-align: center; color: var(--ink-dim); padding: 8px; }
.lobby-settings .seg { display: flex; gap: 4px; }
.lobby-settings .seg .btn.on { background: var(--gold-dk); color: #1a0f06; }
@media (max-width: 520px) { .br-box { padding: 10px; } .br-sort { margin-left: 0; } .br-more { padding-left: 0; } .br-join { min-width: 70px; } }
