html, body { margin: 0; height: 100%; overflow: hidden; background: #38697f; font: 14px/1.3 system-ui, sans-serif; color: #f4f1ea; user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#labels, #overlay { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
/* #134: "Click to play" in a portal's frame while the page around the game has the keyboard (ClickToPlay); every click
   goes through it; never on a touch screen. */
#click-to-play { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; pointer-events: none; display: none; padding: 12px 24px; border-radius: 12px; background: rgba(10,30,40,.85); border: 2px solid rgba(233,196,106,.8); box-shadow: 0 2px 6px rgba(0,0,0,.45); color: #e9c46a; font-size: 22px; font-weight: 700; white-space: nowrap; }
html:not(.touch) #click-to-play.on { display: block; }
/* #134: a scroll in the game never runs on into the portal's page around it. */
html[data-portal], html[data-portal] body { overscroll-behavior: none; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button, #hud .bar { pointer-events: auto; }
#top { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); white-space: nowrap; display: flex; gap: 14px; align-items: center; background: rgba(20,18,14,.6); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
#stock { display: flex; gap: 14px; }
i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; border: 1px solid #0006; vertical-align: -1px; }
#message { position: absolute; top: 34%; width: 100%; text-align: center; font-size: 28px; font-weight: 700; text-shadow: 0 2px 6px #000a; }
#bottom { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars { position: relative; display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.bar { display: flex; gap: 4px; background: rgba(20,18,14,.6); padding: 5px; border-radius: 8px; }
.bar button { display: flex; flex-direction: column; align-items: center; min-width: 74px; padding: 4px 6px; border: 1px solid #0008; border-radius: 6px; background: #5b4a35; color: #f4f1ea; font: inherit; font-size: 12px; cursor: pointer; }
.bar button:hover { background: #75603f; }
/* The building small, as in the game, in your colour. */
.bar button img.icon { width: 32px; height: 32px; margin: 1px 0; }
.bar button img.icon:not([src]) { visibility: hidden; }
.bar button.poor { opacity: .45; }
/* #82: key hints as Primal Isle draws them (client/hud.js drawKey): a small orange cap with dark bold text and a darker
   bottom edge like a key; the bound key in the player's layout. None on a touch screen (html.touch .key). */
.key { display: inline-block; box-sizing: border-box; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 3px; background: #f08c2e; color: #2b1a08; font: 800 10px/15px system-ui, sans-serif; text-align: center; white-space: nowrap; box-shadow: inset 0 -1.5px 0 rgba(90, 40, 0, .45); vertical-align: 1px; }
.key + .key { margin-left: 2px; }
#tutorial .key { margin: 0 1px; }
.bar button { position: relative; }
.bar button .key { position: absolute; top: 2px; left: 2px; }
#selection button .key { margin-right: 5px; }
/* #87/#120: Call army and Clear mark, beside the build strip (desktop; the phone has them as thumb buttons), each only
   while it does something. Right of the build strip (David: "put in on the right side"), outside its box, so the strip
   stays centred. */
.idle { display: none !important; }
#army { position: absolute; left: 100%; margin-left: 12px; top: 50%; transform: translateY(-50%); display: flex; gap: 8px; align-items: center; pointer-events: none; }
#army .army { display: flex; align-items: center; gap: 6px; white-space: nowrap; font: 600 13px/1.2 system-ui, sans-serif; border-radius: 12px; border: 1px solid rgba(233, 196, 106, 0.5); background: #4a6340; color: #f4f1ea; padding: 7px 12px; cursor: pointer; pointer-events: auto; }
#army .army:hover { background: #587a4c; }
#army .army .sym { width: 18px; height: 18px; }
html.touch #army { display: none; }
.name { font-weight: 600; }
.cost { font-size: 11px; white-space: nowrap; display: flex; gap: 6px; justify-content: center; min-height: 14px; }
/* Resources as pictures (berries, logs, rock, coin): top bar, cost lines. */
.amt { display: inline-flex; align-items: center; gap: 2px; }
.amt .sym, .res .sym { width: 16px; height: 16px; flex: none; }
.cost .amt .sym { width: 14px; height: 14px; }
#side { position: absolute; top: 10px; right: 10px; }
#minimap { width: 170px; height: 170px; border-radius: 8px; border: 2px solid rgba(20,18,14,.6); display: block; }
#leaders { position: absolute; top: 10px; left: 10px; width: max-content; min-width: 120px; max-width: 170px; box-sizing: border-box; background: rgba(20,18,14,.6); padding: 6px 10px; border-radius: 8px; font-size: 12px; }
#leaders .title { font-weight: 700; margin-bottom: 3px; white-space: nowrap; }
#leaders .title .count, #board .title .count { font-weight: 400; opacity: .65; margin-left: 4px; }
#leaders .title .key { margin-left: 6px; vertical-align: 1px; }
#leaders .row { display: flex; gap: 4px; white-space: nowrap; }
#leaders .row em { font-style: normal; flex: none; min-width: 1.6em; text-align: right; opacity: .7; }
#leaders .row span { overflow: hidden; text-overflow: ellipsis; }
#leaders .row.mine { color: #ffd86b; font-weight: 700; }
#leaders .gap { opacity: .6; text-align: center; }
#leaders .last, #board .last { color: #ffd86b; margin-bottom: 3px; display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#leaders .last svg, #board .last svg { width: 14px; height: 14px; flex: none; }
/* The big window (#62): every column, centred, while Tab is held (desktop) or after a tap on the rank button. */
#board { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 640px; max-width: calc(var(--page-w, 100vw) - 24px); max-height: calc(var(--page-h, 100vh) - 24px); overflow-y: auto; box-sizing: border-box; background: rgba(20,18,14,.88); border: 1px solid rgba(233,196,106,.5); padding: 14px 18px; border-radius: 12px; font-size: 16px; z-index: 5; }
#board.open { display: block; }
html:not(.touch) #board { pointer-events: auto; }  /* hover shows the column tooltips */
#board .title { font-weight: 700; font-size: 20px; margin-bottom: 6px; }
#board .hint { float: right; font-size: 12px; opacity: .6; }
#board .hint .tch, html.touch #board .hint .desk { display: none; }
html.touch #board .hint .tch { display: inline; }
#board .row { display: grid; grid-template-columns: 1fr 64px 64px 64px 64px 56px 72px; gap: 6px; white-space: nowrap; padding: 2px 0; }
#board .row span { overflow: hidden; text-overflow: ellipsis; }
#board .row b { font-weight: 400; text-align: right; }
#board .row b:last-child { font-weight: 700; }
#board .row.head > * { opacity: .75; }
#board .row.head { font-size: 14px; border-bottom: 1px solid rgba(255,255,255,.2); margin-bottom: 2px; }
#board .row.head b { display: flex; justify-content: flex-end; align-items: center; }
#board .row.head svg { width: 20px; height: 20px; }
#board .row.mine { color: #ffd86b; font-weight: 700; }
#board .gap { opacity: .6; text-align: center; }
/* #93: the window lists every player on the map; when they do not fit it scrolls (wheel, or a finger on a phone: a
   drag scrolls, a tap closes), its column heads stay at the top and your own row stays in sight, at the top or bottom. */
#board { overscroll-behavior: contain; }
html.touch #board { pointer-events: auto; touch-action: pan-y; }
#board .row.head { position: sticky; top: 0; z-index: 2; background: #1d1a15; box-shadow: 0 -14px 0 #1d1a15; }
#board .row.mine { position: sticky; top: 25px; bottom: 0; z-index: 1; background: #2a251b; }
html.touch #board { font-size: 13px; padding: 10px 12px; }
html.touch #board .title { font-size: 16px; }
html.touch #board .row { grid-template-columns: 1fr 44px 36px 40px 40px 30px 46px; gap: 3px; }
html.touch.portrait #board { font-size: 11.5px; padding: 10px 8px; } html.touch.portrait #board .row { grid-template-columns: 1fr 38px 28px 34px 38px 24px 42px; gap: 2px; } html.touch.portrait #board .row.head svg { width: 16px; height: 16px; }
.sym { width: 16px; height: 16px; display: block; }
/* What just happened to you (#37): a line that fades; gold won bursts into coins. */
#news { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
#news .headline { position: relative; font-size: 22px; font-weight: 700; color: #ffd86b; text-shadow: 0 2px 6px #000c; white-space: nowrap; animation: headline 4.5s ease-in forwards; }
#news .coin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border: 0; border-radius: 0; animation: coin 1.1s ease-out forwards; }
#news .coin .sym { width: 18px; height: 18px; }
/* #120: what an army button does, said once: plain, smaller, wrapping on a narrow screen. */
#news .headline.hint { font-size: 16px; font-weight: 600; color: #f4f1ea; white-space: normal; max-width: min(520px, 86vw); text-align: center; }
@keyframes headline { 0% { opacity: 0; transform: scale(.8); } 8% { opacity: 1; transform: scale(1.06); } 14% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes coin { 0% { transform: translate(0, 0) scale(.6); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; } }
html.touch #news .headline { font-size: 16px; }
html.touch #news .headline.hint { font-size: 14px; }
/* The death line (#42): what felled you, then what happens now and the gold taken. */
#message .then { font-size: 17px; font-weight: 600; margin-top: 6px; opacity: .9; }
#message .gold { color: #ffd86b; }
html.touch #message .then { font-size: 13px; }
/* The kill feed (#42): top right under the minimap. */
#feed { position: absolute; top: 196px; right: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; pointer-events: none; }
#feed .kill { display: flex; align-items: center; gap: 5px; background: rgba(20,18,14,.6); padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; animation: feed 6s linear forwards; }
#feed .kill b { opacity: .7; font-weight: 400; }
/* #74: an alarm's line, in its colour (red: attack, orange: on your land), with a bar of it. */
#feed .kill.alarm { border: 2px solid currentColor; } /* the same width all round (David: "like on the left side the linewith is bigger") */
@keyframes feed { 0% { opacity: 0; } 5% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
/* Under the rank button (#78: it stood on the feed): rank top 112 + 54 high + 6. */
html.touch #feed { top: 112px; right: 8px; }
/* #79: a phone held sideways: the right column belongs to the minimap, the rank button and below them the thumb
   buttons around the attack stick; the feed goes top left under the resource bar (three lines). */
html.touch.landscape #feed { top: 100px; left: 8px; right: auto; align-items: flex-start; }
html.touch.landscape #feed .kill:nth-last-child(n+4) { display: none; }
/* While a wheel is open the feed waits (it would lie on the wheel). */
#hud.wheel #feed { visibility: hidden; }
html.touch #feed .kill { font-size: 10px; padding: 2px 6px; }
/* A phone held sideways: the banner steps aside for the chip. */
html.touch.landscape #bottom:has(#selection.open) #tutorial { display: none; }
.res { display: inline-flex; align-items: center; gap: 2px; }
.vil { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 6px; border-radius: 9px; background: rgba(255,255,255,.12); font-size: 11px; font-weight: 600; }
.vil .sym { width: 14px; height: 14px; color: var(--accent, #d9473a); }
#stats { position: absolute; bottom: 8px; left: 10px; font-size: 11px; opacity: .8; text-shadow: 0 1px 3px #000; }
#tutorial { display: none; margin-bottom: 44px; align-items: center; gap: 10px; pointer-events: auto; background: #14120e; border: 2px solid #ffd86b; padding: 7px 8px 7px 14px; border-radius: 10px; font-size: 15px; font-weight: 600; }
#tutorial.open { display: flex; }
#tutorial small { color: #ffd86b; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-right: 6px; }
#tutorial .head { font-size: 12px; font-weight: 500; opacity: .85; }
#tutorial .goal { font-size: 17px; font-weight: 700; margin-top: 2px; }
#tutorial { transition: border-color .2s, box-shadow .2s; }
#tutorial.done { border-color: #5ee07a; box-shadow: 0 0 16px #5ee07a; }
#tutorial button { background: none; border: 0; color: #f4f1ea; font-size: 15px; cursor: pointer; opacity: .7; padding: 2px 6px; }
#tutorial button:hover { opacity: 1; }
/* #35: what the tutorial points at pulses orange, the arrow's colour, once a second (as labels.rs Pulse). */
/* #129 part B: the tutorial's row in pictures: how (the gesture), the thing, an arrow, what you get, how far. */
#tutorial .story { display: flex; align-items: center; gap: 6px; flex: none; }
#tutorial .story svg.gest { height: 48px; width: auto; flex: none; }
#tutorial .story img.thing { width: 48px; height: 48px; flex: none; }
#tutorial .story .mark { display: inline-flex; align-items: center; gap: 2px; color: #f4f1ea; font-size: 16px; font-weight: 800; }
#tutorial .story .mark svg.sym { width: 38px; height: 38px; }
#tutorial .story .mark.big svg.sym { width: 50px; height: 50px; }
#tutorial .story .to { font-size: 22px; line-height: 1; color: #ffd86b; }
#tutorial .dots { display: inline-flex; gap: 4px; align-items: center; margin-left: 2px; }
#tutorial .dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #f08c2e; box-sizing: border-box; }
#tutorial .dot.on { background: #f08c2e; }
#tutorial .bar { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; }
#tutorial .bar svg.sym { width: 18px; height: 18px; }
#tutorial .bar .fill { display: inline-block; width: 56px; height: 10px; border-radius: 5px; background: rgba(244,241,234,.18); border: 1px solid #f4f1ea; overflow: hidden; }
#tutorial .bar .fill i { display: block; height: 100%; background: #f08c2e; }
#tutorial .bar small { font-size: 11px; color: #f4f1ea; text-transform: none; letter-spacing: 0; margin: 0; font-weight: 700; }
svg.gest .blink { animation: tutblink 1s ease-in-out infinite; }
svg.gest .grow { animation: tutgrow 1.2s linear infinite; transform-box: view-box; }
@keyframes tutblink { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes tutgrow { 0% { transform: scale(.15); } 100% { transform: scale(1); } }
@keyframes tut { 0%, 100% { box-shadow: 0 0 0 2px rgba(240,140,46,.55), 0 0 6px rgba(240,140,46,.35); } 50% { box-shadow: 0 0 0 4px #f08c2e, 0 0 16px #f08c2e; } }
.bar button.tut, #leaders.tut, #rank.tut, #army .army.tut, #selection button.tut, #nudge button.tut, #zoom button.tut { border-color: #f08c2e; animation: tut 1s ease-in-out infinite; }
/* #129 part C: the walked wall's ✓ (its border is set inline) */
#walkbar button.tut { border-color: #f08c2e !important; animation: tut 1s ease-in-out infinite; }
/* The round buttons as in Primal Isle (David: "the fullscreen and sound button and a settingsbutton has to go to the
   same place as in primalisle"): a row at the top directly left of the minimap, nearest the map first: settings
   (gear), sound, fullscreen (hidden where the browser forbids it); icons: Lucide, ISC License. */
#corner { position: absolute; top: 12px; right: 192px; display: flex; flex-direction: row-reverse; align-items: center; gap: 8px; pointer-events: auto; }
#hud .round { width: 40px; height: 40px; padding: 0; margin: 0; border-radius: 50%; background: rgba(10, 30, 40, 0.55); border: 1px solid rgba(233, 196, 106, 0.5); display: flex; align-items: center; justify-content: center; cursor: pointer; }
#hud .round.hidden { display: none; }
#hud .round.on { background: rgba(233, 196, 106, 0.35); }
.round svg { width: 22px; height: 22px; fill: none; stroke: #e9c46a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#fullscreen .fs-off, #fullscreen.on .fs-on, #sound .snd-off, #sound.muted .snd-on { display: none; }
#fullscreen.on .fs-off, #sound.muted .snd-off { display: inline; }
/* Settings: one panel under the row (closes on a click elsewhere or Esc): volume, mute, your colour, tutorial. */
#settings { display: none; position: absolute; top: 60px; right: 192px; width: 260px; box-sizing: border-box; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: rgba(10, 30, 40, 0.92); border: 1px solid rgba(233, 196, 106, 0.5); font-size: 13px; font-weight: 600; pointer-events: auto; }
#settings.open { display: flex; }
/* Label | slider | number: the number has a column of its own, wide enough for "100 %" (David: "valume % is
   overlapping"). */
.volume { display: grid; grid-template-columns: auto minmax(0, 1fr) 4.2em; align-items: center; column-gap: 10px; }
.volume input { width: 100%; min-width: 0; margin: 0; padding: 0; height: 26px; accent-color: #e9c46a; cursor: pointer; }
.volume output { white-space: nowrap; text-align: right; font-size: 13px; color: #b9c7a8; }
/* Name: label | field; Apply with a line under it for the wait ("Next change in 4:32") or what is wrong. */
.name { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; }
.name input { box-sizing: border-box; width: 100%; min-width: 0; margin: 0; font: inherit; font-size: 14px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(233, 196, 106, 0.5); background: rgba(244, 241, 234, 0.95); color: #222; user-select: text; }
/* #95: Server: label | the choice (Auto or one server with its ping); shown only when there is more than one. */
.server { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 10px; }
.server[hidden] { display: none; }
.server select { box-sizing: border-box; width: 100%; min-width: 0; margin: 0; font: inherit; font-size: 13px; padding: 5px 6px; border-radius: 6px; border: 1px solid rgba(233, 196, 106, 0.5); background: rgba(244, 241, 234, 0.95); color: #222; cursor: pointer; }
#settings-apply { font: inherit; font-size: 14px; font-weight: 700; padding: 8px 10px; border-radius: 8px; border: 1px solid #0008; background: #c9952f; color: #1d160b; cursor: pointer; }
#settings-apply[disabled] { opacity: .55; cursor: default; }
#settings-note { text-align: center; }
/* #82: General | Keys. The Keys tab hides the general part and lists every action with its cap (as Primal Isle's). */
#settings-tabs { display: flex; gap: 4px; }
#settings-tabs button { flex: 1; font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(233, 196, 106, 0.35); background: transparent; color: #d9d2c2; cursor: pointer; }
#settings-tabs button.on { background: rgba(233, 196, 106, 0.25); border-color: rgba(233, 196, 106, 0.7); color: #f4f1ea; }
#settings-keys { display: none; flex-direction: column; gap: 8px; min-height: 0; }
html:not(.touch) #settings.keys { width: 330px; }
html:not(.touch) #settings.keys > :not(#settings-tabs):not(#settings-keys) { display: none; }
html:not(.touch) #settings.keys #settings-keys { display: flex; }
#key-list { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; max-height: min(58vh, 520px); overflow-y: auto; padding-right: 4px; }
#key-list h4 { grid-column: 1 / -1; margin: 6px 0 0; font-size: 12px; color: #e9c46a; text-transform: uppercase; letter-spacing: .05em; }
#key-list h4:first-child { margin-top: 0; }
.key-cap { margin: 0; min-width: 96px; padding: 3px 10px; border-radius: 5px; font: 800 13px system-ui, sans-serif; background: #f08c2e; color: #2b1a08; border: 0; border-bottom: 3px solid rgba(90, 40, 0, 0.5); cursor: pointer; }
.key-cap.fixed { background: #4a5a44; color: #d9e2cf; border-bottom-color: rgba(0, 0, 0, 0.35); cursor: default; }
.key-cap.wait { background: #e9c46a; outline: 2px solid #fff3c4; }
#key-note { margin: 0; min-height: 1.3em; color: #e9c46a; text-align: center; }
.key-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.key-actions button { font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(233, 196, 106, 0.5); background: #4a6340; color: #f4f1ea; cursor: pointer; }
.key-actions button[disabled] { opacity: .5; cursor: default; }
html.touch #settings-tabs, html.touch #settings-keys { display: none; }
.mute { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.mute input { width: 18px; height: 18px; margin: 0; accent-color: #e9c46a; cursor: pointer; }
#tutorial-again { font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(233, 196, 106, 0.5); background: #4a6340; color: #f4f1ea; cursor: pointer; }
/* #48: Start over; the first tap swaps it for the question in the same place. */
#start-over, #start-over-yes, #start-over-no { font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(233, 196, 106, 0.5); background: #7a3328; color: #f4f1ea; cursor: pointer; }
#start-over[disabled] { opacity: .55; cursor: default; }
#start-over.hidden { display: none; }
#start-over-ask { display: none; grid-template-columns: 1fr 1fr; gap: 6px; text-align: center; }
#start-over-ask.open { display: grid; }
#start-over-ask span { grid-column: 1 / -1; color: #e9c46a; }
#start-over-no { background: #4a6340; }
#sticks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#game { touch-action: none; }
/* Desktop: the rank button and the cross for building belong to the touch layout. */
#rank, #hud #cancel { display: none; }
/* A narrow desktop: the row goes under the resource bar when it would reach it. */
@media (max-width: 1250px) { html:not(.touch) #corner { top: 58px; } html:not(.touch) #settings { top: 106px; } }
/* Room above the bar for the tutorial's arrow at a build button. */
/* #129 part B: room for the arrow and its plate above the lit build button (nothing between or under them). */
#bottom.lit #tutorial { margin-bottom: 170px; }

/* ---------- Touch: compact HUD (#19), landscape first ---------- */
html.touch #top { top: 6px; padding: 3px 8px; gap: 8px; font-size: 12px; border-radius: 7px; }
html.touch #stock { gap: 6px; }
html.touch #top .res .sym { width: 11px; height: 11px; }
html.touch .vil { margin-left: 3px; padding: 0 4px; font-size: 10px; }
html.touch .vil .sym { width: 12px; height: 12px; }
/* #90: the population as a symbol and count; red when full, blinking when someone tries to train more. */
/* David 2026-12-04: "is the pop limit aligned wit the amounts?": centred in the bar like the amounts, not on a text line */
#population { display: flex; align-items: center; }
#population .pop { display: inline-flex; align-items: center; gap: 3px; }
#population .sym { width: 18px; height: 18px; color: #f4f1ea; }
#population.full .pop, #population.full .sym { color: #ff5a4e; }
/* #109: on #population itself, which stays; its .pop is redrawn with every new number and would blink again. */
#population.refused-a { animation: refused-a .9s steps(2, jump-none) 3; }
#population.refused-b { animation: refused-b .9s steps(2, jump-none) 3; }
@keyframes refused-a { 0% { opacity: 1; } 50% { opacity: .15; } 100% { opacity: 1; } }
@keyframes refused-b { 0% { opacity: 1; } 50% { opacity: .15; } 100% { opacity: 1; } }
html.touch #population .sym { width: 14px; height: 14px; }
html.touch #stats { display: none; }
html.touch #message { font-size: 18px; }
html.touch #corner { top: 8px; right: 116px; gap: 6px; }
html.touch #settings { top: 56px; right: 116px; }
html.touch #side { top: 8px; right: 8px; }
html.touch #minimap { width: 96px; height: 96px; }
/* Touch: the rank button under the minimap (the row of round buttons takes the top left of the map). */
html.touch #rank { display: grid; grid-template-columns: auto auto; align-content: center; align-items: baseline; column-gap: 5px; line-height: 1.05; position: absolute; top: 40px; left: 8px; height: 54px; box-sizing: border-box; padding: 0 12px; border-radius: 8px; background: rgba(20,18,14,.6); border: 2px solid rgba(20,18,14,.6); color: #ffd86b; font: inherit; font-size: 14px; font-weight: 700; pointer-events: auto; }
html.touch #rank b { text-align: right; }
html.touch #rank:empty { display: none; }
html.touch #hud:has(#settings.open) #rank { display: none; } /* the open settings window covers that corner */
html.touch #rank small { font-size: 10px; font-weight: 600; color: #f4f1ea; opacity: .8; text-transform: uppercase; }
/* Touch: the rank button replaces the list; a tap on it opens #board. */
html.touch #leaders { display: none; }
html.touch #bottom { left: 150px; right: 150px; bottom: 4px; gap: 6px; }
/* #79: no build strip on touch (the Build button opens a wheel); the banner, the chip and the cross keep between the
   move stick and the thumb buttons (their arc reaches 207 px in from the right edge). */
html.touch #build { display: none; }
html.touch.landscape #bottom { right: 213px; }
html.touch .bars { flex-wrap: nowrap; max-width: 100%; gap: 6px; align-items: center; }
html.touch #build { overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 4px; }
html.touch #build::-webkit-scrollbar { display: none; }
html.touch .bar button { flex: none; min-width: 60px; padding: 3px 4px; font-size: 11px; }
html.touch .bar button img.icon { width: 24px; height: 24px; margin: 0; }
html.touch .key { display: none; }
html.touch #hud #cancel { display: none; flex: none; }
html.touch #hud #cancel.open { display: flex; }
html.touch #tutorial { margin-bottom: 8px; max-width: 100%; box-sizing: border-box; padding: 4px 4px 4px 10px; font-size: 13px; gap: 4px; }
html.touch #tutorial .why { display: none; }
html.touch #tutorial .head, html.touch #tutorial .goal { display: inline; }
html.touch #tutorial .goal { font-size: 14px; }
html.touch #tutorial .story { gap: 3px; margin-right: 4px; }
html.touch #tutorial .story svg.gest, html.touch #tutorial .story img.thing { height: 36px; }
html.touch #tutorial .story img.thing { width: 36px; }
html.touch #tutorial .story .mark svg.sym { width: 28px; height: 28px; }
html.touch #tutorial .story .mark.big svg.sym { width: 36px; height: 36px; }
html.touch #tutorial .story .to { font-size: 17px; }
html.touch #tutorial .bar .fill { width: 36px; }
html.touch #bottom.lit #tutorial { margin-bottom: 8px; }
/* Landscape phone: the resource bar keeps to the left so it ends before the round buttons (it is centred on a desktop and
   would reach the fullscreen button at 844 px). The banner may take two lines between the sticks. */
html.touch.landscape #top { left: 8px; transform: none; }
/* Portrait: the resource bar alone on the top row, the buttons and the minimap below it; the sticks and the thumb buttons
   rest in the bottom corners, the banner, the chip and the cross above them. */
html.touch.portrait #top { left: 6px; right: 6px; transform: none; justify-content: center; }
html.touch.portrait #corner, html.touch.portrait #side { top: 40px; }
html.touch.portrait #settings { top: 88px; }
html.touch.portrait #rank { top: 88px; }
html.touch.portrait #feed { top: 144px; }
/* #20: upright the headlines go below the feed (at most four lines), above the winner card; at 22 % they ran into
   the alarm lines. */
html.touch.portrait #feed .kill:nth-last-child(n+5) { display: none; }
html.touch.portrait #news { top: 30%; }
/* The alarm arrows keep below the headlines (app.rs `draw_alarms`): room for an arrow turned aside, its barbs lie wider than its tip. */
#news { padding-bottom: 12px; }
/* #20 landscape: the winner card compact, below the headline and above the tutorial (the alarm arrows keep below a
   headline while it shows, as below the feed). */
html.touch.landscape #winner { align-items: flex-start; padding-top: 120px; box-sizing: border-box; }
html.touch.landscape #winner .card { padding: 8px 14px; column-gap: 12px; row-gap: 5px; width: min(360px, 60vw); }
html.touch.landscape #winner-map { width: 112px; height: 112px; }
html.touch.landscape #winner-title, html.touch.landscape #winner.yours #winner-title { font-size: 16px; }
html.touch.landscape #winner-name { font-size: 17px; }
html.touch.landscape #winner-name .sym { width: 20px; height: 20px; }
html.touch.landscape #winner-stats { font-size: 13px; }
html.touch.landscape #winner-closes { font-size: 11px; }
html.touch.landscape #hud #winner-new, html.touch.landscape #hud #winner-share { font-size: 15px; padding: 6px; }
html.touch.portrait #bottom { left: 6px; right: 6px; bottom: 216px; }
html.touch.portrait #zoom { top: 88px; }

/* ---------- #79: the phone's thumb buttons (as Primal Isle's touch buttons), zoom and orientation ---------- */
#pad, #zoom, #hud #orient { display: none; }
html.touch #pad { display: block; }
html.touch #hud #orient { display: flex; }
html.touch #zoom { display: flex; position: absolute; top: 56px; right: 116px; gap: 6px; }
#hud .round.small { width: 32px; height: 32px; }
#hud .round.small svg { width: 18px; height: 18px; }
#pad .thumb { position: absolute; box-sizing: border-box; padding: 0; margin: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: rgba(15, 22, 12, 0.45); border: 2px solid rgba(244, 241, 230, 0.45); color: #f4f1e6; font: 700 9px/1 system-ui, sans-serif;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
#pad .thumb svg { width: 20px; height: 20px; fill: none; stroke: #f4f1e6; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#pad .thumb:active { background: rgba(233, 196, 106, 0.55); border-color: #e9c46a; }
#pad .thumb.on { background: rgba(233, 196, 106, 0.3); border-color: #e9c46a; }
#pad .thumb.tut { border-color: #f08c2e; animation: tut 1s ease-in-out infinite; }
/* The Build button is the canvas' (Touch): a finger on it opens the wheel and slides on into it without lifting. */
html.touch #hud #build-open { pointer-events: none; }
/* #79: the arrows, check and cross around a dropped building's ghost (placed by the game, nudge.rs). */
#nudge { display: none; }
html.touch #nudge.open { display: block; }
#nudge button { position: absolute; box-sizing: border-box; padding: 0; margin: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(15, 22, 12, 0.55); border: 2px solid rgba(244, 241, 230, 0.6); touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
#nudge button svg { width: 62%; height: 62%; fill: none; stroke: #f4f1e6; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
#nudge button:active { background: rgba(233, 196, 106, 0.55); border-color: #e9c46a; }
#nudge #nudge-build { background: rgba(46, 125, 50, 0.85); border-color: #a5e39a; }
#nudge #nudge-cancel { background: rgba(140, 40, 30, 0.8); border-color: #f0a59a; }
/* A finger held on the minimap shows the overview. */
html.touch #minimap { pointer-events: auto; touch-action: none; }
/* The page turned by 90 degrees where the screen cannot be locked (iPhone): its top along the screen's right edge. */
html.turned body { position: fixed; top: 0; left: 0; width: var(--page-w); height: var(--page-h); transform-origin: 0 0; transform: translateX(100vw) rotate(90deg); }
#net { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); background: rgba(120,30,20,.8); padding: 6px 14px; border-radius: 8px; font-weight: 700; }
#net.hidden { display: none; }
/* #20: the map is captured: the winner's card (gold) or who won, and on to a new map. */
#winner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
#winner.hidden { display: none; }
#winner .card { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 28px; background: rgba(20,18,14,.84); border: 2px solid rgba(233,196,106,.5); border-radius: 14px; width: min(360px, 86vw); box-sizing: border-box; text-align: center; }
/* #116: the picture of the won map (the owners' land, the winner's bright), the words, Share (the winner) and on: the
   title above, the picture left of the words, the buttons below (low enough to keep clear of the headline, the feed,
   the tutorial and the thumb buttons). */
#winner .card { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "title title" "map words" "actions actions"; align-items: center; column-gap: 18px; row-gap: 12px; width: min(500px, 86vw); }
#winner-title { grid-area: title; }
#winner-map { grid-area: map; width: 200px; height: 200px; border-radius: 8px; border: 1px solid rgba(233,196,106,.45); display: block; }
#winner .words { grid-area: words; display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* The longest name (12 letters, wide ones) wraps inside the card instead of running out of it. */
#winner .words { min-width: 0; }
#winner-name { flex-wrap: wrap; justify-content: center; }
#winner-name span { overflow-wrap: anywhere; min-width: 0; }
#winner .actions { grid-area: actions; display: flex; gap: 8px; width: 100%; }
#hud #winner-share { font: inherit; font-size: 19px; font-weight: 700; padding: 10px 16px; border: 1px solid #ffd86b; border-radius: 8px; background: rgba(255,216,107,.12); color: #ffd86b; cursor: pointer; }
#hud #winner-share.hidden { display: none; }
html.touch #winner .card { column-gap: 14px; row-gap: 8px; padding: 12px 16px; width: min(360px, 86vw); }
html.touch #winner-map { width: 132px; height: 132px; }
html.touch #winner .words { gap: 6px; }
html.touch #winner-name { font-size: 18px; gap: 4px 6px; }
#winner-stats { flex-direction: column; gap: 2px; }
html.touch #winner-stats { font-size: 14px; }
html.touch #hud #winner-new, html.touch #hud #winner-share { font-size: 16px; padding: 8px 12px; }
#winner.yours .card { border-color: #ffd86b; box-shadow: 0 0 28px rgba(255,216,107,.5); }
#winner-title { margin: 0; font-size: 22px; }
#winner.yours #winner-title { color: #ffd86b; font-size: 28px; }
#winner-name { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; }
#winner-name .sym { width: 28px; height: 28px; }
#winner-stats { display: flex; font-size: 16px; font-weight: 600; }
#winner-closes { margin: 0; font-size: 13px; opacity: .85; }
#hud #winner-new { flex: 1; width: 100%; font: inherit; font-size: 19px; font-weight: 700; padding: 10px; border: 1px solid #0008; border-radius: 8px; background: #c9952f; color: #1d160b; cursor: pointer; }
html.touch #winner-title { font-size: 19px; }
html.touch #winner.yours #winner-title { font-size: 23px; }
#join { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(#4b6a2c, #22301a); z-index: 10; }
#join.hidden { display: none; }
/* #89: links to the privacy policy and terms, small, in the settings and on the join card. */
.legal { margin: 2px 0 0; font-size: 11px; opacity: .75; text-align: center; }
.legal a { color: inherit; }
#join .card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 28px 32px; background: rgba(20,18,14,.7); border-radius: 14px; width: min(340px, 86vw); box-sizing: border-box; }
#join h1 { margin: 0; font-size: 30px; }
#join button { width: 100%; font: inherit; font-size: 20px; font-weight: 700; padding: 10px; border: 1px solid #0008; border-radius: 8px; background: #c9952f; color: #1d160b; cursor: pointer; }
#join-status { margin: 0; min-height: 1.3em; text-align: center; }
/* #123: under the place in line: the game starts by itself. */
#join-hint { margin: 0; font-size: 14px; opacity: .8; text-align: center; }
#join-hint:empty { display: none; }
/* #124: in line, a button per other server with room ("Play now on Singapore – ping 180 ms"), lighter than the card's own. */
#join-elsewhere { display: flex; flex-direction: column; gap: 8px; width: 100%; }
#join-elsewhere:empty { display: none; }
#join #join-elsewhere button { font-size: 16px; font-weight: 600; background: #e9dcc0; }

/* Your colour: a hue slider (the whole circle at the game's saturation and lightness) beside your hero in it. */
.hue-slider { -webkit-appearance: none; appearance: none; height: 14px; border-radius: 7px; border: 1px solid #0008; margin: 0; padding: 0; cursor: pointer;
  background: linear-gradient(to right, hsl(0,62%,52%), hsl(60,62%,52%), hsl(120,62%,52%), hsl(180,62%,52%), hsl(240,62%,52%), hsl(300,62%,52%), hsl(360,62%,52%)); }
.hue-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #f4f1ea; border: 2px solid #1d160b; }
.hue-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #f4f1ea; border: 2px solid #1d160b; }
.hue-note { margin: 0; font-size: 12px; color: #e9c46a; min-height: 1em; }
.hue { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; column-gap: 10px; row-gap: 2px; }
.hue canvas { width: 32px; height: 32px; grid-row: 1 / 3; }
.hue .hue-slider { width: 100%; }
.hue .hue-note { grid-column: 2; font-size: 11px; }

/* Portal mode (#30, <html data-portal>): the portal's frame has its own full screen. */
html[data-portal] #fullscreen { display: none !important; }
#settings-note:empty { display: none; }
/* A phone held sideways has little height: the panel lays out in two columns, so it ends above the tutorial. */
html.touch.landscape #settings.open { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 500px; gap: 8px 14px; padding: 10px 12px; }
html.touch.landscape #settings-note, html.touch.landscape #start-over-ask { grid-column: 1 / -1; }

/* #25: how many units the rectangle chose; a press clears them */
#selection { display: none; align-self: center; align-items: center; gap: 8px; margin: 0 0 6px; padding: 4px 6px 4px 12px; border-radius: 16px; background: rgba(20, 28, 36, 0.82); color: #fff; font: 600 13px/1.2 system-ui, sans-serif; pointer-events: auto; }
#selection.open { display: flex; }
#selection button { font: inherit; border-radius: 12px; border: 1px solid rgba(233, 196, 106, 0.5); background: #4a6340; color: #f4f1ea; padding: 5px 12px; cursor: pointer; }
#selection #selection-clear { padding: 5px 9px; background: transparent; }
html.touch #selection button { padding: 7px 14px; }
