:root {
  --ink: #18271f;
  --ink-soft: #5f6b5e;
  --paper: #f6f3e9;
  --paper-deep: #e6ead7;
  --card: rgba(255, 253, 246, .88);
  --line: rgba(30, 56, 38, .13);
  --green: #2d583c;
  --green-deep: #1e3c2e;
  --gold: #e2b35d;
  --shadow: 0 24px 60px rgba(31, 55, 37, .14);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #dbe2c7; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--ink); font-family: "Plus Jakarta Sans", system-ui, sans-serif; background: radial-gradient(circle at 9% 6%, rgba(244,211,139,.28), transparent 26%), linear-gradient(150deg, #edf0df 0%, #d9e2ce 48%, #f4efdf 100%); }
button, a { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, summary:focus-visible, #settlement-canvas:focus-visible { outline: 3px solid #e2b35d; outline-offset: 3px; }

.ambient { position: fixed; pointer-events: none; border-radius: 50%; filter: blur(4px); opacity: .55; }
.ambient-one { width: 380px; height: 380px; top: 7%; right: -140px; background: rgba(237,190,96,.23); }
.ambient-two { width: 420px; height: 420px; bottom: -170px; left: -110px; background: rgba(88,142,98,.2); }
.settlement-nav { position: sticky; top: 14px; z-index: 10; display: flex; justify-content: space-between; align-items: center; width: min(1400px, calc(100vw - 28px)); margin: 14px auto 0; padding: 12px 16px; border: 1px solid rgba(26,51,35,.1); border-radius: 12px; background: rgba(253,252,246,.83); box-shadow: 0 14px 38px rgba(42,64,40,.12); backdrop-filter: blur(18px); }
.site-brand { font-family: "Fraunces", Georgia, serif; font-size: 21px; font-weight: 700; letter-spacing: -.04em; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-status { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.nav-status i, .live-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #64a86c; box-shadow: 0 0 0 4px rgba(100,168,108,.13), 0 0 18px rgba(100,168,108,.55); }
.games-menu { position: relative; }
.games-menu > summary { list-style: none; padding: 10px 15px; border: 1px solid rgba(28,55,37,.12); border-radius: 999px; background: rgba(255,255,252,.8); color: var(--green-deep); font-size: 12px; font-weight: 800; cursor: pointer; }
.games-menu > summary::-webkit-details-marker { display: none; }
.games-menu > summary::after { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 0 3px 9px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); }
.games-panel { position: absolute; top: 48px; right: 0; width: 290px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(253,252,246,.96); box-shadow: 0 22px 50px rgba(25,52,35,.18); }
.games-heading { display: flex; justify-content: space-between; gap: 14px; padding: 7px 8px 11px; border-bottom: 1px solid var(--line); }
.games-heading span, .games-heading small { color: var(--ink-soft); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.games-heading strong { display: block; margin-top: 4px; font-family: "Fraunces", Georgia, serif; font-size: 17px; }
.games-panel > a { display: grid; gap: 2px; padding: 11px 9px; border-radius: 10px; color: var(--ink); font-size: 12px; font-weight: 800; }
.games-panel > a:hover, .games-panel > a.current { background: #edf3e7; color: var(--green-deep); }
.games-panel > a small { color: var(--ink-soft); font-size: 10px; font-weight: 600; }

.settlement-shell { position: relative; width: min(1400px, calc(100vw - 28px)); margin: 0 auto; padding: 54px 0 36px; }
.game-intro { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin: 0 10px 24px; }
.eyebrow { margin: 0; color: #66805e; font-size: 10px; font-weight: 800; letter-spacing: .15em; line-height: 1.4; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { margin-top: 9px; font-family: "Fraunces", Georgia, serif; font-size: clamp(55px, 7vw, 94px); line-height: .9; letter-spacing: -.065em; }
h1 span { display: inline-block; color: var(--gold); font-size: .34em; vertical-align: top; transform: translate(6px, 2px); }
.lede { max-width: 540px; margin-top: 14px; color: var(--ink-soft); font-size: 17px; line-height: 1.6; }
.intro-note { display: flex; align-items: center; gap: 13px; padding: 13px 17px; border: 1px solid rgba(43,88,60,.13); border-radius: 12px; background: rgba(252,250,239,.7); }
.note-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #e9dfb7; color: #906b31; font-size: 22px; }
.intro-note strong, .intro-note small { display: block; }
.intro-note strong { font-size: 12px; }
.intro-note small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; }

.game-frame { display: grid; grid-template-columns: minmax(0, 1fr) 346px; min-height: 730px; overflow: hidden; border: 1px solid rgba(28,52,36,.14); border-radius: 18px; background: rgba(251,249,239,.66); box-shadow: var(--shadow); }
.world-column { min-width: 0; padding: 14px; background: #314d3b; }
.world-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; min-height: 58px; padding: 0 8px 13px; color: #f5f2de; }
.world-title { display: flex; align-items: center; gap: 11px; }
.world-kicker { display: block; color: rgba(237,241,217,.64); font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.world-title strong { display: block; margin-top: 3px; font-family: "Fraunces", Georgia, serif; font-size: 22px; letter-spacing: -.03em; }
.world-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: rgba(239,243,221,.74); font-family: "DM Mono", monospace; font-size: 11px; }
.world-actions span { padding: 8px 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 8px; background: rgba(10,24,17,.18); }
.world-actions span:nth-child(3) { color: #f6df9c; }
.world-actions span:nth-child(4) { color: #a9d0bc; }
.world-actions button, .quiet-button { padding: 8px 11px; border: 1px solid rgba(231,213,157,.32); border-radius: 8px; background: rgba(231,213,157,.12); color: #f6e4aa; font-size: 11px; font-weight: 800; }
.world-actions button:hover, .world-actions button.is-paused { background: rgba(231,213,157,.28); }
.world-actions button.is-paused#settlement-speed { border-color: rgba(231,213,157,.52); color: #fff1bd; }
.controls-help { position: relative; z-index: 4; }
.controls-help > summary { list-style: none; padding: 8px 10px; border: 1px solid rgba(231,213,157,.22); border-radius: 8px; background: rgba(10,24,17,.18); color: rgba(239,243,221,.82); font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 10px; font-weight: 800; cursor: pointer; }
.controls-help > summary::-webkit-details-marker { display: none; }
.controls-help > summary::after { content: "⌄"; margin-left: 6px; color: #e8c878; }
.controls-help[open] > summary { background: rgba(231,213,157,.22); }
.controls-popover { position: absolute; top: calc(100% + 8px); right: 0; display: grid; gap: 7px; width: 176px; padding: 11px; border: 1px solid rgba(231,213,157,.32); border-radius: 10px; background: rgba(25,46,33,.96); box-shadow: 0 14px 32px rgba(11,26,17,.26); color: #eaf0d8; font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 9px; font-weight: 700; }
.controls-popover span { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
kbd { padding: 2px 5px; border: 1px solid rgba(255,255,255,.24); border-radius: 4px; background: rgba(255,255,255,.1); color: #fff0bd; font-family: "DM Mono", monospace; font-size: 8px; }
.canvas-wrap { position: relative; min-height: 640px; height: calc(100vh - 276px); max-height: 790px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: #a5bd7e; box-shadow: inset 0 0 0 1px rgba(21,43,29,.15), inset 0 18px 50px rgba(28,50,31,.1); }
#settlement-canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#settlement-canvas:active { cursor: grabbing; }
.map-overlay { position: absolute; left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.map-overlay-top { top: 14px; }
.map-overlay-event { top: 54px; justify-content: center; }
.major-event-banner { display: inline-block; padding: 8px 13px; border: 1px solid rgba(255,222,151,.36); border-radius: 99px; background: rgba(35,48,45,.78); color: #fff0bd; box-shadow: 0 8px 24px rgba(19,28,28,.18); font-size: 10px; font-weight: 800; letter-spacing: .04em; opacity: 0; transform: translateY(-5px); transition: opacity 180ms ease, transform 180ms ease; }
.major-event-banner.is-visible { opacity: 1; transform: translateY(0); }
.map-overlay-bottom { bottom: 12px; align-items: center; color: rgba(246,246,225,.7); font-size: 10px; font-weight: 700; flex-wrap: wrap; }
.map-overlay-bottom #settlement-placement-feedback { color: #f8e7aa; font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .02em; }
.map-overlay-bottom #settlement-placement-feedback.is-valid { color: #b9e5a9; }
.map-overlay-bottom #settlement-placement-feedback.is-invalid { color: #ffb1a0; }
.map-chip { padding: 7px 9px; border: 1px solid rgba(255,248,205,.23); border-radius: 7px; background: rgba(27,54,37,.46); color: #fff4c2; font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .08em; }
.map-chip-soft { color: rgba(255,246,207,.76); }
.settlement-toast { position: absolute; left: 50%; top: 50%; z-index: 3; max-width: min(330px, 70%); padding: 12px 16px; border: 1px solid rgba(246,224,151,.36); border-radius: 11px; background: rgba(25,46,33,.9); color: #fff5cf; box-shadow: 0 15px 34px rgba(11,26,17,.22); font-size: 12px; font-weight: 700; text-align: center; opacity: 0; transform: translate(-50%, -20%); transition: opacity 180ms ease, transform 180ms ease; pointer-events: none; }
.settlement-toast.is-visible { opacity: 1; transform: translate(-50%, -50%); }

.side-panel { display: flex; align-self: start; flex-direction: column; width: 100%; height: min(730px, calc(100vh - 90px)); min-height: 0; overflow: auto; background: rgba(253,252,245,.92); }
.side-section { padding: 19px 19px 18px; border-bottom: 1px solid var(--line); }
.supply-section { background: linear-gradient(135deg, rgba(234,240,221,.8), rgba(251,249,239,.4)); }
.section-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 13px; }
.section-label > span { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.section-label small { color: #82917d; font-size: 9px; font-weight: 700; }
.inventory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.population-section { background: rgba(246,241,222,.42); }
.guidance-section { background: linear-gradient(145deg, rgba(232,241,223,.84), rgba(252,250,239,.52)); }
.guidance-section strong { display: block; color: var(--green-deep); font-family: "Fraunces", Georgia, serif; font-size: 20px; line-height: 1.02; }
.guidance-section p { margin-top: 7px; color: #70806f; font-size: 10px; line-height: 1.45; }
.population-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.population-stat { padding: 8px 4px; border: 1px solid rgba(45,88,60,.1); border-radius: 9px; background: rgba(255,255,249,.65); text-align: center; }
.population-stat strong, .population-stat small { display: block; }
.population-stat strong { color: var(--green-deep); font-family: "DM Mono", monospace; font-size: 17px; font-weight: 500; }
.population-stat small { margin-top: 4px; color: #82917d; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.discovery-section { background: linear-gradient(145deg, rgba(248,242,218,.74), rgba(246,247,231,.46)); }
.discovery-intro { margin: -4px 0 12px; color: #7a8877; font-size: 10px; line-height: 1.45; }
.discovery-list { display: grid; gap: 7px; }
.discovery-card { padding: 8px 9px 9px; border: 1px solid rgba(45,88,60,.11); border-radius: 10px; background: rgba(255,255,249,.64); }
.discovery-card.is-known { border-color: rgba(202,157,71,.4); background: rgba(255,248,220,.7); }
.discovery-card-top { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 7px; }
.discovery-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: rgba(206,164,77,.16); color: #b27c32; font-size: 13px; }
.discovery-card.is-known .discovery-icon { background: #e8d49a; color: #7b5d28; }
.discovery-copy strong, .discovery-copy small { display: block; }
.discovery-copy strong { color: #536750; font-size: 10px; }
.discovery-copy small { margin-top: 3px; color: #899586; font-size: 8px; }
.discovery-status { color: #9a7943; font-family: "DM Mono", monospace; font-size: 8px; }
.discovery-card.is-known .discovery-status { color: #63835e; }
.discovery-meter { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #e5e5d6; }
.discovery-meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d3a04d, #f1cf7e); }
.discovery-card.is-known .discovery-meter span { background: linear-gradient(90deg, #78a36d, #c7d890); }
.discovery-card p { margin-top: 6px; color: #7b8877; font-size: 8px; line-height: 1.35; }
.major-event-section { background: linear-gradient(145deg, rgba(62,75,72,.08), rgba(241,235,210,.52)); }
.major-event-section.is-hidden { display: none; }
.major-event-card { padding: 11px; border: 1px solid rgba(181,126,66,.26); border-radius: 11px; background: rgba(255,248,223,.74); }
.major-event-card strong { display: block; color: #70582f; font-family: "Fraunces", Georgia, serif; font-size: 18px; line-height: 1; }
.major-event-card p { margin-top: 7px; color: #7b7765; font-size: 10px; line-height: 1.45; }
.event-prep-line { display: flex; justify-content: space-between; gap: 8px; margin-top: 12px; color: #8c8468; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.event-prep-line b { color: #8a6935; font-family: "DM Mono", monospace; font-size: 9px; font-weight: 500; }
.event-prep-track { height: 5px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: #e2dfcc; }
.event-prep-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c38a43, #e6c472); transition: width 260ms ease; }
.resource-readout { padding: 10px 8px; border: 1px solid rgba(45,88,60,.11); border-radius: 10px; background: rgba(255,255,249,.74); text-align: center; }
.resource-readout[title], #settlement-storage-capacity[title] { cursor: help; }
.resource-symbol { display: block; color: var(--resource-color); font-size: 18px; line-height: 1; }
.resource-label { display: block; margin-top: 6px; color: #82907e; font-size: 9px; font-weight: 700; }
.resource-readout strong { display: block; margin-top: 3px; font-family: "DM Mono", monospace; font-size: 17px; }
.resource-status { display: block; margin-top: 5px; color: #73906d; font-size: 8px; font-weight: 800; letter-spacing: .04em; text-transform: capitalize; }
.resource-readout.supply-abundant { border-color: rgba(96,148,87,.28); background: rgba(234,245,224,.82); }
.resource-readout.supply-adequate { border-color: rgba(45,88,60,.13); }
.resource-readout.supply-low { border-color: rgba(207,162,80,.4); background: rgba(252,243,213,.75); }
.resource-readout.supply-low .resource-status { color: #b07b35; }
.resource-readout.supply-critical { border-color: rgba(190,99,78,.5); background: rgba(250,229,218,.8); }
.resource-readout.supply-critical .resource-status { color: #b35f50; }
.priority-section { background: rgba(248,247,234,.5); }
.priority-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.priority-button { display: grid; justify-items: center; gap: 3px; min-width: 0; padding: 7px 3px; border: 1px solid rgba(45,88,60,.11); border-radius: 9px; background: rgba(255,255,249,.72); color: var(--ink); }
.priority-button:hover { border-color: rgba(187,136,74,.42); background: #fbf1d4; }
.priority-button > span { color: #a77b40; font-size: 14px; line-height: 1; }
.priority-button strong { overflow: hidden; width: 100%; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.priority-button small { color: #789074; font-family: "DM Mono", monospace; font-size: 7px; text-transform: uppercase; }
.priority-button:focus-visible { outline-offset: 2px; }
.priority-button.priority-high { border-color: rgba(194,139,62,.44); background: #fbf1d4; }
.priority-button.priority-high small { color: #aa7132; }
.priority-button.priority-low { opacity: .68; }
.priority-note { margin-top: 8px; color: #87927f; font-size: 9px; line-height: 1.4; }
.objective-list { display: grid; gap: 7px; }
.objective-row { display: grid; grid-template-columns: 19px 1fr auto; align-items: center; gap: 5px; min-height: 28px; color: #5e6b5e; font-size: 11px; }
.objective-check { display: grid; place-items: center; width: 18px; height: 18px; border: 1px solid #a7b69f; border-radius: 50%; color: #80957d; font-size: 13px; }
.objective-row strong { color: #8b9985; font-family: "DM Mono", monospace; font-size: 10px; font-weight: 500; }
.objective-row.is-complete { color: #547852; text-decoration: line-through; }
.objective-row.is-complete .objective-check { border-color: #6e9b69; background: #dfeeda; color: #528253; }

.selected-section { min-height: 206px; background: rgba(241,243,228,.38); }
.empty-selection { padding: 6px 2px; }
.empty-selection strong { display: block; max-width: 220px; margin-top: 8px; font-family: "Fraunces", Georgia, serif; font-size: 22px; line-height: 1; }
.empty-selection p { margin-top: 10px; color: var(--ink-soft); font-size: 11px; line-height: 1.6; }
.selected-head { display: flex; align-items: center; gap: 12px; }
.portrait, .structure-mark, .wildlife-mark { display: grid; place-items: center; flex: 0 0 auto; width: 45px; height: 45px; box-shadow: inset 0 1px rgba(255,255,255,.3); }
.portrait, .wildlife-mark { background-repeat: no-repeat; background-size: 400% 300%; background-position: var(--sprite-x, 0%) var(--sprite-y, 0%); }
.portrait { border-radius: 14px; background-color: var(--portrait, #6c936b); background-image: url("./assets/villagers/villager-atlas-v2.png"); }
.structure-mark { border-radius: 14px; background-color: var(--structure, #b88752); background-image: url("./assets/buildings/building-atlas-v3.png"); background-repeat: no-repeat; background-size: 400% 300%; background-position: var(--sprite-x, 0%) var(--sprite-y, 0%); }
.wildlife-mark { border-radius: 50% 50% 45% 45%; background-color: var(--wildlife, #8b745d); background-image: url("./assets/animals/animal-atlas-v2.png"); }
.selected-head h3 { margin-top: 3px; font-family: "Fraunces", Georgia, serif; font-size: 23px; line-height: 1; }
.selected-head p { margin-top: 4px; color: #778473; font-size: 10px; }
.selected-note { margin: 13px 0; color: #667266; font-size: 11px; font-style: italic; line-height: 1.5; }
.relationship-lines { display: grid; gap: 7px; margin: 11px 0; padding: 9px; border: 1px solid rgba(187,136,74,.16); border-radius: 9px; background: rgba(255,252,233,.5); }
.relationship-lines > div { display: flex; justify-content: space-between; gap: 9px; align-items: baseline; }
.relationship-lines strong { max-width: 170px; color: #667266; font-size: 10px; font-weight: 700; text-align: right; }
.selected-activity { display: flex; align-items: center; gap: 9px; padding: 9px; border: 1px solid rgba(75,110,70,.13); border-radius: 9px; background: rgba(255,255,248,.63); }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; background: #dda953; box-shadow: 0 0 0 4px rgba(221,169,83,.13); }
.activity-dot-danger { background: #c96e59; box-shadow: 0 0 0 4px rgba(201,110,89,.13); }
.selected-activity strong, .selected-activity small { display: block; }
.selected-activity strong { margin-top: 3px; font-size: 11px; }
.selected-activity small { margin-top: 3px; color: #82917d; font-size: 9px; }
.thought-line { display: flex; gap: 5px; align-items: flex-start; margin-top: 10px; color: #768274; font-size: 10px; line-height: 1.45; }
.thought-line > span { color: #bd9350; font-family: "Fraunces", Georgia, serif; font-size: 19px; line-height: .7; }
.thought-line p { font-style: italic; }
.structure-purpose { margin: 10px 0 2px; padding: 9px; border-left: 2px solid #d7ae61; border-radius: 0 8px 8px 0; background: rgba(255,252,233,.5); }
.structure-purpose p { margin-top: 4px; color: #71806f; font-size: 10px; line-height: 1.45; }
.need-stack { display: grid; gap: 7px; margin-top: 12px; }
.need-row { display: grid; grid-template-columns: 66px 1fr 32px; align-items: center; gap: 7px; color: #6b7869; font-size: 9px; }
.need-row b { color: #8b9685; font-family: "DM Mono", monospace; font-size: 9px; font-weight: 500; text-align: right; }
.need-track, .meter-track { height: 5px; overflow: hidden; border-radius: 99px; background: #dfe4d5; }
.need-track i, .meter-track span { display: block; height: 100%; border-radius: inherit; }
.structure-meter { display: grid; gap: 7px; margin-top: 18px; }
.structure-meter > div:last-child { display: flex; justify-content: space-between; color: #7e8c78; font-size: 9px; }
.structure-meter strong { color: var(--ink); font-family: "DM Mono", monospace; font-size: 10px; font-weight: 500; }
.meter-track span { background: #d6a24e; }
.material-lines { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; color: #7e8b78; font-size: 10px; }
.material-lines b { color: var(--ink); font-family: "DM Mono", monospace; font-weight: 500; }
.structure-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.structure-facts > span { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 7px 8px; border: 1px solid rgba(45,88,60,.1); border-radius: 8px; background: rgba(255,255,249,.58); }
.structure-facts small { color: #7e8c78; font-size: 8px; }
.structure-facts b { color: var(--ink); font-family: "DM Mono", monospace; font-size: 9px; font-weight: 500; }
.construction-status { margin-top: 10px; padding: 8px 9px; border-left: 2px solid #d7ae61; border-radius: 0 8px 8px 0; background: rgba(255,252,233,.55); color: #7d745d; font-size: 9px; line-height: 1.45; }
.structure-action { width: 100%; margin-top: 13px; padding: 8px 10px; border: 1px solid rgba(76,111,70,.2); border-radius: 8px; background: #edf3e7; color: #557653; font-size: 9px; font-weight: 800; }
.structure-action:hover { background: #e1eddc; }
.structure-action-danger { border-color: rgba(172,102,77,.2); background: #f7e8df; color: #a4614d; }
.structure-action-danger:hover { background: #f3dbcf; }
.selected-clear { display: block; width: 100%; margin-top: 13px; padding: 7px 10px; border: 1px solid rgba(45,88,60,.14); border-radius: 8px; background: rgba(255,255,249,.72); color: #687b66; font-size: 9px; font-weight: 800; }
.selected-clear:hover { border-color: rgba(187,136,74,.42); background: #fbf1d4; }
.selected-clear kbd { float: right; border-color: rgba(45,88,60,.14); background: rgba(45,88,60,.06); color: #789074; }
.build-menu { display: grid; gap: 7px; }
.build-card { display: grid; grid-template-columns: 31px 1fr auto; align-items: center; gap: 8px; width: 100%; padding: 9px; border: 1px solid rgba(45,88,60,.12); border-radius: 10px; background: rgba(255,255,249,.66); color: var(--ink); text-align: left; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.build-card:hover, .build-card.is-active { border-color: rgba(187,136,74,.5); background: #fbf1d4; transform: translateY(-1px); }
.build-card.is-muted { opacity: .54; }
.build-card-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background-color: color-mix(in srgb, var(--structure) 18%, white); background-image: url("./assets/buildings/building-atlas-v3.png"); background-repeat: no-repeat; background-size: 400% 300%; background-position: var(--sprite-x, 0%) var(--sprite-y, 0%); color: var(--structure); font-size: 0; }
.build-card-copy strong, .build-card-copy small { display: block; }
.build-card-copy strong { font-size: 10px; }
.build-card-copy small { margin-top: 4px; color: #87927f; font-family: "DM Mono", monospace; font-size: 8px; }
.build-card-copy .build-card-status { margin-top: 3px; color: #9b7942; font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 8px; font-weight: 800; }
.build-card.is-muted .build-card-status { color: #aa6f52; }
.build-card-arrow { color: #9a7943; font-size: 10px; font-weight: 800; }
.build-card[aria-disabled="true"] { cursor: help; }
.build-card[aria-disabled="true"]:hover { border-color: rgba(187,136,74,.3); background: #faf2dc; }

.under-frame { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; margin-top: 16px; }
.under-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--card); box-shadow: 0 18px 42px rgba(31,55,37,.08); }
.under-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 16px; }
.under-heading h2 { margin-top: 5px; font-family: "Fraunces", Georgia, serif; font-size: 25px; line-height: 1; letter-spacing: -.04em; }
.under-count { color: #8a9886; font-family: "DM Mono", monospace; font-size: 10px; }
.save-cluster { display: grid; justify-items: end; gap: 5px; }
.save-cluster small { color: #82917d; font-family: "DM Mono", monospace; font-size: 8px; text-align: right; }
.villager-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.villager-row { display: grid; justify-items: center; gap: 7px; padding: 10px 5px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--ink); text-align: center; }
.villager-row:hover, .villager-row.is-selected { border-color: rgba(80,119,75,.22); background: #edf3e7; }
.mini-portrait { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; background-color: var(--portrait); background-image: url("./assets/villagers/villager-atlas-v2.png"); background-repeat: no-repeat; background-size: 400% 300%; background-position: var(--sprite-x, 0%) var(--sprite-y, 0%); color: #fff3d1; font-family: "Fraunces", Georgia, serif; font-size: 0; }
.villager-row-copy strong, .villager-row-copy small { display: block; }
.villager-row-copy strong { font-size: 10px; }
.villager-row-copy small { margin-top: 4px; color: #87927f; font-size: 8px; }
.villager-state { width: 5px; height: 5px; border-radius: 50%; background: #79a36f; }
.villager-state.is-warning { background: #d1785d; box-shadow: 0 0 0 4px rgba(209,120,93,.12); }
.event-log { display: grid; gap: 9px; min-height: 128px; }
.event-item { display: grid; grid-template-columns: 7px 1fr; gap: 9px; align-items: start; }
.event-item > span { width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: #d7a95c; }
.event-item p { color: #6f7a6c; font-size: 10px; line-height: 1.45; }
.quiet-button { border-color: rgba(46,91,59,.15); background: #eff3e8; color: #557154; }
.reset-link { margin-top: 13px; padding: 7px 0; border: 0; background: transparent; color: #9b8570; font-size: 9px; font-weight: 700; }
.reset-link:hover { color: #ae604b; }
.footer-note { margin: 21px 4px 0; color: #7b8876; font-size: 10px; }
code { padding: 2px 5px; border-radius: 4px; background: rgba(255,255,255,.42); font-family: "DM Mono", monospace; font-size: 9px; }

.milestone { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: rgba(24,41,30,.46); backdrop-filter: blur(9px); opacity: 0; pointer-events: none; transition: opacity 240ms ease; }
.milestone.is-visible { opacity: 1; pointer-events: auto; }
.milestone-card { max-width: 510px; padding: 48px 44px 40px; border: 1px solid rgba(255,244,202,.54); border-radius: 20px; background: radial-gradient(circle at 50% 0, rgba(247,208,111,.25), transparent 36%), #f7f1dd; box-shadow: 0 30px 80px rgba(12,30,18,.28); text-align: center; transform: translateY(12px); transition: transform 280ms ease; }
.milestone.is-visible .milestone-card { transform: translateY(0); }
.milestone-spark { display: block; color: #d49d47; font-size: 34px; }
.milestone-card h2 { margin-top: 12px; font-family: "Fraunces", Georgia, serif; font-size: clamp(36px, 7vw, 58px); line-height: .92; letter-spacing: -.06em; }
.milestone-card p:not(.eyebrow) { margin: 16px auto 25px; max-width: 360px; color: #6c7568; font-size: 13px; line-height: 1.7; }
.milestone-card button { padding: 12px 17px; border: 0; border-radius: 9px; background: var(--green); color: #fff8df; font-size: 11px; font-weight: 800; }
.discovery-modal { position: fixed; inset: 0; z-index: 29; display: grid; place-items: center; padding: 18px; background: rgba(24,41,30,.34); backdrop-filter: blur(5px); opacity: 0; pointer-events: none; transition: opacity 220ms ease; }
.discovery-modal.is-visible { opacity: 1; pointer-events: auto; }
.discovery-modal-card { width: min(430px, 100%); padding: 32px 32px 28px; border: 1px solid rgba(255,244,202,.62); border-radius: 18px; background: radial-gradient(circle at 50% 0, rgba(247,208,111,.3), transparent 40%), #fbf4dc; box-shadow: 0 25px 70px rgba(12,30,18,.24); text-align: center; transform: translateY(10px) scale(.98); transition: transform 260ms ease; }
.discovery-modal.is-visible .discovery-modal-card { transform: translateY(0) scale(1); }
.discovery-modal-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 13px; border-radius: 18px; background: #e7cf91; color: #765623; font-size: 28px; box-shadow: 0 0 0 8px rgba(231,207,145,.22); }
.discovery-modal-card h2 { margin-top: 8px; font-family: "Fraunces", Georgia, serif; font-size: clamp(32px, 6vw, 47px); line-height: .94; letter-spacing: -.05em; }
.discovery-modal-card > p:not(.eyebrow) { margin: 13px auto 15px; max-width: 330px; color: #6b7668; font-size: 12px; line-height: 1.6; }
.discovery-reward { margin: 0 auto 21px; padding: 9px 12px; border: 1px solid rgba(187,136,74,.2); border-radius: 9px; background: rgba(255,252,233,.7); color: #7a673b; font-size: 10px; line-height: 1.45; }
.discovery-modal-card button { padding: 11px 17px; border: 0; border-radius: 9px; background: var(--green); color: #fff8df; font-size: 11px; font-weight: 800; }
.storm-milestone { position: fixed; inset: 0; z-index: 31; display: grid; place-items: center; padding: 18px; background: rgba(26,40,40,.5); backdrop-filter: blur(10px); opacity: 0; pointer-events: none; transition: opacity 280ms ease; }
.storm-milestone.is-visible { opacity: 1; pointer-events: auto; }
.storm-milestone-card { width: min(540px, 100%); padding: 48px 44px 40px; border: 1px solid rgba(225,240,214,.48); border-radius: 20px; background: radial-gradient(circle at 50% 0, rgba(193,219,195,.36), transparent 38%), #edf1dd; box-shadow: 0 30px 90px rgba(10,28,28,.36); text-align: center; transform: translateY(12px); transition: transform 300ms ease; }
.storm-milestone.is-visible .storm-milestone-card { transform: translateY(0); }
.storm-milestone-spark { display: block; color: #d5a85c; font-size: 34px; }
.storm-milestone-card h2 { margin-top: 12px; font-family: "Fraunces", Georgia, serif; font-size: clamp(38px, 7vw, 62px); line-height: .9; letter-spacing: -.06em; }
.storm-milestone-card > p:not(.eyebrow) { margin: 17px auto 25px; max-width: 380px; color: #687569; font-size: 13px; line-height: 1.7; }
.storm-milestone-card button { padding: 12px 18px; border: 0; border-radius: 9px; background: var(--green); color: #fff8df; font-size: 11px; font-weight: 800; }

@media (max-width: 1060px) { .game-frame { grid-template-columns: 1fr; } .side-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); height: auto; overflow: visible; } .side-section { border-right: 1px solid var(--line); } .selected-section { grid-column: span 2; } .canvas-wrap { height: min(65vw, 650px); min-height: 520px; } }
@media (max-width: 700px) { .settlement-nav, .settlement-shell { width: min(100% - 18px, 1400px); } .settlement-nav { top: 8px; margin-top: 8px; } .site-brand { font-size: 17px; } .nav-status { display: none; } .settlement-shell { padding-top: 38px; } .game-intro { align-items: start; flex-direction: column; margin: 0 4px 18px; } h1 { font-size: 62px; } .intro-note { width: 100%; } .world-column { padding: 9px; } .world-toolbar { align-items: start; flex-direction: column; gap: 10px; padding-bottom: 10px; } .world-actions { width: 100%; justify-content: space-between; gap: 5px; } .world-actions span { flex: 1; padding-left: 5px; padding-right: 5px; text-align: center; } .controls-help { margin-left: auto; } .controls-popover { right: 0; } .canvas-wrap { height: 92vw; min-height: 390px; } .map-overlay-bottom { font-size: 8px; } .side-panel { display: block; } .side-section { border-right: 0; } .selected-section { min-height: 0; } .under-frame { grid-template-columns: 1fr; } .villager-list { grid-template-columns: repeat(5, minmax(52px, 1fr)); overflow-x: auto; } .under-card { padding: 16px; } .games-panel { position: fixed; top: 68px; right: 9px; width: min(290px, calc(100vw - 18px)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; } }
