/* The game's own layout: the HUD, build menu, inspector, feed, settings and
   phone sheets. Colours, sizes, spacing, corners and layers come from
   tokens.css; buttons, text boxes, chips, pills, boxes, callouts, labels and
   pop-ups from components.css. Desktop-first; phones get .game.mobile. */


* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: var(--fs-base)/1.4 var(--font); overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.game { position: fixed; inset: 0; }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(var(--blur-panel));
  box-shadow: var(--shadow-1);
}
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.bad { color: var(--bad); }

/* ---- top HUD ---- */
.hud-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: var(--sp-8); align-items: stretch; pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-top .spacer { flex: 1; pointer-events: none; }
.city-chip { padding: var(--sp-8) var(--sp-14); min-width: 150px; }
.city-name { font-weight: 700; font-size: var(--fs-lg); }
/* the name, with the city's clock on the right */
.city-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-12); }
.chip-clock { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* Long or several charities wrap onto a second line (the top bar grows and
   the panels below move down with it); past that it ends in … and the full
   name is in the tooltip and the city pop-up. */
.charity-badge { margin-top: var(--sp-6); font-size: var(--fs-xs); line-height: 1.35; font-weight: 600; color: var(--charity); max-width: 240px; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.charity-badge[hidden] { display: none; }
.lp-charity { margin: -2px 0 var(--sp-10); padding: var(--sp-8) var(--sp-10); border-radius: var(--r-md); background: var(--charity-tint); border: 1px solid var(--charity-line); font-size: var(--fs-sm); line-height: 1.45; display: grid; gap: var(--sp-4); }
.lp-charity b { color: var(--charity); }
.lp-charity a { color: var(--accent-2); font-weight: 600; justify-self: start; }
.level-row { display: flex; align-items: center; gap: var(--sp-8); color: var(--muted); font-size: var(--fs-sm); }
.level-row b { color: var(--text); }
.xpbar { flex: 1; height: 5px; background: var(--fill-4); border-radius: var(--r-sm); overflow: hidden; min-width: 60px; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.stats { display: flex; align-items: center; gap: var(--sp-14); padding: var(--sp-8) var(--sp-14); font-variant-numeric: tabular-nums; }
.stat { white-space: nowrap; }
.stat.bad { color: var(--bad); }
.player-chip { flex: none; display: grid; grid-template-columns: auto auto; column-gap: var(--sp-12); align-items: center; padding: var(--sp-6) var(--sp-12); }
.player-chip select { padding: var(--sp-4) var(--sp-6); max-width: 170px; }
.player-chip .balance { font-weight: 800; font-size: var(--fs-xl); color: var(--good); text-align: right; font-variant-numeric: tabular-nums; }
.player-chip .sub { grid-column: 1 / span 2; color: var(--muted); font-size: var(--fs-xs); }

/* ---- build menu ---- */
.build-menu { position: absolute; left: 12px; top: calc(var(--hud-bottom, 72px) + 12px); bottom: 76px; width: 268px; display: flex; flex-direction: column; overflow: hidden; }
.build-title { padding: var(--sp-10) var(--sp-14) var(--sp-4); }
.tabs { display: flex; flex-wrap: wrap; gap: var(--sp-4); padding: var(--sp-4) var(--sp-10) var(--sp-8); border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: var(--sp-6); padding: var(--sp-4) var(--sp-8); border-radius: var(--r-pill); background: var(--fill-2); border: 1px solid transparent; font-size: var(--fs-xs); }
.tab:hover { background: var(--fill-4); }
.tab.on { border-color: var(--accent-2); background: var(--accent-tint); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.items { overflow-y: auto; padding: var(--sp-8); display: flex; flex-direction: column; gap: var(--sp-6); }
.item { display: flex; gap: var(--sp-10); align-items: center; text-align: left; padding: var(--sp-8) var(--sp-10); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--fill-1); }
.item:hover { background: var(--fill-4); }
.item.on { border-color: var(--accent-2); background: var(--accent-tint); }
.item.locked { opacity: 0.45; cursor: not-allowed; }
.swatch { width: 22px; height: 22px; border-radius: var(--r-sm); flex: none; box-shadow: inset 0 -6px 0 var(--shade); }
.item-main { display: flex; flex-direction: column; min-width: 0; }
.item-name { font-weight: 600; }
.item-meta { color: var(--muted); font-size: var(--fs-xs); }
.badge { background: var(--warn); color: var(--warn-ink); border-radius: var(--r-sm); padding: 0 var(--sp-4); font-size: var(--fs-2xs); font-weight: 700; }

/* ---- inspector ---- */
.inspector { position: absolute; right: 12px; top: calc(var(--hud-bottom, 72px) + 12px); width: 300px; max-height: calc(100% - 330px); overflow-y: auto; padding: var(--sp-12) var(--sp-14); }
.insp-head { display: flex; gap: var(--sp-10); align-items: center; }
.insp-head .close { margin-left: auto; align-self: flex-start; }
.insp-name { font-weight: 700; font-size: var(--fs-lg); }
.insp-sub { color: var(--muted); font-size: var(--fs-sm); }
.status { margin: var(--sp-10) 0 var(--sp-6); padding: var(--sp-2) var(--sp-8); text-transform: uppercase; letter-spacing: 0.04em; }
.fund-bar { height: 10px; border-radius: var(--r-sm); background: var(--fill-4); overflow: hidden; }
.fund-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--fund-a), var(--fund-b)); }
.fund-row { margin-top: var(--sp-6); }
.contrib { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin-top: var(--sp-12); }
.contrib-custom { display: flex; gap: var(--sp-6); margin-top: var(--sp-8); }
.contrib-custom input { flex: 1; min-width: 0; border-radius: var(--r-md); }
.section-label { margin-top: var(--sp-14); }
.effects, .backers { margin: var(--sp-6) 0 0; padding-left: var(--sp-20); }
.backers { padding-left: 0; list-style: none; }
.backers li { display: flex; justify-content: space-between; padding: var(--sp-2) 0; }
/* A player's name, linked to their profile (/u/<login>). */
a.plink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line-bright); }
a.plink:hover { color: var(--accent-2); border-bottom-color: var(--accent-2); }
/* The plaque on a finished building or decoration: who made it. */
.plaque { margin-top: var(--sp-8); }
.plaque-row { padding: 1px 0; color: var(--muted); }
.plaque-row a.plink, .plaque-row b { color: var(--text); }
.plaque-name { color: var(--gold); }
.name-box { margin-top: var(--sp-10); padding-top: var(--sp-8); border-top: 1px solid var(--line); }
.name-box.streamer .section-label::after { content: " · only you see this"; text-transform: none; letter-spacing: 0; color: var(--muted); font-weight: 400; }
.name-ticket { margin-top: var(--sp-6); font-size: var(--fs-sm); color: var(--gold); max-width: 340px; }
.name-ticket > div + div { margin-top: var(--sp-4); }
.name-ticket select { max-width: 200px; font-size: var(--fs-sm); }
.name-ticket .ticket-actions { display: flex; flex-wrap: wrap; gap: var(--sp-6); align-items: center; margin-top: var(--sp-4); }
.backers span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- view controls, hint ---- */
.view-controls { position: absolute; left: 12px; bottom: 12px; display: flex; gap: var(--sp-8); }
.seg { display: flex; padding: var(--sp-4); gap: var(--sp-2); }
.seg button { background: none; border: 0; padding: var(--sp-6) var(--sp-12); border-radius: var(--r-md); color: var(--muted); font-weight: 600; }
.seg button:hover { color: var(--text); background: var(--fill-3); }
.seg button.on { background: var(--accent-tint-2); color: var(--text); }
.hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: var(--sp-8) var(--sp-14); white-space: nowrap; }

/* ---- feed ---- */
.feed { position: absolute; right: 12px; bottom: 12px; width: 300px; max-height: 230px; display: flex; flex-direction: column; }
.feed-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-8) var(--sp-12) var(--sp-4); }
.feed ul { list-style: none; margin: 0; padding: 0 var(--sp-6) var(--sp-8); overflow-y: auto; }
.feed li { padding: var(--sp-4) var(--sp-6); border-radius: var(--r-sm); font-size: var(--fs-sm); }
.feed li[data-init]:not([data-init=""]):hover { background: var(--fill-3); cursor: pointer; }
.feed .when { color: var(--muted); margin-left: var(--sp-6); font-size: var(--fs-xs); }
.feed .times { display: inline-block; padding: 0 var(--sp-6); border-radius: var(--r-pill); background: var(--fill-4); color: var(--text); font-size: var(--fs-xs); font-weight: 700; }
.feed.collapsed ul { display: none; }

/* ---- tooltip, toasts, modal ---- */
.tooltip { position: absolute; pointer-events: none; background: var(--overlay); border: 1px solid var(--line); padding: var(--sp-4) var(--sp-8); border-radius: var(--r-sm); font-size: var(--fs-sm); max-width: 260px; z-index: var(--z-tooltip); }
.toasts { position: absolute; top: calc(var(--hud-bottom, 72px) + 12px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--sp-6); align-items: center; z-index: var(--z-toast); pointer-events: none; }
.toast { background: var(--panel-solid); border: 1px solid var(--line); border-left: 3px solid var(--good); padding: var(--sp-8) var(--sp-14); border-radius: var(--r-md); box-shadow: var(--shadow-1); transition: opacity var(--t-slow), transform var(--t-slow); }
.toast.err { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast.out { opacity: 0; transform: translateY(-6px); }
.modal-backdrop[hidden] { display: none; }
.modal ul { padding-left: var(--sp-20); }
.modal ul.perm-list { margin: var(--sp-6) 0 var(--sp-10); }
.modal ul.since { list-style: none; padding: 0; }
.modal ul.since li { padding: var(--sp-6) 0; border-bottom: 1px solid var(--line); }
.modal ul.open li { cursor: pointer; }
.modal ul.open li:hover { color: var(--accent-2); }

[hidden] { display: none !important; }

/* Narrow windows that aren't phones (phones get .mobile, below). */
@media (max-width: 900px) {
  .game:not(.mobile) .hud-top { flex-wrap: wrap; }
  .game:not(.mobile) .stats { order: 5; flex-wrap: wrap; gap: var(--sp-8); }
  .game:not(.mobile) .chip-clock { display: none; }
  .game:not(.mobile) .build-menu { top: auto; bottom: 64px; height: 38%; width: calc(100% - 24px); }
  .game:not(.mobile) .inspector { left: 12px; right: 12px; width: auto; top: 140px; max-height: 45%; }
  .game:not(.mobile) .feed { display: none; }
  .game:not(.mobile) .hint { white-space: normal; width: calc(100% - 24px); bottom: 60px; }
}
.cap-note { margin-top: var(--sp-12); font-size: var(--fs-sm); }

/* repaints */
.paint-chip { display: inline-block; width: 14px; height: 14px; border-radius: var(--r-sm); vertical-align: -2px; box-shadow: inset 0 0 0 1px var(--line-bright); }
.paint-chip.original { background: conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%, var(--checker-a) 0 75%, var(--checker-b) 0) 0 0 / 7px 7px; }
.paint-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-6); }
.paint-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-4); margin: var(--sp-10) 0 var(--sp-6); }
.paint-sw { aspect-ratio: 1; min-width: 0; padding: 0; border-radius: var(--r-sm); border: none; cursor: pointer; box-shadow: inset 0 0 0 1px var(--shade); }
.paint-sw:hover { transform: scale(1.15); }
.turn-arrows { position: absolute; left: 0; top: 0; z-index: var(--z-map-ui); display: flex; gap: var(--sp-6); pointer-events: none; will-change: transform; }
.turn-arrows[hidden] { display: none; }
.turn-arrows button { pointer-events: auto; width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid var(--line-bright); background: var(--overlay); color: white; font-size: 19px; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px var(--shade-2); }
.turn-arrows button:hover { background: var(--overlay-hover); border-color: var(--line-brighter); }
.turn-arrows button:active { transform: scale(0.94); }
.turn-hint { margin: var(--sp-8) 0 var(--sp-2); }
@media (pointer: coarse) { .turn-arrows button { width: 42px; height: 42px; font-size: 22px; } .turn-arrows { gap: var(--sp-10); } }
.paint-sw.current { box-shadow: inset 0 0 0 1px var(--shade), 0 0 0 1px var(--line-bright); }
.paint-sw.on { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px white; position: relative; z-index: 1; }
.contrib button.on, .paint-orig.on { border-color: white; background: var(--fill-5); }
.game.mobile .paint-grid { gap: var(--sp-6); }

/* demolition */
.demo-box { margin-top: var(--sp-12); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.fund-bar.demo i { background: linear-gradient(90deg, var(--demo-a), var(--demo-b)); }
.boost { color: var(--warn); }
.stat.community { display: inline-flex; align-items: center; gap: var(--sp-6); }
.stat .meter { display: inline-block; width: 46px; height: 6px; border-radius: var(--r-sm); background: var(--fill-4); overflow: hidden; }
.stat .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--good)); }

/* Let the stats wrap instead of pushing the player box off-screen. */
.hud-top .stats { flex: 0 1 auto; min-width: 0; flex-wrap: wrap; row-gap: var(--sp-2); }

/* build menu: needs, counters, effect chips */
.needs { padding: var(--sp-10) var(--sp-12) var(--sp-4); border-bottom: 1px solid var(--line); }
.needs-title { margin-bottom: var(--sp-4); }
.need { padding: var(--sp-6) 0; }
.need + .need { border-top: 1px dashed var(--line); }
.need-text { font-weight: 600; font-size: var(--fs-sm); }
.need.ok { color: var(--good); font-size: var(--fs-sm); }
.need-fixes { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-4); }
.need-fixes button { font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-8); background: var(--accent-tint); }
.need-fixes button:hover { background: var(--accent-tint-2); }
.open-count { float: right; text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text); }
.item-fx { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text); opacity: 0.85; }
.fx { white-space: nowrap; }

/* level-up banner */
.levelup { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); z-index: var(--z-overlay); width: min(420px, calc(100% - 32px));
  padding: var(--sp-16) var(--sp-20); text-align: center; border-color: var(--warn-line); box-shadow: 0 10px 40px var(--warn-tint), var(--shadow-1); }
.levelup.show { animation: levelup-in 0.5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes levelup-in { from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(0.92); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.levelup-star { font-size: 30px; /* emoji */ line-height: 1; }
.levelup-title { font-size: var(--fs-2xl); font-weight: 800; color: var(--warn); margin: var(--sp-4) 0 var(--sp-6); }
.levelup-sub { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--sp-6); }
.levelup-list { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-6); }
.levelup-list button { font-size: var(--fs-sm); padding: var(--sp-4) var(--sp-10); border-radius: var(--r-pill); border: 1px solid var(--warn-line); background: var(--warn-tint); }
.levelup-list button:hover { background: var(--warn-tint-2); }
.levelup-actions { margin-top: var(--sp-10); }
.full-note { margin: 0 var(--sp-10) var(--sp-6); font-size: var(--fs-sm); }

/* Twitch sign-in */
.auth-box { display: inline-flex; align-items: center; gap: var(--sp-8); }
.payday { color: var(--gold); }
.auth-box .avatar { width: 26px; height: 26px; border-radius: 50%; }
.auth-box .join-form { display: inline-flex; gap: var(--sp-6); margin: 0; }
.auth-box .join-form input { width: 130px; padding: var(--sp-4) var(--sp-8); }
.auth-box .who { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
/* the name opens the account menu; it shortens with … but the pill under it never does */
.who-name { display: inline-flex; align-items: center; gap: var(--sp-4); max-width: 160px; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text); cursor: pointer; }
.who-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-name .caret { flex: none; font-size: var(--fs-2xs); color: var(--muted); }
.who-name:hover .caret, .who-name[aria-expanded="true"] .caret { color: var(--text); }
.who .menu { top: calc(100% + 6px); left: 0; }
.twitch-btn { display: inline-block; background: var(--twitch); color: white; font-weight: 700; text-decoration: none; padding: var(--sp-6) var(--sp-12); border-radius: var(--r-md); }
.twitch-btn:hover { background: var(--twitch-hover); }
.live-dot { color: var(--live); font-weight: 800; }

/* feedback form */
.fb-kinds { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin: var(--sp-10) 0; }
.fb-kinds button { padding: var(--sp-6) var(--sp-10); font-size: var(--fs-base); }
.modal textarea { width: 100%; border-radius: var(--r-md); padding: var(--sp-8); margin-bottom: var(--sp-6); }

/* rotate button inside the placement hint */
.hint-btn { padding: var(--sp-2) var(--sp-8); border-radius: var(--r-sm); border: 1px solid var(--accent-2); background: var(--accent-tint); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; }

/* link to /privacy next to the sign-in button and in the feedback form */
.privacy-link, .modal a[href="/privacy"] { color: var(--muted); font-size: var(--fs-xs); text-decoration: underline; }
.privacy-link { margin-left: var(--sp-8); }

/* ---- map expansion (Build menu > Land) ---- */
.tab.land-tab { gap: var(--sp-4); }
.land-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--land); display: inline-block; box-shadow: 0 0 6px var(--land); }
.land { display: flex; flex-direction: column; gap: var(--sp-8); padding: var(--sp-2); }
.land-title { font-weight: 700; font-size: var(--fs-md); }
.land-status { font-size: var(--fs-sm); }
.land-compass { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 44px); gap: var(--sp-6); margin: var(--sp-4) 0; }
.land-dir { border-radius: var(--r-md); border: 1px solid var(--line); background: var(--fill-3); font-weight: 600; font-size: var(--fs-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.land-dir:hover:not(:disabled) { background: var(--grass-tint-2); border-color: var(--grass); }
.land-dir:disabled { opacity: 0.4; cursor: not-allowed; }
.land-dir.funding { border-color: var(--land); background: var(--land-tint); }
.land-dir span { font-size: var(--fs-2xs); font-weight: 500; color: var(--warn); }
.land-center { display: grid; place-items: center; border-radius: var(--r-md); background: var(--grass-tint); color: var(--grass-soft); font-weight: 700; font-size: var(--fs-sm); }
.land-card.flash { animation: landflash 1.4s ease-out; }
@keyframes landflash { 0% { box-shadow: 0 0 0 2px var(--land); } 100% { box-shadow: 0 0 0 0 transparent; } }
.land-card-title { font-weight: 600; margin-bottom: var(--sp-6); }
.land-card .contrib { margin-top: var(--sp-8); }
.land-note { font-size: var(--fs-sm); color: var(--warn); }

/* ---- landmarks (phased buildings) ---- */
.stage-list { list-style: none; padding: 0; margin: var(--sp-8) 0 var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-sm); }
.stage-list li { display: flex; gap: var(--sp-8); align-items: center; padding: var(--sp-4) var(--sp-6); border-radius: var(--r-sm); }
.stage-list .mark { width: 14px; text-align: center; }
.stage-list .nm { flex: 1; }
.stage-list .amt { color: var(--muted); font-size: var(--fs-xs); }
.stage-list li.done { color: var(--good); }
.stage-list li.now { background: var(--warn-tint); color: var(--text); font-weight: 600; }
.stage-list li.stalled { background: var(--warn-tint); color: var(--warn); }
.stage-list li.todo { color: var(--muted); }

/* Streamer's link to their admin page, next to Sign out */
.auth-box .admin-link { font-weight: 600; }

/* streamer moderation: the "what will be removed" list */
.rm-list, .modal ul.rm-list { list-style: none; margin: var(--sp-10) 0; padding: 0; max-height: min(320px, 45vh); overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.rm-list li { padding: var(--sp-8) var(--sp-10); font-size: var(--fs-sm); border-bottom: 1px solid var(--line); }
.rm-list li:last-child { border-bottom: 0; }
.rm-list label { display: flex; gap: var(--sp-8); align-items: flex-start; cursor: pointer; }
.rm-money { color: var(--warn); font-size: var(--fs-sm); margin-top: var(--sp-2); }

/* settings (the gear menu), opening up from the bottom-left toolbar */
.seg button.gear { font-size: var(--fs-xl); line-height: 1; padding: var(--sp-4) var(--sp-10); }
.seg button.gear[aria-expanded="true"] { background: var(--accent-tint-2); color: var(--text); }
/* Settings: a pop-up over the map area; everything else blurs behind it.
   --set-left/right/top/bottom come from placeSettings() in main.mjs. */
/* Centered in that area, as wide as it allows up to 900px, and only as tall
   as its contents need. */
.settings { position: absolute; display: flex; flex-direction: column; padding: 0; outline: none;
  --set-area-w: calc(100% - var(--set-left, 16px) - var(--set-right, 16px));
  --set-area-h: calc(100% - var(--set-top, 16px) - var(--set-bottom, 16px));
  width: min(var(--set-area-w), 900px); max-height: var(--set-area-h);
  left: calc((100% + var(--set-left, 16px) - var(--set-right, 16px)) / 2);
  top: calc((100% + var(--set-top, 16px) - var(--set-bottom, 16px)) / 2);
  transform: translate(-50%, -50%);
  background: var(--panel-solid, var(--panel)); box-shadow: var(--shadow-3); }
.set-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-14) var(--sp-20) var(--sp-8); font-size: var(--fs-lg); }
.set-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-6) var(--sp-20) var(--sp-16); overscroll-behavior: contain; container-type: inline-size; }
/* One column when narrow, otherwise two: Map and Activity feed on the left,
   Build menu and Placing on the right (about the same height), and More as
   a strip along the bottom. */
.set-cols { display: grid; gap: var(--sp-14); grid-template-columns: minmax(0, 1fr); }
@container (min-width: 600px) {
  .set-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "view view" "map build" "map placing" "feed placing" "more more"; }
}
.set-view { grid-area: view; } .set-map { grid-area: map; } .set-build { grid-area: build; }
.set-placing { grid-area: placing; } .set-feed { grid-area: feed; } .set-more { grid-area: more; }
@container (max-width: 599px) { .set-cols > * { grid-area: auto; } }
.set-group { min-width: 0; padding: var(--sp-14) var(--sp-16) var(--sp-12); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--fill-1); }
.set-group .set-btns { margin-top: var(--sp-2); }
.set-more { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-10) var(--sp-16); }
.set-more .set-sec { margin: 0 var(--sp-4) 0 0; }
.set-more .set-btns, .set-more .set-support { margin: 0; }
.set-sec { margin: 0 0 var(--sp-8); }
.set-sub { margin: var(--sp-8) 0 var(--sp-4); font-size: var(--fs-sm); color: var(--muted); }
.set-sec + .set-sub { margin-top: 0; }
.set-check { display: flex; align-items: flex-start; gap: var(--sp-8); padding: var(--sp-6) 0; font-size: var(--fs-base); line-height: 1.35; cursor: pointer; }
.set-check input { margin: var(--sp-2) 0 0; flex: none; accent-color: var(--accent); }
.set-seg { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-4); margin: var(--sp-2) 0 var(--sp-8); border-radius: var(--r-md); background: var(--fill-2); }
.set-seg:last-child { margin-bottom: var(--sp-2); }
.set-seg button { flex: 1 0 auto; white-space: nowrap; padding: var(--sp-6) var(--sp-10); border: 0; border-radius: var(--r-md); background: none; color: var(--muted); font-size: var(--fs-base); font-weight: 600; }
.set-seg button:hover { color: var(--text); }
.set-seg button.on { background: var(--accent-tint-2); color: var(--text); }
.set-foot { padding: var(--sp-12) var(--sp-20) var(--sp-14); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--sp-6) var(--sp-8); }
.set-foot button { white-space: nowrap; }
.set-foot-acts { display: flex; gap: var(--sp-8); margin-left: auto; }
.set-foot-left { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-16); }
.set-foot-acts button { padding: var(--sp-8) var(--sp-20); }
.set-support { display: flex; align-items: baseline; gap: var(--sp-8); flex-wrap: wrap; margin-top: var(--sp-10); padding: var(--sp-10) var(--sp-12); border-radius: var(--r-md); border: 1px solid var(--support-line); background: var(--support-tint); color: var(--text); font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
.set-support span { color: var(--muted); font-weight: 400; font-size: var(--fs-xs); }
.set-support:hover { background: var(--support-tint-2); }
.set-link { color: var(--muted); font-size: var(--fs-sm); text-decoration: underline; white-space: nowrap; }
.set-link:hover { color: var(--text); }

/* build menu: "hide what I can't build", thumbnails and the big view */
.build-filter { display: flex; align-items: center; gap: var(--sp-6); padding: 0 var(--sp-14) var(--sp-6); font-size: var(--fs-sm); color: var(--muted); cursor: pointer; user-select: none; }
.build-filter input { margin: 0; accent-color: var(--accent); }
.items-empty { padding: var(--sp-14) var(--sp-6); text-align: center; font-size: var(--fs-sm); }
.item-wrap { position: relative; display: flex; flex-direction: column; }
.item-wrap > .item { width: 100%; }
.thumb { width: 44px; height: 44px; flex: none; border-radius: var(--r-md); display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 70%, color-mix(in srgb, var(--cat) 22%, transparent), var(--fill-1) 70%);
  border: 1px solid var(--line); }
.thumb img, .thumb svg { width: 40px; height: 40px; object-fit: contain; display: block; }
/* The expand arrow sits on the thumbnail's bottom-right corner. It's a
   sibling of the item button (not inside it) so it still works on locked,
   disabled items. */
.thumb-zoom { position: absolute; left: 39px; top: calc(50% + 4px); width: 19px; height: 19px; padding: 0; border-radius: var(--r-sm);
  display: grid; place-items: center; font-size: var(--fs-sm); line-height: 1; border: 1px solid var(--line-bright);
  background: var(--overlay); color: var(--text); opacity: 0.75; }
.item-wrap:hover .thumb-zoom, .thumb-zoom:focus-visible { opacity: 1; }
.thumb-zoom:hover { background: var(--accent); border-color: var(--accent); }
.bp-head { display: flex; align-items: flex-start; gap: var(--sp-8); }
.bp-head h2 { flex: 1; }
.bp-stage { margin: var(--sp-12) 0 var(--sp-8); height: min(320px, 45vh); border-radius: var(--r-lg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; padding: var(--sp-16); overflow: hidden;
  background: radial-gradient(ellipse at 50% 75%, var(--grass-tint-2), var(--grass-shadow) 70%); }
.bp-stage img, .bp-stage svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.bp-turn { display: flex; gap: var(--sp-6); justify-content: center; margin-bottom: var(--sp-8); }
.bp-turn button { padding: var(--sp-4) var(--sp-12); }
.bp-info { display: flex; flex-direction: column; gap: var(--sp-4); font-size: var(--fs-sm); }
.bp-note { margin-top: var(--sp-6); }

/* ---- phones (.game.mobile, set by main.mjs) ----------------------------------
   A bottom bar; the build menu, activity feed, building panel and settings
   slide up over the map as sheets, one at a time. --hud-bottom and --bar-h
   are measured in main.mjs. */
.game:not(.mobile) .m-only { display: none !important; }
.game.mobile .d-only { display: none !important; }
.game.mobile { --safe-b: env(safe-area-inset-bottom, 0px); --sheet-max: calc(100% - var(--hud-bottom, 90px) - var(--bar-h, 56px) - 8px); }

/* top: city + balance on one line, the stats as a strip that scrolls sideways */
.game.mobile .hud-top { top: calc(6px + env(safe-area-inset-top, 0px)); left: calc(6px + env(safe-area-inset-left, 0px)); right: calc(6px + env(safe-area-inset-right, 0px)); gap: var(--sp-6); flex-wrap: wrap; }
.game.mobile .city-chip { flex: 1 1 0; min-width: 0; padding: var(--sp-6) var(--sp-10); }
.game.mobile .city-name { font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game.mobile .chip-clock, .game.mobile .hud-top .spacer { display: none; }
.game.mobile .player-chip { flex: 0 1 auto; min-width: 0; max-width: 64%; padding: var(--sp-6) var(--sp-10); column-gap: var(--sp-8); }
.game.mobile .player-chip .balance { font-size: var(--fs-lg); }
.game.mobile .player-chip .sub { font-size: var(--fs-xs); line-height: 1.3; }
.game.mobile .auth-box { flex-wrap: wrap; gap: var(--sp-6); }
.game.mobile .auth-box .privacy-link { display: none; }
.game.mobile .auth-box .avatar { width: 22px; height: 22px; }
.game.mobile .who-name { max-width: 110px; }
.game.mobile .auth-box .join-form input { width: 110px; }
.game.mobile .name-ticket { max-width: none; }
.game.mobile .hud-top .stats { order: 5; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: var(--sp-12); padding: var(--sp-6) var(--sp-10); font-size: var(--fs-sm); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.game.mobile .hud-top .stats::-webkit-scrollbar { display: none; }

/* bottom bar */
.game.mobile .view-controls { left: 0; right: 0; bottom: 0; z-index: var(--z-bar); gap: var(--sp-6); padding: var(--sp-6) calc(6px + env(safe-area-inset-right, 0px)) calc(6px + var(--safe-b)) calc(6px + env(safe-area-inset-left, 0px));
  overflow-x: auto; scrollbar-width: none; background: var(--panel-solid); border-top: 1px solid var(--line); }
.game.mobile .view-controls::-webkit-scrollbar { display: none; }
.game.mobile .view-controls .panel { flex: none; box-shadow: none; backdrop-filter: none; }
.game.mobile .seg button { min-height: 40px; padding: var(--sp-6) var(--sp-12); white-space: nowrap; }
.game.mobile .seg button.gear { padding: var(--sp-4) var(--sp-12); }
.game.mobile [data-act="zoomIn"], .game.mobile [data-act="zoomOut"] { display: none; }

/* sheets */
.game.mobile .build-menu, .game.mobile .feed, .game.mobile .inspector {
  position: absolute; left: 0; right: 0; top: auto !important; bottom: var(--bar-h, 56px); width: auto; z-index: var(--z-sheet);
  border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; box-shadow: var(--shadow-up); background: var(--panel-solid); backdrop-filter: none; }
.game.mobile .build-menu { display: none; height: min(64%, var(--sheet-max)); }
.game.mobile .feed { display: none; height: min(55%, var(--sheet-max)); max-height: none; }
.game.mobile .inspector { max-height: min(60%, var(--sheet-max)); padding: var(--sp-14) var(--sp-16) var(--sp-16); overscroll-behavior: contain; }
.game.mobile .settings { width: auto; max-height: none; left: var(--set-left); right: var(--set-right); top: var(--set-top); bottom: var(--set-bottom); transform: none; }
.game.mobile .set-body { padding: var(--sp-4) var(--sp-12) var(--sp-8); }
.game.mobile .set-head { padding: var(--sp-12) var(--sp-16) var(--sp-6); }
.game.mobile .set-foot { padding: var(--sp-10) var(--sp-16) var(--sp-12); }
.game.mobile .build-menu .items, .game.mobile .feed ul { overscroll-behavior: contain; }
.sheet-close { position: absolute; top: 6px; right: 8px; z-index: 1; font-size: var(--fs-lg); padding: var(--sp-6) var(--sp-10); }
.game.mobile .build-menu .needs { max-height: 26%; overflow-y: auto; padding-right: 44px; flex: none; }
.game.mobile .build-menu .needs:empty, .game.mobile .build-menu .needs[hidden] + .build-title { padding-right: 44px; }
.game.mobile .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: none; padding: var(--sp-4) var(--sp-10) var(--sp-10); }
.game.mobile .tabs::-webkit-scrollbar { display: none; }
.game.mobile .tab { flex: none; padding: var(--sp-8) var(--sp-12); font-size: var(--fs-sm); }
.game.mobile .items { flex: 1; padding-bottom: var(--sp-14); }
.game.mobile .item { padding: var(--sp-10); }
.game.mobile .thumb-zoom { width: 26px; height: 26px; left: 34px; opacity: 1; font-size: var(--fs-md); }
.game.mobile .build-filter { padding: var(--sp-4) var(--sp-14) var(--sp-8); }
.game.mobile .feed-head { padding: var(--sp-10) var(--sp-12) var(--sp-6); font-size: var(--fs-sm); }
.game.mobile .feed li { padding: var(--sp-8) var(--sp-8); font-size: var(--fs-base); }

/* bigger things to tap */
.game.mobile .contrib button, .game.mobile .contrib-custom button, .game.mobile .modal-actions button { padding: var(--sp-10) var(--sp-14); }
.game.mobile .insp-head .close { padding: var(--sp-6) var(--sp-10); font-size: var(--fs-lg); }
.game.mobile .set-check { padding: var(--sp-8) 0; font-size: var(--fs-base); }
.game.mobile .set-seg button { padding: var(--sp-8) var(--sp-6); }
.game.mobile .land-compass { grid-template-rows: repeat(3, 54px); }
/* iOS zooms the page into any text box under 16px */
.game.mobile input, .game.mobile select, .game.mobile textarea { font-size: var(--fs-lg); }

/* the placing bar: what's in hand, and Place / Rotate / Cancel */
.game.mobile .hint { left: 6px; right: 6px; bottom: calc(var(--bar-h, 56px) + 6px); transform: none; width: auto; white-space: normal; padding: var(--sp-8) var(--sp-10); z-index: var(--z-hint); }
.hint.touch .hint-text { font-size: var(--fs-sm); }
.hint-actions { display: flex; gap: var(--sp-8); margin-top: var(--sp-8); }
.hint-actions button { min-height: 42px; padding: var(--sp-8) var(--sp-14); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--fill-4); font-weight: 600; }
.hint-actions button.primary { flex: 1; }
.game:not(.mobile) .hint.touch { white-space: normal; max-width: min(560px, calc(100% - 24px)); }

/* toasts and the level-up card go under the HUD; no hover tooltips */
.game.mobile .toasts { top: calc(var(--hud-bottom, 90px) + 6px); width: calc(100% - 24px); }
.game.mobile .toast { max-width: 100%; text-align: center; }
.game.mobile .levelup { top: calc(var(--hud-bottom, 90px) + 10px); }
.game.mobile .tooltip { display: none !important; }
.game.mobile .modal { max-height: calc(100% - 32px); overflow-y: auto; }
.hint-actions button.primary { background: var(--accent); border-color: var(--accent); color: white; }

/* phones on their side: one HUD row, a one-line placing bar, sheets down the right */
@media (max-height: 500px) {
  .game.mobile .city-chip { flex: 0 1 auto; max-width: 28%; }
  .game.mobile .hud-top .stats { order: 0; flex: 1 1 0; }
  .game.mobile .player-chip { max-width: 34%; }
  .game.mobile .hint { display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-6) var(--sp-8) var(--sp-6) var(--sp-12); }
  .game.mobile .hint-text { flex: 1; min-width: 0; }
  .game.mobile .hint-actions { margin-top: 0; flex: none; }
  .game.mobile .hint-actions button { min-height: 38px; padding: var(--sp-6) var(--sp-12); }
  .game.mobile .hint-actions button.primary { flex: none; }
  .game.mobile .build-menu, .game.mobile .feed, .game.mobile .inspector {
    left: auto; right: calc(6px + env(safe-area-inset-right, 0px)); width: min(440px, 60%); border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .game.mobile .build-menu, .game.mobile .feed { height: var(--sheet-max); }
  .game.mobile .inspector { max-height: var(--sheet-max); }
  .game.mobile .build-menu .needs { max-height: 22%; }
}

/* ---- phones, v2: top = city, balance, settings; bottom = a tab bar of sheets ---- */
.needs .need-why { display: none; }
.game.mobile .view-controls { display: none; }
.game.mobile .hud-top .stats { display: none; }
.m-gear { flex: none; width: 44px; display: grid; place-items: center; font-size: var(--fs-xl); color: var(--muted); padding: 0; }
.m-gear[aria-expanded="true"] { color: var(--text); background: var(--accent-tint-2); }
.game.mobile .player-chip { max-width: none; flex: 0 1 auto; }

.tabbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: var(--z-bar); display: flex; background: var(--panel-solid); border-top: 1px solid var(--line);
  padding: var(--sp-4) calc(4px + env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) calc(4px + env(safe-area-inset-left, 0px)); }
.tabbar button { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-6) var(--sp-2) var(--sp-6); border: 0; border-radius: var(--r-lg);
  background: none; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; }
.tabbar .ti { position: relative; font-size: var(--fs-xl); line-height: 1.1; }
.tabbar button.on { color: var(--text); background: var(--accent-tint); }
.tabbar .tab-main .ti { font-size: var(--fs-2xl); }
.tab-badge { position: absolute; top: -3px; right: -10px; min-width: 16px; height: 16px; padding: 0 var(--sp-4); border-radius: var(--r-md); background: var(--warn); color: var(--warn-ink); font: 700 10px/16px var(--font); font-style: normal; text-align: center; }

/* the sheets the tab bar opens (only one at a time) */
.game.mobile .m-sheet { position: absolute; left: 0; right: 0; bottom: var(--bar-h, 60px); z-index: var(--z-sheet); display: none; flex-direction: column; max-height: min(70%, var(--sheet-max));
  border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; background: var(--panel-solid); backdrop-filter: none; box-shadow: var(--shadow-up); }
.game.mobile[data-sheet="needs"] .needs-sheet, .game.mobile[data-sheet="stats"] .stats-sheet { display: flex; }
.game.mobile[data-sheet="build"] .build-menu, .game.mobile[data-sheet="feed"] .feed { display: flex; }
.game.mobile[data-sheet] .hint { display: none; }
.m-sheet-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-12) var(--sp-12) var(--sp-6) var(--sp-16); font-size: var(--fs-lg); }
.m-sheet-head .ghost { font-size: var(--fs-lg); padding: var(--sp-6) var(--sp-10); }
.m-sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--sp-16) var(--sp-16); margin: 0; }
.needs-sheet .need { padding: var(--sp-10) 0; }
.needs-sheet .need-text { font-size: var(--fs-md); }
.needs-sheet .need-why { display: block; color: var(--muted); font-size: var(--fs-sm); margin: var(--sp-2) 0 var(--sp-6); }
.needs-sheet .need-fixes { gap: var(--sp-6); }
.needs-sheet .need-fixes button { font-size: var(--fs-base); padding: var(--sp-8) var(--sp-12); }
.needs-sheet .need.ok { font-size: var(--fs-md); padding: var(--sp-12) 0; }
.stats-list { list-style: none; }
.stats-list li { padding: var(--sp-10) 0; border-bottom: 1px solid var(--line); }
.stats-list li:last-child { border-bottom: 0; }
.stats-list .srow { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-10); font-size: var(--fs-md); }
.stats-list .sname { font-weight: 600; }
.stats-list .sval { font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: var(--sp-6); }
.stats-list li.bad .sname, .stats-list li.bad .sval { color: var(--bad); }
.stats-list .stip { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.stats-list .meter { display: inline-block; width: 60px; height: 7px; border-radius: var(--r-sm); background: var(--fill-4); overflow: hidden; }
.stats-list .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--good)); }

/* build sheet: step 1 lists the categories, step 2 one category's buildings */
.game.mobile .build-menu .needs { display: none; }
.game.mobile .build-menu { height: min(72%, var(--sheet-max)); }
.game.mobile .build-title { padding: var(--sp-14) 52px var(--sp-4) var(--sp-16); }
.game.mobile .sheet-close { top: 8px; }
.game.mobile.build-cats .tabs { flex-direction: column; flex-wrap: nowrap; overflow-x: hidden; overflow-y: auto; flex: 1; gap: var(--sp-6); padding: var(--sp-6) var(--sp-12) var(--sp-14); border-bottom: 0; overscroll-behavior: contain; }
.game.mobile.build-cats .tab { display: flex; width: 100%; padding: var(--sp-14) var(--sp-14); border-radius: var(--r-lg); font-size: var(--fs-md); font-weight: 600; gap: var(--sp-10); flex: none; }
.game.mobile.build-cats .tab .dot { width: 11px; height: 11px; }
.game.mobile.build-cats .tab.on { border-color: transparent; background: var(--fill-2); }
.cat-count { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.game.mobile.build-cats .items, .game.mobile.build-cats .cat-head { display: none !important; }
.game.mobile:not(.build-cats) .tabs, .game.mobile:not(.build-cats) .build-filter { display: none; }
.cat-head { display: flex; align-items: center; gap: var(--sp-8); padding: var(--sp-2) var(--sp-12) var(--sp-8) var(--sp-8); border-bottom: 1px solid var(--line); font-size: var(--fs-lg); }
.cat-head .ghost { font-size: var(--fs-md); padding: var(--sp-8) var(--sp-10); color: var(--accent-2); }
.set-btns { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin: var(--sp-6) 0 var(--sp-2); }
.set-btns button { padding: var(--sp-10) var(--sp-12); border-radius: var(--r-md); border: 1px solid var(--line); background: var(--fill-3); }

@media (max-height: 500px) {
  .game.mobile .m-sheet { left: auto; right: calc(6px + env(safe-area-inset-right, 0px)); width: min(440px, 60%); max-height: var(--sheet-max); }
  .tabbar button { flex-direction: row; justify-content: center; gap: var(--sp-6); font-size: var(--fs-sm); padding: var(--sp-6) var(--sp-2); }
  .tabbar .ti { font-size: var(--fs-xl); }
}

.game.mobile .city-chip { min-width: 118px; }
.game.mobile .player-chip { min-width: 0; } /* not overflow:hidden: the account menu drops out of it */
.game.mobile .player-chip select { max-width: 110px; }
.game.mobile .player-chip .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabbar .tab-main .ti { font-size: var(--fs-xl); }
@media (max-height: 500px) { .tabbar .ti { margin-right: var(--sp-14); } .tab-badge { right: -14px; } }

/* ---- desktop: the placing bar sits between the build menu and the feed,
   above the view buttons; "City needs" folds to one line ---- */
@media (min-width: 901px) {
  .game:not(.mobile) .hint { left: var(--hint-left, 292px); right: var(--hint-right, 324px); bottom: 62px; transform: none; width: fit-content; max-width: none; margin: 0 auto; white-space: normal; }
  .game:not(.mobile) .hint.touch { max-width: 620px; }
}
.game:not(.mobile) .hint.touch .hint-actions button { min-height: 34px; }
.needs-fold { cursor: pointer; user-select: none; display: flex; align-items: baseline; gap: var(--sp-6); }
.needs-fold:hover { color: var(--text); }
.fold-arrow { font-size: var(--fs-2xs); }
.needs-peek { margin-left: var(--sp-4); text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--text); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.needs.folded { padding-bottom: var(--sp-6); }
.needs.folded .need { display: none; }
.needs-fold { white-space: nowrap; }
.needs-peek { flex: 1; }

/* city level box (click the level) */
.city-chip { position: relative; cursor: pointer; }
.city-chip:hover .xpbar, .city-chip[aria-expanded="true"] .xpbar { box-shadow: 0 0 0 1px var(--accent-2); }
.level-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: var(--z-pop); width: 280px; padding: var(--sp-12) var(--sp-14); cursor: default;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); white-space: normal; }
.lp-big { font-size: var(--fs-lg); margin-bottom: var(--sp-6); }
.lp-big b { color: var(--accent-2); }
.lp-bar { height: 8px; margin-bottom: var(--sp-4); }
.lp-bar i { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.lp-how { margin-top: var(--sp-8); font-size: var(--fs-sm); color: var(--muted); }
.lp-next { margin-top: var(--sp-4); font-size: var(--fs-sm); }
.game.mobile .level-pop { width: min(300px, calc(100vw - 12px)); }
/* inspector: more than one thing on the clicked spot */
.insp-layers { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--accent-2); }
.hud-top { z-index: var(--z-hud); }

/* Keyboard shortcuts list (Settings → Keyboard shortcuts, or ?) */
table.hotkeys { width: 100%; border-collapse: collapse; margin: var(--sp-2) 0 var(--sp-8); font-size: var(--fs-base); }
table.hotkeys td { padding: var(--sp-6) 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.hotkeys th { text-align: left; padding: var(--sp-14) 0 var(--sp-4); }
table.hotkeys td:first-child { padding-right: var(--sp-16); width: 46%; }
table.hotkeys kbd { margin: 0 1px; }

/* "What's new" notice (main.mjs showWhatsNew; text from shared/notes.mjs) */
.wn-modal { max-width: 520px; }
.wn-modal .wn-tag { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-2); font-weight: 700; }
.wn-modal h2 { margin-top: var(--sp-4); }
.wn-modal .wn-body { line-height: 1.5; }
.wn-modal .wn-body ul { margin: var(--sp-6) 0; padding-left: var(--sp-20); }
.wn-modal .wn-body li { margin: var(--sp-4) 0; }
.wn-modal .wn-body p { margin: var(--sp-6) 0; }
.wn-modal .wn-body a { color: var(--accent-2); }
.wn-older { margin-top: var(--sp-12); border-top: 1px solid var(--line); padding-top: var(--sp-8); font-size: var(--fs-base); }
.wn-older > summary, .wn-old > summary { cursor: pointer; color: var(--muted); padding: var(--sp-4) 0; }
.wn-older { max-height: 40vh; overflow-y: auto; }
.wn-old { margin-left: var(--sp-6); }
.wn-old > summary b { color: var(--text); }
/* What's new: the notices scroll inside the card; Got it stays below. */
.modal.wn-modal { display: flex; flex-direction: column; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: hidden; }
.game.mobile .modal.wn-modal { max-height: calc(100dvh - 32px); overflow: hidden; }
.modal.wn-multi { width: min(520px, calc(100% - 32px)); }
.wn-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -20px; padding: 0 var(--sp-20); }
.wn-modal .modal-actions { flex: none; padding-top: var(--sp-12); border-top: 1px solid transparent; }
.wn-multi .modal-actions { border-top-color: var(--line); }
.wn-count { margin-bottom: var(--sp-8) !important; }
/* Where one notice ends and the next begins. */
.wn-divider { display: flex; align-items: center; gap: var(--sp-10); margin: var(--sp-20) 0 var(--sp-8); color: var(--accent-2); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.wn-divider::before, .wn-divider::after { content: ""; flex: 1; height: 2px; border-radius: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.wn-entry:first-child .wn-divider { margin-top: var(--sp-4); }
.wn-multi .wn-entry h2 { font-size: var(--fs-xl); }
.wn-scroll .wn-older { max-height: none; overflow: visible; }
.wn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-left: var(--sp-4); vertical-align: middle; }

/* Build menu families (e.g. Trees): one card, a row of species to pick from */
.family-card { display: flex; flex-direction: column; gap: var(--sp-4); }
.species { display: flex; flex-wrap: wrap; gap: var(--sp-4); padding-left: var(--sp-8); }
.species .sp { padding: var(--sp-2) var(--sp-8) var(--sp-2) var(--sp-4); background: var(--fill-1); }
.species .sp.dim { opacity: 0.55; }
.species .sp-thumb { width: 20px; height: 20px; display: inline-grid; place-items: center; overflow: hidden; }
.species .sp-thumb img, .species .sp-thumb svg { max-width: 20px; max-height: 20px; }
.game.mobile .species .sp { padding: var(--sp-4) var(--sp-10) var(--sp-4) var(--sp-4); font-size: var(--fs-base); }

/* Double earning rate running (main.mjs boostNote) */

/* Sign-in chooser (public/js/shared/signin.mjs): one button, then a list of platforms. */
.signin-btn { display: inline-block; background: var(--accent); color: white; font: inherit; font-weight: 700; border: 0; cursor: pointer; padding: var(--sp-6) var(--sp-12); border-radius: var(--r-md); }
.signin-btn:hover { background: var(--accent-hover); }
.signin-btn.block { display: block; width: 100%; margin-top: var(--sp-14); padding: var(--sp-10) var(--sp-12); }
.signin-dialog { padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--panel-solid); color: var(--text); max-width: min(380px, calc(100vw - 24px)); width: 100%; }
.signin-box { padding: var(--sp-20) var(--sp-20) var(--sp-14); margin: 0; }
.signin-box h2 { margin: 0 0 var(--sp-6); font-size: var(--fs-xl); }
.signin-box p { margin: 0 0 var(--sp-14); font-size: var(--fs-base); }
.signin-list { display: flex; flex-direction: column; gap: var(--sp-8); }
.signin-option { display: flex; align-items: center; gap: var(--sp-10); padding: var(--sp-10) var(--sp-12); border-radius: var(--r-md); border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font-size: var(--fs-md); }
a.signin-option:hover { border-color: var(--accent-2); background: var(--fill-1); }
.signin-option.off { opacity: 0.55; cursor: default; }
.signin-soon { margin-left: auto; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.signin-mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: var(--r-sm); font-weight: 800; font-size: var(--fs-md); background: var(--fill-solid); color: white; flex: none; }
.signin-mark.signin-twitch { background: var(--twitch); }
.signin-mark.signin-kick { background: var(--kick); color: var(--kick-ink); }
.signin-foot { display: flex; align-items: center; justify-content: space-between; margin-top: var(--sp-14); font-size: var(--fs-sm); }
.signin-foot a { color: var(--accent-2); }

/* "1 new message" under the player's name (main.mjs): waits on their profile. */
.who .msg-pill { display: block; width: max-content; white-space: nowrap; margin-top: var(--sp-4); padding: 1px var(--sp-8); border-radius: var(--r-pill); background: var(--accent); color: white; font-size: var(--fs-xs); font-weight: 700; text-decoration: none; line-height: 1.6; }
.who .msg-pill:hover { background: var(--accent-hover); }

/* Phone sheets slide up when they open (motion rules are in components.css). */
.game.mobile[data-sheet="build"] .build-menu, .game.mobile[data-sheet="feed"] .feed,
.game.mobile[data-sheet="needs"] .needs-sheet, .game.mobile[data-sheet="stats"] .stats-sheet { animation: sheet-up var(--t-med) var(--ease-out); }
.settings-wrap:not([hidden]) > .settings { animation: fade-in var(--t-med) var(--ease-out); }

/* The welcome card's three steps (main.mjs startSessionWelcome). */
.welcome-steps { list-style: none; padding: 0 !important; margin: var(--sp-14) 0; display: grid; gap: var(--sp-12); }
.welcome-steps li { display: grid; grid-template-columns: 40px 1fr; gap: var(--sp-12); align-items: center; }
.welcome-steps .muted { font-size: var(--fs-sm); margin-top: var(--sp-2); }
.wl-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); background: var(--accent-wash); border: 1px solid var(--line); font-size: 20px; /* emoji */ }
.welcome-start { margin: 0; }
