:root {
  --ink: #1c1915;
  --muted: #6d645b;
  --line: #e4ddd2;
  --paper: #ffffff;
  --red: #c23b33;
  --red-deep: #8d241e;
  --page: #ffffff;
  --page-texture: url("texture-fond.png");
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

html {
  background-color: var(--page);
  background-image: var(--page-texture);
  background-repeat: repeat;
  background-size: auto;
  background-position: top left;
}

body {
  overflow: hidden;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--ink);
  background: transparent;
}

body.is-intro #map canvas,
body.is-playing #map canvas {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%231c1915' stroke-width='1.25' d='M8 2.5v11M2.5 8h11'/%3E%3C/svg%3E") 8 8,
    crosshair;
}

#map canvas.is-sketching {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='2.75' fill='%231c1915'/%3E%3C/svg%3E") 8 8,
    pointer;
}

#map-shell {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--page);
  background-image: var(--page-texture);
  background-repeat: repeat;
  background-size: auto;
  background-position: top left;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

#map canvas {
  touch-action: none;
}

.round-brief {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.round-brief[hidden] { display: none !important; }

body.is-round-brief #chrome,
body.is-round-brief .score-history-wrap {
  filter: blur(5px);
  opacity: 0.45;
  pointer-events: none;
}

.round-brief-card {
  width: min(100%, 520px);
  text-align: center;
}

.round-brief-kicker {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
}

.round-brief-prompt {
  margin: 10px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.round-brief-target {
  margin: 8px 0 0;
  font-size: clamp(36px, 11vw, 72px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  text-wrap: balance;
}

.btn-round-start {
  margin-top: 22px;
  min-width: min(100%, 16rem);
  padding: 12px 20px;
  font-size: 14px;
}

#chrome {
  position: fixed;
  top: 14px;
  left: 16px;
  z-index: 10;
  transition: filter 0.28s ease, opacity 0.28s ease;
  width: fit-content;
  max-width: min(288px, calc(100vw - 32px));
  max-height: calc(100vh - 28px);
  overflow-x: hidden;
  overflow-y: auto;
  pointer-events: none;
  scrollbar-width: thin;
}

#chrome[hidden] { display: none !important; }

#chrome .brand,
#chrome .btn-primary,
#chrome .btn-secondary,
#chrome .stats-section,
#chrome .round-result-sheet {
  pointer-events: auto;
}

#screen-game {
  width: fit-content;
  max-width: min(288px, calc(100vw - 32px));
}

.brand {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-shadow: 0 0 12px #fff, 0 0 8px #fff, 0 1px 0 #fff;
}

body.is-playing .brand {
  font-size: 36px;
  line-height: 1.02;
  white-space: nowrap;
}

.score-history-wrap {
  position: fixed;
  top: 14px;
  right: 28px;
  z-index: 10;
  width: fit-content;
  max-width: min(200px, calc(100vw - 44px));
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
  transition: filter 0.28s ease, opacity 0.28s ease;
}

.score-history-wrap[hidden] { display: none !important; }

body.is-playing .score-history-wrap {
  top: 26px;
}

.score-history-heading {
  margin: 0 0 2px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-shadow: 0 0 10px #fff, 0 0 6px #fff;
}

.score-history {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink);
  text-shadow: 0 0 10px #fff, 0 0 6px #fff;
}

.score-history li {
  padding: 1px 0;
  white-space: nowrap;
}

.score-history-empty,
.score-history-current {
  color: var(--muted);
}

.score-history-current {
  color: var(--red);
  font-weight: 600;
}

.score-history-total {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(28, 25, 21, 0.15);
  font-weight: 700;
}

.round-score-wrap[hidden] { display: none !important; }

.round-score-banner-kicker {
  margin: 8px 0 4px;
  text-shadow: none;
}

.round-score-banner {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 0 2px 10px rgba(28, 25, 21, 0.12);
  pointer-events: auto;
}

.round-score-banner-score {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #ffffff;
  white-space: nowrap;
}

.round-score-banner-score strong {
  font-weight: 700;
  color: #ffffff;
}

.round-meta {
  margin: 10px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red);
  text-shadow: 0 0 10px #fff, 0 0 6px #fff;
}

.round-prompt {
  margin: 6px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-shadow: 0 0 10px #fff, 0 0 6px #fff;
}

.target-line {
  margin: 2px 0 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-shadow: 0 0 12px #fff, 0 0 8px #fff;
}

.stats-section {
  margin-top: 10px;
  width: fit-content;
  max-width: min(288px, calc(100vw - 32px));
  padding: 0;
  background: transparent;
  border: 0;
  pointer-events: auto;
}

.stats-section[hidden] { display: none !important; }

.round-result-sheet[hidden] { display: none !important; }

.round-result-card {
  width: fit-content;
  max-width: min(288px, calc(100vw - 32px));
}

.round-result-card .stats-section {
  margin-top: 10px;
  width: 100%;
  max-width: none;
}

.round-result-card .stats-grid,
.round-result-card .stats-hero {
  width: 100%;
  box-sizing: border-box;
}

.round-result-card .btn-block {
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 521px) {
  .round-result-card .stats-section {
    margin-top: 14px;
  }

  .round-result-card .btn-block:first-of-type {
    margin-top: 14px;
  }
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.stats-grid > div {
  display: block;
}

.stats-hero {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(28, 25, 21, 0.08);
}

.stats-hero-zone {
  border-left: 3px solid var(--red);
}

.stats-hero-ecart {
  border-left: 3px solid var(--ink);
}

.stats-cartouche {
  display: inline-block;
  margin: 0 0 8px;
  padding: 5px 11px;
  border-radius: 6px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.stats-cartouche-ink {
  background: var(--ink);
  color: #ffffff;
}

.stats-cartouche-red {
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  color: #ffffff;
}

.stats-hero dd + dt {
  margin-top: 10px;
}

.stats-hero dt {
  margin-top: 0;
}

.stats-grid dt {
  display: block;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats-grid dd {
  display: block;
  margin: 3px 0 0;
  font-size: 16px;
  letter-spacing: -0.03em;
}

#res-actual,
#res-count,
#res-diff-pop {
  font-weight: 700;
}

#res-diff-pct {
  font-weight: 700;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.map-draw-actions {
  position: fixed;
  z-index: 12;
  margin: 0;
  visibility: hidden;
  pointer-events: auto;
  padding: 6px 8px;
  border: 1px solid rgba(28, 25, 21, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 18px rgba(28, 25, 21, 0.12);
}

.action-row[hidden],
#btn-next[hidden],
#btn-perfect-zone[hidden] {
  display: none !important;
}

.btn-primary,
.btn-secondary {
  padding: 9px 14px;
  border-radius: 8px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.btn-block {
  display: block;
  width: 100%;
  margin-top: 10px;
}

.btn-primary {
  border: 0;
  background: linear-gradient(180deg, var(--red), var(--red-deep));
  color: white;
  box-shadow: 0 2px 10px rgba(28, 25, 21, 0.15);
}

.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(28, 25, 21, 0.08);
}

.final-score {
  margin: 8px 0 0;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--red-deep);
  text-shadow: 0 0 12px #fff;
}

.status {
  margin: 8px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  color: var(--muted);
}

.intro-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.88);
  background-image: var(--page-texture);
  background-repeat: repeat;
  background-size: auto;
  backdrop-filter: blur(2px);
}

#intro-modal {
  background-color: rgba(255, 255, 255, 0.38);
  background-image: none;
  backdrop-filter: blur(0);
}

body.is-intro #map-shell {
  opacity: 0.5;
  transition: opacity 0.45s ease;
}

body.is-playing #map-shell {
  opacity: 1;
}

body.is-intro .map-hud {
  opacity: 0;
  pointer-events: none;
}

.intro-modal[hidden] { display: none !important; }

.finish-card {
  width: min(440px, 100%);
}

.final-score-kicker {
  margin: 12px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.finish-card .final-score {
  margin-top: 4px;
}

.finish-recap {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.finish-recap li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.finish-recap-title {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.finish-recap-detail {
  margin: 4px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.finish-card .btn-primary {
  display: block;
  width: 100%;
  margin-top: 16px;
}

.intro-card {
  width: min(400px, 100%);
  padding: 22px 22px 18px;
  border: 1px solid rgba(28, 25, 21, 0.1);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 16px 48px rgba(28, 25, 21, 0.14);
}

.intro-card h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lead {
  margin: 10px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.field-label {
  margin: 14px 0 6px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.mode-switch button {
  border: 0;
  background: white;
  color: var(--muted);
  padding: 8px 10px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mode-switch button + button { border-left: 1px solid var(--line); }
.mode-switch button[aria-pressed="true"] { background: var(--ink); color: white; }

.mode-note {
  margin: 8px 0 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

.intro-card .btn-primary {
  display: block;
  width: 100%;
  margin-top: 16px;
}

#timer-block {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 11;
  height: 13px;
  background: rgba(28, 25, 21, 0.06);
}

#timer-block[hidden] { display: none !important; }

.timer-bar {
  position: relative;
  height: 100%;
  width: 100%;
}

.timer-fill {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding-right: 8px;
  overflow: hidden;
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  transform-origin: left center;
  transition: width 0.1s linear;
}

.timer-value {
  flex: none;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: #ffffff;
  white-space: nowrap;
  pointer-events: none;
}

.map-hud {
  position: absolute;
  right: 12px;
  bottom: 52px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(28, 25, 21, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 4px 18px rgba(28, 25, 21, 0.08);
}

body.is-playing #chrome {
  top: 26px;
  max-width: min(400px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
}

#load-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background-color: rgba(255, 255, 255, 0.9);
  background-image: var(--page-texture);
  background-repeat: repeat;
  background-size: auto;
  backdrop-filter: blur(2px);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#load-overlay.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#load-overlay[hidden] { display: none; }

.load-card {
  width: min(320px, calc(100vw - 40px));
  padding: 16px 18px 14px;
  border: 1px solid rgba(28, 25, 21, 0.1);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 12px 36px rgba(28, 25, 21, 0.12);
}

.load-text {
  margin: 0 0 12px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.load-bar {
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.load-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  transition: width 0.28s ease-out;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle-ui {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d3c9ba;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s ease;
}

.toggle input:checked + .toggle-ui { background: var(--red); }
.toggle input:checked + .toggle-ui::after { transform: translateX(14px); }

.city-label {
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
  white-space: nowrap;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}

.city-label i {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

.city-label.major { font-size: 13px; }
.city-label[hidden] { display: none !important; }

.maplibregl-ctrl-attrib {
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 11px;
}

@media (max-width: 520px) {
  .brand { font-size: 18px; line-height: 1.05; }
  body.is-playing .brand { font-size: 22px; }

  .round-meta { margin-top: 6px; font-size: 9px; }
  .round-prompt { margin-top: 4px; font-size: 10px; }
  .target-line { font-size: 17px; margin-top: 1px; }

  #chrome {
    left: 10px;
    top: 10px;
    max-width: min(260px, calc(100vw - 120px));
    max-height: calc(100dvh - 58px);
  }

  #screen-game { max-width: min(260px, calc(100vw - 120px)); }

  body.is-playing #chrome { top: 20px; max-height: calc(100dvh - 68px); }

  .score-history-wrap {
    right: 22px;
    top: 10px;
    max-width: min(118px, calc(100vw - 140px));
  }

  body.is-playing .score-history-wrap { top: 20px; }

  .score-history { font-size: 10px; line-height: 1.35; }
  .score-history-heading { font-size: 8px; }

  .stats-section { margin-top: 6px; max-width: min(260px, calc(100vw - 120px)); }
  .stats-grid { gap: 6px; }
  .stats-hero { padding: 6px 8px; }
  .stats-cartouche { margin-bottom: 6px; padding: 4px 8px; font-size: 9px; }
  .stats-grid dt { font-size: 9px; }
  .stats-grid dd { font-size: 14px; margin-top: 2px; }

  .round-score-banner-kicker { margin-top: 4px; font-size: 10px; }
  .round-score-banner { padding: 7px 10px; }
  .round-score-banner-score { font-size: 18px; }

  .btn-primary,
  .btn-secondary { padding: 8px 11px; font-size: 12px; }
  .btn-block { margin-top: 6px; }

  #timer-block {
    height: 11px;
  }

  .timer-value { font-size: 9px; padding-right: 6px; }

  .map-hud {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 0;
    z-index: 12;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .map-hud .toggle {
    text-shadow: 0 0 10px #fff, 0 0 6px #fff;
  }

  .map-hud .toggle-communes { display: none; }

  .toggle { font-size: 11px; gap: 5px; }
  .toggle-ui { width: 30px; height: 18px; }
  .toggle-ui::after { width: 14px; height: 14px; }
  .toggle input:checked + .toggle-ui::after { transform: translateX(12px); }

  .city-label { font-size: 7px; gap: 2px; }
  .city-label.major { font-size: 8px; }
  .city-label i { width: 3px; height: 3px; }

  .maplibregl-marker { pointer-events: none !important; }

  #map canvas { touch-action: none; }

  .round-brief {
    padding: 14px 12px;
    padding-bottom: max(64px, calc(52px + env(safe-area-inset-bottom)));
  }

  .round-brief-prompt { margin-top: 6px; font-size: 12px; }

  .round-brief-target {
    font-size: clamp(30px, 10vw, 48px);
  }

  .btn-round-start {
    margin-top: 16px;
    width: 100%;
    max-width: 272px;
  }

  .map-draw-actions {
    z-index: 14;
    flex-direction: column-reverse;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .map-draw-actions .btn-primary,
  .map-draw-actions .btn-secondary {
    min-width: 9.5rem;
    padding: 10px 16px;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(28, 25, 21, 0.14);
  }

  .maplibregl-ctrl-bottom-right,
  .maplibregl-ctrl-attrib,
  .maplibregl-ctrl-attrib.maplibregl-compact {
    display: none !important;
  }

  #finish-modal.intro-modal {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .finish-card {
    width: min(100%, calc(100vw - 20px));
    max-height: calc(
      100dvh - max(12px, env(safe-area-inset-top)) - max(12px, env(safe-area-inset-bottom))
    );
    overflow-y: auto;
    padding: 14px 14px 12px;
    margin: auto;
    flex-shrink: 0;
  }

  .finish-card h1 { font-size: 22px; }
  .final-score-kicker { margin-top: 8px; font-size: 11px; }
  .finish-card .final-score { font-size: 26px; margin-top: 2px; }

  .finish-recap { margin-top: 10px; }
  .finish-recap li { padding: 6px 0; }
  .finish-recap-title { font-size: 11px; }
  .finish-recap-detail { margin-top: 2px; font-size: 10px; line-height: 1.35; }

  .finish-card .field-label { margin-top: 10px; margin-bottom: 4px; }
  .finish-card .mode-note { margin-top: 4px; font-size: 10px; }
  .finish-card .btn-primary { margin-top: 10px; padding: 9px 12px; }

  .intro-modal { padding: 12px; }
  .intro-card { padding: 16px 16px 14px; }
  .intro-card h1 { font-size: 24px; }

  #chrome {
    z-index: 26;
  }

  .score-history-wrap {
    z-index: 26;
  }

  .round-result-sheet {
    position: fixed;
    inset: 0;
    z-index: 24;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: rgba(28, 25, 21, 0.32);
    backdrop-filter: blur(3px);
    pointer-events: auto;
  }

  .round-result-card {
    width: min(calc(100vw - 48px), 272px);
    max-height: min(78dvh, 100%);
    overflow-y: auto;
    padding: 12px 10px 10px;
    border: 1px solid rgba(28, 25, 21, 0.1);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 44px rgba(28, 25, 21, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .round-result-card .round-score-wrap {
    width: 100%;
    max-width: 252px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .round-result-card .round-score-banner-kicker {
    margin-top: 0;
    text-shadow: none;
  }

  .round-result-card .stats-section {
    width: 100%;
    max-width: 252px;
  }

  .round-result-card .stats-grid {
    width: 100%;
    align-items: stretch;
  }

  .round-result-card .stats-hero {
    width: 100%;
    box-sizing: border-box;
  }

  .round-result-card .btn-block {
    width: 100%;
    max-width: 252px;
    margin-left: auto;
    margin-right: auto;
  }

  .round-result-card .btn-block:first-of-type {
    margin-top: 10px;
  }

  #btn-perfect-zone {
    display: none !important;
  }
}

@media (max-height: 820px) and (min-width: 521px) {
  body.is-playing .brand { font-size: 28px; }
  .target-line { font-size: 21px; }
  .stats-section { margin-top: 8px; }
  .stats-hero { padding: 8px; }
  .btn-block { margin-top: 8px; }
}
