@charset "UTF-8";

html[lang='en'] [data-lang='ja'],
html[lang='ja'] [data-lang='en'] {
  display: none !important;
}

:root {
  --ink: #19231f;
  --ink-soft: #43504a;
  --paper: #f4f0e6;
  --paper-strong: #fffdf6;
  --glass: rgba(245, 242, 232, 0.9);
  --line: rgba(25, 35, 31, 0.18);
  --coral: #e96349;
  --yellow: #f0c75e;
  --sky: #b9d1ca;
  --pine: #365147;
  --muted: #59665f;
  --danger: #b74335;
  --shadow: 0 24px 70px rgba(22, 30, 26, 0.18);
  --display: 'Arial Narrow', 'Bahnschrift Condensed', 'Aptos Narrow', sans-serif;
  --sans: Inter, 'Noto Sans JP', 'Yu Gothic UI', 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--sans);
  overscroll-behavior: none;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

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

kbd {
  min-width: 25px;
  padding: 4px 6px;
  border: 1px solid currentColor;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  font: 700 10px/1 var(--sans);
  text-align: center;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--sky);
}

#world {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
}

.scene-wash {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(242, 239, 228, 0.2), transparent 44%),
    linear-gradient(180deg, transparent 60%, rgba(23, 32, 28, 0.15));
  transition: opacity 350ms ease;
}

.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.14;
  mix-blend-mode: multiply;
  background-image:
    repeating-radial-gradient(
      circle at 19% 11%,
      transparent 0,
      rgba(23, 31, 28, 0.08) 1px,
      transparent 2px,
      transparent 5px
    ),
    repeating-linear-gradient(
      112deg,
      transparent 0,
      transparent 5px,
      rgba(255, 255, 255, 0.12) 6px,
      transparent 7px
    );
  background-size:
    43px 41px,
    19px 23px;
}

.topbar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 250px minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  height: calc(68px + max(14px, env(safe-area-inset-top)));
  padding: max(14px, env(safe-area-inset-top)) 30px 10px;
  border-bottom: 1px solid rgba(25, 35, 31, 0.16);
  background: rgba(245, 242, 232, 0.64);
  backdrop-filter: blur(16px) saturate(0.85);
  transition:
    transform 280ms ease,
    opacity 200ms ease;
}

.wordmark {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.wordmark-mark {
  position: relative;
  display: block;
  width: 42px;
  height: 38px;
}

.wordmark-mark i {
  position: absolute;
  bottom: 5px;
  display: block;
  width: 16px;
  background: var(--ink);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.wordmark-mark i:nth-child(1) {
  left: 0;
  height: 27px;
}

.wordmark-mark i:nth-child(2) {
  left: 12px;
  height: 38px;
  background: var(--coral);
}

.wordmark-mark i:nth-child(3) {
  right: 0;
  height: 22px;
}

.wordmark-copy {
  display: flex;
  flex-direction: column;
  letter-spacing: 0.06em;
}

.wordmark-copy strong {
  font: 900 22px/0.95 var(--display);
  letter-spacing: -0.03em;
}

.wordmark-copy small {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.main-nav {
  display: flex;
  min-width: 0;
  height: 100%;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-item {
  position: relative;
  height: 50px;
  padding: 0 23px;
  color: rgba(25, 35, 31, 0.53);
  font: 800 12px/1 var(--sans);
  letter-spacing: 0.12em;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.nav-item > span:first-child {
  margin-right: 9px;
  color: rgba(25, 35, 31, 0.34);
  font-size: 8px;
}

.nav-item::after {
  position: absolute;
  right: 20px;
  bottom: -7px;
  left: 20px;
  height: 3px;
  background: var(--coral);
  content: '';
  opacity: 0;
  transform: scaleX(0.4);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.22);
}

.nav-item.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.profile-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px;
  transition: background 160ms ease;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.36);
}

.icon-button.is-muted .sound-waves {
  opacity: 0.35;
  text-decoration: line-through;
}

.profile-copy {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.profile-copy small {
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.profile-copy strong {
  margin-top: 3px;
  font: 800 12px/1 var(--sans);
}

.profile-copy strong span {
  color: rgba(25, 35, 31, 0.28);
}

.profile-badge {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
  font: 900 12px/1 var(--sans);
}

main {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.screen {
  position: absolute;
  inset: 0;
  padding: 106px 32px 30px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 220ms ease,
    visibility 0s linear 220ms;
}

.screen.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s, 0s;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.19em;
}

.eyebrow > span:first-child {
  display: inline-block;
  width: 24px;
  height: 3px;
  background: var(--coral);
}

/* Menu */

.menu-screen {
  padding: 0;
}

.hero-copy {
  position: absolute;
  top: clamp(126px, 16vh, 180px);
  left: clamp(32px, 5vw, 84px);
  width: min(620px, 48vw);
  filter: drop-shadow(0 2px 15px rgba(248, 244, 232, 0.22));
}

.hero-copy h1 {
  margin: 18px 0 16px;
  font: 900 clamp(64px, 7.4vw, 118px)/0.88 var(--display);
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.hero-lede {
  max-width: 480px;
  color: rgba(25, 35, 31, 0.73);
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 650;
  line-height: 1.85;
  letter-spacing: 0.04em;
}

.hero-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-top: 27px;
}

.primary-action {
  display: flex;
  min-width: 290px;
  min-height: 66px;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  border: 1px solid rgba(14, 22, 18, 0.28);
  border-radius: 7px;
  color: var(--paper-strong);
  background: var(--ink);
  box-shadow: 0 12px 30px rgba(25, 35, 31, 0.18);
  text-align: left;
  transition:
    transform 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.primary-action:hover {
  background: #263630;
  box-shadow: 0 16px 35px rgba(25, 35, 31, 0.24);
  transform: translateY(-2px);
}

.primary-action .action-icon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--yellow);
  font-size: 12px;
}

.icon-play::before {
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
  content: '';
}

.icon-diagonal {
  position: relative;
  display: inline-block !important;
  width: 12px;
  height: 12px;
  margin: 0 0 0 5px !important;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  font-size: 0 !important;
}

.icon-diagonal::after {
  position: absolute;
  top: 1px;
  right: 0;
  width: 14px;
  height: 1px;
  background: currentColor;
  content: '';
  transform: rotate(-45deg);
  transform-origin: right center;
}

.primary-action > span[data-lang] {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.primary-action small {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.53);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.primary-action strong {
  font: 900 15px/1 var(--sans);
  letter-spacing: 0.08em;
}

.primary-action kbd {
  color: rgba(255, 255, 255, 0.62);
}

.secondary-action {
  min-width: 140px;
  padding: 0 18px;
  border: 1px solid rgba(25, 35, 31, 0.28);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(244, 240, 230, 0.48);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.05em;
  backdrop-filter: blur(6px);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.secondary-action span {
  margin-left: 12px;
  font-size: 16px;
}

.secondary-action:hover {
  background: var(--paper);
  transform: translateY(-2px);
}

.stage-card {
  position: absolute;
  top: clamp(120px, 15vh, 160px);
  right: clamp(28px, 4vw, 70px);
  width: clamp(300px, 25vw, 380px);
  padding: 18px;
  border: 1px solid rgba(25, 35, 31, 0.2);
  border-radius: 10px;
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(15px) saturate(0.85);
}

.stage-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(90deg, var(--coral) 0 28%, var(--yellow) 28% 43%, var(--pine) 43%);
  content: '';
}

.stage-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.stage-card-topline b {
  color: var(--coral);
}

.weather-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 20px;
  background: rgba(25, 35, 31, 0.07);
  color: var(--ink);
  letter-spacing: 0.06em;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.weather-pill svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.stage-map {
  position: relative;
  height: 130px;
  margin: 10px -4px 8px;
  border-bottom: 1px solid var(--line);
}

.stage-map svg {
  width: 100%;
  height: 112px;
  overflow: visible;
}

.stage-map path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-shadow {
  stroke: rgba(25, 35, 31, 0.14);
  stroke-width: 12;
}

.map-road {
  stroke: var(--coral);
  stroke-width: 4;
  stroke-dasharray: 520;
  animation: draw-route 1100ms ease both;
}

.stage-map circle,
.stage-map rect {
  fill: var(--ink);
}

.map-distance {
  position: absolute;
  right: 0;
  bottom: 10px;
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

@keyframes draw-route {
  from {
    stroke-dashoffset: 520;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.stage-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.stage-title-row > div,
.selected-car-ribbon > div:nth-child(2) {
  min-width: 0;
}

.stage-title-row p {
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.stage-title-row h2 {
  margin-top: 3px;
  font: 900 23px/1 var(--display);
  letter-spacing: -0.02em;
}

.stage-grade {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--ink);
  font: 900 20px/1 var(--display);
}

.stage-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 15px 0 13px;
  background: var(--line);
}

.stage-meta > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 10px 8px;
  background: rgba(247, 244, 234, 0.85);
}

.stage-meta dt {
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.stage-meta dd {
  overflow: hidden;
  font: 850 10px/1 var(--sans);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-switcher {
  display: flex;
  gap: 7px;
}

.route-switcher button {
  position: relative;
  flex: 1;
  height: 31px;
  border: 1px solid rgba(25, 35, 31, 0.16);
  border-radius: 4px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.2);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  transition:
    color 150ms,
    background 150ms;
}

.route-switcher button:hover,
.route-switcher button.is-active {
  color: var(--paper);
  background: var(--ink);
}

.selected-car-ribbon {
  position: absolute;
  right: clamp(28px, 4vw, 70px);
  bottom: 27px;
  left: clamp(32px, 5vw, 84px);
  display: grid;
  grid-template-columns: 55px minmax(170px, 1fr) minmax(310px, 0.75fr) 98px;
  min-height: 72px;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(25, 35, 31, 0.2);
  border-radius: 8px;
  background: rgba(244, 240, 230, 0.86);
  box-shadow: 0 18px 50px rgba(25, 35, 31, 0.14);
  backdrop-filter: blur(13px);
}

.ribbon-index {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ribbon-index b {
  margin-top: 3px;
  color: var(--ink);
  font: 900 21px/1 var(--display);
}

.selected-car-ribbon > div:nth-child(2) {
  display: flex;
  flex-direction: column;
  padding: 0 19px;
}

.selected-car-ribbon > div:nth-child(2) small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.15em;
}

.selected-car-ribbon > div:nth-child(2) strong {
  overflow: hidden;
  font: 900 22px/1 var(--display);
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-car-ribbon dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-left: 1px solid var(--line);
}

.selected-car-ribbon dl > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 16px;
  border-right: 1px solid var(--line);
}

.selected-car-ribbon dt {
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.selected-car-ribbon dd {
  font-size: 11px;
  font-weight: 900;
}

.selected-car-ribbon > button {
  display: flex;
  flex: 0 0 auto;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 12px;
  white-space: nowrap;
  border-radius: 0 7px 7px 0;
  color: var(--paper);
  background: var(--coral);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  transition: filter 150ms;
}

.selected-car-ribbon > button:hover {
  filter: brightness(1.08);
}

.selected-car-ribbon > button span {
  display: block;
  margin-top: 5px;
  font-size: 14px;
}

.menu-hint {
  position: absolute;
  bottom: 108px;
  left: clamp(32px, 5vw, 84px);
  display: flex;
  gap: 16px;
  color: rgba(25, 35, 31, 0.53);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.menu-hint span {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Garage */

.garage-screen {
  display: grid;
  grid-template-columns: minmax(510px, 1fr) 310px;
  gap: 24px;
  padding: 103px 30px 27px;
  background: linear-gradient(
    90deg,
    rgba(233, 230, 219, 0.94) 0%,
    rgba(233, 230, 219, 0.9) 54%,
    rgba(233, 230, 219, 0.1) 76%,
    rgba(233, 230, 219, 0.62)
  );
}

.catalogue-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 24px 26px 20px;
  border: 1px solid rgba(25, 35, 31, 0.2);
  border-radius: 10px;
  background: rgba(247, 244, 234, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.panel-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading > div:first-child {
  min-width: 0;
}

.panel-heading h1 {
  margin-top: 4px;
  font: 900 54px/0.9 var(--display);
  letter-spacing: -0.055em;
}

.collection-count {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  padding-left: 17px;
  border-left: 1px solid var(--line);
}

.collection-count b {
  font: 900 28px/1 var(--display);
}

.collection-count span {
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  line-height: 1.4;
  letter-spacing: 0.12em;
}

.garage-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.garage-toolbar > * {
  min-width: 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-row button {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.filter-row button:hover,
.filter-row button.is-active {
  color: var(--paper);
  background: var(--ink);
}

.search-field {
  display: flex;
  width: 145px;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.38);
}

.search-field input {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: none;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.07em;
}

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

.car-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(126px, 1fr));
  gap: 9px;
  min-height: 0;
  margin-top: 13px;
  padding-right: 6px;
  overflow: auto;
  scrollbar-color: rgba(25, 35, 31, 0.3) transparent;
  scrollbar-width: thin;
}

.car-grid-empty {
  grid-column: 1 / -1;
  align-self: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.car-card {
  position: relative;
  min-height: 127px;
  padding: 9px;
  overflow: hidden;
  border: 1px solid rgba(25, 35, 31, 0.13);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.29);
  text-align: left;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.car-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  background: var(--card-color);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  content: '';
}

.car-card:hover {
  border-color: rgba(25, 35, 31, 0.42);
  background: rgba(255, 255, 255, 0.53);
  transform: translateY(-2px);
}

.car-card.is-selected {
  border: 2px solid var(--ink);
  background: var(--paper-strong);
  box-shadow: 0 9px 24px rgba(25, 35, 31, 0.11);
}

.car-card-index {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
}

.car-mini {
  --mini-body-height: 25px;
  --mini-roof-height: 14px;
  --mini-wheel-size: 14px;
  position: relative;
  width: clamp(92px, 72%, 112px);
  height: 45px;
  margin: 11px auto 3px;
}

.car-mini .mini-shadow {
  position: absolute;
  right: 8%;
  bottom: 2px;
  left: 8%;
  height: 7px;
  border-radius: 50%;
  background: rgba(25, 35, 31, 0.18);
  filter: blur(3px);
}

.car-mini .mini-body {
  position: absolute;
  right: 8%;
  bottom: 6px;
  left: 8%;
  height: var(--mini-body-height);
  border-radius: 35% 48% 18% 18%;
  background: var(--card-color);
  box-shadow: inset 0 -5px rgba(25, 35, 31, 0.12);
}

.car-mini .mini-roof {
  position: absolute;
  right: 25%;
  bottom: calc(var(--mini-body-height) + 1px);
  left: 28%;
  height: var(--mini-roof-height);
  border-radius: 50% 55% 0 0;
  background: #334542;
  transform: skewX(-9deg);
}

.car-mini .mini-wheel {
  position: absolute;
  bottom: 1px;
  width: var(--mini-wheel-size);
  height: var(--mini-wheel-size);
  border: 3px solid #202824;
  border-radius: 50%;
  background: #bbb8aa;
}

.car-mini .mini-wheel.left {
  left: 17%;
}
.car-mini .mini-wheel.right {
  right: 14%;
}

/* HERITAGE: 丸みの強いロングノーズのクラシッククーペ。キャビンは小さく後方寄り */
.car-mini.body-classic .mini-body {
  right: 10%;
  left: 12%;
  height: calc(var(--mini-body-height) - 1px);
  border-radius: 60% 45% 20% 20%;
}
.car-mini.body-classic .mini-roof {
  right: 34%;
  left: 38%;
  height: calc(var(--mini-roof-height) - 2px);
  border-radius: 65% 65% 0 0;
  transform: none;
}
/* クラシックのクロームバンパー */
.car-mini.body-classic .mini-body::after {
  position: absolute;
  right: 2%;
  bottom: 3px;
  left: 2%;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.55);
  content: '';
}

.car-mini.body-hatch .mini-roof,
.car-mini.body-rally .mini-roof {
  right: 22%;
  left: 33%;
}

/* RALLY: 大型リアウイングとボクシーなキャビン */
.car-mini.body-rally .mini-roof {
  border-radius: 25% 40% 0 0;
  transform: skewX(-6deg);
}
.car-mini.body-rally .mini-body::before {
  position: absolute;
  top: -7px;
  left: -2%;
  width: 16%;
  height: 3px;
  border-radius: 1px;
  background: #202824;
  content: '';
}
.car-mini.body-rally .mini-body::after {
  position: absolute;
  top: -5px;
  left: 4%;
  width: 4px;
  height: 6px;
  background: #202824;
  transform: skewX(14deg);
  content: '';
}

/* TOURING: 低く長いファストバック。流線型のルーフライン */
.car-mini.body-hatch .mini-body {
  right: 4%;
  left: 5%;
  height: calc(var(--mini-body-height) - 5px);
  border-radius: 30% 60% 14% 14%;
}
.car-mini.body-hatch .mini-roof {
  right: 26%;
  bottom: calc(var(--mini-body-height) - 5px);
  left: 18%;
  height: calc(var(--mini-roof-height) - 4px);
  border-radius: 20% 90% 0 0;
  transform: skewX(-16deg);
}

.car-mini.body-wagon .mini-roof {
  right: 18%;
  left: 25%;
  border-radius: 35% 25% 0 0;
}

.car-mini.body-suv .mini-body,
.car-mini.body-pickup .mini-body {
  right: 5%;
  left: 5%;
  height: calc(var(--mini-body-height) + 3px);
  border-radius: 20% 20% 12% 12%;
}

.car-mini.body-suv .mini-roof {
  right: 17%;
  bottom: calc(var(--mini-body-height) + 4px);
  left: 18%;
  height: calc(var(--mini-roof-height) + 2px);
  border-radius: 18% 18% 0 0;
  transform: none;
}
/* ALL-ROAD: ルーフラック(横棒+脚2本)と大径ホイールで悪路感を出す */
.car-mini.body-suv {
  --mini-wheel-size: 17px;
}
.car-mini.body-suv .mini-roof::before {
  position: absolute;
  top: -5px;
  right: 6%;
  left: 6%;
  height: 3px;
  border-radius: 2px;
  background: #202824;
  content: '';
}
.car-mini.body-suv .mini-roof::after {
  position: absolute;
  top: -3px;
  left: 20%;
  width: 60%;
  height: 3px;
  background:
    linear-gradient(to right, #202824 0 3px, transparent 3px calc(100% - 3px), #202824 calc(100% - 3px));
  content: '';
}

.car-mini.body-pickup .mini-roof {
  right: 48%;
  bottom: calc(var(--mini-body-height) + 4px);
  left: 16%;
  height: calc(var(--mini-roof-height) + 1px);
}

.car-mini.body-buggy .mini-body {
  right: 14%;
  left: 14%;
  height: calc(var(--mini-body-height) - 5px);
  border-radius: 55% 55% 18% 18%;
}

.car-mini.body-buggy .mini-roof {
  right: 32%;
  bottom: calc(var(--mini-body-height) - 5px);
  left: 35%;
  height: calc(var(--mini-roof-height) - 4px);
  background: transparent;
  border: 3px solid #334542;
  border-bottom: 0;
}

/* EXPERIMENTAL: 極端に低いウェッジシェイプ+キャノピー+垂直テールフィン */
.car-mini.body-prototype {
  --mini-wheel-size: 11px;
}
.car-mini.body-prototype .mini-body {
  right: 1%;
  left: 2%;
  height: calc(var(--mini-body-height) - 9px);
  border-radius: 0 90% 10% 10%;
  clip-path: polygon(0 32%, 100% 0, 100% 100%, 0 100%);
}

.car-mini.body-prototype .mini-roof {
  right: 36%;
  bottom: calc(var(--mini-body-height) - 9px);
  left: 40%;
  height: calc(var(--mini-roof-height) - 6px);
  border-radius: 80% 95% 0 0;
  transform: skewX(-18deg);
}
.car-mini.body-prototype .mini-roof::after {
  position: absolute;
  top: -6px;
  left: -170%;
  width: 4px;
  height: 12px;
  background: #202824;
  clip-path: polygon(0 0, 100% 45%, 100% 100%, 0 100%);
  content: '';
}

.car-card small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-card strong {
  display: block;
  margin: 4px 0 8px;
  overflow: hidden;
  font: 900 14px/1 var(--display);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  /* 右下のコーナー装飾(::after 24px)とクラスラベルが重ならないよう余白を取る */
  padding-right: 26px;
  border-top: 1px solid var(--line);
  font-size: 7px;
  font-weight: 900;
}

.car-card-footer span:last-child {
  color: var(--coral);
}

.car-inspector {
  position: relative;
  display: flex;
  flex-direction: column;
  align-self: end;
  min-height: 570px;
  padding: 23px;
  border: 1px solid rgba(25, 35, 31, 0.22);
  border-radius: 10px;
  background: linear-gradient(
    180deg,
    rgba(246, 243, 233, 0.2) 0,
    rgba(246, 243, 233, 0.54) 185px,
    rgba(246, 243, 233, 0.94) 220px,
    rgba(246, 243, 233, 0.94) 100%
  );
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.car-inspector-empty {
  position: absolute;
  inset: 23px;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.car-inspector-empty[hidden] {
  display: none;
}

.car-inspector-empty strong {
  font: 900 18px/1.1 var(--display);
}

.car-inspector-empty span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.car-inspector.is-empty > :not(.car-inspector-empty) {
  visibility: hidden;
}

.inspector-order {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--muted);
  font: 800 9px/1 var(--sans);
  letter-spacing: 0.08em;
}

.inspector-order span:first-child {
  color: var(--ink);
  font-size: 14px;
}

.car-identity {
  margin-top: 190px;
}

.car-identity > p {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.car-identity h2 {
  margin: 5px 0 10px;
  font: 900 33px/0.95 var(--display);
  letter-spacing: -0.04em;
}

.car-identity h2 em {
  color: var(--coral);
  font-style: normal;
}

.car-tags {
  display: flex;
  gap: 5px;
}

.car-tags span {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink-soft);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.performance-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.performance-bars > div {
  display: grid;
  grid-template-columns: 78px 1fr 22px;
  align-items: center;
  gap: 8px;
}

.performance-bars span {
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.performance-bars i {
  height: 4px;
  overflow: hidden;
  background: rgba(25, 35, 31, 0.12);
}

.performance-bars i b {
  display: block;
  width: 70%;
  height: 100%;
  background: var(--ink);
  transition: width 300ms ease;
}

.performance-bars em {
  font-size: 8px;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.paint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

#paint-swatches {
  display: flex;
  gap: 8px;
}

.paint-swatch {
  width: 44px;
  height: 44px;
  border: 2px solid var(--paper-strong);
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(25, 35, 31, 0.23);
}

.paint-swatch.is-active {
  box-shadow: 0 0 0 2px var(--ink);
}

.select-car-button {
  display: flex;
  min-height: 55px;
  flex-direction: column;
  justify-content: center;
  margin-top: auto;
  padding: 0 15px;
  border-radius: 5px;
  color: var(--paper);
  background: var(--ink);
  text-align: left;
  transition:
    background 160ms,
    transform 160ms;
}

.select-car-button:hover {
  background: #2d4038;
  transform: translateY(-1px);
}

.select-car-button span {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.select-car-button small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 7px;
}

/* Tune */

.tune-screen {
  overflow: auto;
  background: rgba(231, 229, 219, 0.86);
  backdrop-filter: blur(11px) saturate(0.72);
}

.tune-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1380px;
}

.tune-heading h1 {
  margin-top: 5px;
  font: 900 clamp(40px, 4.5vw, 66px)/0.9 var(--display);
  letter-spacing: -0.055em;
}

.tune-heading > p {
  max-width: 330px;
  padding-bottom: 4px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.65;
}

.tune-layout {
  display: grid;
  grid-template-columns: 235px minmax(480px, 1fr) 270px;
  gap: 14px;
  max-width: 1380px;
  min-height: 590px;
  margin: 0 auto;
}

.preset-column,
.setup-panel,
.setup-impact {
  border: 1px solid rgba(25, 35, 31, 0.19);
  border-radius: 9px;
  background: rgba(248, 245, 236, 0.9);
  box-shadow: 0 16px 45px rgba(25, 35, 31, 0.11);
}

.section-label {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.preset-column {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

#tune-presets {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.preset-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  min-height: 72px;
  align-items: center;
  padding: 10px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.26);
  text-align: left;
  transition:
    background 150ms,
    color 150ms,
    transform 150ms;
}

.preset-card:hover {
  transform: translateX(2px);
}

.preset-card.is-active {
  color: var(--paper);
  background: var(--ink);
}

.preset-icon {
  grid-row: span 2;
  color: var(--coral);
  font-size: 20px;
}

.preset-card b {
  align-self: end;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.preset-card small {
  align-self: start;
  margin-top: 4px;
  color: var(--muted);
  font-size: 7px;
}

.preset-card.is-active small {
  color: rgba(255, 255, 255, 0.55);
}

.preset-card i {
  position: absolute;
  top: 8px;
  right: 8px;
  color: rgba(25, 35, 31, 0.3);
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
}

.preset-card.is-active i {
  color: rgba(255, 255, 255, 0.28);
}

.reset-setup {
  min-height: 44px;
  margin-top: auto;
  padding: 12px 0 3px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.reset-setup:hover {
  color: var(--danger);
}

.setup-panel {
  padding: 0 22px 20px;
}

.setup-panel-head {
  display: flex;
  height: 70px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.setup-panel-head > div {
  display: flex;
  flex-direction: column;
}

.setup-panel-head small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.setup-panel-head strong {
  margin-top: 5px;
  font: 900 20px/1 var(--display);
}

.setup-saved {
  color: #547d58;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.setup-saved.is-saving {
  color: var(--coral);
}

.toggle-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 0 20px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.26);
}

.toggle-strip label {
  display: flex;
  min-width: 0;
  min-height: 44px;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border-right: 1px solid var(--line);
}

.toggle-strip label:last-child {
  border: 0;
}

.toggle-strip span {
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.toggle-strip select {
  width: 100%;
  min-height: 44px;
  border: 0;
  background: none;
  font-size: 8px;
  font-weight: 900;
}

.slider-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
}

.slider-groups section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tune-slider {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.tune-slider > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tune-slider b,
.tune-slider output {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.tune-slider output {
  color: var(--coral);
}

.tune-slider input {
  width: 100%;
  height: 44px;
  border-radius: 0;
  appearance: none;
  background: linear-gradient(
      90deg,
      var(--coral) 0 var(--range, 50%),
      rgba(25, 35, 31, 0.14) var(--range, 50%)
    )
    center / 100% 4px no-repeat;
}

.tune-slider input::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--paper-strong);
  border-radius: 50%;
  appearance: none;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.tune-slider input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper-strong);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}

.tune-slider small {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 6px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.tune-slider small i {
  font-style: normal;
}

.setup-impact {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.impact-score {
  display: flex;
  align-items: center;
  margin-top: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.impact-score > span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--paper);
  background: var(--coral);
  font: 900 16px/1 var(--display);
}

.impact-score strong {
  margin-left: 8px;
  font: 900 27px/1 var(--display);
}

.impact-score small {
  margin-left: auto;
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-align: right;
}

.impact-chart {
  height: 215px;
  margin: 8px -3px;
}

.impact-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chart-grid polygon,
.chart-grid line {
  fill: none;
  stroke: rgba(25, 35, 31, 0.14);
  stroke-width: 1;
}

.chart-value {
  fill: rgba(233, 99, 73, 0.25);
  stroke: var(--coral);
  stroke-width: 2;
  transition: points 240ms ease;
}

.chart-labels text {
  fill: var(--muted);
  font: 900 6px var(--sans);
  letter-spacing: 0.06em;
  text-anchor: middle;
}

.impact-numbers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.impact-numbers > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.impact-numbers dt {
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.impact-numbers dd {
  font-size: 9px;
  font-weight: 900;
}

.primary-action.compact {
  width: 100%;
  min-width: 0;
  min-height: 53px;
  margin-top: 14px;
}

.primary-action.compact .action-icon {
  flex-basis: 33px;
  width: 33px;
  height: 33px;
}

/* Race */

#app[data-mode='race'] .topbar,
#app[data-mode='paused'] .topbar,
#app[data-mode='result'] .topbar {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
}

#app[data-mode='race'] .scene-wash,
#app[data-mode='paused'] .scene-wash,
#app[data-mode='result'] .scene-wash {
  opacity: 0;
}

.race-hud {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  padding: max(24px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  color: var(--paper-strong);
  pointer-events: none;
  text-shadow: 0 2px 10px rgba(11, 18, 15, 0.34);
}

#app[data-mode='race'] .race-hud,
#app[data-mode='paused'] .race-hud,
#app[data-mode='result'] .race-hud {
  display: block;
}

.hud-stage {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

.hud-stage small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.hud-stage strong {
  margin: 5px 0 10px;
  font: 900 21px/1 var(--display);
  letter-spacing: -0.02em;
}

.hud-stage span {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 3px;
  background: rgba(14, 22, 18, 0.42);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
  backdrop-filter: blur(7px);
}

.hud-stage span i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--yellow);
}

.hud-time {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: 50%;
  display: flex;
  min-width: 210px;
  flex-direction: column;
  align-items: center;
  padding: 10px 18px;
  border-top: 3px solid var(--yellow);
  border-radius: 4px;
  background: rgba(14, 22, 18, 0.52);
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.hud-time small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.hud-time strong {
  margin: 2px 0;
  font: 900 26px/1 var(--display);
  letter-spacing: 0.02em;
}

.hud-time span {
  color: var(--yellow);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.hud-time .split-delta {
  min-height: 1.2em;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 9px;
}

.hud-time .split-delta[data-kind='faster'] {
  color: #b9f5c7;
}

.hud-time .split-delta[data-kind='slower'] {
  color: #ffd0c5;
}

.hud-pause {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  right: max(28px, env(safe-area-inset-right));
  display: grid;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  color: var(--paper);
  background: rgba(14, 22, 18, 0.44);
  font: 900 13px/1 var(--sans);
  pointer-events: auto;
  backdrop-filter: blur(8px);
}

.hud-progress {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: max(28px, env(safe-area-inset-left));
  width: 220px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  background: rgba(14, 22, 18, 0.48);
  backdrop-filter: blur(9px);
}

.mini-map {
  height: 105px;
}

.mini-map canvas {
  width: 100%;
  height: 100%;
}

.progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.progress-copy span,
.hud-progress > small {
  color: rgba(255, 255, 255, 0.55);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.progress-copy strong {
  font: 900 16px/1 var(--display);
}

.progress-line {
  display: block;
  height: 3px;
  margin: 7px 0 5px;
  background: rgba(255, 255, 255, 0.17);
}

.progress-line b {
  display: block;
  width: 0;
  height: 100%;
  background: var(--yellow);
  transition: width 150ms linear;
}

.hud-recovery {
  position: absolute;
  bottom: max(39px, env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition:
    opacity 180ms,
    transform 180ms;
}

.hud-recovery.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hud-recovery kbd {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-color: rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(14, 22, 18, 0.52);
}

.hud-recovery span {
  font-size: 7px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.1em;
}

.hud-telemetry {
  position: absolute;
  right: max(35px, env(safe-area-inset-right));
  bottom: max(28px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 54px 115px;
  grid-template-rows: 74px 22px;
  width: 185px;
  height: 113px;
}

.rev-arc {
  position: absolute;
  inset: -14px -8px 14px -10px;
  overflow: hidden;
  border-radius: 50%;
  background: conic-gradient(
    from 225deg,
    var(--yellow) 0 var(--rev, 0deg),
    rgba(255, 255, 255, 0.16) var(--rev, 0deg) 270deg,
    transparent 270deg
  );
  opacity: 0.72;
  mask: radial-gradient(circle, transparent 68%, #000 69%);
}

.gear {
  z-index: 1;
  display: flex;
  align-items: flex-end;
  font: 900 70px/0.78 var(--display);
  text-align: center;
}

.speed {
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}

.speed strong {
  font: 900 43px/0.8 var(--display);
  letter-spacing: -0.03em;
}

.speed span {
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.drive-mode {
  z-index: 1;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
}

.drive-mode > span {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.drive-mode > i {
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
}

.drive-mode > i b {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--yellow);
  transition: width 80ms linear;
}

.countdown {
  position: absolute;
  top: 50%;
  left: 50%;
  display: none;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
}

.countdown.is-visible {
  display: flex;
}

.countdown span {
  font: 900 clamp(105px, 18vw, 220px)/0.7 var(--display);
  text-shadow: 0 8px 35px rgba(15, 21, 18, 0.32);
  animation: count-pop 700ms ease both;
}

.countdown small {
  margin-top: 26px;
  padding: 6px 12px;
  border-radius: 3px;
  color: var(--ink);
  background: var(--yellow);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-shadow: none;
}

@keyframes count-pop {
  0% {
    opacity: 0;
    transform: scale(1.5);
  }
  20% {
    opacity: 1;
    transform: scale(1);
  }
  80% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0.4;
    transform: scale(0.82);
  }
}

/* Modals and notifications */

.modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  /* トラックを確定幅にしないと、カードのwidth:min(470px,100%)の%が
     内容依存になり、長い見出しがカードを画面外まで押し広げる */
  grid-template-columns: minmax(0, 100%);
  overflow: auto;
  visibility: hidden;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  background: rgba(17, 25, 21, 0.38);
  backdrop-filter: blur(9px) saturate(0.75);
  transition: opacity 180ms;
}

.modal.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(420px, 100%);
  margin-block: auto;
  padding: 33px;
  border: 1px solid rgba(25, 35, 31, 0.25);
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 0 40px 90px rgba(12, 18, 15, 0.3);
}

.modal-card h2 {
  margin: 9px 0 9px;
  font: 900 43px/0.9 var(--display);
  letter-spacing: -0.05em;
}

.modal-card > p:not(.eyebrow) {
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.modal-card .primary-action {
  width: 100%;
  min-width: 0;
  margin-bottom: 10px;
}

.modal-link {
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.modal-link:hover {
  color: var(--coral);
}

.briefing-modal {
  z-index: 75;
}

.briefing-card {
  width: min(610px, 100%);
}

.briefing-card h2 {
  margin-bottom: 22px;
  max-width: 100%;
  overflow-wrap: normal;
  text-wrap: balance;
}

/* The title receives programmatic focus when the dialog opens. Keep that
   focus target for screen readers without exposing the browser's fragmented
   default outline as a decorative border. */
.modal-card h2:focus,
.result-card h2:focus {
  outline: none;
}

.briefing-controls dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.briefing-controls dl > div {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  background: var(--paper-strong);
}

.briefing-controls dd,
.briefing-settings label > span,
.result-medal > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.briefing-controls dt {
  font: 900 10px/1 var(--display);
  letter-spacing: 0.05em;
}

.briefing-controls dd {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.35;
}

.briefing-settings {
  display: grid;
  gap: 1px;
  margin: 0 0 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.briefing-settings legend {
  margin-left: 10px;
  padding: 0 6px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.briefing-settings label {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 14px;
  cursor: pointer;
}

.briefing-settings label + label {
  border-top: 1px solid var(--line);
}

.briefing-settings label > span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.briefing-settings strong {
  font-size: 10px;
  letter-spacing: 0.06em;
}

.briefing-settings small {
  color: var(--muted);
  font-size: 9px;
}

.briefing-settings input {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  accent-color: var(--coral);
}

.briefing-card .primary-action {
  width: 100%;
  min-width: 0;
}

.result-modal {
  justify-items: end;
  padding-right: max(50px, 8vw);
  background: linear-gradient(90deg, rgba(17, 25, 21, 0.04), rgba(17, 25, 21, 0.55));
}

.result-card {
  position: relative;
  width: min(470px, 100%);
  margin-block: auto;
  padding: 36px;
  border-radius: 9px;
  background: var(--paper);
  box-shadow: 0 40px 90px rgba(12, 18, 15, 0.28);
}

.result-card h2 {
  margin: 9px 0 22px;
  font: 900 52px/0.83 var(--display);
  letter-spacing: -0.055em;
}

.result-stamp {
  position: absolute;
  top: 30px;
  right: 29px;
  width: 66px;
  height: 66px;
  padding-top: 15px;
  border: 2px solid var(--coral);
  border-radius: 50%;
  color: var(--coral);
  font-size: 6px;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.1em;
  text-align: center;
  transform: rotate(8deg);
}

.result-stamp b {
  font-size: 8px;
}

.result-time {
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-time small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.result-time strong {
  margin: 4px 0;
  font: 900 41px/1 var(--display);
  letter-spacing: 0.015em;
}

.result-time span {
  color: var(--coral);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.result-medal {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.result-medal-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink-soft);
  font-size: 18px;
}

.result-medal > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-medal small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.result-medal strong {
  font: 900 16px/1 var(--display);
  letter-spacing: 0.05em;
}

.result-medal[data-medal='bronze'] .result-medal-mark {
  background: #9b684d;
}

.result-medal[data-medal='silver'] .result-medal-mark {
  color: var(--ink);
  background: #c7ccc9;
}

.result-medal[data-medal='gold'] .result-medal-mark {
  color: var(--ink);
  background: var(--yellow);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0;
}

.result-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 12px;
  border-right: 1px solid var(--line);
}

.result-stats > div:first-child {
  padding-left: 0;
}
.result-stats > div:last-child {
  border: 0;
}

.result-stats dt {
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.result-stats dd {
  font-size: 10px;
  font-weight: 900;
}

.result-actions {
  display: flex;
  gap: 9px;
}

.result-actions .primary-action {
  min-width: 225px;
}

.result-actions .secondary-action {
  min-width: 120px;
}

.toast {
  position: absolute;
  top: 102px;
  right: 30px;
  z-index: 80;
  display: flex;
  min-width: 240px;
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid rgba(25, 35, 31, 0.19);
  border-radius: 6px;
  background: var(--paper-strong);
  box-shadow: 0 16px 45px rgba(25, 35, 31, 0.17);
  opacity: 0;
  pointer-events: none;
  transform: translateX(25px);
  transition:
    opacity 180ms,
    transform 180ms;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast > span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: #557c5b;
  font-size: 11px;
  font-weight: 900;
}

.toast > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toast small {
  color: var(--muted);
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.toast strong {
  font-size: 9px;
  letter-spacing: 0.08em;
}

.boot-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  color: var(--paper);
  background: var(--ink);
  opacity: 1;
  pointer-events: none;
  transition:
    opacity 600ms ease 200ms,
    visibility 600ms ease 200ms;
}

.boot-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.boot-logo {
  display: flex;
  height: 55px;
  align-items: flex-end;
  gap: 0;
}

.boot-logo span {
  display: block;
  width: 31px;
  background: var(--paper);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  animation: boot-mountain 800ms ease both;
}

.boot-logo span:nth-child(1) {
  height: 38px;
}
.boot-logo span:nth-child(2) {
  height: 55px;
  margin-left: -8px;
  background: var(--coral);
  animation-delay: 90ms;
}
.boot-logo span:nth-child(3) {
  height: 30px;
  margin-left: -8px;
  animation-delay: 180ms;
}

.boot-screen p {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.28em;
}

@keyframes boot-mountain {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.touch-controls {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  z-index: 45;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
}

.touch-steer,
.touch-utility,
.touch-pedals {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.touch-utility {
  position: absolute;
  bottom: 2px;
  left: 50%;
  align-items: flex-end;
  transform: translateX(-50%);
}

.touch-utility button {
  width: 44px;
  height: 44px;
  font-size: 10px;
}

#app[data-transmission='auto'] .touch-utility .manual-only {
  display: none;
}

.touch-controls button {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  color: var(--paper);
  background: rgba(14, 22, 18, 0.42);
  font-size: 11px;
  font-weight: 900;
  backdrop-filter: blur(8px);
  touch-action: none;
}

.touch-controls button:active,
.touch-controls button.is-held {
  color: var(--ink);
  background: var(--yellow);
}

.touch-controls .touch-handbrake {
  width: 46px;
  height: 46px;
  align-self: flex-end;
  font-size: 8px;
}

.touch-controls .touch-throttle {
  width: 72px;
  height: 72px;
  background: rgba(233, 99, 73, 0.67);
}

.mobile-toolbar {
  position: absolute;
  top: max(52px, calc(env(safe-area-inset-top) + 44px));
  right: max(12px, env(safe-area-inset-right));
  z-index: 55;
  display: none;
  gap: 8px;
}

.mobile-toolbar .icon-button {
  width: 44px;
  height: 44px;
  border-color: rgba(25, 35, 31, 0.28);
  background: rgba(245, 242, 232, 0.88);
  backdrop-filter: blur(8px);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

#app[data-mode='race'] .mobile-toolbar,
#app[data-mode='paused'] .mobile-toolbar,
#app[data-mode='result'] .mobile-toolbar {
  top: max(14px, env(safe-area-inset-top));
  right: max(68px, calc(env(safe-area-inset-right) + 58px));
}

#app[data-mode='race'] .mobile-toolbar .icon-button,
#app[data-mode='paused'] .mobile-toolbar .icon-button,
#app[data-mode='result'] .mobile-toolbar .icon-button {
  color: var(--paper);
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(14, 22, 18, 0.52);
}

#app[data-reduced-effects='true'] *,
#app[data-reduced-effects='true'] *::before,
#app[data-reduced-effects='true'] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media (pointer: coarse) {
  #app[data-mode='race'] .touch-controls {
    display: flex;
  }
  .menu-hint {
    display: none;
  }
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 225px minmax(270px, 1fr) auto auto;
    padding-right: 20px;
    padding-left: 20px;
  }
  .profile-copy {
    display: none;
  }
  .nav-item {
    padding: 0 14px;
  }
  .hero-copy {
    width: 52vw;
  }
  .stage-card {
    width: 310px;
  }
  .selected-car-ribbon {
    grid-template-columns: 50px 1fr minmax(260px, 0.8fr) 80px;
  }
  .selected-car-ribbon dl > div {
    padding: 5px 9px;
  }
  .garage-screen {
    grid-template-columns: minmax(480px, 1fr) 285px;
    gap: 12px;
    padding-right: 16px;
    padding-left: 16px;
  }
  .car-grid {
    grid-template-columns: repeat(3, minmax(126px, 1fr));
  }
  .car-inspector {
    min-height: 540px;
  }
  .tune-layout {
    grid-template-columns: 205px minmax(450px, 1fr) 235px;
  }
  .tune-screen {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (max-height: 760px) and (min-width: 961px) {
  .topbar {
    height: 70px;
    padding-top: 8px;
  }
  .screen {
    padding-top: 87px;
  }
  .hero-copy {
    top: 105px;
  }
  .hero-copy h1 {
    font-size: clamp(59px, 7vw, 88px);
  }
  .hero-lede {
    line-height: 1.55;
  }
  .hero-actions {
    margin-top: 18px;
  }
  .stage-card {
    top: 99px;
    transform: scale(0.91);
    transform-origin: top right;
  }
  .selected-car-ribbon {
    bottom: 18px;
    min-height: 63px;
  }
  .menu-hint {
    bottom: 92px;
  }
  .garage-screen {
    padding-top: 86px;
    padding-bottom: 16px;
  }
  .catalogue-panel {
    padding-top: 15px;
  }
  .panel-heading h1 {
    font-size: 42px;
  }
  .panel-heading {
    margin-bottom: 10px;
  }
  .car-card {
    min-height: 112px;
  }
  .car-mini {
    --mini-body-height: 20px;
    --mini-roof-height: 11px;
    --mini-wheel-size: 12px;
    width: clamp(86px, 72%, 100px);
    height: 37px;
    margin-top: 5px;
  }
  /* 短い画面ではクラシックの車高を下げない(横長比率の検査上限を超えるため) */
  .car-mini.body-classic .mini-body {
    height: var(--mini-body-height);
  }
  .car-inspector {
    min-height: calc(100vh - 102px);
  }
  .car-identity {
    margin-top: 125px;
  }
  .tune-heading h1 {
    font-size: 45px;
  }
  .tune-heading {
    margin-bottom: 10px;
  }
  .tune-layout {
    min-height: 500px;
  }
  .preset-card {
    min-height: 61px;
  }
  .slider-groups section {
    gap: 14px;
  }
  .impact-chart {
    height: 165px;
  }
}

@media (max-width: 960px) {
  .modal {
    place-items: center;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  }
  /* メニュー系モードでは2段ヘッダー(約102px)がモーダルより上に重なるため、
     その分の上部オフセットを確保してカード先頭が隠れないようにする */
  #app:not([data-mode='race']):not([data-mode='paused']):not([data-mode='result']) .modal {
    padding-top: calc(106px + env(safe-area-inset-top));
  }
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: 44px 44px;
    gap: 0;
    height: calc(94px + max(8px, env(safe-area-inset-top)));
    padding: max(8px, env(safe-area-inset-top)) 14px 6px;
  }
  .wordmark-copy small,
  .profile-cluster,
  .main-nav .nav-item > span:first-child {
    display: none;
  }
  .wordmark-mark {
    width: 32px;
    height: 30px;
  }
  .wordmark-mark i {
    width: 13px;
  }
  .wordmark-mark i:nth-child(1) {
    height: 21px;
  }
  .wordmark-mark i:nth-child(2) {
    left: 10px;
    height: 30px;
  }
  .wordmark-mark i:nth-child(3) {
    height: 17px;
  }
  .wordmark-copy strong {
    font-size: 17px;
  }
  .main-nav {
    min-width: 0;
    justify-content: flex-end;
  }
  .wordmark {
    min-width: 0;
  }
  .site-links {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 6px;
    width: 100%;
    padding-right: 100px;
    border-top: 1px solid rgba(25, 35, 31, 0.12);
  }
  .site-links a,
  .site-links #lang-toggle {
    padding: 0 1px;
    font-size: 9px;
  }
  .nav-item {
    height: 44px;
    padding: 0 9px;
    font-size: 12px;
  }
  .nav-item::after {
    right: 8px;
    bottom: -4px;
    left: 8px;
  }
  .screen {
    padding: calc(118px + env(safe-area-inset-top)) 14px 14px;
  }
  .hero-copy {
    top: calc(118px + env(safe-area-inset-top));
    left: 20px;
    width: calc(100% - 40px);
  }
  .hero-copy h1 {
    margin-top: 11px;
    font-size: clamp(54px, 20vw, 82px);
  }
  .hero-lede {
    max-width: 310px;
    font-size: 10px;
  }
  .hero-actions {
    margin-top: 19px;
  }
  .primary-action {
    min-width: 0;
    min-height: 58px;
  }
  .hero-actions .primary-action {
    flex: 1;
  }
  .hero-actions .secondary-action {
    min-width: 105px;
  }
  .primary-action .action-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
  }
  .primary-action kbd {
    display: none;
  }
  .stage-card {
    top: auto;
    right: 15px;
    /* 直下のリボン(画面下端フラッシュ)の上端にぴったり合わせ、背景の隙間を消す */
    bottom: calc(64px + env(safe-area-inset-bottom));
    left: 15px;
    width: auto;
    padding: 12px;
  }
  .stage-map {
    display: none;
  }
  .stage-title-row {
    padding-top: 14px;
  }
  .stage-meta {
    margin: 10px 0;
  }
  .route-switcher button {
    min-height: 44px;
  }
  .selected-car-ribbon {
    /* 画面下端にフラッシュさせ、上下の背景の隙間をなくす */
    right: 0;
    bottom: 0;
    left: 0;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 63px;
    padding-bottom: env(safe-area-inset-bottom);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    box-sizing: border-box;
  }
  .selected-car-ribbon dl {
    display: none;
  }
  .selected-car-ribbon > div:nth-child(2) {
    padding: 0 12px;
  }
  .selected-car-ribbon > div:nth-child(2) strong {
    font-size: 17px;
  }
  .selected-car-ribbon > button {
    min-width: 66px;
    min-height: 44px;
    font-size: 12px;
  }
  .menu-hint {
    display: none;
  }
  .garage-screen {
    display: block;
    padding: calc(112px + env(safe-area-inset-top)) 10px 10px;
    overflow: auto;
    background: rgba(233, 230, 219, 0.9);
  }
  .catalogue-panel {
    min-height: 58dvh;
    padding: 17px 14px;
    overflow: visible;
  }
  .panel-heading h1 {
    font-size: 39px;
  }
  .garage-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .search-field {
    width: 100%;
  }
  .car-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    max-height: 40dvh;
    padding-right: 0;
  }
  .car-inspector {
    min-height: 460px;
    margin-top: 10px;
    padding: 18px;
  }
  .car-identity {
    margin-top: 150px;
  }
  .tune-screen {
    overflow: auto;
  }
  .tune-heading {
    display: block;
  }
  .tune-heading h1 {
    font-size: 42px;
  }
  .tune-heading > p {
    margin-top: 8px;
  }
  .tune-layout {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }
  .preset-column {
    min-height: 0;
  }
  #tune-presets {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .reset-setup {
    margin-top: 12px;
  }
  .setup-panel {
    padding: 0 15px 18px;
  }
  .toggle-strip {
    grid-template-columns: 1fr;
  }
  .toggle-strip label {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .slider-groups {
    grid-template-columns: 1fr;
    gap: 25px;
  }
  .setup-impact {
    min-height: 510px;
  }
  .hud-stage {
    top: max(14px, env(safe-area-inset-top));
    left: max(14px, env(safe-area-inset-left));
  }
  .hud-stage strong {
    font-size: 15px;
  }
  .hud-stage span {
    display: none;
  }
  .hud-time {
    top: max(14px, env(safe-area-inset-top));
    min-width: 150px;
    padding: 8px 10px;
  }
  .hud-time strong {
    font-size: 20px;
  }
  /* 中央のタイマーと重ならない幅でステージ名を省略表示する */
  .hud-stage {
    max-width: calc(50vw - 120px);
  }
  .hud-stage small,
  .hud-stage strong {
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .hud-time span {
    display: none;
  }
  .hud-pause {
    top: max(14px, env(safe-area-inset-top));
    right: max(14px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
  }
  .hud-progress {
    bottom: 96px;
    left: max(14px, env(safe-area-inset-left));
    width: 150px;
    padding: 8px;
  }
  .mini-map {
    height: 68px;
  }
  .hud-telemetry {
    right: max(14px, env(safe-area-inset-right));
    bottom: 101px;
    transform: scale(0.82);
    transform-origin: bottom right;
  }
  .hud-recovery {
    bottom: 172px;
  }
  .result-modal {
    place-items: center;
  }
  .result-card {
    padding: 26px 20px;
  }
  .result-card h2 {
    font-size: 44px;
  }
  .result-time strong {
    font-size: 34px;
  }
  .result-actions {
    flex-direction: column;
  }
  .result-actions .primary-action,
  .result-actions .secondary-action {
    width: 100%;
    min-width: 0;
    min-height: 54px;
  }
  .toast {
    top: 78px;
    right: 12px;
    left: 12px;
    min-width: 0;
  }
  .mobile-toolbar {
    display: flex;
  }
  /* メニュー系モードではヘッダー2段目(52〜96px帯)の中央に収め、下端の食み出しを防ぐ */
  #app:not([data-mode='race']):not([data-mode='paused']):not([data-mode='result']) .mobile-toolbar {
    top: 54px;
  }
  #app:not([data-mode='race']):not([data-mode='paused']):not([data-mode='result']) .mobile-toolbar .icon-button {
    width: 40px;
    height: 40px;
  }
  .briefing-card {
    padding: 24px 20px;
  }
  .briefing-card h2 {
    font-size: clamp(32px, 10vw, 40px);
    line-height: 1;
  }
  #app[data-mode='race'] .mobile-toolbar,
  #app[data-mode='paused'] .mobile-toolbar,
  #app[data-mode='result'] .mobile-toolbar {
    top: max(76px, calc(env(safe-area-inset-top) + 68px));
    right: max(14px, env(safe-area-inset-right));
  }
}

@media (max-width: 460px), (max-height: 620px) and (max-width: 960px) {
  .hero-copy {
    top: calc(108px + env(safe-area-inset-top));
  }
  .hero-copy .eyebrow {
    display: none;
  }
  .hero-copy h1 {
    font-size: 51px;
  }
  .hero-lede {
    line-height: 1.55;
  }
  .hero-actions {
    margin-top: 12px;
  }
  .hero-actions .secondary-action {
    display: none;
  }
  .stage-card {
    /* 直下のリボンとの隙間を作らないよう960px幅時と同じ位置に合わせる */
    bottom: calc(64px + env(safe-area-inset-bottom));
  }
  .stage-card-topline {
    display: none;
  }
  .stage-title-row {
    padding-top: 0;
  }
  .stage-meta {
    margin-bottom: 6px;
  }
  .stage-meta > div {
    padding: 7px 5px;
  }
  .route-switcher button {
    height: 44px;
  }
  .selected-car-ribbon {
    /* 画面下端フラッシュを維持する */
    bottom: 0;
  }
  .briefing-controls dl {
    grid-template-columns: 1fr;
  }
  .result-card h2 {
    padding-right: 68px;
  }
  .result-stamp {
    top: 22px;
    right: 18px;
    width: 52px;
    height: 52px;
    padding-top: 11px;
  }
}

@media (max-width: 460px) and (orientation: portrait) {
  .wordmark-copy {
    display: none;
  }
  .touch-steer,
  .touch-pedals {
    gap: 4px;
  }
  .touch-controls button {
    width: 52px;
    height: 52px;
  }
  .touch-controls .touch-handbrake {
    width: 44px;
    height: 44px;
  }
  .touch-controls .touch-throttle {
    width: 58px;
    height: 58px;
  }
  .touch-utility {
    bottom: 76px;
  }
}

@media (orientation: landscape) and (max-height: 520px) and (max-width: 960px) {
  .hero-copy {
    top: 82px;
    left: 24px;
    width: 46%;
  }
  .hero-copy h1 {
    margin: 4px 0 8px;
    font-size: clamp(46px, 9vw, 64px);
  }
  .hero-copy .hero-lede,
  .hero-copy .eyebrow {
    display: none;
  }
  .hero-actions {
    margin-top: 9px;
  }
  .hero-actions .primary-action {
    max-width: 290px;
  }
  .stage-card {
    top: 78px;
    right: 16px;
    bottom: auto;
    left: auto;
    width: min(330px, 45vw);
  }
  .selected-car-ribbon {
    right: 16px;
    bottom: 8px;
    left: 24px;
  }
  .hud-progress {
    bottom: 80px;
    width: 138px;
  }
  .hud-progress .mini-map {
    display: none;
  }
  .hud-telemetry {
    bottom: 77px;
  }
  .touch-controls button {
    width: 54px;
    height: 54px;
  }
  .touch-controls .touch-throttle {
    width: 60px;
    height: 60px;
  }
  .touch-utility button,
  .touch-controls .touch-handbrake {
    width: 44px;
    height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.site-links {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.site-links a,
.site-links #lang-toggle {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 2px;
  color: var(--ink, #19231f);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.site-links #lang-toggle {
  flex: 0 0 auto;
}
.site-links #lang-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.site-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 960px) {
  .site-links {
    gap: 6px;
  }
  .site-links a,
  .site-links #lang-toggle {
    padding: 0 1px;
    font-size: 9px;
  }
}
