:root {
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --navy: #08284b; --blue: #087adb; --paper: #fff8df; --paper-dark: #e9dfbf;
  --gold: #ffc82e; --gold-hi: #ffe68b; --gold-lo: #e7a314;
  --rust: #bf3d24; --ink: #08284b; --text: #08284b; --text2: #516078;
  --line: #08284b; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--blue); color: var(--text); font-family: var(--font); }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
button:disabled { cursor: default; }
#cv { position: fixed; inset: 0; touch-action: none; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#stage { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#stage img { -webkit-user-drag: none; }
#ui > * { pointer-events: auto; }
.btn, .hud, .dock, .panel, .result, .hint { background: var(--paper); border: 2px solid var(--navy); box-shadow: 0 5px 0 var(--navy); }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 16px; border-radius: 10px; font-weight: 800; font-size: 15px; }
.btn:active, .go:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy); }
.btn.primary, .go { background: var(--gold); color: var(--navy); border: 2px solid var(--navy); box-shadow: 0 5px 0 var(--navy), inset 0 2px 0 var(--gold-hi); }
.btn.big { justify-content: space-between; min-height: 72px; padding: 12px 20px; }
.btn.big .playCopy { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.btn.big strong { font-size: 23px; font-weight: 900; }
.btn.big small { font-size: 12px; font-weight: 650; }
.btn.big > svg { width: 28px; height: 28px; }
.iconBtn { width: 44px; height: 44px; flex: none; border: 2px solid var(--navy); border-radius: 8px; display: grid; place-items: center; background: var(--paper); color: var(--navy); }
.st { display: inline-grid; }
.st svg { width: 100%; height: 100%; fill: #c5c8c7; stroke: var(--navy); stroke-width: 1; }
.st.on svg { fill: var(--gold); }
.st.inline { width: 16px; height: 16px; vertical-align: -3px; margin-left: 3px; }
.home, .sheetMode { background: var(--blue) url('/assets/menu-canyon.webp') center / cover no-repeat; }
.home::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, #005da244, transparent 65%); }
.home::after { content: ''; position: absolute; inset: auto 0 0; height: 9px; background: repeating-linear-gradient(130deg, var(--navy) 0 16px, var(--gold) 16px 32px); }
.homeTop { position: absolute; top: calc(var(--sat) + 28px); left: 5%; right: 5%; display: flex; justify-content: space-between; align-items: center; gap: 16px; color: var(--paper); }
.miniBrand { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 900; letter-spacing: 2px; }
.miniBrand svg { width: 36px; height: 26px; }
.home .brand { position: absolute; left: 5%; right: 5%; top: calc(var(--sat) + 112px); pointer-events: none; }
.brand .eyebrow { font-size: 12px; letter-spacing: 3px; font-weight: 800; color: var(--paper); margin-bottom: 16px; }
.brand h1 { margin: 0; font-family: "Arial Black", "Segoe UI", sans-serif; font-size: clamp(70px, 10vw, 145px); font-weight: 1000; font-style: italic; line-height: 1; letter-spacing: -.06em; color: var(--paper); -webkit-text-stroke: 2px var(--navy); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--navy), 5px 5px 0 var(--navy), 7px 7px 0 var(--navy); }
.brand p { margin: 24px 0 0; color: var(--paper); font-size: 19px; font-weight: 750; text-shadow: 0 2px 0 #08467a; }
.homeActions { position: absolute; left: 5%; bottom: calc(36px + var(--sab)); width: 360px; padding: 22px; display: grid; gap: 14px; background: var(--paper); border: 2px solid var(--navy); border-radius: 14px; box-shadow: 6px 6px 0 var(--navy); }
.actionLabel { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; letter-spacing: 1.5px; font-weight: 900; }
.actionLabel span:last-child { color: var(--text2); letter-spacing: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 .btn { font-size: 13px; padding: 0 8px; background: #fffdf2; box-shadow: 0 3px 0 var(--navy); }
.tally { text-align: center; color: var(--text2); font-size: 13px; padding-top: 6px; }
.tally b { font-weight: 900; color: var(--navy); }
.tally i { display: inline-block; width: 4px; height: 4px; background: currentColor; margin: 0 8px; vertical-align: 3px; }
.tally.small { margin-left: auto; padding: 0; white-space: nowrap; }
.sheetMode::before { content: ''; position: absolute; inset: 0; background: #08284bb3; }
.panel { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 24px); bottom: calc(var(--sab) + 24px); width: min(740px, calc(100% - 32px)); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.panel.levels { max-width: 360px; }
.panel.board { max-width: 340px; }
.panelTop { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border-bottom: 2px solid var(--navy); }
.panelTop h2 { margin: 0; font-size: 24px; font-weight: 900; letter-spacing: -.6px; }
.scroll { overflow: auto; padding: 20px; }
.world { position: relative; border-radius: 10px; padding: 0 14px 14px; margin-bottom: 18px; overflow: hidden; background: #fffcf0; border: 2px solid var(--navy); box-shadow: 0 3px 0 var(--navy); }
.world:last-child { margin-bottom: 4px; }
.worldHead { position: relative; height: 145px; margin: 0 -14px 14px; padding: 16px; display: flex; align-items: flex-end; background-size: cover; background-position: center 70%; border-bottom: 2px solid var(--navy); }
.worldHead::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 30%, #08284bbc); }
.worldHead h3 { position: relative; z-index: 1; margin: 0; font-size: 23px; font-weight: 900; color: var(--paper); }
.worldHead h3 small { display: block; margin-bottom: 4px; font-size: 11px; letter-spacing: 2px; color: #ffe68b; }
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tile { position: relative; border: 2px solid var(--navy); border-radius: 8px; padding: 12px 4px; min-height: 82px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--paper); box-shadow: 0 3px 0 var(--navy); }
.tile .num { font-size: 27px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .stars { display: flex; gap: 2px; }
.tile .stars .st { width: 15px; height: 15px; }
.tile.next { background: var(--gold); }
.tile.done { background: #e0efda; }
.tile.locked { background: #ebe7d9; color: #75818a; border-color: #a1a8a7; box-shadow: 0 3px 0 #a1a8a7; }
.tile.locked .stars { opacity: .4; }
.tabs { display: flex; gap: 6px; margin: 18px 20px; padding: 4px; background: var(--paper-dark); border-radius: 10px; }
.tab { flex: 1; min-height: 44px; border: 2px solid transparent; background: transparent; border-radius: 7px; font-weight: 800; color: var(--text2); }
.tab.on { background: var(--navy); color: var(--paper); }
.rows { flex: 1; overflow: auto; padding: 0 20px 12px; }
.lbRow { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid #ccc5ad; border-radius: 8px; margin-bottom: 8px; background: #fffdf4; }
.lbRow .rk { width: 26px; text-align: center; font-weight: 900; color: var(--text2); }
.lbRow.p1 { background: #ffeb9c; border-color: var(--navy); }
.lbRow .av { width: 40px; height: 40px; border-radius: 8px; background: #dceafa; display: grid; place-items: center; font-weight: 900; overflow: hidden; flex: none; }
.lbRow .av img { width: 100%; height: 100%; object-fit: cover; }
.lbRow .nm { flex: 1; min-width: 0; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbRow .sc { font-size: 13px; white-space: nowrap; color: var(--text2); }
.lbRow .sc b { color: var(--navy); font-size: 16px; }
.lbRow .dot { display: inline-block; width: 3px; height: 3px; background: currentColor; margin: 0 6px; vertical-align: 3px; }
.lbRow.me { border: 2px solid var(--blue); }
.empty { padding: 36px 20px; text-align: center; color: var(--text2); line-height: 1.5; }
.mine { padding: 18px 16px; border-top: 2px solid var(--navy); text-align: center; color: var(--text2); }
.mine b { color: var(--navy); }
.play { pointer-events: none; }
.play > * { pointer-events: auto; }
.hud { position: absolute; left: 16px; right: 16px; top: calc(var(--sat) + 16px); display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 12px; max-width: 900px; margin: 0 auto; }
.lvTitle { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.lvTitle small { font-size: 10px; font-weight: 800; letter-spacing: 1px; color: var(--text2); }
.lvTitle b { font-size: 18px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.budget { width: 160px; flex: none; }
.budgetLabel { display: block; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-align: right; margin-bottom: 3px; color: var(--text2); }
.bNums { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px; font-variant-numeric: tabular-nums; }
.bNums b { font-size: 19px; font-weight: 900; }
.bNums span { font-size: 12px; color: var(--text2); }
.bar { position: relative; height: 8px; border-radius: 3px; background: #d8d8c8; margin-top: 6px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: #258551; }
.bar em { position: absolute; top: -2px; width: 2px; height: 12px; background: var(--navy); }
.budget.over .bar i { background: var(--rust); width: 100% !important; }
.budget.over .bNums b { color: var(--rust); }
.dock { position: absolute; left: 12px; right: 12px; bottom: calc(var(--sab) + 14px); border-radius: 12px; padding: 10px; display: grid; gap: 10px; max-width: 560px; margin: 0 auto; }
.mats { display: flex; gap: 8px; }
.mat { flex: 1; min-width: 0; border: 2px solid #d2ceb9; border-radius: 8px; padding: 10px 4px 8px; background: #f4eedc; display: flex; flex-direction: column; align-items: center; gap: 6px; line-height: 1.1; }
.mat span { font-size: 14px; font-weight: 850; }
.mat small { font-size: 12px; color: var(--text2); font-variant-numeric: tabular-nums; }
.mat.on { background: #ffeaa1; border-color: var(--navy); box-shadow: 0 3px 0 var(--navy); }
.sw { display: block; width: 44px; height: 14px; border-radius: 2px; background-size: cover; background-position: left center; border: 1px solid var(--navy); }
.sw.rope { height: 6px; margin: 4px 0; }
.tools { display: flex; gap: 6px; align-items: stretch; }
.tool { width: 62px; flex: none; min-height: 52px; border: 0; border-radius: 8px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0; }
.tool span { font-size: 12px; font-weight: 700; }
.tool.on { background: #c8e1f6; color: var(--navy); }
.tool.on.danger { background: #f8d8cf; color: #9b2d1b; }
.tool[disabled] { opacity: .55; }
.tool.armed { background: var(--rust); color: #fff; }
.go { flex: 1; border-radius: 8px; min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 18px; font-weight: 900; }
.dock .tools:only-child .tool { flex: 1; width: auto; }
.hint { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 106px); width: max-content; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 8px; font-size: 14px; line-height: 1.4; }
.hint.gone, .toast.gone { opacity: 0; pointer-events: none; }

.toast { position: absolute; left: 50%; top: calc(var(--sat) + 106px); transform: translateX(-50%); max-width: calc(100% - 24px); padding: 12px 18px; border-radius: 8px; background: var(--rust); border: 2px solid var(--navy); color: #fff; font-weight: 750; font-size: 14px; box-shadow: 0 4px 0 var(--navy); }
.result { position: absolute; left: 50%; bottom: calc(var(--sab) + 14px); transform: translateX(-50%); width: min(520px, calc(100% - 24px)); border-radius: 14px; padding: 24px 20px; text-align: center; }
.result h3 { margin: 0 0 6px; font-size: 30px; font-weight: 900; }
.result p { margin: 0 auto 18px; color: var(--text2); line-height: 1.5; max-width: 34ch; font-size: 16px; }
.result p b { color: var(--navy); }
.result p em { font-style: normal; color: #896100; font-weight: 800; }
.result:not(.win) h3 { color: var(--rust); }
.acts { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.acts .btn:only-child { grid-column: 1 / -1; }
.bigStars { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: -4px 0 12px; }
.bigStars .st { width: 48px; height: 48px; }
.bigStars .st:nth-child(2) { width: 62px; height: 62px; }
@media (hover: hover) { .btn:hover, .go:hover, .tile:not(:disabled):hover { filter: brightness(1.06); } .mat:hover, .tool:not(:disabled):hover { background: #ffeaa1; } }
@container game (max-width: 600px) {
  .home { background-position: 80% center; }
  .homeTop { top: calc(var(--sat) + 20px); left: 20px; right: 20px; }
  .miniBrand { font-size: 10px; letter-spacing: 1px; gap: 7px; }
  .miniBrand svg { width: 28px; }
  .home .brand { top: calc(var(--sat) + 100px); left: 22px; right: 22px; }
  .brand .eyebrow { font-size: 10px; letter-spacing: 2px; margin-bottom: 12px; }
  .brand h1 { font-size: clamp(54px, 15.5vw, 90px); -webkit-text-stroke-width: 1.5px; text-shadow: 3px 3px 0 var(--navy), 5px 5px 0 var(--navy); }
  .brand p { font-size: 15px; margin-top: 18px; }
  .homeActions { left: 20px; right: 20px; bottom: calc(26px + var(--sab)); width: auto; padding: 16px; gap: 12px; }
  .panel { top: calc(var(--sat) + 10px); bottom: calc(var(--sab) + 10px); width: calc(100% - 20px); }
  .panelTop { padding: 12px; gap: 10px; }
  .panelTop h2 { font-size: 21px; }
  .scroll { padding: 12px; }
  .world { padding: 0 10px 12px; }
  .worldHead { margin: 0 -10px 12px; height: 125px; }
  .tiles { gap: 6px; }
  .tile { min-height: 70px; padding: 10px 2px; }
  .tile .stars { gap: 0; }
  .tile .stars .st { width: 12px; height: 12px; }
  .hud { left: 10px; right: 10px; top: calc(var(--sat) + 10px); gap: 9px; padding: 8px; }
  .lvTitle b { font-size: 15px; }
  .lvTitle small { font-size: 9px; letter-spacing: 0; }
  .budget { width: 120px; }
  .bNums b { font-size: 16px; }
  .bNums span { font-size: 10px; }
  .hint, .toast { top: calc(var(--sat) + 96px); }
  .dock { padding: 8px; gap: 8px; }
  .tool { width: 53px; }
  .go { font-size: 16px; gap: 3px; }
}
@container game (max-height: 650px) and (min-width: 601px) {
  .homeTop { top: calc(var(--sat) + 16px); }
  .home .brand { top: calc(var(--sat) + 78px); }
  .brand h1 { font-size: 82px; }
  .brand .eyebrow { margin-bottom: 8px; }
  .brand p { margin-top: 12px; }
  .homeActions { bottom: calc(22px + var(--sab)); padding: 14px; gap: 10px; width: 340px; }
  .homeActions .tally { display: none; }
  .homeActions .btn.big { min-height: 56px; }
}
@container game (max-height: 500px) and (orientation: landscape) {
  .homeTop { top: calc(var(--sat) + 16px); left: 4%; right: 4%; }
  .miniBrand { font-size: 10px; letter-spacing: 1px; gap: 7px; }
  .home .brand { top: calc(var(--sat) + 100px); left: 4%; right: 52%; }
  .brand .eyebrow { font-size: 10px; letter-spacing: 1.5px; margin-bottom: 12px; }
  .brand h1 { font-size: clamp(34px, 7cqw, 70px); }
  .brand p { font-size: 13px; margin-top: 18px; }
  .homeActions { left: auto; right: 6%; bottom: calc(var(--sab) + 24px); width: min(300px, 46%); padding: 12px; gap: 8px; }
  .homeActions .tally { display: none; }
  .homeActions .btn.big { min-height: 60px; padding: 10px 12px; }
  .homeActions .btn.big strong { font-size: 21px; }
  .actionLabel { font-size: 9px; letter-spacing: .5px; }
  .row2 { grid-template-columns: 1fr; gap: 8px; }
  .row2 .btn { font-size: 14px; padding: 0 12px; min-height: 48px; gap: 8px; }
  .panel { top: calc(var(--sat) + 8px); bottom: calc(var(--sab) + 12px); width: min(520px, calc(100% - 32px)); }
  .panelTop { padding: 8px 12px; gap: 10px; flex-shrink: 0; }
  .panelTop h2 { font-size: 21px; }
  .scroll { padding: 10px 12px; min-height: 0; }
  .world { padding: 0 10px 10px; margin-bottom: 12px; }
  .worldHead { height: 66px; margin: 0 -10px 10px; padding: 10px 12px; }
  .worldHead h3 { font-size: 19px; }
  .worldHead h3 small { font-size: 9px; margin-bottom: 2px; }
  .tiles { gap: 8px; }
  .tile { min-height: 60px; padding: 6px 4px; gap: 4px; }
  .tile .num { font-size: 23px; }
  .tabs { margin: 8px 12px; flex-shrink: 0; }
  .rows { min-height: 0; padding: 0 12px 8px; }
  .lbRow { padding: 8px; gap: 8px; margin-bottom: 6px; }
  .mine { padding: 8px 12px; flex-shrink: 0; font-size: 13px; }
  .empty { padding: 16px; }
  .hud { left: max(8px, env(safe-area-inset-left)); right: calc(230px + env(safe-area-inset-right)); top: calc(var(--sat) + 8px); padding: 0; max-width: none; gap: 6px; border: 0; background: transparent; box-shadow: none; align-items: stretch; }
  .hud > .iconBtn, .lvTitle, .budget { background: var(--paper); border: 2px solid var(--navy); border-radius: 10px; box-shadow: 0 3px 0 var(--navy); }
  .hud > .iconBtn { align-self: flex-start; min-width: 44px; width: 44px; height: 52px; }
  .lvTitle { flex: 0 1 200px; padding: 7px 10px; justify-content: center; }
  .lvTitle b { font-size: 14px; }
  .lvTitle small { font-size: 9px; letter-spacing: 0; }
  .budget { width: 126px; padding: 6px 9px; margin-left: auto; }
  .budgetLabel { font-size: 9px; margin-bottom: 2px; }
  .bar { height: 5px; margin-top: 5px; }
  .bar em { height: 9px; }
  .bNums b { font-size: 15px; }
  .bNums span { font-size: 10px; }
  .dock { left: auto; right: calc(8px + env(safe-area-inset-right)); width: 212px; top: calc(var(--sat) + 8px); bottom: auto; max-height: calc(100% - var(--sat) - var(--sab) - 20px); padding: 8px; align-content: start; overflow-y: auto; gap: 10px; }
  .mats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mat { min-height: 64px; padding: 6px 3px; gap: 3px; }
  .mat span { font-size: 13px; }
  .mat small { font-size: 12px; }
  .tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border-top: 1px solid #d2ceb9; padding-top: 8px; }
  .tool { min-height: 48px; width: auto; background: #ede5ce; border: 1px solid #d2ceb9; }
  .tool span { font-size: 12px; }
  .go { grid-column: 1 / -1; min-height: 52px; font-size: 17px; }
  .dock .tools:only-child { grid-template-columns: 1fr; border-top: 0; padding-top: 0; }
  .hint, .toast { left: calc((100% - 230px - env(safe-area-inset-right)) / 2); max-width: calc(100% - 258px - env(safe-area-inset-right)); top: calc(var(--sat) + 84px); font-size: 12px; padding: 8px 12px; }
  .result { left: calc((100% - 230px - env(safe-area-inset-right)) / 2); width: calc(100% - 254px - env(safe-area-inset-right)); padding: 14px; max-width: 430px; }
  .result p { margin-bottom: 12px; }
  .bigStars .st { width: 32px; height: 32px; }
  .bigStars .st:nth-child(2) { width: 42px; height: 42px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

#stage { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; container: game / size; }
@media (pointer: coarse) and (orientation: portrait) {
  #stage { inset: 0 auto auto 100%; width: 100dvh; height: 100dvw; transform: rotate(90deg); transform-origin: top left; --sat: env(safe-area-inset-left, 0px); --sab: env(safe-area-inset-right, 0px); }
}

/* One thumb-height toolbar keeps the landscape playfield full-width. */
@container game (max-height: 500px) and (orientation: landscape) {
  .hud { right: max(8px, env(safe-area-inset-right)); }
  .dock { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); top: auto; bottom: calc(var(--sab) + 10px); width: auto; max-width: 900px; display: flex; align-items: stretch; gap: 10px; padding: 6px; overflow: visible; }
  .mats { display: flex; flex: 1; gap: 6px; }
  .mat { min-height: 56px; padding: 5px 3px; gap: 2px; }
  .mat span { font-size: 12px; }
  .mat small { font-size: 11px; }
  .tools { display: flex; border-top: 0; border-left: 1px solid #d2ceb9; padding: 0 0 0 8px; gap: 6px; }
  .tool { width: 48px; min-height: 56px; }
  .tool span { font-size: 11px; }
  .go { min-width: 92px; padding: 0 8px; font-size: 15px; }
  .dock .tools:only-child { width: 100%; border: 0; padding: 0; }
  .hint, .toast { left: 50%; max-width: calc(100% - 32px); }
  .result { left: 50%; width: min(430px, calc(100% - 24px)); bottom: calc(var(--sab) + 88px); }
}

/* Compact menus, including their contents; touch targets remain at least 44px. */
.panel.levels, .panel.board { margin-block: auto; }
.panel.levels { max-height: 360px; }
.panel.board { max-height: 320px; }
.panel .panelTop { padding: 4px 8px; gap: 8px; flex-shrink: 0; }
.panel .panelTop h2 { font-size: 18px; }
.panel .tally.small { font-size: 12px; }
.levels .scroll { padding: 8px; min-height: 0; }
.levels .world { padding: 0 6px 6px; margin-bottom: 8px; border-radius: 8px; }
.levels .worldHead { height: 40px; margin: 0 -6px 6px; padding: 5px 8px; }
.levels .worldHead h3 { font-size: 15px; }
.levels .worldHead h3 small { font-size: 8px; letter-spacing: 1px; margin-bottom: 1px; }
.levels .tiles { gap: 5px; }
.levels .tile { min-height: 48px; padding: 4px 2px; gap: 3px; border-radius: 6px; }
.levels .tile .num { font-size: 20px; }
.levels .tile .stars { gap: 0; }
.levels .tile .stars .st { width: 11px; height: 11px; }
.board .tabs { margin: 6px 8px; padding: 2px; gap: 4px; flex-shrink: 0; }
.board .tab { font-size: 13px; min-height: 44px; }
.board .rows { padding: 0 8px 6px; min-height: 0; }
.board .lbRow { padding: 6px; gap: 6px; margin-bottom: 5px; min-height: 44px; }
.board .lbRow .rk { width: 18px; flex: none; font-size: 13px; }
.board .lbRow .av { width: 28px; height: 28px; border-radius: 6px; font-size: 12px; }
.board .lbRow .nm { font-size: 13px; }
.board .lbRow .sc { font-size: 11px; }
.board .lbRow .sc b { font-size: 13px; }
.board .lbRow .dot { margin: 0 4px; }
.board .mine { padding: 6px 8px; font-size: 12px; flex-shrink: 0; }
.board .empty { padding: 12px; font-size: 13px; }

/* Compact level identity and an explicit spending summary. */
.play .hud { align-items: flex-start; }
.play .budget { margin-left: auto; width: clamp(142px, 23cqw, 190px); padding: 7px 10px; border-radius: 10px; background: var(--navy); color: var(--paper); border-color: var(--navy); box-shadow: 0 3px 0 #041a32; }
.play .budgetLabel { text-align: left; font-size: 9px; letter-spacing: .5px; color: #b9d1e8; }
.play .bNums { justify-content: flex-start; gap: 4px; }
.play .bNums b { font-size: 18px; color: var(--paper); }
.play .bNums span { font-size: 11px; color: #b9d1e8; }
.play .bar { height: 4px; margin-top: 5px; background: #355775; }
.play .bar i { background: var(--gold); }
.play .bar em { height: 8px; background: #ecf2f7; }
.budgetStatus { display: block; margin-top: 5px; font-size: 10px; color: #c7e6d3; font-variant-numeric: tabular-nums; }
.play .budget.over .bNums b, .budget.over .budgetStatus { color: #ffb9a6; }
.play .budget.over .bar i { background: #ff795c; }

.play .hud { right: auto; width: max-content; margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none; }
.play .budgetStrip { position: absolute; top: calc(var(--sat) + 8px); right: max(12px, env(safe-area-inset-right)); width: 240px; max-width: calc(100% - 80px); padding: 6px 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 3px 8px; background: #08284bef; pointer-events: none; }
.budgetLevel { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-bottom: 5px; margin-bottom: 2px; border-bottom: 1px solid #ffffff30; font-size: 12px; }
.budgetLevel b { flex: none; color: var(--gold); }
.budgetLevel span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.budgetStrip .budgetLabel { margin: 0; font-size: 8px; letter-spacing: .4px; }
.budgetStrip .bNums { grid-column: 1; grid-row: 3; }
.budgetStrip .bNums b { font-size: 16px; }
.budgetStrip .budgetStatus { grid-column: 2; grid-row: 2 / 4; margin: 0; text-align: right; font-size: 10px; }
.budgetStrip .bar { grid-column: 1 / -1; margin: 2px 0 0; }
.play:has(.result) .budgetStrip { visibility: hidden; }

/* Navigation on the left cliff, the primary play action on the right. */
.home .homeActions { left: auto; right: max(4%, env(safe-area-inset-right)); bottom: calc(var(--sab) + 24px); width: min(280px, 46%); padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.homeNav { position: absolute; left: max(4%, env(safe-area-inset-left)); bottom: calc(var(--sab) + 24px); width: min(180px, 34%); display: grid; gap: 10px; }
.homeNav .btn { min-height: 48px; padding: 0 8px; gap: 6px; font-size: 14px; }
.home .homeActions .btn.big { min-height: 68px; padding: 10px 14px; gap: 8px; }
.home .homeActions .btn.big strong { font-size: clamp(14px, 2.8cqw, 21px); }
.home .homeActions .playCopy { min-width: 0; }
.home .homeActions .playCopy small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.home .homeActions .btn.big > svg { width: 20px; height: 20px; flex: none; }
@container game (max-width: 400px) {
  .homeNav .btn { font-size: 11px; gap: 4px; }
  .homeNav .btn svg { width: 16px; flex: none; }
  .home .homeActions .btn.big { padding: 8px; gap: 4px; }
  .home .homeActions .btn.big > svg { width: 16px; }
}
