:root {
  --paper: #e7dcc8;
  --paper-2: #f3ead8;
  --ink: #1c1712;
  --muted: #5c5348;
  --line: #1c1712;
  --rule: #c4b49a;
  --gold: #8a4a1a;
  --gold-2: #8a4a1a;
  --land: #8a6f52;
  --water: #1a2836;
  --danger: #8a2a18;
  --focus: #1c1712;
  --serif: "Fraunces", "Times New Roman", serif;
  --sans: "Manrope", "Palatino Linotype", serif;
  --radius: 0;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.4;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ink); }

.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 20; }

#app {
  height: 100%;
  height: 100dvh;
}

.top { display: none; }

.stage {
  position: relative;
  height: 100%;
}
.map-wrap {
  position: relative;
  height: 100%;
  background: var(--water);
  overflow: hidden;
}
#map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.sphere-land { display: none; }

.country {
  fill: #b8b2a8;
  stroke: #1a140c;
  stroke-width: 0.45px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.country.is-hover { stroke: #3a3228; }
.country.is-visited { stroke: #1a140c; }
.country.is-recommend { stroke: #1a140c; stroke-dasharray: 4 2; }
.country.is-dim { opacity: 0.28; }
.country.is-focus-continent { stroke: #f3ead8; stroke-width: 0.7px; }
.country.is-flash { filter: brightness(1.2); }
.country:focus-visible { outline: 2px solid #f3ead8; outline-offset: 1px; }

.tooltip {
  position: fixed;
  top: 0; left: 0;
  z-index: 12;
  pointer-events: none;
  background: var(--paper-2);
  color: var(--ink);
  padding: 10px 12px;
  min-width: 170px;
  border: 1px solid var(--ink);
}
.tip-name { font-size: 22px; }
.tip-status { margin-top: 4px; font-size: 14px; font-style: italic; color: var(--muted); }
.tip-meta { margin-top: 3px; font-size: 14px; }

.cartouche {
  position: absolute;
  z-index: 5;
  left: 12px;
  top: 12px;
  max-width: min(200px, 70vw);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  color: var(--ink);
  border: 1px solid var(--ink);
}
.cartouche-toggle {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 7px 10px;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.cartouche-name {
  font-size: 16px;
  font-weight: 500;
  font-family: var(--serif);
  line-height: 1;
}
.cartouche .pct {
  margin: 0;
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
  font-family: var(--serif);
}
.cartouche.is-open .pct {
  font-size: 28px;
}
.cartouche-body {
  padding: 0 10px 8px;
  border-top: 1px solid var(--ink);
}
.cartouche .pct-sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.cartouche-hint,
.cartouche-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--sans);
}
.cartouche-hint[hidden],
.cartouche-note[hidden] { display: none !important; }
.cartouche #btn-undo {
  display: block;
  margin-top: 8px;
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--ink);
}
.cartouche #btn-undo[hidden] { display: none; }

.hud { position: absolute; z-index: 4; }
.hud-explored { display: none; }
.ring { display: none; }

.map-tools {
  position: absolute;
  z-index: 18;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.map-tools button {
  background: var(--paper);
  border: 1px solid var(--ink);
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  font-size: 13px;
  line-height: 1;
  color: var(--ink);
  touch-action: manipulation;
}
.map-tools button:hover { background: var(--paper-2); }

html.map-chrome-off .cartouche,
html.map-chrome-off .find,
html.map-chrome-off .paint-palette,
html.map-chrome-off .peek,
html.map-chrome-off .tooltip,
html.map-chrome-off #zoom-in,
html.map-chrome-off #zoom-out,
html.map-chrome-off #zoom-reset,
html.map-chrome-off .dock {
  display: none !important;
}

.find {
  position: absolute;
  z-index: 7;
  right: 12px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 6px;
  max-width: min(320px, calc(100vw - 24px));
}
.index-btn {
  height: 30px;
  padding: 0 9px;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  touch-action: manipulation;
}
.find-icon {
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  touch-action: manipulation;
}
.find-icon svg { width: 15px; height: 15px; display: block; }
.find-icon[aria-expanded="true"] { background: var(--paper-2); }
.find-panel {
  width: min(280px, calc(100vw - 32px));
  flex-basis: 100%;
  order: 3;
  margin-top: 0;
  background: var(--paper);
  border: 1px solid var(--ink);
}
.find-panel input {
  width: 100%;
  background: var(--paper);
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 10px 12px;
  font-size: 16px;
}
.find .search-results {
  max-height: min(44vh, 320px);
  overflow: auto;
  border: 0;
}

.empty-hint { display: none; }

.paint-palette {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 16;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  max-width: min(400px, 70vw);
  padding: 6px 8px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border: 1px solid var(--ink);
}
.paint-palette .chip,
.color-chips .chip {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--ink);
  flex-shrink: 0;
}
.paint-palette .chip.is-on,
.color-chips .chip.is-on {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.palette-name {
  font-size: 12px;
  margin-left: 2px;
  color: var(--ink);
}
.palette-rule {
  width: 1px;
  height: 16px;
  background: var(--ink);
  opacity: 0.45;
  margin: 0 2px;
  flex-shrink: 0;
}
.tool-btn {
  width: 22px;
  height: 22px;
  padding: 2px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid transparent;
  color: var(--ink);
  flex-shrink: 0;
}
.tool-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}
.tool-btn.is-on {
  border-color: var(--ink);
}
html[data-map-tool="erase"] .country { cursor: pointer; }
html[data-map-tool="point"] .country { cursor: pointer; }
.color-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 4px;
}
.color-key { margin: 8px 0 18px; }
.key-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: center;
  margin: 6px 0;
}
.key-row .chip {
  width: 22px;
  height: 22px;
  display: block;
  border: 1px solid var(--ink);
}
.key-row input {
  background: var(--paper-2);
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 6px 0;
  width: 100%;
}

.ledger {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: var(--paper);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.ledger-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  padding: 8px 18px 8px;
  border-bottom: 1px solid var(--ink);
  padding-top: max(8px, env(safe-area-inset-top, 0px));
}
.ledger-head .plate-no { display: none; }
.ledger-head h2 {
  margin: 2px 0 6px;
  font-size: 22px;
  font-weight: 500;
}
#ledger-close {
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.index-menu {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--ink);
}
.index-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  padding: 18px 0 16px;
  color: inherit;
}
.index-name {
  display: block;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.15;
}
.index-note {
  display: block;
  margin-top: 5px;
  color: #4a433c;
  font-size: 15px;
  line-height: 1.4;
}
.index-menu button:hover .index-name,
.index-menu button:focus-visible .index-name {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.index-modes {
  display: flex;
  flex-direction: column;
  margin-top: 18px;
  border-top: 1px solid var(--ink);
}
.index-modes button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 16px 0;
  color: inherit;
}
.index-modes button strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
}
.index-modes button span {
  display: block;
  margin-top: 4px;
  color: #4a433c;
  font-size: 15px;
  font-weight: 400;
}
.index-modes button.is-on,
.index-modes button[aria-pressed="true"] {
  color: var(--ink);
}
.index-modes button.is-on strong,
.index-modes button[aria-pressed="true"] strong {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.below {
  padding: 18px 22px 96px;
  max-width: 40rem;
  margin: 0 auto;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: #14110e;
}
.below h2, .below .year, .below .stat dd {
  font-family: var(--serif);
}
.lead {
  font-size: 1.05rem;
  color: #14110e;
  margin: 0.35rem 0 1.15rem;
}
.lead strong, .stat dd strong, .match strong, .how-grid strong {
  color: #9a3412;
  font-weight: 700;
}
.stat dd.accent { color: #9a3412; }
.below-grid {
  display: block;
  margin-bottom: 0;
}
.panel-block {
  background: none;
  border: 0;
  padding: 8px 0 16px;
}
#continents-block {
  border-top: 1px solid var(--ink);
  padding-top: 22px;
  margin-top: 8px;
}
.panel-block .kicker { display: none; }
.panel-block h2 {
  font-size: 1.85rem;
  font-weight: 500;
  margin: 0 0 12px;
  line-height: 1.2;
}
.kicker {
  font-family: var(--sans);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  color: #9a3412;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}
.muted { color: #4a433c; line-height: 1.55; }
.stat dt { font-size: 14px; font-style: italic; color: #4a433c; letter-spacing: 0; text-transform: none; }
.stat dd { margin: 2px 0 14px; font-size: 26px; color: #14110e; line-height: 1.15; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 28px;
  margin: 8px 0 18px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}

.bar {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  gap: 10px;
  align-items: center;
  margin: 4px 0;
  width: 100%;
  background: none;
  border: 0;
  padding: 4px 0;
  text-align: left;
  color: inherit;
}
.bar .label { font-size: 15px; letter-spacing: 0; text-transform: none; font-weight: 600; color: #1a1510; }
.bar { grid-template-columns: 120px 1fr auto; }
.bar .pct-n { font-size: 14px; color: #9a3412; font-weight: 600; font-family: var(--sans); }
.bar[data-continent="Europe"] .fill { background: #9a3412; }
.bar[data-continent="Asia"] .fill { background: #c27820; }
.bar[data-continent="North America"] .fill { background: #3d6b8a; }
.bar[data-continent="South America"] .fill { background: #b05628; }
.bar[data-continent="Africa"] .fill { background: #c4a024; }
.bar[data-continent="Oceania"] .fill { background: #2f7a6a; }
.bar[data-continent="Antarctica"] .fill { background: #6a7a88; }
.track { height: 5px; background: #d4c6ae; }
.fill { height: 5px; background: #1c1712; width: 0; }
.bar:hover .label { text-decoration: underline; }

.country-list { list-style: none; margin: 0; padding: 0; }
.country-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}
.flag { font-size: 18px; line-height: 1; }
.below .list-meta { color: #3d362e; font-style: normal; font-weight: 500; }
.list-meta { color: var(--muted); font-size: 14px; font-style: italic; }
.row-btn, .chip-btn { background: none; border: 0; padding: 0; text-align: left; }
.row-btn { display: contents; cursor: pointer; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.filters input, .filters select {
  background: var(--paper-2);
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 6px 0;
  min-width: 0;
  border-radius: 0;
}
.filters input { flex: 1; }

.rec {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.rec h3 { margin: 0; font-size: 1.35rem; font-weight: 500; font-family: var(--serif); }
.match { font-size: 1.05rem; margin: 4px 0 8px; color: #1a1510; }
.why { margin: 8px 0 0; padding: 0 0 0 1.1em; color: #3d362e; font-size: 15.5px; }
.why li { margin: 3px 0; }
.why li::marker { color: var(--ink); }

.goal { margin: 14px 0 18px; }
.goal-head { display: flex; justify-content: space-between; gap: 8px; }
.goal-head span { color: #9a3412; font-weight: 700; font-family: var(--sans); }
.goal .track { margin-top: 8px; }

.year { font-size: 22px; margin: 18px 0 8px; color: #9a3412; }
.tl-item { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 6px 0; }
.tl-dot { width: 7px; height: 7px; margin-top: 8px; background: var(--ink); }

.method {
  font-size: 15.5px;
  color: #3d362e;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  margin-top: 18px;
}
.method strong { color: #9a3412; }
.legal-links {
  margin-top: 28px;
}
.legal-links a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reset-map {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--ink);
}
.reset-map .field { margin-bottom: 6px; }
.reset-map input {
  width: 100%;
  max-width: 16rem;
  background: var(--paper-2);
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 8px 0;
  margin-bottom: 12px;
}
.reset-map .danger { margin-top: 4px; }
.reset-error { color: var(--danger); font-size: 14px; margin: 8px 0 0; }

.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: none;
  grid-template-columns: 1fr 1fr;
  background: var(--paper);
  border-top: 1px solid var(--ink);
  z-index: 13;
  padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
}
.dock button {
  background: none;
  border: 0;
  color: var(--ink);
  text-align: center;
  font-size: 15px;
  padding: 8px 4px;
}
.dock button[aria-pressed="true"] {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.overlay {
  position: fixed; inset: 0;
  background: rgba(28, 23, 18, 0.45);
  z-index: 20;
  display: grid;
  place-items: start center;
  padding: 10vh 16px 16px;
}
.search-box { width: min(560px, 100%); }
.search-box input {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 14px 16px;
  font-size: 22px;
}
.search-hint { color: var(--muted); font-size: 14px; font-style: italic; }
.search-results { background: var(--paper); border: 1px solid var(--ink); border-top: 0; max-height: 50vh; overflow: auto; }
.search-hit {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.search-hit.is-active, .search-hit:hover { background: var(--paper-2); }

.sheet { position: fixed; inset: 0; z-index: 18; }
.sheet-back { position: absolute; inset: 0; background: rgba(28, 23, 18, 0.4); }
.sheet-card {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(420px, 100%);
  background: var(--paper);
  border-left: 1px solid var(--ink);
  padding: 28px 22px 40px;
  overflow: auto;
}
.sheet-card h2 { font-weight: 500; font-size: 32px; margin: 0 0 8px; }
.field { margin: 14px 0; }
.field label { display: block; font-size: 14px; font-style: italic; color: var(--muted); margin-bottom: 6px; letter-spacing: 0; text-transform: none; }
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--paper-2);
  border: 0;
  border-bottom: 1px solid var(--ink);
  padding: 8px 0;
  border-radius: 0;
}
.cities { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.city {
  border-bottom: 1px solid var(--ink);
  padding: 2px 0;
  font-size: 15px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.city button { border: 0; background: none; color: var(--muted); padding: 0; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photos img { width: 100%; height: 84px; object-fit: cover; display: block; border: 1px solid var(--ink); }

.primary, .ghost, .danger, .text-btn, .icon-btn {
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  padding: 4px 0;
  letter-spacing: 0;
  text-transform: none;
  font-size: 16px;
  border-radius: 0;
}
.primary { font-weight: 600; }
.ghost { border-bottom-color: var(--rule); }
.danger { color: var(--danger); border-bottom-color: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; }
.actions a.ghost { text-decoration: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 30;
  background: var(--paper);
  color: var(--ink);
  padding: 12px 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 240px;
  border: 1px solid var(--ink);
}
.toast button {
  border: 0;
  background: none;
  font-size: 15px;
  text-decoration: underline;
  color: var(--ink);
}

.celebrate {
  position: fixed; inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  background: rgba(28, 23, 18, 0.45);
}
.celebrate-card {
  background: var(--paper);
  color: var(--ink);
  padding: 32px 28px;
  text-align: left;
  max-width: 400px;
  border: 1px solid var(--ink);
}
.celebrate-card h2 { font-size: 32px; margin: 0 0 8px; font-weight: 500; }

.share-preview {
  background: var(--water);
  color: var(--paper);
  padding: 24px;
  border: 1px solid var(--ink);
}
.share-preview .who { font-size: 30px; }
.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.how-grid div { border: 0; border-top: 1px solid var(--rule); padding: 10px 16px 10px 0; }
.how-grid strong { display: block; font-size: 24px; color: #9a3412; }
.how-pct { display: block; margin-top: 2px; font-size: 14px; font-weight: 700; color: #9a3412; }

.peek {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 18px;
  z-index: 16;
  background: var(--paper);
  color: var(--ink);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--ink);
}
.peek h3 { margin: 0; font-weight: 500; font-size: 22px; }
.peek .peek-meta { color: var(--muted); font-size: 14px; font-style: italic; margin: 2px 0 0; }
.peek .color-chips { flex: 1 0 100%; margin: 4px 0 2px; }
.peek-actions { display: flex; gap: 14px; }

.rec-tag { font-size: 13px; font-style: italic; color: var(--muted); letter-spacing: 0; text-transform: none; }

.legal { max-width: 38rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }
.legal h1 { font-weight: 500; font-size: 2.2rem; margin: 0 0 0.4rem; }
.legal h2 { font-weight: 500; font-size: 1.35rem; margin: 1.8rem 0 0.5rem; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

html.ledger-open .peek { display: none !important; }
html.ledger-open .map-tools,
html.ledger-open .find,
html.ledger-open .paint-palette,
html.ledger-open .cartouche { display: none !important; }

@media (pointer: coarse) {
  .paint-palette .chip,
  .color-chips .chip,
  .key-row .chip {
    width: 24px;
    height: 24px;
  }
  .tool-btn {
    width: 28px;
    height: 28px;
  }
  .tool-btn svg {
    width: 18px;
    height: 18px;
  }
  .map-tools button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    font-size: 15px;
  }
  .find-icon {
    width: 40px;
    height: 40px;
  }
  .find-icon svg { width: 18px; height: 18px; }
  .dock button {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .peek-actions .primary,
  .peek-actions .ghost {
    min-height: 44px;
    padding: 8px 0;
  }
  input, select, textarea { font-size: 16px; }
}

@media (max-width: 1099px) {
  :root { --dock-h: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .index-btn { display: none; }
  .find {
    top: max(8px, env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
  }
  .dock { display: grid; }
  html.map-chrome-off .map-wrap { height: 100dvh; }
  html.map-chrome-off .peek { bottom: 12px; }
  .map-wrap { height: calc(100dvh - var(--dock-h)); }
  .ledger { bottom: var(--dock-h); }
  .below { padding-bottom: 40px; }
  .sheet-card {
    top: auto; left: 0; right: 0; bottom: 0; height: min(88dvh, 760px);
    border-left: 0;
    border-top: 1px solid var(--ink);
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .toast { bottom: calc(18px + var(--dock-h)); }
  .peek { bottom: calc(12px + var(--dock-h)); }
}

@media (max-width: 1099px) and (min-width: 721px) {
  .cartouche {
    left: max(14px, env(safe-area-inset-left, 0px));
    top: max(14px, env(safe-area-inset-top, 0px));
  }
  .map-tools {
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: 14px;
  }
  .paint-palette {
    left: max(14px, env(safe-area-inset-left, 0px));
    bottom: 14px;
    max-width: min(240px, calc(100vw - 120px));
  }
}

@media (max-width: 720px) {
  .cartouche {
    left: max(8px, env(safe-area-inset-left, 0px));
    top: max(8px, env(safe-area-inset-top, 0px));
  }
  .cartouche-name { font-size: 15px; }
  .cartouche .pct { font-size: 15px; }
  .cartouche.is-open .pct { font-size: 22px; }
  .map-tools {
    right: max(8px, env(safe-area-inset-right, 0px));
    bottom: 10px;
  }
  .paint-palette {
    left: max(8px, env(safe-area-inset-left, 0px));
    bottom: 10px;
    max-width: min(228px, calc(100vw - 86px));
    padding: 7px;
    gap: 5px;
  }
  .palette-name { display: none; }
  .stat-row,
  .how-grid { grid-template-columns: 1fr; }
  .below { padding: 16px 18px 48px; }
  .ledger-head { padding-left: 16px; padding-right: 16px; }
  .peek { left: 8px; right: 8px; }
  .overlay { padding: max(12px, env(safe-area-inset-top, 0px)) 12px 16px; }
}

@media (max-width: 960px) and (orientation: landscape) and (max-height: 500px) {
  .cartouche { max-width: 150px; }
  .cartouche.is-open .pct { font-size: 20px; }
  .paint-palette { max-width: min(200px, 55vw); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
