/* civsg panels stage: City View, Advisors, Explorer, Almanac, Find my town, Quests, the dock, Tour,
   town card and share modals. Paper on the walnut table; tokens from tokens.css. No UI text under 12 px,
   tap targets 44 px, no horizontal overflow. */

/* ---------------------------------------------------------------- panel widths (desktop) */
@media (min-width: 701px) {
  .panel[data-panel="city"], .panel[data-panel="findmytown"], .panel[data-panel="quests"], .panel[data-panel="hub"] { width: min(440px, calc(100% - 2 * var(--gap) - 96px)); }
  .panel[data-panel="advisors"] { width: min(500px, calc(100% - 2 * var(--gap) - 96px)); }
  .panel[data-panel="almanac"] { width: min(560px, calc(100% - 2 * var(--gap) - 96px)); }
  .panel[data-panel="explorer"] { width: min(720px, calc(100% - 2 * var(--gap) - 96px)); }
}
.panel-body { overflow-x: hidden; }

/* ---------------------------------------------------------------- shared bits */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pn-lede { font-size: var(--text-14); color: var(--ink-2); margin: 0 0 14px; line-height: var(--leading-body); }
.pn-note { font-size: var(--text-12); color: var(--ink-3); margin: 6px 0; line-height: 1.45; }
.pn-block { margin: 18px 0 0; }
.pn-block > h3, .pn-pane h3, .cz-head h3 { margin: 0 0 6px; font: 700 var(--text-16) / 1.2 var(--font-display); letter-spacing: -0.005em; }
.pn-block p { margin: 0 0 8px; font-size: var(--text-14); line-height: var(--leading-body); }

.n { font-variant-numeric: var(--num); }
.n-src { color: inherit; text-decoration: none; background-image: linear-gradient(90deg, currentColor 40%, transparent 0); background-size: 4px 1px; background-repeat: repeat-x; background-position: 0 100%; padding-bottom: 1px; }
.n-src:hover { color: var(--accent); }
/* a narrow figure ("6") still gets a 24 px hit area (44 px on touch), centred on it, without moving the text */
.n-src { position: relative; }
.n-src::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 24px); height: max(100%, 24px); transform: translate(-50%, -50%); }
@media (pointer: coarse) {
  .n-src::after { width: max(100%, 44px); height: max(100%, 44px); }
}
.src-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 8px 0 0; }
.src-k { font-size: var(--text-12); color: var(--ink-3); text-transform: uppercase; letter-spacing: var(--tracking-caps); margin-right: 2px; }
.src-chip { font-size: var(--text-12); color: var(--ink-2); text-decoration: none; padding: 2px 8px; border-radius: var(--r-pill); background: var(--paper-2); border: 1px solid var(--hairline); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-chip:hover { border-color: var(--ink-3); color: var(--ink); }
/* (after the base rule, so it wins) touch: a 44 px tap target that still looks like the small chip; the extra
   6 px each side is a transparent border outside the painted pill (background and hairline on the padding box) */
@media (pointer: coarse) {
  .src-chip { display: inline-block; line-height: 24px; padding: 4px 10px; vertical-align: middle; border: 6px solid transparent; background-clip: padding-box; box-shadow: inset 0 0 0 1px var(--hairline); margin: 0 -3px; }
  .src-chip:hover { border-color: transparent; box-shadow: inset 0 0 0 1px var(--ink-3); }
  .src-row { gap: 0 6px; }
}
.pn-link { border: 0; background: none; color: var(--accent); padding: 10px 0; min-height: 44px; font-weight: 600; font-size: var(--text-13); text-align: left; }
.pn-back { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; min-height: 44px; padding: 0 8px 0 0; color: var(--ink-2); font-weight: 600; font-size: var(--text-13); margin: -6px 0 4px; }
.pn-back svg { width: 18px; height: 18px; }
.pn-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: var(--r-2);
  border: 1px solid var(--hairline); background: var(--paper); color: var(--ink); font-weight: 600; font-size: var(--text-13); text-decoration: none; box-shadow: var(--e-1);
  transition: background var(--d-feedback) var(--ease-out), transform var(--d-feedback) var(--ease-out); }
.pn-btn:hover { background: var(--paper-2); }
.pn-btn:active { transform: translateY(1px); box-shadow: none; }
.pn-btn svg { width: 18px; height: 18px; flex: none; }
.pn-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.pn-btn[aria-pressed="true"] use { fill: #ffd27a; }
.pn-btn svg use { fill: none; }
.pn-btn-pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pn-btn-pri:hover { background: var(--accent); filter: brightness(1.05); }
.pn-btn-s { min-height: 44px; padding: 0 12px; font-size: var(--text-12); }
.pn-btn-big { width: 100%; margin: 14px 0 4px; min-height: 52px; font-size: var(--text-14); }

/* tabs: a sticky row of paper tabs */
.pn-tabs { position: sticky; top: -14px; z-index: 3; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 14px -18px 0; padding: 8px 18px 0;
  background: var(--paper); border-bottom: 1px solid var(--hairline); scroll-snap-type: x proximity; }
.pn-tabs::-webkit-scrollbar { display: none; }
.pn-tabs button { flex: none; min-height: 44px; padding: 0 12px; border: 0; background: none; font-weight: 600; font-size: var(--text-13); color: var(--ink-3);
  border-bottom: 3px solid transparent; margin-bottom: -1px; scroll-snap-align: start; white-space: nowrap; }
.pn-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pn-tabs button:hover { color: var(--ink); }
.pn-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px 12px; padding: 2px 18px 6px; }
.pn-chips::-webkit-scrollbar { display: none; }
.pn-chips button { flex: none; min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--hairline); background: var(--paper); font-size: var(--text-13); font-weight: 600; color: var(--ink-2); }
.pn-chips button[aria-selected="true"] { background: var(--cc, var(--ink)); color: #fff; border-color: transparent; box-shadow: var(--e-1); }

/* bar rows (economy, rankings) */
.bars, .rank { display: grid; gap: 4px; }
.bar { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 30px; font-size: var(--text-13); }
.bar-btn { border: 0; background: none; padding: 0 4px; border-radius: var(--r-1); min-height: 44px; text-align: left; color: inherit; width: 100%; }
.bar-btn:hover { background: var(--paper-2); }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-t { height: 12px; background: var(--paper-2); border-radius: 2px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--hairline); }
.bar-t i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transform-origin: left; animation: pn-grow var(--d-enter) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 40ms); }
.bar-v { font-weight: 600; font-variant-numeric: var(--num); text-align: right; white-space: nowrap; }
@keyframes pn-grow { from { transform: scaleX(0); } }
@keyframes pn-rise { from { opacity: 0; transform: translateY(8px); } }
.rank { margin: 12px 0 6px; }
.rank-h { font-weight: 600; font-size: var(--text-13); margin-bottom: 2px; }
.rank .bar-t i { background: var(--ink-2); }

/* key numbers */
.keynums { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.kn { padding: 10px 12px; border-radius: var(--r-2); background: var(--paper-2); }
.kn-v { font: 750 var(--text-24) / 1.05 var(--font-display); font-variant-numeric: var(--num); letter-spacing: -0.01em; }
.kn-l { font-size: var(--text-12); color: var(--ink-3); margin-top: 2px; }

/* ---------------------------------------------------------------- City View */
.cv-hero { position: relative; }
.cv-ribbon { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 8px -18px; padding: 4px 22px 4px 12px; background: var(--accent); color: #fff; box-shadow: var(--e-2);
  clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%); animation: pn-ribbon var(--d-enter) var(--ease-out) both; }
.cv-ribbon .cv-emb { display: flex; width: 34px; height: 34px; }
.cv-rl { font: 750 var(--text-20) / 1.1 var(--font-display); letter-spacing: -0.005em; }
@keyframes pn-ribbon { from { transform: translateX(-24px); opacity: 0; } }
.cv-why { font-size: var(--text-14); color: var(--ink-2); margin: 0 0 12px; line-height: var(--leading-body); }
.cv-why .src-row { margin-top: 4px; }
.cv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.cv-stat { padding: 10px 12px 12px; border-radius: var(--r-3); background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--hairline); min-width: 0; }
.cv-v { font: 750 var(--text-32) / 1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: var(--num); }
.cv-l { font-size: var(--text-12); color: var(--ink-3); margin: 3px 0 4px; }
.cv-d { display: inline-block; font-size: var(--text-12); font-weight: 600; color: var(--ink-2); font-variant-numeric: var(--num); }
.cv-d.up { color: #2f7d52; } .cv-d.down { color: var(--bad); }
:root[data-theme="dark"] .cv-d.up { color: #6fcf97; }
.cv-medals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.medal { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 2px 0; animation: pn-rise var(--d-enter) var(--ease-paper) both; }
.medal:nth-child(2) { animation-delay: 60ms; } .medal:nth-child(3) { animation-delay: 120ms; } .medal:nth-child(4) { animation-delay: 180ms; }
.medal-d { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font: 800 var(--text-20) / 1 var(--font-display); font-variant-numeric: var(--num);
  background: radial-gradient(circle at 35% 30%, var(--paper), var(--paper-3)); box-shadow: var(--e-1), inset 0 0 0 3px var(--paper-3), inset 0 0 0 4px var(--hairline); color: var(--ink); }
.medal-h { font-size: var(--text-12); font-weight: 600; margin-right: 1px; opacity: 0.7; align-self: center; }
.medal-d { display: flex; align-items: center; justify-content: center; }
.medal.m10 .medal-d { background: radial-gradient(circle at 35% 30%, #f6ead0, #d9c29a); box-shadow: var(--e-1), inset 0 0 0 3px #c9ac72; color: #3d2f17; }
.medal.m3 .medal-d { background: radial-gradient(circle at 35% 30%, #fbe8b0, #d1a54a); box-shadow: var(--e-2), inset 0 0 0 3px #b8913e; color: #3d2a08; }
.medal.m1 .medal-d { background: radial-gradient(circle at 35% 30%, #ffe9a6, #c89211); box-shadow: var(--e-2), inset 0 0 0 3px #a57b12, 0 0 0 3px rgb(200 146 17 / 0.25); color: #2d1e00; }
.medal-l { font-size: var(--text-12); font-weight: 600; line-height: 1.15; }
.medal-o { font-size: var(--text-12); color: var(--ink-3); line-height: 1; }
.cv-lines { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0 0 12px; }
.cv-k { font-size: var(--text-12); color: var(--ink-3); text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.cv-k2 { font-size: var(--text-12); color: var(--ink-3); }
.ln { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-12); font-weight: 600; }
.ln i { width: 12px; height: 12px; border-radius: 50%; background: var(--lc); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--lc); }
.ln-big { padding: 4px 10px 4px 6px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--lc) 12%, var(--paper)); cursor: pointer; min-height: 28px; }
.cv-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.cv-live { margin-top: 4px; }
.cv-pane { padding-top: 14px; min-height: 240px; }
.cv-pane > * { animation: pn-rise var(--d-enter) var(--ease-out) both; }

/* districts: paper plaques */
.plaques { display: grid; gap: 12px; }
.plaque { position: relative; padding: 14px 14px 12px; background: linear-gradient(180deg, var(--paper), var(--paper-2)); box-shadow: var(--e-2);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 12px, 100% calc(100% - 12px), calc(100% - 12px) 100%, 12px 100%, 0 calc(100% - 12px), 0 12px);
  border-top: 4px solid var(--pc); animation: pn-rise var(--d-enter) var(--ease-paper) both; animation-delay: calc(var(--i) * 70ms); }
.plaque::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 1px; background: #b8913e; opacity: 0.6; }
.plq-head { display: flex; gap: 12px; align-items: flex-start; }
.plq-ic { flex: none; width: 44px; height: 44px; }
.plaque h3 { margin: 0 0 4px; font: 750 var(--text-18) / 1.15 var(--font-display); }
.plq-tier { font: 700 var(--text-12) / 1 var(--font-ui); text-transform: uppercase; letter-spacing: var(--tracking-caps); padding: 3px 6px; border-radius: 4px; background: var(--pc); color: #fff; vertical-align: 2px; }
.plq-rule { font-size: var(--text-13); color: var(--ink-2); line-height: 1.4; }
.plq-ev { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.plq-ev li { display: flex; gap: 8px; align-items: baseline; font-size: var(--text-14); line-height: 1.4; }
.plq-v { flex: none; font: 750 var(--text-16) / 1 var(--font-display); color: var(--pc); }
.plaque .src-row { margin-bottom: 8px; }
.plq-missing { margin: 16px 0 0; border-top: 1px solid var(--hairline); }
.plq-missing summary, .fmt-how summary, .fg summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: var(--text-13); color: var(--ink-2); }
.plq-mini { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: var(--text-13); color: var(--ink-2); line-height: 1.4; border-bottom: 1px solid var(--hairline); }
.plq-mini b { color: var(--ink); }
.plq-missing .plq-mini { opacity: 0.75; }
.plq-mic { flex: none; width: 32px; height: 32px; display: flex; justify-content: center; }

/* citizens: rows of paper figures */
.cz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; border-bottom: 3px solid var(--cc); padding-bottom: 6px; margin-bottom: 10px; }
.cz-head span { font-size: var(--text-12); color: var(--ink-3); text-align: right; }
.cz-stand { padding: 10px 12px; border-radius: var(--r-2); background: color-mix(in srgb, var(--accent) 8%, var(--paper)); margin-bottom: 12px; }
.cz-sk { font-size: var(--text-12); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--accent); margin-bottom: 4px; }
.cz-stand ul { margin: 0; padding-left: 18px; font-size: var(--text-14); line-height: 1.45; }
.cz-x { font-weight: 700; color: var(--accent); font-variant-numeric: var(--num); }
.cz-rows { display: grid; gap: 10px; }
.fr-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: var(--text-13); margin-bottom: 3px; }
.fr-l { color: var(--ink); min-width: 0; }
.fr-v { flex: none; font-weight: 700; font-variant-numeric: var(--num); white-space: nowrap; }
.fr-n { font-weight: 400; color: var(--ink-3); }
.fr-r { margin-left: 6px; font-size: var(--text-12); padding: 1px 5px; border-radius: 4px; }
.fr-r.up { background: color-mix(in srgb, var(--cc) 18%, var(--paper)); color: var(--ink); }
.fr-r.down { background: var(--paper-2); color: var(--ink-3); }
.fr-figs { position: relative; height: 24px; }
.fr-base, .fr-in { display: flex; justify-content: space-between; height: 24px; }
.fr-base svg, .fr-in svg { width: calc(100% / 20 - 2px); max-width: 14px; height: 24px; flex: none; }
.fr-base svg { fill: var(--paper-3); }
.fr-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; overflow: hidden; transition: width 700ms var(--ease-out); transition-delay: calc(var(--i) * 50ms); }
.fr-fill.on { width: var(--w); }
.fr-in svg { fill: var(--cc); filter: drop-shadow(1px 1px 0 rgb(var(--shadow-ink) / 0.35)); }
.fr-nat { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.fr-nat::before { content: ""; position: absolute; top: -3px; left: -3px; border: 4px solid transparent; border-top-color: var(--ink); }

/* economy */
.ec-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ec-top > div { padding: 10px; border-radius: var(--r-2); background: var(--paper-2); min-width: 0; }
.ec-top .cv-v { font-size: var(--text-24); }
.lq { display: grid; gap: 3px; }
.lq-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 48px; gap: 8px; align-items: center; font-size: var(--text-13); min-height: 26px; }
.lq-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.lq-bar { position: relative; height: 12px; background: var(--paper-2); border-radius: 2px; }
.lq-bar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--ink-3); }
.lq-bar i { position: absolute; top: 0; bottom: 0; background: var(--ink-3); border-radius: 2px; }
.lq-row.hot .lq-bar i { background: var(--accent); }
.lq-row.hot .lq-l { color: var(--ink); font-weight: 600; }
.lq-v { text-align: right; font-weight: 600; font-variant-numeric: var(--num); }

/* places */
.wonders { display: grid; gap: 8px; }
.wonder { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 10px 12px; border: 0; border-radius: var(--r-2); background: linear-gradient(180deg, var(--paper), var(--paper-2)); box-shadow: var(--e-1), inset 0 -2px 0 #b8913e; min-height: 44px; color: inherit; }
.wonder:hover { box-shadow: var(--e-2), inset 0 -2px 0 #b8913e; }
.w-ic { flex: none; width: 40px; height: 40px; }
.w-t { display: grid; gap: 2px; font-size: var(--text-13); }
.w-t b { font: 700 var(--text-16) / 1.2 var(--font-display); }
.w-rule { font-size: var(--text-12); color: var(--ink-3); }
.amen { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.am { display: grid; grid-template-columns: 30px auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 8px; border-radius: var(--r-2); background: var(--paper-2); }
.am-ic { grid-row: 1 / span 2; width: 30px; height: 30px; }
.am-v { font: 750 var(--text-20) / 1 var(--font-display); font-variant-numeric: var(--num); }
.am-l { font-size: var(--text-12); color: var(--ink-2); }
.am-p { display: block; color: var(--ink-3); font-size: var(--text-12); }
.fg { border-bottom: 1px solid var(--hairline); }
.fg summary { gap: 10px; color: var(--ink); list-style: none; }
.fg summary::-webkit-details-marker { display: none; }
.fg-ic { width: 28px; height: 28px; flex: none; }
.fg-l { flex: 1; font-weight: 500; }
.fg-n { font-weight: 700; font-variant-numeric: var(--num); }
.fg ul { list-style: none; margin: 0 0 8px; padding: 0 0 0 38px; columns: 2; column-gap: 12px; }
.fg li { break-inside: avoid; }
.fg .pn-link { color: var(--ink-2); font-weight: 500; padding: 0; min-height: 32px; font-size: var(--text-13); }
@media (pointer: coarse) { .fg .pn-link { min-height: 44px; } }

/* then and now */
.tn { display: grid; gap: 8px; }
.tn-head { display: grid; grid-template-columns: minmax(0, 1fr) 84px 20px 104px; font: 750 var(--text-14) / 1 var(--font-display); color: var(--ink-3); text-align: right; }
.tn-head span:first-child { grid-column: 2; } .tn-head span:last-child { grid-column: 4; }
.tn-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px 20px 104px; gap: 0; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
.tn-l { font-size: var(--text-14); font-weight: 600; display: grid; } .tn-l .pn-note { margin: 2px 0 0; font-weight: 400; }
.tn-l .tn-caveat { margin-top: 4px; padding: 4px 8px; border-radius: var(--r-2); background: color-mix(in srgb, #c98a1a 14%, transparent); color: var(--ink-2); }
.tn-l .tn-caveat b { color: var(--ink); }
.tn-v { text-align: right; font: 700 var(--text-18) / 1.1 var(--font-display); font-variant-numeric: var(--num); }
.tn-now { display: grid; justify-items: end; }
.tn-arrow::before { content: ""; display: block; margin: 0 auto; width: 8px; height: 8px; border-top: 2px solid var(--ink-3); border-right: 2px solid var(--ink-3); transform: rotate(45deg); }
.lc { width: 100%; height: auto; display: block; }
.lc-g { stroke: var(--hairline); }
.lc-t { fill: var(--ink-3); font: 12px var(--font-ui); font-variant-numeric: var(--num); }
.lc-a { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.lc-l { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.lc-d { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.dec { display: flex; gap: 4px; align-items: flex-end; height: 130px; margin: 6px 0; }
.dec-c { flex: 1; display: grid; grid-template-rows: auto 1fr auto; height: 100%; text-align: center; min-width: 0; }
.dec-v { font-size: var(--text-12); font-weight: 600; font-variant-numeric: var(--num); }
.dec-b { display: flex; align-items: flex-end; }
.dec-b i { display: block; width: 100%; background: #d8664a; border-radius: 3px 3px 0 0; box-shadow: inset 0 2px 0 rgb(255 255 255 / 0.35); transform-origin: bottom; animation: pn-grow-y var(--d-enter) var(--ease-out) both; }
@keyframes pn-grow-y { from { transform: scaleY(0); } }
.dec-l { font-size: var(--text-12); color: var(--ink-3); }

/* compare */
.cmp-pick { display: grid; gap: 4px; font-size: var(--text-12); color: var(--ink-3); margin-bottom: 12px; }
.cmp-pick select, .ex-pick select { min-height: 44px; border-radius: var(--r-2); border: 1px solid var(--hairline); background: var(--paper); color: var(--ink); font-size: var(--text-14); padding: 0 10px; width: 100%; min-width: 0; }
.cmp-h, .cmp-r { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.cmp-h { position: sticky; top: 30px; background: var(--paper); z-index: 2; padding: 4px 0; }
.cmp-n { border: 0; background: none; font: 750 var(--text-16) / 1.1 var(--font-display); text-align: left; padding: 6px 0; min-height: 44px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-b { color: var(--accent); }
.cmp-r { padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: var(--text-13); }
.cmp-l { color: var(--ink-2); }
.cmp-c { display: grid; gap: 3px; min-width: 0; }
.cmp-v { font-weight: 600; font-variant-numeric: var(--num); }
.cmp-c i { display: block; height: 5px; border-radius: 3px; background: var(--paper-3); }
.cmp-c.win i { background: var(--ink); }
.cmp-c.b.win i { background: var(--accent); }

/* ---------------------------------------------------------------- Advisors */
.council { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.adv-card { position: relative; display: grid; justify-items: center; align-content: start; gap: 2px; padding: 10px 8px 12px; border: 0; border-radius: var(--r-3); background: var(--paper-2);
  text-align: center; color: inherit; box-shadow: var(--e-1); animation: pn-rise var(--d-enter) var(--ease-paper) both; animation-delay: calc(var(--i) * 45ms); transition: transform var(--d-feedback) var(--ease-out), box-shadow var(--d-feedback); }
.adv-card:hover { transform: translateY(-3px); box-shadow: var(--e-3); }
.adv-pic { display: flex; justify-content: center; }
.adv-n { font: 750 var(--text-16) / 1.15 var(--font-display); margin-top: 4px; }
.adv-r { font-size: var(--text-12); color: var(--ink-3); }
.adv-q { font-size: var(--text-13); color: var(--ink); line-height: 1.4; margin-top: 6px; text-align: left; }
.adv-new { position: absolute; top: 8px; right: 8px; font-size: var(--text-12); font-weight: 700; color: #fff; background: var(--accent); border-radius: var(--r-pill); padding: 1px 7px; }
.adv-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; margin: 4px 0 4px; }
.adv-say { position: relative; padding: 12px 14px; border-radius: var(--r-3); background: var(--paper-2); box-shadow: var(--e-1); }
.adv-say::before { content: ""; position: absolute; left: -9px; top: 50%; margin-top: -9px; border: 9px solid transparent; border-left: 0; border-right-color: var(--paper-2); }
.adv-quote { margin: 4px 0 0; font: 600 var(--text-16) / 1.35 var(--font-display); }
.briefs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: b; }
.brief { animation: pn-rise var(--d-enter) var(--ease-out) both; animation-delay: calc(var(--i) * 60ms); border-radius: var(--r-2); background: var(--paper); box-shadow: inset 0 0 0 1px var(--hairline); padding: 2px 12px 8px; }
.brief-b { display: grid; gap: 4px; width: 100%; border: 0; background: none; text-align: left; padding: 8px 0 4px; min-height: 44px; color: inherit; }
.brief-t { font-size: var(--text-14); line-height: 1.45; }
.brief-go { display: inline-flex; align-items: center; gap: 2px; font-size: var(--text-12); font-weight: 700; color: var(--accent); }
.brief-go svg { width: 14px; height: 14px; }
.brief-b:hover .brief-t { text-decoration: underline; text-decoration-color: var(--hairline); }
.brief-src { font-size: var(--text-12); color: var(--ink-3); }
.brief-src .src-row { margin-top: 4px; }
.rank-more { display: block; }

/* ---------------------------------------------------------------- Explorer */
.ex-lvl { display: inline-flex; padding: 3px; border-radius: var(--r-2); background: var(--paper-2); gap: 2px; margin-bottom: 10px; }
.ex-lvl button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 6px; background: none; font-weight: 600; font-size: var(--text-13); color: var(--ink-2); }
.ex-lvl button span { font-weight: 400; color: var(--ink-3); font-variant-numeric: var(--num); }
.ex-lvl button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--e-1); }
@media (pointer: coarse) { .ex-lvl button { min-height: 44px; } }
.ex-picks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; margin-bottom: 10px; }
.ex-pick { display: grid; gap: 2px; font-size: var(--text-12); color: var(--ink-3); min-width: 0; }
.ex-pick > span { display: flex; justify-content: space-between; align-items: center; min-height: 24px; font-weight: 600; }
.ex-log { border: 1px solid var(--hairline); background: var(--paper); border-radius: 4px; font-size: var(--text-12); padding: 1px 6px; color: var(--ink-3); min-height: 24px; }
.ex-log[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.ex-plot { position: relative; margin: 4px 0; }
.ex-plot canvas { display: block; touch-action: pan-y; }
.ex-tip { position: absolute; pointer-events: none; z-index: 2; padding: 8px 10px; border-radius: var(--r-2); background: var(--paper); box-shadow: var(--e-3); font-size: var(--text-12); line-height: 1.45; max-width: 260px; }
.ex-tip span { color: var(--ink-3); }
.ex-about { font-size: var(--text-12); color: var(--ink-3); line-height: 1.45; margin: 6px 0 10px; }
.ex-ab { margin-bottom: 2px; }
.ex-ab b { color: var(--ink-2); }
.ex-tablewrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.ex-table { width: 100%; border-collapse: collapse; font-size: var(--text-13); font-variant-numeric: var(--num); }
.ex-table th, .ex-table td { padding: 0 6px; height: 36px; border-bottom: 1px solid var(--hairline); text-align: left; white-space: nowrap; }
.ex-table td { color: var(--ink-2); max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.ex-table thead th { position: sticky; top: 30px; background: var(--paper); z-index: 2; height: auto; vertical-align: bottom; white-space: normal; }
.ex-table thead button { border: 0; background: none; padding: 6px 0; font-weight: 700; font-size: var(--text-12); color: var(--ink-2); text-align: inherit; min-height: 44px; max-width: 130px; line-height: 1.2; }
.ex-table th[aria-sort="ascending"] button, .ex-table th[aria-sort="descending"] button { color: var(--accent); }
.ex-table .numc { text-align: right; }
.ex-table tbody th { font-weight: 600; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.ex-table tbody tr { cursor: pointer; }
.ex-table tbody tr:hover, .ex-table tbody tr.hl { background: color-mix(in srgb, #ffd27a 30%, var(--paper)); }
@media (pointer: coarse) { .ex-table th, .ex-table td { height: 44px; } }

/* ---------------------------------------------------------------- Almanac */
.alm-pane { padding-top: 10px; }
.alm-list { margin: 0; padding-left: 18px; font-size: var(--text-13); line-height: 1.5; color: var(--ink-2); }
.alm-list li { margin-bottom: 4px; }
.alm-kv { font-size: var(--text-13); }
.alm-kv dd { text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.alm-checks { list-style: none; margin: 0; padding: 0; font-size: var(--text-13); display: grid; gap: 6px; }
.alm-checks b { display: inline-block; font-size: var(--text-12); padding: 1px 6px; border-radius: 4px; background: #2f7d52; color: #fff; }
.alm-checks .no b { background: var(--bad); }
.alm-checks span { color: var(--ink-3); }
.alm-yh { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.alm-yh h3 { margin: 0; font: 750 var(--text-18) / 1.1 var(--font-display); }
.alm-ic { width: 36px; height: 36px; flex: none; }
.alm-ws { display: grid; gap: 4px; margin-top: 10px; }
.alm-w { display: flex; justify-content: space-between; gap: 10px; align-items: center; border: 0; background: none; text-align: left; min-height: 44px; padding: 4px 6px; border-radius: var(--r-1); font-size: var(--text-13); color: inherit; border-bottom: 1px solid var(--hairline); }
.alm-w:hover { background: var(--paper-2); }
.alm-wv { text-align: right; font-weight: 600; flex: none; }
.alm-terr { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 6px 12px; font-size: var(--text-13); }
.alm-terr dt { font-weight: 600; } .alm-terr dd { margin: 0; color: var(--ink-2); }
.alm-lens { padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.alm-lens p { font-size: var(--text-13); margin: 4px 0; }
.alm-lh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.alm-search input { width: 100%; min-height: 44px; border-radius: var(--r-2); border: 1px solid var(--hairline); background: var(--paper); padding: 0 12px; font-size: var(--text-14); }
.alm-src { border-bottom: 1px solid var(--hairline); scroll-margin-top: 56px; }
.alm-src summary { display: grid; gap: 2px; padding: 10px 0; min-height: 44px; cursor: pointer; list-style: none; }
.alm-src summary::-webkit-details-marker { display: none; }
.alm-src summary::before { content: ""; float: right; width: 8px; height: 8px; margin: 6px 4px 0 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform var(--d-feedback); }
.alm-src[open] summary::before { transform: rotate(-135deg); }
.as-t { font-weight: 600; font-size: var(--text-14); }
.as-p { font-size: var(--text-12); color: var(--ink-3); }
.as-u { color: var(--warn); }
.as-b { padding: 0 0 12px; font-size: var(--text-13); }
.as-b p { font-size: var(--text-13); }
.as-b h4 { margin: 10px 0 4px; font-size: var(--text-12); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--ink-3); }
.alm-src.is-target { background: color-mix(in srgb, #ffd27a 22%, var(--paper)); margin: 0 -18px; padding: 0 18px; box-shadow: inset 4px 0 0 var(--accent); }
.alm-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alm-files li { padding: 6px 8px; border-radius: var(--r-1); background: var(--paper-2); min-width: 0; }
.af-n { font-weight: 600; overflow-wrap: anywhere; } .af-n a { color: inherit; }
.af-m { font-size: var(--text-12); color: var(--ink-3); }
.af-h { display: block; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-3); overflow-wrap: anywhere; }
.alm-flag { padding: 8px 10px; background: var(--paper-2); border-radius: var(--r-2); }
.alm-keys { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.6fr); gap: 6px 12px; font-size: var(--text-13); }
.alm-keys dt { font-weight: 600; } .alm-keys dd { margin: 0; color: var(--ink-2); }
.alm-ds .plq-mini { border-bottom: 1px solid var(--hairline); }

/* ---------------------------------------------------------------- Find my town */
.fmt-crit { display: grid; gap: 2px; }
.fc { display: grid; grid-template-columns: minmax(0, 1fr) 24px; align-items: center; gap: 0 8px; padding: 4px 0; border-bottom: 1px solid var(--hairline); }
.fc-l { font-size: var(--text-13); color: var(--ink-3); font-weight: 500; }
.fc.on .fc-l { color: var(--ink); font-weight: 600; }
.fc-w { text-align: right; font: 750 var(--text-16) / 1 var(--font-display); color: var(--ink-3); font-variant-numeric: var(--num); }
.fc.on .fc-w { color: var(--accent); }
.fc input[type="range"] { grid-column: 1 / -1; width: 100%; height: 32px; margin: 0; accent-color: var(--accent); }
@media (pointer: coarse) { .fc input[type="range"] { height: 44px; } }
.fc-p { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: var(--text-12); color: var(--ink-3); }
.fc-p input { flex: 1; min-height: 44px; border-radius: var(--r-2); border: 1px solid var(--hairline); background: var(--paper); padding: 0 10px; font-size: var(--text-14); font-variant-numeric: var(--num); min-width: 0; }
.fc:not(.on) .fc-p { display: none; }
.fmt-res { margin-top: 16px; }
.fmt-res > h3 { margin: 0 0 8px; font: 750 var(--text-18) / 1.2 var(--font-display); }
.fmt-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fr-card { animation: pn-rise var(--d-enter) var(--ease-out) both; animation-delay: calc(var(--i) * 40ms); }
.fr-card details { border-radius: var(--r-2); background: var(--paper-2); }
.fr-card summary { display: grid; grid-template-columns: 34px minmax(0, 1fr) 84px; gap: 10px; align-items: center; padding: 6px 10px; min-height: 52px; cursor: pointer; list-style: none; }
.fr-card summary::-webkit-details-marker { display: none; }
.frc-rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 750 var(--text-16) / 1 var(--font-display); background: var(--paper); box-shadow: inset 0 0 0 2px #b8913e; }
.fr-card:first-child .frc-rank { background: var(--accent); color: #fff; box-shadow: inset 0 0 0 2px #ffd27a; }
.frc-n { display: grid; min-width: 0; } .frc-n b { font: 700 var(--text-16) / 1.15 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .frc-n span { font-size: var(--text-12); color: var(--ink-3); }
.frc-s { display: grid; grid-template-columns: 1fr 28px; gap: 6px; align-items: center; font-weight: 700; font-variant-numeric: var(--num); text-align: right; }
.frc-s i, .frc-b i { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.frc-s::before { content: none; }
.frc-why { margin: 0 12px 8px; font-size: var(--text-13); line-height: 1.45; }
.frc-sc { list-style: none; margin: 0 12px; padding: 0; display: grid; gap: 4px; }
.frc-sc li { display: grid; grid-template-columns: minmax(0, 1fr) 64px 24px; gap: 8px; align-items: center; font-size: var(--text-12); color: var(--ink-2); }
.frc-b { height: 8px; border-radius: 4px; background: var(--paper-3); overflow: hidden; }
.frc-b i { background: #b8913e; }
.frc-w { text-align: right; color: var(--ink-3); font-variant-numeric: var(--num); }
.frc-act { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 12px; }

/* ---------------------------------------------------------------- Quests */
.qst-prog { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 10px; margin-bottom: 4px; }
.qst-pv { font: 800 var(--text-44) / 1 var(--font-display); font-variant-numeric: var(--num); }
.qst-pv span { font-size: var(--text-18); color: var(--ink-3); font-weight: 600; }
.qst-pl { font-size: var(--text-13); color: var(--ink-2); }
.qst-bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--paper-3); margin-top: 8px; overflow: hidden; }
.qst-bar i { display: block; height: 100%; background: linear-gradient(90deg, #d42e12, #fa9e0d, #009645, #005ec4, #9900aa); }
.qst-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.qst-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; min-height: 56px; border: 0; border-radius: var(--r-2); background: var(--paper-2); color: inherit; box-shadow: inset 4px 0 0 var(--qc); }
.qst-card:hover { background: var(--paper-3); }
.qst-no { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 750 var(--text-16) / 1 var(--font-display); color: #fff; background: var(--qc); }
.qst-no.big { width: 52px; height: 52px; font-size: var(--text-24); box-shadow: var(--e-2); }
.qst-q { font-size: var(--text-14); line-height: 1.35; }
.qst-st { font-size: var(--text-12); font-weight: 700; color: var(--accent); }
.qst-card.done .qst-st { color: #2f7d52; } .qst-card.rev .qst-st { color: var(--ink-3); }
.qst-card.done { opacity: 0.8; }
.qst-play { padding: 4px 0; }
.qst-big { font: 750 var(--text-24) / 1.15 var(--font-display); margin: 12px 0 6px; letter-spacing: -0.01em; }
.qst-how { font-size: var(--text-13); color: var(--ink-3); margin: 0 0 12px; }
.qst-fb { min-height: 24px; font-size: var(--text-14); line-height: 1.45; margin: 0 0 12px; border-radius: var(--r-2); }
.qst-fb:not(:empty) { padding: 10px 12px; background: var(--paper-2); }
.qst-fb.no { box-shadow: inset 4px 0 0 var(--warn); }
.qst-fb.ok { box-shadow: inset 4px 0 0 #2f7d52; background: color-mix(in srgb, #2f7d52 10%, var(--paper)); }
.qst-fb.rev { box-shadow: inset 4px 0 0 var(--ink-3); }
.qst-stamp { float: right; margin: -6px -4px 4px 8px; animation: pn-stamp 420ms var(--ease-paper) both; }
@keyframes pn-stamp { 0% { transform: scale(1.8) rotate(-12deg); opacity: 0; } 60% { transform: scale(0.94) rotate(2deg); opacity: 1; } 100% { transform: none; } }
.qst-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.passport { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; padding: 14px; border-radius: var(--r-3);
  background: repeating-linear-gradient(0deg, transparent 0 27px, rgb(var(--shadow-ink) / 0.06) 27px 28px), #f3ead6; box-shadow: inset 0 0 0 1px rgb(var(--shadow-ink) / 0.12), var(--e-1); }
:root[data-theme="dark"] .passport { background: repeating-linear-gradient(0deg, transparent 0 27px, rgb(255 255 255 / 0.04) 27px 28px), #2a2520; }
.stamp { border: 0; background: none; padding: 2px; display: grid; place-items: center; min-height: 92px; border-radius: 50%; }
.stamp:hover { background: rgb(0 0 0 / 0.04); }

/* ---------------------------------------------------------------- Hub */
.hub { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hub-t { display: grid; align-content: start; gap: 4px; text-align: left; padding: 12px; min-height: 112px; border: 0; border-radius: var(--r-3); background: var(--paper-2); color: inherit; box-shadow: var(--e-1); }
.hub-t:hover { background: var(--paper-3); }
.hub-t > svg { width: 28px; height: 28px; color: var(--accent); }
.hub-t b { font: 750 var(--text-16) / 1.15 var(--font-display); }
.hub-t span { font-size: var(--text-12); color: var(--ink-3); line-height: 1.35; }
.hub-adv { grid-column: 1 / -1; min-height: 0; }
.hub-pics { display: flex; gap: 4px; margin-bottom: 4px; }
.hub-t[data-act="sound"][aria-pressed="false"] .snd-w { display: none; }
.hub-t[data-act="sound"][aria-pressed="true"] .snd-x { display: none; }

/* ---------------------------------------------------------------- the dock */
.pn-dock { position: absolute; z-index: 14; left: var(--gap); top: calc(var(--gap) + 52px + 8px + 52px + 8px); display: grid; gap: 2px; padding: 4px;
  background: var(--paper); border-radius: var(--r-3); box-shadow: var(--e-2); transition: opacity var(--d-enter) var(--ease-out); }
.pn-dock button { display: grid; justify-items: center; gap: 2px; width: 64px; min-height: 52px; padding: 6px 2px; border: 0; border-radius: var(--r-2); background: none; color: var(--ink-2); font-size: var(--text-12); font-weight: 600; line-height: 1.1; }
.pn-dock button svg { width: 22px; height: 22px; }
.pn-dock button:hover { background: var(--paper-2); color: var(--ink); }
.pn-dock button.is-on { background: var(--ink); color: var(--paper); }
.pn-dock button[data-act="sound"][aria-pressed="false"] .snd-w, .pn-dock button[data-act="sound"][aria-pressed="true"] .snd-x { display: none; }
.pn-dock button[data-act="sound"][aria-pressed="false"] { color: var(--ink-3); }
.pn-dock button[data-act="find"] svg, .pn-dock button[data-act="advisors"] svg { color: var(--accent); }
.pn-tools { display: none; }
.app[data-mode="loading"] .pn-dock, .app[data-mode="opening"] .pn-dock, .app[data-mode="loading"] .pn-tools, .app[data-mode="opening"] .pn-tools { opacity: 0; pointer-events: none; }
.app[data-legend="on"] .pn-dock { max-height: calc(100% - 132px - var(--legend-h, 180px) - 24px); overflow: auto; scrollbar-width: none; }
@media (max-height: 820px) and (min-width: 701px) {
  .pn-dock button { min-height: 44px; width: 52px; }
  .pn-dock button span { display: none; }
}
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  .pn-dock { display: none; }
  .pn-tools { position: absolute; z-index: 16; left: var(--gap); bottom: calc(var(--gap) + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px;
    min-height: 48px; padding: 0 18px 0 14px; border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font: 750 var(--text-16) / 1 var(--font-display); box-shadow: var(--e-3); }
  .pn-tools svg { width: 20px; height: 20px; }
  .app[data-legend="on"] .pn-tools { bottom: calc(var(--gap) + var(--legend-h, 120px) + 8px); }
  .app[data-history="on"] .pn-tools { opacity: 0; pointer-events: none; visibility: hidden; }   /* one Play at a time: the timebar has its own */
  .app[data-panel="on"] .pn-tools { opacity: 0; pointer-events: none; visibility: hidden; }
  .tn-head, .tn-row { grid-template-columns: minmax(0, 1fr) 76px 18px 92px; }
  .ec-top { grid-template-columns: 1fr 1fr; }
  .ec-top > div:last-child { grid-column: 1 / -1; }
  .cv-v { font-size: var(--text-24); }
  .cv-ribbon { margin-left: -16px; }
  .pn-tabs { margin: 12px -16px 0; padding: 4px 16px 0; top: -10px; }
  .pn-chips, .ex-tablewrap { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .council { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adv-hero { grid-template-columns: 1fr; justify-items: center; }
  .adv-say::before { left: 50%; top: -9px; margin: 0 0 0 -9px; border: 9px solid transparent; border-top: 0; border-bottom-color: var(--paper-2); }
  .fg ul { columns: 1; }
}
@media (max-width: 360px) {
  .cv-stats { grid-template-columns: 1fr; }
  .cv-medals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-picks { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- modal (town card, share) */
.pn-overlay { position: absolute; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgb(20 16 12 / 0.55); animation: pn-fade var(--d-menu) var(--ease-out) both; }
.pn-overlay.is-leaving { animation: pn-fade var(--d-menu) var(--ease-out) reverse both; }
@keyframes pn-fade { from { opacity: 0; } }
.pn-modal { width: min(560px, 100%); max-height: calc(100% - 16px); overflow: auto; background: var(--paper); color: var(--ink); border-radius: var(--r-4); box-shadow: var(--e-4); animation: pn-rise var(--d-enter) var(--ease-out) both; }
.pn-mh { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 8px 18px; border-bottom: 1px solid var(--hairline); }
.pn-mh h2 { margin: 0; font: 750 var(--text-20) / 1.15 var(--font-display); }
.pn-mb { padding: 14px 18px 18px; }
.pn-img { display: grid; place-items: center; min-height: 160px; border-radius: var(--r-3); background: var(--table); overflow: hidden; }
.pn-img-card { aspect-ratio: 1080 / 1350; max-height: 62vh; margin: 0 auto; }
.pn-img img { display: block; max-width: 100%; max-height: 62vh; height: auto; }
.pn-loading { color: #e6c983; font-size: var(--text-14); padding: 24px; text-align: center; }
.pn-macts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.share-link { display: flex; gap: 6px; }
.share-link input { flex: 1; min-width: 0; min-height: 44px; border-radius: var(--r-2); border: 1px solid var(--hairline); background: var(--paper-2); padding: 0 10px; font-size: var(--text-13); }
@media (max-width: 420px) { .share-link { flex-wrap: wrap; } .share-link input { flex-basis: 100%; } }

/* ---------------------------------------------------------------- Tour */
.app.is-touring .topbar, .app.is-touring .lensbar, .app.is-touring .mapctl, .app.is-touring .legend, .app.is-touring .pn-dock,
.app.is-touring .pn-tools, .app.is-touring .timebar, .app.is-touring .toast { opacity: 0 !important; pointer-events: none !important; transition: opacity 600ms var(--ease-out); }
.tour-cap { position: absolute; z-index: 85; left: 0; right: 0; bottom: 0; padding: 80px 5vw 4vh; pointer-events: none; color: #f7f2e8;
  background: linear-gradient(0deg, rgb(20 16 12 / 0.82), rgb(20 16 12 / 0.5) 55%, transparent); }
.tour-in { max-width: 1100px; transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out); }
.tour-cap.is-out .tour-in { opacity: 0; transform: translateY(16px); }
.tour-k { font: 600 clamp(13px, 1.4vw, 22px) / 1.2 var(--font-ui); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: #e6c983; }
.tour-t { font: 800 clamp(48px, 8vw, 132px) / 0.95 var(--font-display); letter-spacing: -0.03em; font-stretch: 90%; margin: 6px 0 10px; text-shadow: 0 4px 24px rgb(0 0 0 / 0.4); }
.tour-h { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; font: 700 clamp(18px, 2vw, 32px) / 1.2 var(--font-display); }
.tour-rib { padding: 4px 26px 6px 14px; background: var(--accent); color: #fff; clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%); }
.tour-dots { display: inline-flex; gap: 8px; } .tour-dots i { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 0 3px #f7f2e8; }
.tour-w { font: 400 clamp(15px, 1.5vw, 24px) / 1.4 var(--font-ui); max-width: 900px; color: #e7dfd1; }
.tour-n { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 14px; font: 500 clamp(14px, 1.3vw, 20px) / 1.3 var(--font-ui); color: #d9cfbd; }
.tour-n b { font: 800 clamp(22px, 2.4vw, 40px) / 1 var(--font-display); color: #f7f2e8; margin-right: 6px; font-variant-numeric: var(--num); }
.tour-so { flex-basis: 100%; color: #e6c983; }
.tour-hint { position: absolute; right: 5vw; bottom: 2vh; padding: 6px 12px; border-radius: var(--r-pill); background: rgb(20 16 12 / 0.6); font-size: var(--text-14); font-weight: 600; color: #f7f2e8; }
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) { .tour-cap { padding: 60px 16px 24px; } .tour-hint { position: static; display: inline-block; margin-top: 12px; } }

@media (prefers-reduced-motion: reduce) {
  .fr-fill { transition: none; }
}

/* ---------------------------------------------------------------- fixes after the first render pass */
.fr-figs svg { stroke: none; }
.bar { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 76px; }
.plaques, .briefs, .wonders, .cz-rows, .council { grid-template-columns: minmax(0, 1fr); }
.council { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.plaque, .brief, .wonder, .fr { min-width: 0; }
.src-row { min-width: 0; }
.src-chip { min-width: 0; }
.fmt-more { margin-top: 4px; }
.fmt-more > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; font-size: var(--text-13); color: var(--ink-2); }
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) { .council { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.alm-src summary { position: relative; display: block; padding-right: 28px; }
.alm-src summary::before { position: absolute; right: 4px; top: 16px; float: none; margin: 0; }
.as-t, .as-p { display: block; }
.alm-kv { grid-template-columns: auto minmax(0, 1fr); }
.alm-kv dd { text-align: left; }
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) { .alm-src.is-target { margin: 0 -16px; padding: 0 16px; } }
@media (pointer: coarse) { .ex-log { min-height: 44px; min-width: 44px; } .ex-pick > span { min-height: 44px; } }
.fmt-best { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: 52px; margin: 0 0 12px; padding: 6px 12px; border: 0; border-radius: var(--r-2); background: color-mix(in srgb, var(--accent) 10%, var(--paper)); color: inherit; text-align: left; font-size: var(--text-13); }
.fmt-best .frc-rank { background: var(--accent); color: #fff; box-shadow: inset 0 0 0 2px #ffd27a; }
.fmt-best b { font: 700 var(--text-16) / 1.2 var(--font-display); }
.fmt-see { font-size: var(--text-12); font-weight: 700; color: var(--accent); white-space: nowrap; }
.fmt-why { display: block; margin-top: 2px; font-size: var(--text-12); color: var(--ink-2); }
/* the reason comes before the title it earns (Tampines: the share of finance workers, then "Finance quarter") */
.cv-why.cv-why-first { margin: 0 0 8px; padding-right: 72px; }   /* clear of the Less button */
.lc, .lc text { stroke-width: 0; } .lc text { stroke: none; } .lc-g { stroke-width: 1; } .lc-l { stroke-width: 2.5; } .lc-d { stroke-width: 2; }

/* City View: the hero folds to one row past the first tab (and from the start on phones) */
.cv-mini { display: none; }
.cv-hero.is-compact .cv-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 0 84px 2px 0; position: relative; }
.cv-hero.is-compact .cv-more { position: absolute; right: -6px; top: 50%; transform: translateY(-50%); }
.cv-hero:not(.is-compact) .cv-mini { display: block; position: absolute; top: -6px; right: -6px; z-index: 1; }
.cv-hero:not(.is-compact) .cv-mini > :not(.cv-more) { display: none; }
.cv-hero.is-compact > :is(.cv-ribbon, .cv-why, .src-row, .cv-stats, .cv-medals, .cv-lines, .cv-actions) { display: none; }
.cv-mini-h { padding: 3px 10px; border-radius: var(--r-pill); background: var(--accent); color: #fff; font: 750 var(--text-14) / 1.2 var(--font-display); }
.cv-mini-v { font: 750 var(--text-16) / 1.2 var(--font-display); font-variant-numeric: var(--num); }
.cv-mini-v small { font: 500 var(--text-12) / 1 var(--font-ui); color: var(--ink-3); }
.cv-more { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; min-width: 44px; padding: 0 10px; border: 0; border-radius: var(--r-pill);
  background: none; color: var(--ink-2); font-size: var(--text-13); font-weight: 600; cursor: pointer; }
.cv-more:hover { background: var(--paper-2); color: var(--ink); }
.cv-more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--d-menu) var(--ease-out); }
.cv-more[aria-expanded="true"] svg { transform: rotate(180deg); }

/* horizontal strips that scroll: fade the edge that has more behind it (ui/dom.js fadeEdges) */
.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px); mask-image: linear-gradient(90deg, transparent, #000 40px); }
.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent); }

/* credits link (Almanac About) */
.pn-lede a { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.pn-lede a:hover { color: var(--accent); }
