/* ============================================================
   Editor máp 2 — cartographic editorial system
   Warm paper, ink green, ochre rules, serif display type.
   Loaded after the legacy sheets; it re-skins the whole app.
   ============================================================ */

:root {
  --ink: #17211b;
  --ink-2: #2c3a31;
  --muted: #5b685f;
  --line: #d7cdbb;
  --line-2: #bfb29d;
  --blue: #1e4a36;
  --blue-2: #3b7155;
  --blue-soft: #e4ebe1;
  --blue-deep: #123326;
  --green: #1e4a36;
  --green-2: #4a7a58;
  --green-soft: #e4ebe1;
  --red: #a64b34;
  --red-2: #ba5a40;
  --red-soft: #f4e4dc;
  --amber: #a87424;
  --amber-2: #bb8730;
  --amber-ink: #744a12;
  --amber-soft: #f2e6ce;
  --purple: #315f6b;
  --purple-soft: #e3eceb;
  --bg: #f3eee2;
  --card: #fbf8f0;
  --paper: #f3eee2;
  --paper-2: #ebe4d6;
  --paper-3: #dfd6c5;
  --bar-1: #eee8db;
  --bar-2: #e4ddce;
  --bar-3: #d8cfbe;
  --bar-border: #bdae96;
  --panel-1: #f7f2e8;
  --panel-2: #e9e2d4;
  --dialog: #fbf8f0;
  --dialog-border: #b9aa93;
  --focus: #9a6a1f;
  --font: "Segoe UI", "Aptos", "Helvetica Neue", Arial, sans-serif;
  --display: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --mono: "Cascadia Mono", "Consolas", "Lucida Console", monospace;
  --lcd: "Cascadia Mono", "Consolas", "Lucida Console", monospace;
  --radius: 3px;
  --radius-sm: 2px;
  --shadow-sm: 0 1px 0 rgba(23, 33, 27, 0.08);
  --shadow: 8px 9px 0 rgba(23, 33, 27, 0.08);
  --hard-shadow: 7px 7px 0 rgba(30, 74, 54, 0.16);
  color-scheme: light dark;
}

html {
  background: var(--paper);
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 400;
  color: var(--ink);
}

::selection {
  background: var(--amber-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

kbd {
  border-color: var(--line-2);
  border-bottom-width: 1px;
  border-radius: 2px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: var(--mono);
}

/* ---------------------------------------------------------- */
/* shared controls                                            */
/* ---------------------------------------------------------- */

.btn-primary,
.btn-ghost,
.btn-soft,
.btn-danger,
.btn-start,
.btn-mode,
.win-btn,
.editor-btn,
.btn-text,
.activity-link,
.zoom-btn,
.icon-btn {
  border-radius: 2px;
  font-family: var(--font);
  letter-spacing: 0.01em;
  box-shadow: none;
  text-shadow: none;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.btn-primary,
.btn-start {
  border: 1px solid var(--forest, var(--blue));
  background: var(--blue);
  color: #fbf8ef;
  font-weight: 600;
}

.btn-primary:hover,
.btn-start:hover {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
  color: #fffdf6;
}

.btn-ghost {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-soft {
  border: 1px solid var(--line-2);
  background: var(--paper-2);
  color: var(--ink);
}

.btn-soft:hover {
  border-color: var(--ink);
  background: var(--paper);
}

.btn-danger {
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff8f3;
}

.btn-danger:hover {
  background: #883b28;
  border-color: #883b28;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-text span {
  color: var(--amber);
  font-size: 14px;
}

.btn-text:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.icon-btn {
  display: inline-grid;
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink);
  font-family: var(--display);
  font-size: 19px;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.nav-back:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.nav-back-arrow {
  color: var(--blue);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1;
}

.nav-back:active {
  transform: translateY(1px) scale(0.985);
}

.link-btn {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 0 0 1px;
  background: none;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ---------------------------------------------------------- */
/* home masthead                                              */
/* ---------------------------------------------------------- */

.home-screen {
  position: relative;
  min-height: 100dvh;
  padding: 0 clamp(18px, 4.2vw, 58px) max(30px, env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23, 33, 27, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 27, 0.035) 1px, transparent 1px);
  background-size: 30px 30px;
}

.home-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(800px 500px at 82% 8%, rgba(30, 74, 54, 0.06), transparent 68%),
    radial-gradient(700px 420px at 4% 30%, rgba(168, 116, 36, 0.06), transparent 70%);
  opacity: 1;
  pointer-events: none;
}

.home-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
}

.home-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(23, 33, 27, 0.18);
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 23px;
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.brand-copy h1 span {
  color: var(--amber);
  font-style: italic;
}

.brand-kicker {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.home-nav {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 3vw, 38px);
}

.home-nav a {
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

.home-nav a:hover {
  border-bottom-color: var(--amber);
  color: var(--blue);
}

.home-help,
.home-settings,
.home-sound {
  justify-self: end;
  border-color: var(--line-2);
}

.home-settings {
  font-size: 16px;
  line-height: 1;
}

.home-sound svg {
  width: 17px;
  height: 17px;
}

.home-sound[aria-pressed="true"] .sound-slash,
.home-sound[aria-pressed="false"] .sound-waves {
  display: none;
}

.settings-sound-field {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-sound {
  min-height: 34px;
}

.settings-dialog {
  width: min(460px, calc(100vw - 24px));
}

.settings-languages {
  margin-top: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-languages .seg-btn {
  min-height: 58px;
}

/* ---------------------------------------------------------- */
/* hero                                                       */
/* ---------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: clamp(34px, 5vw, 78px);
  align-items: center;
  margin: 0;
  padding: clamp(42px, 6.5vw, 86px) 0 clamp(46px, 6vw, 80px);
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.hero::after {
  display: none;
}

.hero-copy {
  min-width: 0;
  position: relative;
  z-index: 1;
}

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 22px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero-kicker-rule {
  display: inline-block;
  width: 38px;
  height: 1px;
  background: var(--amber);
}

.hero h2 {
  max-width: 12ch;
  margin: 0 0 24px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(44px, 5.9vw, 78px);
  font-weight: 400;
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.hero h2 em {
  color: var(--blue);
  font-style: italic;
}

.hero-lead {
  max-width: 490px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.62;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
}

.btn-hero {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 62px;
  padding: 9px 22px 10px;
  border: 1px solid var(--blue-deep);
  background: var(--blue);
  color: #fbf8ef;
  text-align: left;
}

.btn-hero:hover {
  background: var(--blue-deep);
  color: #fffdf6;
}

.btn-hero-label {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}

.btn-hero-meta {
  margin-top: 3px;
  color: #d9c79d;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero-facts {
  display: flex;
  margin: 42px 0 0;
  padding: 15px 0 0;
  border-top: 1px solid var(--line);
}

.hero-facts > div {
  min-width: 0;
  padding: 0 22px;
  border-left: 1px solid var(--line);
}

.hero-facts > div:first-child {
  padding-left: 0;
  border-left: 0;
}

.hero-facts dt {
  color: var(--ink);
  font-family: var(--display);
  font-size: 24px;
  line-height: 1;
}

.hero-facts dd {
  margin: 5px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* framed map plate */

.hero-plate {
  position: relative;
  min-width: 0;
  margin: 0;
  transform: rotate(-1.1deg);
  transition: transform 0.25s ease;
}

.hero-plate:hover {
  transform: rotate(0deg);
}

.plate-frame {
  padding: 9px;
  border: 1px solid var(--line-2);
  background: var(--card);
  box-shadow: var(--hard-shadow);
}

.plate-head,
.plate-foot,
.plate-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.plate-head {
  padding: 1px 2px 8px;
  border-bottom: 1px solid var(--line);
}

.plate-head > span:nth-child(2) {
  color: var(--ink);
}

.plate-coords {
  display: none;
}

.plate-map {
  position: relative;
  margin: 8px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background-color: #f8f4e9;
  background-image:
    linear-gradient(rgba(30, 74, 54, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 74, 54, 0.055) 1px, transparent 1px);
  background-size: 22px 22px;
}

.plate-map > img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0.92;
  filter: saturate(0.75) sepia(0.08);
}

.plate-pin,
.plate-guess {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transform: translate(-50%, -50%);
}

.plate-pin i {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  border: 1.5px solid #fbf8ef;
  border-radius: 50% 50% 50% 0;
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
  transform: rotate(-45deg);
}

.plate-pin i::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #fbf8ef;
}

.plate-pin b,
.plate-guess b {
  padding: 3px 6px;
  border: 1px solid var(--line-2);
  background: rgba(251, 248, 240, 0.94);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.plate-guess {
  color: var(--red);
  transform: translate(-50%, -50%);
}

.plate-guess i {
  position: relative;
  display: block;
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--red);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(251, 248, 240, 0.9);
}

.plate-guess i::before,
.plate-guess i::after {
  content: "";
  position: absolute;
  background: var(--red);
}

.plate-guess i::before {
  left: 50%;
  top: -5px;
  width: 1px;
  height: 25px;
}

.plate-guess i::after {
  top: 50%;
  left: -5px;
  height: 1px;
  width: 25px;
}

.plate-guess b {
  border-color: var(--red);
  color: var(--red);
  background: #fdf3ed;
}

.plate-north {
  position: absolute;
  right: 10px;
  top: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
}

.plate-north i {
  display: block;
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-bottom: 13px solid var(--ink);
  border-left: 5px solid transparent;
}

.plate-foot {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.plate-key {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.plate-key i {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.key-pin {
  background: var(--blue);
}

.key-guess {
  border: 1px solid var(--red);
  background: transparent;
}

.plate-scale {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.plate-scale i {
  display: inline-block;
  width: 24px;
  height: 4px;
  border: 1px solid var(--ink-2);
  border-top: 0;
}

.plate-caption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 7.5px;
}

/* ---------------------------------------------------------- */
/* sections                                                   */
/* ---------------------------------------------------------- */

.activities,
.map-library,
.progress-section {
  padding: clamp(46px, 6vw, 76px) 0;
  border-bottom: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(22px, 4vw, 64px);
  align-items: end;
  margin-bottom: 30px;
}

.section-head > div {
  grid-column: 1;
}

.section-head .section-lead {
  grid-column: 2;
  justify-self: start;
  align-self: end;
}

.section-index {
  margin: 0 0 10px;
  color: var(--amber-ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.section-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(30px, 3.7vw, 46px);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.section-lead {
  max-width: 500px;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.section-head-split {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.section-head-split .section-index,
.section-head-split h2 {
  grid-column: 1;
}

.section-head-split > .section-lead {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: end;
  justify-self: end;
}

/* activity index */

.activity-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  border-top: 1px solid var(--line-2);
}

.activity-row {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 220px 142px;
  gap: 22px;
  align-items: center;
  margin: 0;
  padding: 24px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: background-color 0.15s ease, padding 0.15s ease;
}

.activity-row::before {
  display: none;
}

.activity-row:hover {
  padding-left: 14px;
  background: rgba(251, 248, 240, 0.55);
}

.activity-num {
  color: var(--amber);
  font-family: var(--display);
  font-size: 26px;
  line-height: 1;
}

.activity-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.activity-copy h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.025em;
}

.activity-copy p {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.activity-copy p b {
  color: var(--ink-2);
  font-weight: 600;
}

.activity-meta {
  margin: 0;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 600;
  line-height: 1.7;
  letter-spacing: 0.05em;
  text-align: right;
  text-transform: uppercase;
}

.activity-meta span {
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
}

.activity-link {
  justify-self: end;
  min-height: 41px;
  padding: 0 17px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.activity-link span {
  display: inline-block;
  margin-left: 7px;
  color: var(--amber);
  font-family: var(--font);
  font-size: 14px;
  transition: transform 0.15s ease;
}

.activity-link:hover {
  background: var(--ink);
  color: var(--paper);
}

.activity-link:hover span {
  color: var(--amber-soft);
  transform: translateX(3px);
}

.activity-link-hot {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
}

.activity-link-hot span {
  color: #e5c78a;
}

.activity-link-hot:hover {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

/* the two studio rows form one dark cartographic band */

.activity-row-studio {
  border-bottom-color: rgba(251, 248, 240, 0.22);
  background: var(--blue);
  color: var(--paper);
}

.activity-row-studio:first-of-type {
  margin-top: 10px;
}

.activity-row-studio:last-child {
  border-bottom: 0;
}

.activity-row-studio:hover {
  background: var(--blue-deep);
}

.activity-row-studio .activity-num {
  color: #d7b26a;
}

.activity-row-studio .activity-kicker {
  color: #c7b78d;
}

.activity-row-studio h3 {
  color: #fbf8ef;
}

.activity-row-studio .activity-copy p,
.activity-row-studio .activity-copy p b {
  color: #d9d4c3;
}

.activity-row-studio .activity-meta {
  color: #e8e1cf;
}

.activity-row-studio .activity-meta span {
  color: #b9b29f;
}

.activity-row-studio .activity-link {
  border-color: rgba(251, 248, 240, 0.5);
  color: #fbf8ef;
}

.activity-row-studio .activity-link span {
  color: #d7b26a;
}

.activity-row-studio .activity-link:hover {
  background: #fbf8ef;
  color: var(--blue);
}

.activity-row-studio .activity-link:hover span {
  color: var(--amber);
}

/* map shelf */

.map-shelf {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 16px;
}

.map-sheet {
  margin: 0;
  min-width: 0;
}

.map-sheet-img {
  display: grid;
  overflow: hidden;
  aspect-ratio: 1.38;
  place-items: center;
  border: 1px solid var(--line);
  background:
    linear-gradient(rgba(30, 74, 54, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 74, 54, 0.04) 1px, transparent 1px),
    var(--card);
  background-size: 18px 18px;
}

.map-sheet-img img {
  display: block;
  max-width: 94%;
  max-height: 92%;
  object-fit: contain;
  filter: saturate(0.62) sepia(0.1);
  transition: filter 0.2s ease, transform 0.2s ease;
}

.map-sheet:hover .map-sheet-img {
  border-color: var(--line-2);
}

.map-sheet:hover .map-sheet-img img {
  filter: saturate(0.95) sepia(0.02);
  transform: scale(1.02);
}

.map-sheet figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
}

.map-sheet figcaption b {
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 400;
}

.map-sheet figcaption span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  text-align: right;
  text-transform: uppercase;
}

/* progress ledger */

.progress-section {
  border-bottom: 0;
}

.progress-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(28px, 5vw, 70px);
  align-items: start;
  border-top: 1px solid var(--line-2);
}

.progress-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.progress-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 20px;
  align-items: baseline;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--line);
}

.progress-top {
  display: contents;
}

.progress-name {
  color: var(--ink);
  font-family: var(--display);
  font-size: 21px;
  line-height: 1.1;
}

.progress-value {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
}

.progress-bar {
  grid-column: 1;
  height: 2px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 0;
  background: var(--paper-3);
}

.progress-bar span {
  border-radius: 0;
  background: var(--blue);
}

.progress-meta {
  grid-column: 1;
  margin-top: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.progress-aside {
  padding-left: clamp(18px, 3vw, 30px);
  border-left: 1px solid var(--line);
}

.progress-aside p {
  margin: 0 0 20px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* footer */

.home-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding: 26px 0 4px;
  border-top: 1px solid var(--line);
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-brand img {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(23, 33, 27, 0.16);
}

.footer-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-brand p {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.footer-made {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.01em;
}

.footer-made b {
  color: var(--ink);
  font-weight: 700;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.footer-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
}

.footer-github svg {
  width: 13px;
  height: 13px;
}

.footer-github:hover {
  border-bottom-color: var(--amber);
  color: var(--blue);
}

.about-github {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.about-github:hover {
  color: var(--blue-deep);
}

.footer-credits {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
  text-align: right;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- */
/* game shell and mission HUD                                 */
/* ---------------------------------------------------------- */

.game-screen,
.classic-screen {
  background: var(--paper);
}

.game-topbar,
.classic-topbar,
.legacy-game-topbar,
.classic-screen .classic-topbar,
.legacy-game-topbar {
  padding: max(8px, env(safe-area-inset-top)) clamp(12px, 2.2vw, 26px) 0;
  border-bottom: 1px solid var(--line-2);
  background: var(--card);
  box-shadow: none;
}

.topbar-row {
  min-height: 42px;
  gap: 14px;
}

.game-title {
  color: var(--ink);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.classic-context {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.topbar-actions {
  gap: 6px;
}

.win-btn {
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
}

.win-btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--paper-2);
}

.win-btn .ico,
#classicNextBtn .ico,
#nextBtn .ico,
#classicEndBtn .ico,
#endBtn .ico {
  display: none;
}

#classicNextBtn:not(:disabled),
#nextBtn:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
  box-shadow: none;
}

#classicNextBtn:not(:disabled):hover,
#nextBtn:not(:disabled):hover {
  border-color: var(--blue-deep);
  background: var(--blue-deep);
}

#classicEndBtn,
#endBtn {
  border-color: rgba(166, 75, 52, 0.45);
  color: var(--red);
}

#classicEndBtn:hover,
#endBtn:hover {
  border-color: var(--red);
  background: var(--red-soft);
}

.result-reopen-btn {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #6b4510;
}

.result-reopen-btn:hover:not(:disabled) {
  border-color: var(--amber);
  background: #ecd9b6;
}

.mission-hud {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 8px 0 10px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-1);
  box-shadow: none;
}

.mission-object {
  display: flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
}

.mission-icon {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: none;
  color: var(--blue);
}

.mission-icon svg {
  width: 21px;
  height: 21px;
}

.mission-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.mission-kicker {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.mission-kicker.is-correct {
  color: var(--blue);
}

.mission-kicker.is-partial {
  color: var(--amber);
}

.mission-kicker.is-wrong {
  color: var(--red);
}

.mission-name {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(21px, 2.2vw, 27px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mission-type {
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mission-stats {
  display: flex;
  min-width: 0;
  align-items: stretch;
  gap: 0;
  margin-left: auto;
}

.mission-stat {
  display: flex;
  min-width: 58px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px;
  border-left: 1px solid var(--line);
}

.mission-stat:first-child {
  border-left: 0;
}

.mission-stat-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mission-stat-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  white-space: nowrap;
}

.mission-stat-primary .mission-stat-value {
  color: var(--ink);
  font-size: 23px;
}

.mission-stat-counts .mission-stat-value {
  font-size: 21px;
}

.mission-stat-time .mission-stat-value {
  color: var(--muted);
  font-size: 14px;
}

.mission-stat-counts .mission-stat-value > span:first-child {
  color: var(--blue);
}

.mission-stat-counts .mission-stat-value > span:last-child {
  color: var(--red);
}

.mission-stat-sep {
  color: var(--line-2);
}

.game-progress {
  height: 2px;
  margin: 0;
  overflow: hidden;
  border-radius: 0;
  background: var(--paper-3);
}

.game-progress span {
  border-radius: 0;
  background: var(--blue);
}

.game-body,
.classic-body {
  background: var(--paper);
}

.map-viewport {
  background-color: #f8f3e8;
  background-image:
    linear-gradient(rgba(30, 74, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 74, 54, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
}

.classic-map-viewport::after,
.game-screen .map-viewport::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 1;
  border: 1px solid rgba(30, 74, 54, 0.14);
  pointer-events: none;
}

.map-hint {
  top: 20px;
  left: 50%;
  padding: 3px 0;
  border: 0;
  border-bottom: 1px dashed var(--line-2);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transform: translateX(-50%);
}

.map-tag {
  left: 22px;
  bottom: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-tag::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-right: 7px;
  vertical-align: middle;
  background: var(--amber);
}

.zoom-controls {
  right: max(22px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  gap: 6px;
}

.zoom-btn {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 400;
  box-shadow: 2px 2px 0 rgba(23, 33, 27, 0.07);
}

.zoom-btn:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.zoom-btn-home {
  color: var(--blue);
}

.zoom-btn-vuc {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.zoom-btn-vuc[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
}

.classic-map-viewport .zoom-value {
  min-width: 0;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.map-next-float {
  bottom: max(16px, env(safe-area-inset-bottom));
  border: 1px solid var(--blue-deep);
  border-radius: 2px;
  background: var(--blue);
  color: #fbf8ef;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 rgba(23, 33, 27, 0.16);
}

.map-next-float:hover {
  background: var(--blue-deep);
}

.map-next-float.is-result {
  border-color: var(--amber);
  background: var(--amber);
  color: #2b1b04;
}

.map-tag,
.map-hint {
  z-index: 3;
}

.distance-legend {
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  box-shadow: 4px 4px 0 rgba(23, 33, 27, 0.08);
}

.distance-legend-foot {
  border-top-color: var(--line);
}

.classic-loading {
  background: rgba(243, 238, 226, 0.82);
  backdrop-filter: blur(2px);
}

.loading-card {
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  box-shadow: var(--hard-shadow);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spinner {
  border-color: var(--paper-3);
  border-top-color: var(--blue);
}

/* ---------------------------------------------------------- */
/* responsive home                                            */
/* ---------------------------------------------------------- */

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 42px;
    padding-top: 48px;
  }

  .hero h2 {
    max-width: 14ch;
    font-size: clamp(44px, 8vw, 68px);
  }

  .hero-plate {
    width: min(620px, 100%);
  }

  .section-head,
  .section-head-split {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .section-head .section-lead,
  .section-head-split > .section-lead {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
    max-width: 620px;
  }

  .activity-row {
    grid-template-columns: 48px minmax(0, 1fr) 150px;
  }

  .activity-meta {
    display: none;
  }
}

@media (max-width: 760px) {
  .home-screen {
    padding-right: 18px;
    padding-left: 18px;
    background-size: 24px 24px;
  }

  .home-header {
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding-top: 16px;
  }

  .brand-copy h1 {
    font-size: 21px;
  }

  .home-nav {
    display: none;
  }

  .hero {
    padding: 38px 0 42px;
  }

  .hero-kicker {
    margin-bottom: 16px;
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .hero h2 {
    max-width: 12ch;
    margin-bottom: 18px;
    font-size: clamp(42px, 12.7vw, 58px);
  }

  .hero-lead {
    font-size: 14px;
  }

  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .hero-facts {
    margin-top: 30px;
  }

  .hero-facts > div {
    padding: 0 12px;
  }

  .hero-facts dt {
    font-size: 20px;
  }

  .hero-facts dd {
    font-size: 7px;
    letter-spacing: 0.04em;
  }

  .plate-head,
  .plate-foot {
    font-size: 6.5px;
  }

  .plate-pin b,
  .plate-guess b {
    font-size: 6px;
    padding: 2px 4px;
  }

  .plate-caption {
    display: none;
  }

  .activities,
  .map-library,
  .progress-section {
    padding: 38px 0;
  }

  .section-head {
    margin-bottom: 20px;
  }

  .section-head h2 {
    font-size: 32px;
  }

  .activity-row,
  .activity-row:hover {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px 14px;
    padding: 20px 0;
  }

  .activity-row:hover {
    padding-left: 0;
    background: transparent;
  }

  .activity-num {
    grid-row: 1 / span 2;
    font-size: 22px;
  }

  .activity-copy h3 {
    font-size: 24px;
  }

  .activity-link {
    grid-column: 2;
    justify-self: start;
    margin-top: 6px;
  }

  .activity-row-studio {
    padding: 22px 14px;
  }

  .activity-row-studio:hover {
    padding-left: 14px;
  }

  .map-shelf {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 12px;
  }

  .map-sheet figcaption {
    display: block;
  }

  .map-sheet figcaption span {
    display: none;
  }

  .progress-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .progress-aside {
    padding: 16px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .home-footer {
    flex-direction: column;
    gap: 16px;
  }

  .footer-meta {
    align-items: flex-start;
  }

  .footer-credits {
    text-align: left;
  }
}

@media (max-width: 390px) {
  .hero h2 {
    font-size: 40px;
  }

  .brand-kicker {
    display: none;
  }

  .plate-foot .plate-key:nth-child(2) {
    display: none;
  }
}

/* ---------------------------------------------------------- */
/* dialogs and setup                                          */
/* ---------------------------------------------------------- */

.overlay {
  background: rgba(16, 24, 18, 0.58);
  backdrop-filter: blur(2px) saturate(0.8);
}

.dialog {
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--card);
  box-shadow: 12px 12px 0 rgba(15, 23, 18, 0.26);
}

.dialog-head {
  align-items: flex-start;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.dialog-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(26px, 2.6vw, 34px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.dialog-x {
  display: inline-grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.dialog-x:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.dialog-body {
  padding: 22px;
  background: var(--card);
}

.dialog-actions {
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

.dialog-actions .btn-start,
.dialog-actions .btn-soft,
.dialog-actions .btn-danger,
.dialog-actions .btn-primary {
  min-height: 42px;
  padding: 0 16px;
}

.setup-dialog {
  width: min(1000px, calc(100vw - 32px));
  max-height: min(92dvh, 900px);
  display: flex;
  flex-direction: column;
}

.setup-head {
  padding-bottom: 16px;
}

.setup-head h2 {
  font-size: clamp(30px, 3vw, 38px);
}

.setup-subtitle {
  max-width: 650px;
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.setup-body {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: clamp(22px, 3vw, 38px);
  overflow: auto;
  padding: 22px;
}

.setup-label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.setup-maps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 380px;
  overflow: auto;
  padding: 1px;
  scrollbar-width: thin;
}

.setup-map-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 62px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.setup-map-card:hover {
  border-color: var(--line-2);
  background: var(--paper-2);
}

.setup-map-card.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.setup-map-thumb {
  display: grid;
  flex: 0 0 auto;
  width: 72px;
  height: 46px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--paper);
}

.setup-map-thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: saturate(0.72) sepia(0.06);
}

.setup-map-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.setup-map-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-map-copy span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.setup-options {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 16px;
}

.setup-field {
  display: block;
  min-width: 0;
  margin: 0;
}

.setup-field-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.5;
  text-transform: uppercase;
}

.setup-select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
}

.setup-select:focus {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 2px rgba(30, 74, 54, 0.14);
}

.setup-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.setup-level {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 54px;
  padding: 8px 9px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.setup-level:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.setup-level.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
}

.setup-level .seg-name {
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.1;
}

.setup-level .seg-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.setup-level.is-active .seg-count {
  color: #d8c89f;
}

.setup-count-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.stepper {
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
}

.step-btn {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  border: 0;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 17px;
  cursor: pointer;
}

.step-btn:hover {
  background: var(--paper-3);
}

.step-value {
  width: 56px;
  min-height: 38px;
  padding: 0 4px;
  border: 0;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.setup-summary {
  margin-top: auto;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--paper-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.6;
}

.setup-summary p {
  margin: 0;
}

.setup-summary-main b {
  color: var(--ink);
}

.setup-summary-sub {
  margin-top: 3px !important;
  color: var(--muted);
}

/* results */

.result-dialog {
  width: min(720px, 100%);
}

.result-head {
  align-items: center;
}

.record-badge {
  border: 1px solid var(--amber);
  border-radius: 0;
  background: var(--amber-soft);
  color: #6b4510;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
}

.result-stats .stat {
  padding: 16px 18px;
  border-left: 1px solid var(--line);
}

.result-stats .stat:first-child {
  border-left: 0;
}

.stat-value {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-label {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-text {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
}

.result-text b {
  color: var(--blue);
}

.result-list-wrap {
  border: 1px solid var(--line);
  border-radius: 0;
  overflow: auto;
}

.result-list th {
  border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-list td {
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.result-list tr:last-child td {
  border-bottom: 0;
}

/* help / about */

.help-heading {
  margin: 22px 0 6px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.help-intro,
.help-dialog .dialog-body p {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
}

.help-dialog .dialog-body {
  max-height: 68dvh;
  overflow: auto;
}

.fine {
  color: var(--muted) !important;
  font-family: var(--mono);
  font-size: 8px !important;
  line-height: 1.7 !important;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------- */
/* atlas                                                      */
/* ---------------------------------------------------------- */

.atlas-screen {
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(23, 33, 27, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 27, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
}

.atlas-header {
  padding: 14px clamp(16px, 3.2vw, 34px) 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.atlas-heading h1 {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(25px, 2.6vw, 32px);
  font-weight: 400;
  letter-spacing: -0.03em;
}

.atlas-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.atlas-toolbar {
  gap: 10px;
  padding: 12px clamp(16px, 3.2vw, 34px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.search-field {
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  box-shadow: none;
}

.search-field input {
  color: var(--ink);
  font-size: 12px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-icon {
  color: var(--muted);
  font-family: var(--mono);
}

.filter-chips {
  gap: 4px;
  padding: 0;
}

.filter-chips .chip,
.chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chip:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.chip.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
}

.atlas-toolbar .btn-primary {
  min-height: 36px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.atlas-screen .btn-primary .ico {
  display: none;
}

.atlas-layout {
  gap: 14px;
  padding: 14px clamp(16px, 3.2vw, 34px) max(16px, env(safe-area-inset-bottom));
}

.panel {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
  box-shadow: none;
}

.atlas-map-panel {
  padding: 12px;
}

.atlas-map {
  border: 1px solid var(--line);
  border-radius: 0;
  background-color: #f8f3e8;
  background-image:
    linear-gradient(rgba(30, 74, 54, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 74, 54, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
}

.atlas-map-img {
  filter: saturate(0.7) sepia(0.08);
}

.atlas-map-footer {
  padding-top: 10px;
}

.atlas-legend {
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.legend-dot {
  box-shadow: none;
}

.atlas-level-badge {
  padding: 2px 5px;
  border: 1px solid var(--level-color);
  border-radius: 0;
  background: var(--level-soft);
  color: var(--level-ink);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.atlas-map-info {
  border-top-color: var(--line);
}

.atlas-distribution {
  gap: 2px;
  height: 4px;
  border-radius: 0;
}

.atlas-distribution-labels {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.atlas-tip {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.atlas-list-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.atlas-list-head .link-btn {
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--card);
  color: var(--ink-2);
  font-size: 7.5px;
}

.atlas-list {
  padding: 0 10px;
}

.city-row {
  grid-template-columns: 9px minmax(0, 1fr) auto 12px;
  gap: 8px;
  padding: 9px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.city-row:hover {
  background: var(--paper-2);
}

.city-row.is-selected {
  background: var(--blue-soft);
  box-shadow: inset 2px 0 0 var(--blue);
}

.city-dot {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.city-level {
  padding: 2px 5px;
  border: 1px solid var(--level-color);
  border-radius: 0;
  background: var(--level-soft);
  color: var(--level-ink);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.atlas-detail-name {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
}

.atlas-detail-actions .btn-primary,
.atlas-detail-actions .btn-soft {
  min-height: 30px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.atlas-floating {
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--card);
  box-shadow: 6px 6px 0 rgba(23, 33, 27, 0.16);
}

.atlas-floating-copy b {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 400;
}

.atlas-floating-copy span {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.level-1 {
  --level-color: #2f6b4f;
  --level-soft: #e3ebe5;
  --level-ink: #1b4632;
}

.level-2 {
  --level-color: #a87424;
  --level-soft: #f2e6ce;
  --level-ink: #6b4510;
}

.level-3 {
  --level-color: #a64b34;
  --level-soft: #f4e4dc;
  --level-ink: #6d2f20;
}

/* ---------------------------------------------------------- */
/* editor                                                     */
/* ---------------------------------------------------------- */

.editor-screen {
  background: var(--paper);
}

.editor-topbar {
  min-height: 0;
  padding: 8px clamp(10px, 1.6vw, 18px);
  border-bottom: 1px solid var(--line-2);
  background: var(--card);
  box-shadow: none;
}

.editor-title-wrap {
  gap: 10px;
}

.editor-title-wrap h1 {
  color: var(--ink);
  font-family: var(--display);
  font-size: 23px;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.editor-file-label {
  margin-top: 1px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-actions {
  gap: 5px;
}

.editor-btn {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.editor-btn:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.editor-btn.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
}

.editor-panel-toggle {
  font-size: 8px;
}

.editor-body {
  background: var(--paper);
}

.editor-sidebar {
  border-right: 1px solid var(--line);
  background: var(--card);
}

.editor-sidebar-head {
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--line);
}

.editor-panel-kicker {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.editor-sidebar-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: 21px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.editor-search {
  margin: 10px 12px 8px;
  width: calc(100% - 24px);
}

.editor-tree-tools {
  padding: 0 12px 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.editor-tree-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
}

.editor-tree {
  padding: 2px 8px 12px;
}

.tree-row {
  min-height: 29px;
  padding: 1px 4px 1px calc(var(--tree-depth, 0) * 12px + 2px);
  border-radius: 0;
}

.tree-row:hover {
  background: var(--paper-2);
}

.tree-row.is-selected {
  background: var(--blue-soft);
  box-shadow: inset 2px 0 0 var(--blue);
}

.tree-toggle,
.tree-icon-btn,
.tree-row-action {
  border-radius: 0;
  color: var(--muted);
}

.tree-toggle:hover,
.tree-icon-btn:hover,
.tree-row-action:hover {
  background: var(--paper-2);
  color: var(--blue);
}

.tree-icon-btn[data-state="visible"] {
  color: var(--blue);
}

.tree-row-branch > .tree-label {
  color: var(--ink);
  font-weight: 600;
}

.tree-row-user > .tree-label {
  color: var(--blue);
}

.tree-label {
  font-size: 11px;
}

.tree-color-swatch {
  border-radius: 0;
}

.editor-sidebar-foot {
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.editor-sidebar-foot b {
  color: var(--ink-2);
}

.editor-file-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
}

.editor-map-toolbar {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.editor-view-tools {
  gap: 5px;
}

.editor-view-tools .zoom-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  font-size: 15px;
  box-shadow: none;
}

.editor-view-tools .zoom-value {
  min-width: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.editor-view-toggles {
  gap: 12px;
}

.switch-label {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.switch-track {
  width: 30px;
  height: 16px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--paper-3);
}

.switch-track::after {
  width: 10px;
  height: 10px;
  border-radius: 1px;
  background: var(--card);
  box-shadow: 0 0 0 1px rgba(23, 33, 27, 0.12);
}

.switch input:checked + .switch-track {
  border-color: var(--blue);
  background: var(--blue);
}

.switch input:checked + .switch-track::after {
  transform: translateX(14px);
}

.switch-small .switch-track {
  width: 30px;
  height: 16px;
}

.switch-small .switch-track::after {
  width: 10px;
  height: 10px;
}

.switch-small input:checked + .switch-track::after {
  transform: translateX(14px);
}

.editor-map-viewport {
  background-color: #f8f3e8;
  background-image:
    linear-gradient(rgba(30, 74, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 74, 54, 0.05) 1px, transparent 1px);
  background-size: 30px 30px;
}

.editor-map-viewport::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(30, 74, 54, 0.14);
  pointer-events: none;
}

.editor-map-hint {
  top: 20px;
  border-bottom: 1px dashed var(--line-2);
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.editor-map-viewport .map-tag {
  bottom: 18px;
}

.draw-toolbar {
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--card);
  box-shadow: 6px 6px 0 rgba(23, 33, 27, 0.14);
}

.draw-btn {
  border: 1px solid var(--line-2);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
}

.draw-btn:hover,
.draw-btn.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fbf8ef;
}

.draw-color-wrap span,
.draw-range-wrap span,
.draw-check {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.draw-toolbar .editor-btn {
  font-size: 8px;
}

/* ---------------------------------------------------------- */
/* compact game / editor controls                             */
/* ---------------------------------------------------------- */

@media (min-width: 901px) {
  .editor-panel-toggle {
    display: none;
  }
}

@media (max-width: 900px) {
  .editor-panel-toggle {
    display: inline-grid;
    order: -1;
    width: 34px;
    min-width: 34px;
    height: 32px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line-2);
    background: var(--paper-2);
    color: var(--ink);
    font-size: 0;
  }

  .editor-panel-toggle::before {
    content: "☰";
    font-family: var(--font);
    font-size: 15px;
    line-height: 1;
  }

  .editor-panel-toggle:hover {
    border-color: var(--ink);
    background: var(--paper-3);
  }
}

@media (max-width: 700px) {
  .game-topbar,
  .classic-topbar,
  .legacy-game-topbar {
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .topbar-row {
    min-height: 38px;
    gap: 8px;
  }

  .game-title {
    font-size: 18px;
  }

  .classic-context {
    font-size: 7px;
  }

  .mission-hud {
    margin: 6px 0 8px;
  }

  .mission-object {
    padding: 8px 10px;
  }

  .mission-icon {
    width: 30px;
    height: 32px;
  }

  .mission-icon svg {
    width: 18px;
    height: 18px;
  }

  .mission-name {
    font-size: 23px;
  }

  .mission-stat {
    min-width: 48px;
    padding: 0 9px;
  }

  .mission-stat-time {
    display: none;
  }

  .mission-stat-value {
    font-size: 17px;
  }

  .mission-stat-primary .mission-stat-value {
    font-size: 20px;
  }

  .win-btn {
    min-height: 38px;
    padding: 0 10px;
  }

  .map-tag {
    left: 14px;
    bottom: 12px;
    font-size: 7px;
  }

  .zoom-controls {
    right: 14px;
    bottom: 14px;
    gap: 5px;
  }

  .zoom-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
  }

  .classic-map-viewport::after,
  .game-screen .map-viewport::after,
  .editor-map-viewport::after {
    inset: 8px;
  }

  .setup-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .setup-body {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 16px;
  }

  .setup-maps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .setup-map-card {
    min-height: 56px;
    padding: 6px;
  }

  .setup-map-thumb {
    width: 58px;
    height: 38px;
  }

  .setup-map-copy strong {
    font-size: 14px;
  }

  .setup-summary {
    margin-top: 0;
  }

  .dialog-head {
    padding: 14px 16px 12px;
  }

  .dialog-body {
    padding: 16px;
  }

  .dialog-actions {
    padding: 12px 16px 16px;
  }

  .dialog-actions .btn-start,
  .dialog-actions .btn-soft,
  .dialog-actions .btn-danger,
  .dialog-actions .btn-primary {
    flex: 1 1 auto;
    min-height: 42px;
    padding: 0 12px;
    font-size: 12px;
  }

  .result-stats .stat {
    padding: 12px;
  }

  .result-stats .stat-value {
    font-size: 30px;
  }

  .result-dialog .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .result-dialog .dialog-actions > * {
    width: 100%;
  }

  .result-dialog .dialog-actions > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .atlas-toolbar {
    padding: 10px 14px;
  }

  .atlas-layout {
    display: flex;
    flex-direction: column;
    padding: 10px 14px 14px;
    overflow: auto;
  }

  .atlas-map-panel,
  .atlas-list-panel {
    flex: 0 0 auto;
  }

  .atlas-map-panel {
    padding: 8px;
  }

  .atlas-list-panel {
    max-height: 45dvh;
  }

  .atlas-map-footer {
    display: block;
  }

  .atlas-detail {
    margin-top: 6px;
    text-align: left;
  }

  .atlas-detail-main,
  .atlas-detail-actions {
    justify-content: flex-start;
  }

  .atlas-map-info {
    margin-top: 8px;
    padding-top: 8px;
  }

  .atlas-tip {
    display: none;
  }

  .editor-topbar {
    flex-wrap: wrap;
    gap: 7px;
    padding: 8px 10px;
  }

  .editor-title-wrap {
    flex: 1 1 auto;
  }

  .editor-title-wrap h1 {
    font-size: 20px;
  }

  .editor-actions {
    flex: 1 0 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .editor-actions::-webkit-scrollbar {
    display: none;
  }

  .editor-btn {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 8px;
    font-size: 7.5px;
  }

  .editor-panel-toggle {
    display: inline-grid;
    flex: 0 0 auto;
    width: 32px;
    min-width: 32px;
    height: 30px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line-2);
    font-size: 0;
  }

  .editor-panel-toggle::before {
    content: "☰";
    font-family: var(--font);
    font-size: 15px;
    line-height: 1;
  }

  .editor-map-toolbar {
    padding: 6px 10px;
  }

  .editor-view-toggles {
    gap: 9px;
  }

  .editor-view-tools .zoom-btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
  }

  .switch-label {
    font-size: 7px;
  }

  .editor-sidebar {
    box-shadow: 12px 0 0 rgba(23, 33, 27, 0.1);
  }

  .editor-sidebar-foot {
    display: none;
  }
}

@media (max-width: 480px) {
  .classic-topbar .topbar-actions .win-btn,
  .legacy-game-topbar .topbar-actions .win-btn {
    width: auto;
    min-width: 0;
    height: 38px;
    padding: 0 9px;
  }

  .classic-topbar .topbar-actions #classicEndBtn > span:last-child,
  .legacy-game-topbar .topbar-actions #endBtn > span:last-child {
    display: inline;
  }

  .mission-stat {
    align-items: flex-start;
    padding: 7px 10px;
  }

  .mission-stat-time {
    display: none;
  }

  .setup-maps {
    grid-template-columns: 1fr;
  }

  .setup-levels {
    gap: 4px;
  }

  .setup-level {
    padding: 7px;
  }

  .setup-level .seg-name {
    font-size: 14px;
  }

  .setup-level .seg-count {
    font-size: 6px;
  }

  .setup-count-field {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
}

/* ---------------------------------------------------------- */
/* home v2 — compact, navigable overview                      */
/* ---------------------------------------------------------- */

.home-screen {
  scroll-behavior: smooth;
}

.home-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -1px;
  padding: 12px 1px 11px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
}

.home-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.home-header-play {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--blue-deep);
  border-radius: 2px;
  background: var(--blue);
  color: #fbf8ef;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.home-header-play span {
  color: #e5c78a;
  font-family: var(--font);
  font-size: 14px;
}

.home-header-play:hover {
  background: var(--blue-deep);
}

.brand {
  min-width: 0;
}

.brand-copy h1 {
  font-size: 22px;
}

.brand-kicker {
  margin-top: 2px;
}

.hero {
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(30px, 4vw, 58px);
  padding: clamp(36px, 4.6vw, 58px) 0 clamp(38px, 4.6vw, 56px);
}

.hero-kicker {
  margin-bottom: 15px;
  font-size: 8.5px;
}

.hero h2 {
  max-width: 11ch;
  margin-bottom: 18px;
  font-size: clamp(42px, 5.2vw, 66px);
  line-height: 0.98;
}

.hero-lead {
  max-width: 520px;
  margin-bottom: 24px;
  font-size: 14.5px;
  line-height: 1.62;
}

.hero-actions {
  gap: 14px;
}

.btn-hero-secondary {
  min-height: 44px;
  padding: 0 15px;
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-quickfacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 24px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.04em;
  list-style: none;
  text-transform: uppercase;
}

.hero-quickfacts li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hero-quickfacts li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.hero-plate {
  width: 100%;
  max-width: 540px;
  justify-self: end;
  transform: none;
}

.hero-plate:hover {
  transform: none;
}

.plate-frame {
  padding: 8px;
  box-shadow: 6px 7px 0 rgba(30, 74, 54, 0.14);
}

.plate-head {
  padding-bottom: 7px;
}

.plate-coords {
  display: inline;
}

.plate-map {
  margin: 7px 0;
  aspect-ratio: 520 / 335;
}

.plate-map > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(0.68) sepia(0.08) contrast(0.96);
}

.plate-foot {
  padding-top: 7px;
}

.plate-caption {
  margin-top: 10px;
}

.section-head-compact {
  margin-bottom: 24px;
}

.section-head-compact h2 {
  font-size: clamp(28px, 3.2vw, 40px);
}

.activities,
.map-library,
.progress-section {
  padding: clamp(38px, 4.6vw, 58px) 0;
  scroll-margin-top: 76px;
}

.home-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  border: 0;
}

.home-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--card);
  box-shadow: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.home-card:hover {
  border-color: var(--line-2);
  box-shadow: 3px 4px 0 rgba(23, 33, 27, 0.06);
  transform: translateY(-1px);
}

.home-card-wide {
  grid-column: span 2;
}

.home-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.home-card-tag {
  color: var(--amber-ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.home-card-num {
  color: var(--muted);
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}

.home-card h3 {
  margin: 0 0 7px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.025em;
}

.home-card p {
  flex: 1 1 auto;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.home-card p b {
  color: var(--ink-2);
  font-weight: 600;
}

.home-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.home-card-foot > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.4;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.home-card-btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.home-card-btn span {
  margin-left: 4px;
  color: var(--amber);
  font-family: var(--font);
  font-size: 13px;
}

.home-card-btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.home-card-btn:hover span {
  color: var(--amber-soft);
}

.home-card-featured {
  border-color: var(--blue-deep);
  background: var(--blue);
  color: #fbf8ef;
}

.home-card-featured:hover {
  border-color: var(--blue-deep);
  background: #173e2c;
  box-shadow: 3px 4px 0 rgba(23, 33, 27, 0.18);
}

.home-card-featured h3,
.home-card-featured .home-card-tag {
  color: #fbf8ef;
}

.home-card-featured .home-card-tag {
  color: #e4c383;
}

.home-card-featured p {
  color: #d9d4c3;
}

.home-card-featured .home-card-foot {
  border-top-color: rgba(251, 248, 240, 0.22);
}

.home-card-featured .home-card-foot > span {
  color: #c9c2ae;
}

.home-card-badge {
  padding: 2px 6px;
  border: 1px solid #d7b26a;
  border-radius: 0;
  color: #f0d59a;
  font-family: var(--mono);
  font-size: 6.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.home-card-btn-light {
  border-color: rgba(251, 248, 240, 0.55);
  color: #fbf8ef;
}

.home-card-btn-light span {
  color: #e4c383;
}

.home-card-btn-light:hover {
  background: #fbf8ef;
  color: var(--blue-deep);
}

.home-card-btn-light:hover span {
  color: var(--amber);
}

.map-shelf {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
}

.map-sheet {
  position: relative;
}

.map-sheet-hit {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.map-sheet-hit:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.map-sheet-img {
  aspect-ratio: 1.25;
}

.map-sheet-img img {
  display: block;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.map-sheet figcaption {
  display: block;
  padding-top: 6px;
}

.map-sheet figcaption b {
  font-size: 13px;
}

.map-sheet figcaption span {
  display: none;
}

.progress-section {
  border-bottom: 0;
}

.map-shelf-hint {
  display: none;
}

.progress-layout {
  border-top: 1px solid var(--line-2);
}

.progress-item {
  padding: 14px 0;
}

.progress-name {
  font-size: 20px;
}

.progress-value {
  font-size: 17px;
}

.home-footer {
  margin-top: 18px;
}

@media (max-width: 980px) {
  .home-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-card-wide {
    grid-column: span 2;
  }

  .map-shelf {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hero {
    gap: 32px;
  }

  .hero-plate {
    max-width: 470px;
  }
}

@media (max-width: 760px) {
  .home-header {
    padding: 10px 1px 9px;
  }

  .home-header-play {
    min-height: 36px;
    padding: 0 10px;
  }

  .brand-copy h1 {
    font-size: 20px;
  }

  .brand-kicker {
    display: block;
    font-size: 7px;
    letter-spacing: 0.05em;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 28px 0 32px;
  }

  .hero h2 {
    max-width: 12ch;
    font-size: clamp(40px, 11.8vw, 52px);
    line-height: 0.98;
  }

  .hero-lead {
    margin-bottom: 18px;
    font-size: 14px;
  }

  .hero-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .btn-hero {
    width: 100%;
  }

  .btn-hero-secondary {
    justify-content: center;
    width: 100%;
  }

  .hero-quickfacts {
    gap: 7px 16px;
    margin-top: 18px;
    padding-top: 11px;
    font-size: 7px;
  }

  .hero-plate {
    max-width: none;
  }

  .plate-head,
  .plate-foot,
  .plate-caption {
    display: none;
  }

  .plate-frame {
    padding: 6px;
    box-shadow: 4px 5px 0 rgba(30, 74, 54, 0.12);
  }

  .plate-map {
    height: 156px;
    margin: 0;
    aspect-ratio: auto;
  }

  .plate-map > img {
    object-fit: cover;
  }

  .home-card-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .home-card,
  .home-card-wide {
    grid-column: auto;
    min-height: 0;
    padding: 13px 14px;
  }

  .home-card-top {
    margin-bottom: 8px;
  }

  .home-card h3 {
    margin-bottom: 10px;
    font-size: 22px;
  }

  .home-card p {
    display: none;
  }

  .home-card-foot {
    flex-wrap: nowrap;
    padding-top: 9px;
  }

  .home-card-foot > span {
    flex: 1 1 auto;
  }

  .map-shelf {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .map-shelf::-webkit-scrollbar {
    display: none;
  }

  .map-sheet {
    flex: 0 0 134px;
    scroll-snap-align: start;
  }

  .map-sheet-img {
    aspect-ratio: 1.15;
  }

  .map-shelf-hint {
    display: block;
    margin: 7px 0 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 7px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
  }

  .progress-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  .home-header-play {
    display: none;
  }
}

@media (max-width: 390px) {
  .hero h2 {
    font-size: 39px;
  }

  .home-card-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-card-btn {
    width: 100%;
  }
}

/* ---------------------------------------------------------- */
/* dark theme                                                 */
/* ---------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece6d8;
    --ink-2: #cfc9bb;
    --muted: #a2a89c;
    --line: #384338;
    --line-2: #556252;
    --blue: #8fbfa1;
    --blue-2: #a8cfb4;
    --blue-soft: #22352a;
    --blue-deep: #b6d6bd;
    --green: #8fbfa1;
    --green-2: #a8cfb4;
    --green-soft: #22352a;
    --red: #e09a84;
    --red-2: #e8aa96;
    --red-soft: #3b211b;
    --amber: #d6a84f;
    --amber-2: #e1b761;
    --amber-ink: #e1b761;
    --amber-soft: #3a2e18;
    --purple: #8fb8bd;
    --purple-soft: #203234;
    --bg: #111914;
    --card: #18221b;
    --paper: #111914;
    --paper-2: #1b261e;
    --paper-3: #26332a;
    --bar-1: #1a251d;
    --bar-2: #162019;
    --bar-3: #121a15;
    --bar-border: #3b473b;
    --panel-1: #1c271f;
    --panel-2: #202c23;
    --dialog: #18221b;
    --dialog-border: #556252;
    --focus: #d6a84f;
    color-scheme: dark;
  }

  html,
  body {
    background: var(--paper);
  }

  .home-screen,
  .atlas-screen,
  .game-screen,
  .classic-screen,
  .editor-screen,
  .game-body,
  .classic-body {
    background-color: var(--paper);
  }

  .home-screen,
  .atlas-screen {
    background-image:
      linear-gradient(rgba(236, 230, 216, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(236, 230, 216, 0.035) 1px, transparent 1px);
  }

  .home-bg {
    background:
      radial-gradient(800px 500px at 82% 8%, rgba(143, 191, 161, 0.08), transparent 68%),
      radial-gradient(700px 420px at 4% 30%, rgba(214, 168, 79, 0.06), transparent 70%);
  }

  .brand-logo,
  .footer-brand img {
    filter: saturate(0.4) sepia(0.35) hue-rotate(52deg) brightness(0.9);
  }

  .plate-frame,
  .plate-map,
  .map-sheet-img,
  .map-viewport,
  .editor-map-viewport,
  .atlas-map {
    background-color: #17221b;
  }

  .plate-map,
  .map-viewport,
  .editor-map-viewport,
  .atlas-map {
    background-image:
      linear-gradient(rgba(236, 230, 216, 0.045) 1px, transparent 1px),
      linear-gradient(90deg, rgba(236, 230, 216, 0.045) 1px, transparent 1px);
  }

  .plate-map > img,
  .map-sheet-img img,
  .atlas-map-img {
    filter: invert(0.9) hue-rotate(170deg) saturate(0.65) sepia(0.12);
    opacity: 0.9;
  }

  .plate-guess b {
    border-color: #b86a55;
    background: #3b211b;
    color: #f2b7a5;
  }

  .plate-pin b {
    border-color: var(--line-2);
    background: var(--card);
    color: var(--ink);
  }

  .map-scene {
    filter: invert(0.88) hue-rotate(165deg) saturate(0.72) sepia(0.12);
  }

  .hero h2 em,
  .brand-copy h1 span,
  .section-index,
  .activity-num {
    color: var(--amber);
  }

  .activity-row:hover {
    background: rgba(236, 230, 216, 0.035);
  }

  .activity-row-studio {
    background: #1b3a2c;
  }

  .activity-row-studio:hover {
    background: #234a37;
  }

  .activity-row-studio .activity-copy p,
  .activity-row-studio .activity-copy p b {
    color: #d2cec0;
  }

  .map-sheet img,
  .plate-map > img {
    border-color: var(--line);
  }

  .legend-dot,
  .city-dot {
    box-shadow: none;
  }

  .result-list th,
  .atlas-list-head,
  .editor-sidebar-foot,
  .setup-summary {
    background: var(--paper-2);
  }

  .overlay {
    background: rgba(4, 7, 5, 0.7);
  }

  .dialog,
  .dialog-head,
  .dialog-body,
  .dialog-actions {
    background: var(--card);
  }

  .draw-toolbar,
  .distance-legend,
  .loading-card,
  .map-next-float {
    background: var(--paper-2);
  }

  .map-next-float {
    color: #102017;
    background: var(--amber);
  }

  .map-next-float.is-result {
    background: var(--amber);
    color: #102017;
  }

  .btn-primary,
  .btn-start,
  .btn-hero,
  .activity-link-hot,
  #classicNextBtn:not(:disabled),
  #nextBtn:not(:disabled),
  .chip.is-active,
  .setup-level.is-active,
  .zoom-btn-vuc[aria-pressed="true"],
  .editor-btn.is-active,
  .draw-btn.is-active,
  .btn-danger {
    color: #102017;
  }

  .btn-primary:hover,
  .btn-start:hover,
  .btn-hero:hover,
  .activity-link-hot:hover,
  #classicNextBtn:not(:disabled):hover,
  #nextBtn:not(:disabled):hover,
  .draw-btn.is-active:hover {
    color: #102017;
    background: var(--blue-deep);
  }

  .btn-hero-meta,
  .activity-link-hot span {
    color: #2d4b38;
  }

  .setup-level.is-active .seg-count {
    color: #2d4b38;
  }

  .record-badge {
    border-color: var(--amber);
    background: var(--amber-soft);
    color: #f1d69b;
  }

  .result-reopen-btn {
    border-color: var(--amber);
    background: var(--amber-soft);
    color: #f1d69b;
  }

  .result-reopen-btn:hover:not(:disabled) {
    background: #4a3a1a;
    color: #ffe6ad;
  }

  .mission-icon {
    background: var(--paper-2);
    color: var(--blue);
  }

  .switch-track {
    border-color: var(--line-2);
    background: var(--paper-3);
  }

  .editor-sidebar,
  .editor-map-toolbar {
    background: var(--card);
  }

  .map-tag,
  .map-hint,
  .editor-map-hint,
  .zoom-value {
    color: var(--muted);
  }

  /* home v2 — dark overrides */
  .home-header {
    background: color-mix(in srgb, var(--paper) 94%, transparent);
  }

  .home-header-play {
    border-color: var(--blue-deep);
    background: var(--blue);
    color: #102017;
  }

  .home-header-play span {
    color: #2d4b38;
  }

  .home-header-play:hover {
    background: var(--blue-deep);
  }

  .home-card {
    background: var(--card);
  }

  .home-card-featured {
    border-color: #2b5a42;
    background: #1b3a2c;
  }

  .home-card-featured:hover {
    border-color: #3c7355;
    background: #234a37;
  }

  .home-card-featured .home-card-tag {
    color: #e4c383;
  }

  .home-card-featured .home-card-btn-light {
    border-color: rgba(251, 248, 240, 0.55);
    color: #fbf8ef;
  }

  .home-card-btn:hover {
    background: var(--ink);
    color: var(--paper);
  }

  .home-card-btn-light:hover {
    background: #fbf8ef;
    color: #123326;
  }
}

/* ---------------------------------------------------------- */
/* map recenter control                                       */
/* ---------------------------------------------------------- */

.zoom-btn-center {
  color: var(--blue);
  font-size: 17px;
}

/* ---------------------------------------------------------- */
/* compact portrait game HUD                                  */
/* ---------------------------------------------------------- */

@media (max-width: 700px) and (orientation: portrait) {
  .classic-topbar,
  .legacy-game-topbar {
    padding: max(6px, env(safe-area-inset-top)) 10px 0;
  }

  .topbar-row {
    min-height: 37px;
    gap: 7px;
  }

  .game-title {
    font-size: 18px;
  }

  .classic-context {
    max-width: 210px;
    font-size: 6.8px;
  }

  .mission-hud {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    margin: 5px 0 6px;
    padding: 0;
  }

  .mission-object {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
    padding: 7px 9px;
  }

  .mission-icon {
    width: 28px;
    height: 30px;
  }

  .mission-icon svg {
    width: 17px;
    height: 17px;
  }

  .mission-kicker {
    font-size: 6.2px;
    letter-spacing: 0.08em;
  }

  .mission-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 19px;
    line-height: 1.03;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mission-type {
    display: none;
  }

  .mission-stats {
    flex: 0 0 auto;
    align-items: stretch;
    margin-left: 0;
    padding: 0;
    border-top: 0;
  }

  .mission-stat {
    flex: 0 0 auto;
    min-width: 0;
    align-items: flex-end;
    justify-content: center;
    padding: 0 8px;
  }

  .mission-stat-average,
  .mission-stat-time {
    display: none;
  }

  .mission-stat-label {
    font-size: 6.2px;
    letter-spacing: 0.06em;
  }

  .mission-stat-value {
    font-size: 15px;
  }

  .mission-stat-primary .mission-stat-value {
    font-size: 17px;
  }

  .mission-stat-counts .mission-stat-value {
    font-size: 16px;
  }

  .game-progress {
    margin-top: 0;
  }
}

/* ---------------------------------------------------------- */
/* landscape game layout — HUD becomes a side rail            */
/* ---------------------------------------------------------- */

@media (orientation: landscape) and (max-height: 600px) {
  .hero {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 24px;
    align-items: center;
    padding: 24px 0 28px;
  }

  .hero h2 {
    max-width: 10ch;
    margin-bottom: 12px;
    font-size: clamp(34px, 6.2vw, 46px);
  }

  .hero-lead {
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.52;
  }

  .hero-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  .btn-hero,
  .btn-hero-secondary {
    width: auto;
  }

  .hero-quickfacts {
    margin-top: 12px;
    padding-top: 8px;
    font-size: 6.8px;
  }

  .hero-plate {
    display: block;
    width: 100%;
    max-width: 280px;
    justify-self: end;
  }

  .plate-map {
    height: 158px;
    aspect-ratio: auto;
  }

  .hero-plate .plate-map > img {
    object-fit: cover;
  }

  .home-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-card-wide {
    grid-column: span 2;
  }

  .editor-topbar {
    flex-wrap: nowrap;
    gap: 7px;
    padding: 5px 8px;
  }

  .nav-back {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 0;
    justify-content: center;
  }

  .nav-back-text {
    display: none;
  }

  .editor-title-wrap {
    flex: 0 0 auto;
    gap: 6px;
  }

  .editor-title-wrap h1 {
    font-size: 18px;
  }

  .editor-file-label {
    display: none;
  }

  .editor-actions {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 0;
    scrollbar-width: none;
  }

  .editor-actions::-webkit-scrollbar {
    display: none;
  }

  .editor-actions .editor-btn {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 6px;
    font-size: 7px;
  }

  .editor-actions .icon-btn {
    flex: 0 0 auto;
    width: 30px;
    min-width: 30px;
    height: 30px;
  }

  .editor-panel-toggle {
    width: 30px;
    min-width: 30px;
    height: 30px;
  }

  .editor-map-toolbar {
    flex-wrap: nowrap;
    min-height: 40px;
    gap: 6px;
    padding: 4px 8px;
  }

  .editor-view-tools,
  .editor-view-toggles {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .editor-view-tools .zoom-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 14px;
    box-shadow: none;
  }

  .editor-view-tools .zoom-value {
    min-width: 34px;
    font-size: 7px;
  }

  .switch-small {
    gap: 4px;
  }

  .switch-small .switch-track {
    width: 26px;
    height: 14px;
  }

  .switch-small .switch-track::after {
    width: 8px;
    height: 8px;
  }

  .switch-small input:checked + .switch-track::after {
    transform: translateX(12px);
  }

  .switch-label {
    font-size: 6.5px;
  }

  .editor-draw-toggle,
  #editorDrawToggle {
    min-height: 28px;
    padding: 0 6px;
    font-size: 7px;
  }

  .editor-map-viewport {
    inset: 41px 0 0 0;
  }

  .editor-map-hint {
    top: 12px;
  }

  .classic-screen,
  .game-screen {
    display: grid;
    grid-template-columns: clamp(156px, 20vw, 196px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
  }

  .classic-topbar,
  .legacy-game-topbar {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    width: auto;
    height: 100%;
    overflow-y: auto;
    padding:
      max(5px, env(safe-area-inset-top))
      6px
      max(5px, env(safe-area-inset-bottom))
      max(7px, env(safe-area-inset-left));
    border-right: 1px solid var(--line-2);
    border-bottom: 0;
    scrollbar-width: thin;
  }

  .game-body,
  .classic-body {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .topbar-row,
  .classic-topbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-height: 0;
  }

  .classic-title-wrap {
    width: 100%;
    gap: 5px;
  }

  .classic-title-wrap .icon-btn {
    width: 24px;
    min-width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .classic-context {
    max-width: 100%;
    font-size: 6px;
  }

  .game-title {
    font-size: 15px;
    line-height: 1.05;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin-left: 0;
    gap: 3px;
  }

  .win-btn {
    justify-content: center;
    min-height: 27px;
    padding: 0 4px;
    font-size: 8px;
  }

  .win-btn .ico {
    width: 10px;
    height: 10px;
  }

  .mission-hud {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 4px 0;
    padding: 0;
  }

  .mission-object {
    width: 100%;
    gap: 5px;
    padding: 5px;
  }

  .mission-icon {
    width: 22px;
    height: 24px;
    flex: 0 0 22px;
  }

  .mission-icon svg {
    width: 14px;
    height: 14px;
  }

  .mission-kicker {
    font-size: 5.3px;
  }

  .mission-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 15px;
    line-height: 1.02;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .mission-type {
    display: none;
  }

  .mission-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
  }

  .mission-stat {
    min-width: 0;
    align-items: flex-start;
    padding: 4px 6px;
    border-left: 1px solid var(--line);
  }

  .mission-stat:nth-child(odd) {
    border-left: 0;
  }

  .mission-stat-average,
  .mission-stat-time {
    display: none;
  }

  .mission-stat-label {
    font-size: 5.3px;
  }

  .mission-stat-value {
    font-size: 12px;
  }

  .mission-stat-primary .mission-stat-value {
    font-size: 14px;
  }

  .game-progress {
    display: none;
  }

  .map-hint,
  .map-tag {
    display: none;
  }

  .zoom-controls {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 4px;
  }

  .classic-map-viewport,
  .game-screen .map-viewport {
    inset:
      env(safe-area-inset-top)
      env(safe-area-inset-right)
      env(safe-area-inset-bottom)
      0;
  }

  .zoom-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 15px;
  }

  .zoom-btn-vuc {
    font-size: 7px;
  }

  .classic-map-viewport::after,
  .game-screen .map-viewport::after {
    inset: 6px;
  }

  .map-next-float {
    top: max(8px, env(safe-area-inset-top)) !important;
    bottom: auto !important;
    left: max(8px, env(safe-area-inset-left));
    min-height: 34px;
    padding: 0 12px;
    font-size: 8px;
    transform: none;
  }

  .distance-legend {
    top: 8px;
    right: 8px;
    max-width: min(260px, 46vw);
    padding: 6px 8px;
    font-size: 8px;
  }

  .classic-loading {
    grid-column: 1 / -1;
  }

  .dialog {
    max-height: calc(100dvh - 12px);
    overflow-y: auto;
  }

  .setup-dialog {
    width: min(720px, calc(100vw - 16px));
    max-height: calc(100dvh - 12px);
  }

  .settings-dialog {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 16px);
  }

  .settings-languages .seg-btn {
    min-height: 44px;
  }

  .setup-head {
    padding: 8px 14px 6px;
  }

  .setup-head h2 {
    font-size: 25px;
  }

  .setup-subtitle {
    display: none;
  }

  .setup-dialog .dialog-x {
    width: 30px;
    height: 30px;
    font-size: 17px;
  }

  .setup-body {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 14px;
    padding: 10px 14px;
  }

  .setup-maps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-height: 154px;
    min-height: 0;
    overflow-y: auto;
  }

  .setup-map-card {
    min-height: 52px;
    padding: 5px;
  }

  .setup-map-thumb {
    width: 50px;
    height: 32px;
  }

  .setup-map-copy strong {
    font-size: 13px;
  }

  .setup-map-copy span {
    font-size: 6px;
  }

  .setup-options {
    gap: 5px;
  }

  .setup-field-hint,
  .setup-summary-sub {
    display: none;
  }

  .setup-level {
    min-height: 42px;
    padding: 5px 7px;
  }

  .setup-level .seg-name {
    font-size: 13px;
  }

  .setup-level .seg-count {
    font-size: 5.5px;
  }

  .setup-count-field {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .setup-summary {
    margin-top: 0;
    padding: 7px 9px;
    font-size: 7.5px;
  }

  .setup-actions {
    padding: 6px 14px 8px;
  }

  .setup-actions .btn-start,
  .setup-actions .btn-soft {
    min-height: 32px;
  }

  .result-dialog {
    width: min(700px, calc(100vw - 16px));
  }

  .result-stats .stat {
    padding: 6px 10px;
  }

  .result-stats .stat-value {
    font-size: 24px;
  }

  .result-dialog .dialog-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    padding: 6px 14px 8px;
  }

  .result-dialog .dialog-actions > * {
    flex: 1 1 0;
    min-height: 30px;
    padding: 0 6px;
    font-size: 9px;
  }

  .dialog-head {
    padding: 10px 14px 8px;
  }

  .dialog-head h2 {
    font-size: 23px;
  }

  .dialog-body {
    padding: 12px 14px;
  }

  .dialog-actions {
    padding: 9px 14px 12px;
  }

  .dialog-actions .btn-start,
  .dialog-actions .btn-soft,
  .dialog-actions .btn-danger,
  .dialog-actions .btn-primary {
    min-height: 34px;
    font-size: 10px;
  }
}

/* ---------------------------------------------------------- */
/* motion                                                     */
/* ---------------------------------------------------------- */

/*
 * Guidance used here:
 * - Nielsen Norman Group: simple feedback ~100 ms, larger transitions 200–300 ms.
 * - IBM Carbon: micro-interactions 110–150 ms.
 * - Material Design: exits should be shorter than entrances.
 *
 * Everything below is opacity/transform only, 90–180 ms, with an ease-out
 * curve. `prefers-reduced-motion` disables it at the end of the file.
 */

:root {
  --motion-fast: 110ms;
  --motion-base: 160ms;
  --motion-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes screen-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes feedback-pop {
  0% { transform: translateY(0); }
  45% { transform: translateY(-1px) scale(1.015); }
  100% { transform: translateY(0) scale(1); }
}

.screen:not([hidden]) {
  animation: screen-in 140ms var(--motion-ease) both;
}

.overlay:not([hidden]) {
  animation: overlay-in var(--motion-fast) ease-out both;
}

.overlay:not([hidden]) > .dialog {
  animation: dialog-in var(--motion-base) var(--motion-ease) both;
}

.toast:not([hidden]) {
  animation: toast-in 140ms var(--motion-ease);
}

.map-next-float:not([hidden]) {
  animation: fade-in 120ms ease-out both;
}

.map-hint:not([hidden]),
.distance-legend:not([hidden]),
.classic-loading:not([hidden]) {
  animation: fade-in 120ms ease-out both;
}

.mission-kicker.is-correct,
.mission-kicker.is-wrong,
.mission-kicker.is-partial {
  animation: feedback-pop var(--motion-base) var(--motion-ease);
}

.home-card,
.map-sheet-img img,
.footer-github,
.about-github,
.home-card-btn,
.home-header-play,
.btn-primary,
.btn-start,
.btn-soft,
.btn-danger,
.btn-ghost,
.win-btn,
.zoom-btn,
.icon-btn,
.nav-back,
.chip,
.seg-btn,
.editor-btn,
.draw-btn {
  transition-duration: 120ms;
  transition-timing-function: var(--motion-ease);
}

.home-card-btn,
.home-header-play,
.btn-primary,
.btn-start,
.btn-soft,
.btn-danger,
.btn-ghost,
.win-btn,
.zoom-btn,
.icon-btn,
.nav-back,
.chip,
.seg-btn,
.editor-btn,
.draw-btn {
  transition-property: background-color, color, border-color, transform, box-shadow;
}

.home-card {
  transition-property: border-color, transform, box-shadow;
}

.home-card-btn span,
.home-header-play span,
.footer-github svg {
  transition: transform 120ms var(--motion-ease);
}

.home-card-btn:hover span,
.home-header-play:hover span {
  transform: translateX(2px);
}

.footer-github:hover svg {
  transform: translateY(-1px);
}

.game-progress span {
  transition: width 180ms var(--motion-ease);
}

.btn-primary:active:not(:disabled),
.btn-start:active:not(:disabled),
.btn-soft:active:not(:disabled),
.btn-danger:active:not(:disabled),
.btn-ghost:active:not(:disabled),
.win-btn:active:not(:disabled),
.zoom-btn:active:not(:disabled),
.icon-btn:active:not(:disabled),
.nav-back:active:not(:disabled),
.chip:active:not(:disabled),
.seg-btn:active:not(:disabled),
.home-card-btn:active:not(:disabled),
.home-header-play:active:not(:disabled),
.editor-btn:active:not(:disabled),
.draw-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
  transition-duration: 70ms;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------------------------------------------------- */
/* readability                                                */
/* ---------------------------------------------------------- */

/*
 * The editorial style leans on small mono labels. These minimums keep the
 * hierarchy without making the important copy or controls hard to read.
 */

body {
  font-size: 16px;
}

.hero-lead {
  font-size: 16px;
}

.section-lead {
  font-size: 14.5px;
}

.home-card p {
  font-size: 14px;
  line-height: 1.6;
}

.brand-kicker,
.hero-kicker,
.hero-quickfacts,
.home-nav a,
.section-index {
  font-size: 10px;
}

.home-card-tag {
  font-size: 9px;
}

.home-card-foot > span,
.home-card-btn {
  font-size: 9px;
}

.plate-head span,
.plate-key,
.plate-scale,
.plate-caption,
.plate-coords {
  font-size: 9px;
}

.progress-meta {
  font-size: 9.5px;
}

.progress-aside p {
  font-size: 10px;
}

.footer-github {
  font-size: 9.5px;
}

.footer-credits {
  font-size: 9px;
  line-height: 1.65;
}

.atlas-heading p {
  font-size: 9.5px;
}

.atlas-list-head {
  font-size: 10px;
}

.atlas-tip {
  font-size: 11px;
}

.city-row {
  font-size: 13px;
}

.city-level {
  font-size: 8.5px;
}

.classic-context {
  font-size: 9.5px;
}

.mission-kicker {
  font-size: 9px;
}

.mission-type {
  font-size: 9px;
}

.mission-stat-label {
  font-size: 8.5px;
}

.map-hint,
.map-tag {
  font-size: 9px;
}

.editor-panel-kicker,
.editor-tree-tools,
.editor-tree-count {
  font-size: 9px;
}

.tree-label {
  font-size: 12px;
}

.editor-file-meta {
  font-size: 8.5px;
}

.setup-label {
  font-size: 9px;
}

.setup-subtitle {
  font-size: 10px;
}

.setup-field-hint {
  font-size: 8.5px;
}

.setup-summary {
  font-size: 10px;
  line-height: 1.55;
}

@media (max-width: 420px) {
  .home-header-actions {
    gap: 6px;
  }

  .home-header-actions .icon-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .brand-copy h1 {
    font-size: 18px;
  }

  .brand-kicker {
    display: none;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  /* Keep the compact rail usable, but never below the readable floor. */
  .classic-context {
    font-size: 8px;
  }

  .mission-kicker {
    font-size: 8px;
  }

  .mission-stat-label {
    font-size: 8px;
  }

  .setup-summary {
    font-size: 9px;
  }
}
