/*
 * Ink Lap 版式。只做手机：竖屏分区 + 手机横屏分区（`(orientation: landscape) and (max-height: 560px)`），
 * 桌面跑的是 ui.css「手机画布锁定」收出来的同一块竖屏画布——这里不写任何按视口宽度放大的规则。
 *
 * 分区（data-zone）的矩形逐字取自 art/SCREEN_SPEC.json 的 zones，由 ui.mjs 写进
 * --px/--py/--pw/--ph（竖屏）与 --lx/--ly/--lw/--lh（横屏）；坐标是安全区之后可视区的 0~1。
 * 组件库选择器（.gs-*）一律不覆盖，只给本作自己的 .dr-* 写样式。
 */

#app {
  position: fixed;
  inset: 0;
  background: var(--dr-ink);
  color: var(--gs-ink);
  font-family: var(--dr-font);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  height: 100%;
  background: #05030F;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

.dr-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--dr-night) 0%, var(--dr-ink) 58%, var(--dr-asphalt) 100%);
}

.dr-stage[data-tint='1'] { --dr-tint: #2E8F5A; }
.dr-stage[data-tint='2'] { --dr-tint: #1E5FA8; }
.dr-stage[data-tint='3'] { --dr-tint: #6B2FA0; }
.dr-stage[data-tint='4'] { --dr-tint: #B0306E; }
.dr-stage[data-tint] { background: radial-gradient(120% 70% at 50% 18%, var(--dr-tint) 0%, var(--dr-night) 55%, var(--dr-ink) 100%); }

/* 夜里的霓虹网格地面：加载页 / 错误页不等任何位图（SCREEN_SPEC screen-01 / 20 background mode none） */
.dr-grid-floor {
  position: absolute;
  inset: 52% -30% -10% -30%;
  background:
    repeating-linear-gradient(90deg, rgba(124, 77, 255, 0.35) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(43, 240, 255, 0.28) 0 1px, transparent 1px 36px);
  transform: perspective(320px) rotateX(58deg);
  transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 40%, #000 100%);
  pointer-events: none;
}

.dr-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
  opacity: 0;
  transition: opacity var(--gs-slow) ease;
  pointer-events: none;
}
.dr-bg-img.is-in { opacity: 1; }
.dr-bg-dim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 8, 32, 0.38), rgba(10, 8, 32, 0.06) 35%, rgba(10, 8, 32, 0.28) 70%, rgba(10, 8, 32, 0.72));
  pointer-events: none;
}
.dr-stage[data-dim='strong'] .dr-bg-dim { background: rgba(10, 8, 32, 0.62); }

.dr-safe {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
}

.dr-zone {
  position: absolute;
  left: calc(var(--px) * 100%);
  top: calc(var(--py) * 100%);
  width: calc(var(--pw) * 100%);
  height: calc(var(--ph) * 100%);
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

@media (orientation: landscape) and (max-height: 560px) {
  .dr-zone {
    left: calc(var(--lx) * 100%);
    top: calc(var(--ly) * 100%);
    width: calc(var(--lw) * 100%);
    height: calc(var(--lh) * 100%);
  }
  .dr-portrait-only { display: none !important; }
}

.dr-landscape-only { display: none !important; }
@media (orientation: landscape) and (max-height: 560px) {
  .dr-landscape-only { display: flex !important; }
}

.dr-zone[data-hidden] { display: none; }

/* ============================ 通用件 ============================ */

.dr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 44px;
  min-width: 44px;
  padding: 6px 14px;
  font-family: var(--dr-font);
  line-height: 1.1;
  text-align: center;
}
.dr-btn .dr-ico { width: 22px; height: 22px; flex: 0 0 auto; filter: brightness(0) invert(1); pointer-events: none; }
.dr-btn.gs-btn--primary .dr-ico { filter: brightness(0); }
.dr-btn.gs-btn--primary { box-shadow: 0 0 22px rgba(184, 255, 59, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.55), var(--gs-shadow-button); }
.dr-btn.gs-btn--secondary { background: var(--dr-panel-hi); border: 1.5px solid var(--dr-muted); }
.dr-btn:active { transform: translateY(2px); filter: brightness(0.82); }
.dr-btn[aria-disabled='true'], .dr-btn.is-dim { filter: saturate(0.25) brightness(0.72); box-shadow: none; }
.dr-btn.is-dim .dr-ico { opacity: 0.7; }
.dr-btn-label { overflow-wrap: anywhere; min-width: 0; }

.dr-icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 14px;
  border: 1.5px solid var(--dr-glass-edge);
  background: var(--dr-panel-hi);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}
.dr-icon-btn img { width: 24px; height: 24px; filter: brightness(0) invert(1); pointer-events: none; }
.dr-icon-btn:active { transform: translateY(2px); filter: brightness(0.82); }

.dr-glass {
  background: var(--dr-glass);
  border: 1.5px solid var(--dr-glass-edge);
  border-radius: 22px;
  box-shadow: 0 0 18px rgba(163, 92, 255, 0.25), var(--gs-shadow-card);
}

.dr-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(10, 8, 32, 0.72);
  border: 1.5px solid var(--dr-pad);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  box-sizing: border-box;
}
.dr-pill img { width: 20px; height: 20px; flex: 0 0 auto; }

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

.dr-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: 88%;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(10, 8, 32, 0.86);
  border: 1.5px solid var(--dr-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  z-index: 6;
}

.dr-coach-host {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.dr-anchor { position: absolute; pointer-events: none; }

/* 无字图示气泡（元素第一次出现）：两格小图，读屏走 aria-label（a11y.intro.*） */
.dr-pictos { display: flex; gap: 8px; }
.dr-picto {
  width: 58px;
  height: 46px;
  border-radius: 10px;
  background: var(--dr-asphalt);
  position: relative;
  overflow: hidden;
}
.dr-picto i { position: absolute; display: block; }
.dr-picto .dr-p-car { width: 12px; height: 20px; left: 23px; top: 13px; background: var(--dr-go); border-radius: 5px; }
.dr-picto .dr-p-sand { inset: 6px 4px; background: rgba(232, 178, 90, 0.85); border-radius: 6px; }
.dr-picto .dr-p-pad { inset: 10px 14px; background: var(--dr-pad); border-radius: 4px; }
.dr-picto .dr-p-gap { left: 0; right: 0; top: 16px; height: 12px; background: #05030F; border-block: 2px solid #FF4D5E; }
.dr-picto .dr-p-cone { width: 10px; height: 10px; border-radius: 50%; background: #FF7A1A; box-shadow: 0 0 0 2px #fff inset; }
.dr-picto .dr-p-speed { height: 3px; background: var(--dr-cyan); left: 6px; border-radius: 2px; }

/* ============================ 游玩：顶栏 / 赛场 / 底栏 ============================ */

.dr-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2.2%;
  background: linear-gradient(180deg, rgba(10, 8, 32, 0.92), rgba(10, 8, 32, 0.62));
  border-bottom: 1px solid rgba(43, 240, 255, 0.35);
}
.dr-hud-mid {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dr-lights { display: flex; gap: 5px; align-items: center; height: 18px; }
.dr-lights img { width: 17px; height: 17px; }
.dr-track-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--dr-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}
.dr-ink {
  flex: 0 0 30%;
  max-width: 30%;
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto 8px;
  column-gap: 5px;
  row-gap: 3px;
  align-items: center;
}
.dr-ink img { grid-row: 1 / span 2; width: 18px; height: 18px; }
.dr-ink-label { font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.dr-ink-track { height: 8px; border-radius: 6px; background: rgba(169, 162, 216, 0.25); overflow: hidden; }
.dr-ink-fill { height: 100%; width: 100%; background: var(--dr-cyan); box-shadow: 0 0 8px var(--dr-cyan); border-radius: 6px; transform-origin: 0 50%; }
.dr-ink[data-low='true'] .dr-ink-fill { background: var(--dr-magenta); box-shadow: 0 0 8px var(--dr-magenta); }
.dr-ink[data-flash='true'] .dr-ink-track { background: rgba(255, 77, 94, 0.7); }

.dr-race-timer { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 0 10px rgba(43, 240, 255, 0.8); line-height: 1; }
.dr-gap-chip {
  flex: 0 0 30%;
  max-width: 30%;
  justify-content: center;
  border-color: var(--dr-magenta);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.dr-gap-chip[data-ahead='true'] { border-color: var(--dr-cyan); }
.dr-gap-chip:empty { visibility: hidden; }

.dr-board {
  position: absolute;
  box-sizing: border-box;
  padding: 12px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: crosshair;
}
.dr-board canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  box-shadow: 0 0 0 1.5px rgba(124, 77, 255, 0.85), 0 0 22px rgba(124, 77, 255, 0.45);
  pointer-events: none;
}
.dr-board-layer { position: absolute; inset: 12px; pointer-events: none; }
.dr-hand {
  position: absolute;
  width: 54px;
  height: 54px;
  margin: -42px 0 0 -8px;   /* 指尖在图的左下（约 14% / 78%）：手悬在线头右上方，不挡住正在画的那一段 */
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms linear;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}
.dr-hand.is-on { opacity: 1; }
.dr-ink-warning {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(86%, 320px);
  pointer-events: none;
  z-index: 5;
  font-size: 13px;
  border-color: var(--dr-magenta);
}

.dr-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.2% 4.4% 0;
  box-sizing: border-box;
}
.dr-bar .dr-btn { width: 31.5%; min-height: 56px; height: 62.5%; border-radius: 999px; font-size: 17px; }
.dr-bar .dr-peek { width: 23%; position: relative; }
.dr-bar .dr-peek[hidden] { display: none; }
.dr-bar .dr-peek.is-held { background: var(--dr-bronze); border-color: #fff; box-shadow: 0 0 18px rgba(224, 138, 76, 0.7); }
.dr-bar .dr-spacer { width: 23%; }
.dr-peek .dr-peek-label { position: absolute; top: calc(100% + 3px); left: -70%; right: -70%; font-size: 10.5px; line-height: 1.15; color: var(--dr-cyan); text-align: center; font-weight: 700; pointer-events: none; }
.dr-btn.is-armed { background: var(--dr-magenta); color: #fff; border-color: #fff; }
.dr-btn.is-ready { animation: dr-pulse 1.1s ease-in-out infinite; }
.dr-btn.is-shaking { animation: dr-shake 240ms linear 1; }
.dr-btn.is-breathing { animation: dr-breathe 1.4s ease-in-out infinite; }
:root[data-reduced-motion='on'] .dr-btn.is-shaking { animation: none; border-color: var(--dr-danger); }
@keyframes dr-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); box-shadow: 0 0 30px rgba(184, 255, 59, 0.75); } }
@keyframes dr-breathe { 0%, 100% { box-shadow: 0 0 10px rgba(184, 255, 59, 0.35); } 50% { box-shadow: 0 0 30px rgba(184, 255, 59, 0.8); } }
@keyframes dr-shake { 0%, 50%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
:root[data-reduced-motion='on'] .dr-btn.is-ready,
:root[data-reduced-motion='on'] .dr-btn.is-breathing { animation: none; box-shadow: 0 0 26px rgba(184, 255, 59, 0.7); }

.dr-info {
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  box-sizing: border-box;
}
.dr-info-name { font-weight: 900; font-size: 15px; }
.dr-info-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
.dr-info-row b { font-weight: 900; }
.dr-info-row img { width: 22px; height: 22px; }

.dr-notice { padding: 4px 3%; box-sizing: border-box; display: flex; align-items: center; }
.dr-notice-row { display: flex; align-items: center; gap: 8px; width: 100%; height: 100%; box-sizing: border-box; }
.dr-notice-bar { flex: 1 1 auto; min-width: 0; box-sizing: border-box; border-color: var(--dr-pad); border-radius: 14px; padding: 4px 10px; gap: 8px; flex-wrap: nowrap; max-height: 100%; }
.dr-notice-text { font-size: 11px; line-height: 1.2; flex: 1 1 auto; min-width: 0; margin: 0; }
@media (orientation: landscape) and (max-height: 560px) {
  .dr-notice { align-items: flex-start; padding-top: 6px; }
  .dr-notice-row { height: auto; }
  .dr-notice-text { font-size: 13px; }
}
.dr-notice-mark { width: 26px; height: 26px; border-radius: 50%; background: var(--dr-pad); color: #0A0820; font-weight: 900; display: grid; place-items: center; flex: 0 0 auto; }

/* 玻璃底板画在分区内侧（::before），分区贴到屏幕边时面板也留出边距，不被切成半块 */
.dr-inset-glass { isolation: isolate; }
.dr-inset-glass::before {
  content: '';
  position: absolute;
  inset: var(--dr-inset, 4px);
  z-index: -1;
  background: var(--dr-glass);
  border: 1.5px solid var(--dr-glass-edge);
  border-radius: 20px;
  box-shadow: 0 0 18px rgba(163, 92, 255, 0.25), var(--gs-shadow-card);
  pointer-events: none;
}
.dr-info { --dr-inset: 4px 10px 4px 0; padding: 12px 22px 12px 14px; }
.dr-res-head { --dr-inset: 4px 2.5% 2px; }
.dr-bar .dr-btn-label, .dr-ladder-row span { white-space: nowrap; }
.dr-res-row .dr-btn-label { font-size: 12.5px; line-height: 1.1; white-space: normal; }
.dr-res-row .dr-btn { gap: 5px; }
.dr-res-row .dr-btn .dr-ico { width: 18px; height: 18px; }
.dr-res-text { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 10px rgba(10, 8, 32, 0.9); }
.dr-legend span { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }
.dr-overlay .dr-card-bg { background: linear-gradient(180deg, rgba(44, 35, 112, 0.97), rgba(18, 14, 52, 0.98)); }
:root[data-contrast='on'] .dr-overlay .dr-card-bg { background: #000; }
.dr-bar .dr-btn { padding: 6px 10px; font-size: clamp(14px, 4.3vw, 17px); }
.dr-ov-head:has(> h2:only-child) { justify-content: center; }
.dr-picto img.dr-p-car { position: absolute; width: 14px; height: 22px; left: 22px; top: 12px; object-fit: contain; background: none; }

@media (orientation: landscape) and (max-height: 560px) {
  .dr-hud { flex-wrap: nowrap; isolation: isolate; padding: 8px 18px 6px 10px; border-bottom: 0; background: none; }
  .dr-hud::before { content: ''; position: absolute; inset: 6px 10px 2px 0; z-index: -1; background: var(--dr-glass); border: 1.5px solid var(--dr-glass-edge); border-radius: 18px; pointer-events: none; }
  .dr-res-head { --dr-inset: 4px 10px 2px 0; }
  .dr-bar { align-items: center; padding: 0 3% 0 0; gap: max(16px, 2.5%); justify-content: flex-start; }
  .dr-bar .dr-btn { width: auto; flex: 1 1 0; height: 56px; }
  .dr-bar .dr-btn[data-role='go'], .dr-bar .dr-btn[data-role='skip'] { flex: 1.6 1 0; }
  .dr-bar .dr-spacer { flex: 0.9 1 0; width: auto; }
  .dr-bar .dr-peek { flex: 0.9 1 0; width: auto; }
}

/* ============================ 结算 ============================ */

.dr-res-head {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  grid-template-rows: auto auto auto auto;
  align-items: center;
  justify-items: center;
  padding: 6px 3% 4px;
  box-sizing: border-box;
  row-gap: 2px;
}
.dr-res-head .dr-icon-btn { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
.dr-res-name { grid-column: 2; grid-row: 1; font-size: 14px; font-weight: 800; color: var(--dr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.dr-res-hero { grid-column: 1 / span 3; grid-row: 2; font-size: clamp(20px, 6.2vh, 40px); font-weight: 900; line-height: 1.05; text-align: center; font-variant-numeric: tabular-nums; color: var(--gs-gold); text-shadow: 0 0 14px rgba(255, 197, 49, 0.55); max-width: 96%; overflow-wrap: anywhere; }
.dr-res-hero[data-long='true'] { font-size: clamp(14px, 2.7vh, 20px); color: #fff; text-shadow: none; }
.dr-res-stars { grid-column: 1 / span 3; grid-row: 3; display: flex; gap: 8px; height: clamp(22px, 4.4vh, 34px); }
.dr-res-stars img { height: 100%; width: auto; transition: transform var(--gs-normal) var(--gs-ease-out), opacity var(--gs-normal); }
.dr-res-stars img[data-stamped='false'] { opacity: 0.35; transform: scale(1.4); }
.dr-res-score { grid-column: 1 / span 3; grid-row: 4; display: flex; gap: 10px; align-items: center; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dr-badge-new { background: var(--dr-magenta); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 900; }

.dr-res-board { display: flex; gap: 4%; padding: 1% 6%; box-sizing: border-box; }
.dr-mini {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  aspect-ratio: 9 / 16;
  touch-action: none;
}
.dr-mini canvas { width: 100%; height: 100%; display: block; border-radius: 8px; box-shadow: 0 0 0 1.5px rgba(124, 77, 255, 0.85), 0 0 16px rgba(124, 77, 255, 0.4); }
.dr-res-side { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.dr-ladder { padding: 6px 8px; display: flex; flex-direction: column; gap: 3px; border-radius: 16px; }
.dr-ladder-row { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 4px; padding: 3px 5px; border-radius: 10px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; min-height: 26px; }
.dr-ladder-row img { width: 20px; height: 20px; }
.dr-ladder-row[data-you='true'] { background: rgba(43, 240, 255, 0.16); box-shadow: inset 0 0 0 1.5px var(--dr-cyan); }
.dr-ladder-row img.dr-you-car { width: 14px; height: 22px; object-fit: contain; justify-self: center; }
.dr-legend { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--dr-muted); line-height: 1.2; }
.dr-legend i { flex: 0 0 34px; height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--dr-cyan), #FFD6F0, var(--dr-magenta)); }
.dr-unlock { font-size: 12px; font-weight: 800; padding: 5px 8px; border-radius: 12px; background: rgba(184, 255, 59, 0.14); border: 1.5px solid var(--dr-go); line-height: 1.2; }
.dr-unlock { display: flex; align-items: center; gap: 6px; }
.dr-unlock img { width: 20px; height: 20px; object-fit: contain; flex: 0 0 auto; }
.dr-daily-pill { font-size: 12px; white-space: normal; border-radius: 12px; }
.dr-daily-pill.is-cyan { border-color: var(--dr-cyan); }

.dr-res-play { display: flex; flex-direction: column; gap: 8px; padding: 2px 4.4% 0; box-sizing: border-box; }
.dr-res-text { min-height: 20px; font-size: 14px; font-weight: 800; text-align: center; color: var(--dr-finish); line-height: 1.25; }
.dr-res-text[data-tone='bad'] { color: #FF8CC6; }
.dr-res-play > .dr-btn { width: 100%; min-height: 56px; border-radius: 999px; font-size: 18px; }
.dr-res-row { display: flex; gap: max(8px, 3%); }
.dr-res-row .dr-btn { flex: 1 1 0; min-width: 0; min-height: 48px; border-radius: 999px; font-size: 13px; padding: 4px 6px; }

@media (orientation: landscape) and (max-height: 560px) {
  .dr-res-board { padding: 12px; gap: 0; justify-content: center; }
  .dr-res-board .dr-res-side { display: none; }
  .dr-res-head { grid-template-columns: 52px 1fr 1fr; grid-template-rows: auto auto auto auto auto; column-gap: 8px; padding: 6px 1% 2px; }
  .dr-res-name { grid-column: 2; }
  .dr-res-hero { grid-column: 2; grid-row: 2; }
  .dr-res-stars { grid-column: 2; grid-row: 3; height: 24px; }
  .dr-res-score { grid-column: 2; grid-row: 4; font-size: 13px; }
  .dr-res-head .dr-res-side { display: flex; grid-column: 3; grid-row: 1 / span 5; align-self: stretch; gap: 4px; }
  .dr-res-head .dr-legend { grid-column: 2; grid-row: 5; }
  .dr-res-play { padding: 0 2%; gap: 10px; }
  .dr-res-head { grid-template-columns: 52px 1fr 1.15fr; }
  .dr-ladder { padding: 4px 6px; gap: 1px; }
  .dr-ladder-row { min-height: 20px; padding: 1px 6px; font-size: 12px; }
  .dr-ladder-row img { width: 18px; height: 18px; }
  .dr-res-head .dr-daily-pill { font-size: 10.5px; padding: 2px 8px; }
  .dr-res-head .dr-unlock { font-size: 11px; padding: 3px 6px; }
  .dr-res-play > .dr-btn { min-height: 56px; }
  .dr-res-row .dr-btn { min-height: 52px; }
}
.dr-res-head .dr-res-side { display: none; }
.dr-res-head .dr-legend { display: none; }
@media (orientation: landscape) and (max-height: 560px) {
  .dr-res-head .dr-res-side { display: flex; }
  .dr-res-head .dr-legend { display: flex; }
}

/* ============================ 标题 ============================ */

.dr-title-head { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 2%; box-sizing: border-box; }
.dr-title-head .dr-settings { position: absolute; top: 1.8%; right: 2.2%; }
.dr-logo { width: 40%; max-width: 220px; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 0 18px rgba(163, 92, 255, 0.55)); flex: 0 1 auto; min-height: 0; }
.dr-name { font-size: clamp(26px, 5.6vh, 46px); font-weight: 900; letter-spacing: 0.02em; color: var(--gs-ink); text-shadow: 0 0 18px rgba(43, 240, 255, 0.55); line-height: 1.05; margin-top: 2px; }
.dr-tagline { font-size: 14px; color: var(--dr-muted); font-weight: 700; }
.dr-title-stats { display: flex; gap: 4%; justify-content: center; align-items: center; padding: 0 6%; box-sizing: border-box; }
.dr-title-stats .dr-pill { flex: 1 1 0; justify-content: center; min-width: 0; }
.dr-title-play { display: flex; flex-direction: column; align-items: stretch; gap: 3%; padding: 2% 8% 0; box-sizing: border-box; }
.dr-daily-card {
  display: grid;
  grid-template-columns: 46px 1fr 22px;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px 14px;
  min-height: 64px;
  border-radius: 20px;
  border: 1.5px solid var(--dr-cyan);
  background: linear-gradient(180deg, rgba(34, 27, 90, 0.9), rgba(16, 12, 52, 0.92));
  color: var(--gs-ink);
  font-family: var(--dr-font);
  cursor: pointer;
  box-shadow: 0 0 16px rgba(43, 240, 255, 0.25);
  flex: 0 0 auto;
}
.dr-daily-card .dr-cal { grid-row: 1 / span 2; width: 46px; height: 46px; border-radius: 12px; background: rgba(43, 240, 255, 0.15); display: grid; place-items: center; }
.dr-daily-card .dr-cal img { width: 26px; height: 26px; filter: brightness(0) invert(1); }
.dr-daily-title { font-weight: 900; font-size: 16px; grid-column: 2; }
.dr-daily-sub { font-size: 13px; font-weight: 700; color: var(--dr-go); grid-column: 2; }
.dr-daily-arrow { grid-column: 3; grid-row: 1 / span 2; width: 22px; height: 22px; filter: var(--gs-icon-tint-accent); }
.dr-daily-card[aria-disabled='true'] { border-color: var(--dr-muted); filter: saturate(0.4); }
.dr-daily-card[aria-disabled='true'] .dr-daily-sub { color: var(--dr-muted); }
.dr-title-play .dr-btn--big { min-height: 58px; font-size: 22px; border-radius: 999px; flex: 0 0 auto; }
.dr-title-row { display: flex; gap: max(8px, 4%); flex: 0 0 auto; }
.dr-title-row .dr-btn { flex: 1 1 0; min-height: 52px; border-radius: 999px; font-size: 15px; min-width: 0; }
.dr-hero-car { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.dr-hero-car img { height: min(100%, 120px); transform: rotate(90deg); filter: drop-shadow(0 0 14px rgba(184, 255, 59, 0.5)); }
.dr-hero-car::before { content: ''; position: absolute; left: 6%; right: 6%; top: 50%; height: 4px; background: var(--dr-cyan); box-shadow: 0 0 12px var(--dr-cyan); border-radius: 4px; }

@media (orientation: landscape) and (max-height: 560px) {
  .dr-title-head { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 12px; padding: 2% 3%; }
  .dr-title-head .dr-settings { top: 4%; right: 3%; }
  .dr-logo { width: 26%; }
  .dr-title-play { justify-content: center; gap: 4%; padding: 3% 4%; }
  .dr-hero-car { display: none; }
}

/* ============================ 地图 ============================ */

.dr-map-head { display: flex; align-items: center; gap: 12px; padding: 0 3%; box-sizing: border-box; }
.dr-map-head h1 { margin: 0; font-size: 20px; font-weight: 900; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-map-head .dr-pill { flex: 0 1 auto; border-color: var(--gs-gold); }
.dr-map-list { display: flex; flex-direction: column; gap: 1.2%; padding: 0.8% 4% 2.5%; box-sizing: border-box; }
.dr-circuit { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.dr-circuit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 900; font-size: 14px; line-height: 1.2; padding: 2px 8px; border-radius: 10px; background: linear-gradient(90deg, var(--dr-circuit, #2E8F5A), transparent); }
.dr-circuit-head small { color: var(--dr-pad); font-size: 11px; font-weight: 800; text-align: right; }
.dr-circuit-cards { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.dr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  text-align: center;
  padding: 4px 4px 3px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid rgba(169, 162, 216, 0.5);
  background: rgba(16, 12, 52, 0.86);
  color: var(--gs-ink);
  font-family: var(--dr-font);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
  box-sizing: border-box;
}
.dr-card b { font-size: 13px; font-weight: 900; line-height: 1; }
.dr-card span { font-size: 10px; line-height: 1.1; font-weight: 700; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dr-card .dr-card-stars { display: flex; gap: 1px; height: 15px; }
.dr-card .dr-card-stars img { height: 15px; width: 15px; }
.dr-card em { font-style: normal; font-size: 9.5px; color: var(--dr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.dr-card[data-next='true'] { border-color: var(--dr-cyan); box-shadow: 0 0 12px rgba(43, 240, 255, 0.45); }
.dr-card[aria-disabled='true'] { filter: saturate(0.45) brightness(0.85); background: rgba(34, 27, 90, 0.8); }
.dr-card span { min-height: 2.2em; }
.dr-card .dr-lock { width: 24px; height: 24px; align-self: center; }

@media (orientation: landscape) and (max-height: 560px) {
  .dr-map-list { flex-direction: row; gap: 2%; padding: 0 2% 1%; }
  .dr-circuit-cards { grid-template-columns: 1fr; grid-auto-rows: 1fr; gap: 8px; }
  .dr-card { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 6px; align-items: center; padding: 2px 6px; }
  .dr-card b { grid-row: 1; grid-column: 1; }
  .dr-card span { grid-row: 1; grid-column: 2 / span 2; display: block; white-space: normal; font-size: 10px; }
  .dr-card .dr-card-stars, .dr-card .dr-lock { grid-row: 2; grid-column: 1 / span 2; }
  .dr-card em { grid-row: 2; grid-column: 3; text-overflow: clip; }
}

.dr-circuit { position: relative; isolation: isolate; border-radius: 14px; overflow: hidden; }
.dr-circuit-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.7; z-index: -1; pointer-events: none; }

/* ============================ 车库 ============================ */

.dr-garage-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0 6%; box-sizing: border-box; text-align: center; }
.dr-podium { flex: 1 1 auto; min-height: 0; width: 70%; display: grid; place-items: center; position: relative; background: radial-gradient(60% 22% at 50% 82%, rgba(43, 240, 255, 0.55), transparent 70%); }
.dr-podium img { height: 74%; max-height: 170px; filter: drop-shadow(0 0 16px rgba(184, 255, 59, 0.45)); }
.dr-podium::after { content: ''; position: absolute; bottom: 6%; width: 62%; height: 14%; border-radius: 50%; border: 2px solid var(--dr-cyan); box-shadow: 0 0 18px var(--dr-cyan), inset 0 0 12px rgba(43, 240, 255, 0.5); pointer-events: none; }
.dr-podium i { position: absolute; bottom: 4%; width: 6px; height: 34%; border-radius: 4px; background: linear-gradient(0deg, transparent, var(--dr-trail, #2BF0FF)); }
.dr-garage-hero h2 { margin: 0; font-size: 22px; font-weight: 900; }
.dr-garage-hero p { margin: 0; font-size: 13px; color: var(--dr-muted); font-weight: 700; }
.dr-garage-play { display: flex; flex-direction: column; gap: 3%; padding: 1% 4.4% 0; box-sizing: border-box; }
.dr-cars { display: flex; gap: max(8px, 3%); flex: 0 0 39%; min-height: 0; }
.dr-car-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 18px;
  border: 1.5px solid var(--dr-cyan);
  background: rgba(16, 12, 52, 0.86);
  color: var(--gs-ink);
  font-family: var(--dr-font);
  cursor: pointer;
  padding: 4px;
  overflow: hidden;
  box-sizing: border-box;
}
.dr-car-card img { height: 46%; min-height: 0; }
.dr-car-card b { font-size: 14px; font-weight: 900; }
.dr-car-card small { font-size: 10.5px; font-weight: 800; color: var(--dr-go); line-height: 1.1; text-align: center; }
.dr-car-card[aria-pressed='true'] { border-color: var(--dr-go); box-shadow: 0 0 14px rgba(184, 255, 59, 0.5); }
.dr-car-card[aria-disabled='true'] { filter: saturate(0.3) brightness(0.65); border-color: var(--dr-muted); }
.dr-car-card[aria-disabled='true'] small { color: var(--dr-pad); }
.dr-trail-head { font-weight: 900; font-size: 15px; }
.dr-swatches { display: flex; justify-content: space-between; gap: 8px; }
.dr-swatch { width: 52px; height: 52px; min-width: 44px; min-height: 44px; border-radius: 14px; border: 2px solid rgba(255, 255, 255, 0.25); cursor: pointer; display: grid; place-items: center; padding: 0; }
.dr-swatch[aria-pressed='true'] { border-color: var(--dr-go); box-shadow: 0 0 0 2px var(--dr-go), 0 0 14px rgba(184, 255, 59, 0.6); }
.dr-swatch[aria-disabled='true'] { filter: brightness(0.5); }
.dr-swatch img { width: 22px; height: 22px; filter: brightness(0) invert(1); }
.dr-trail-note { font-size: 12px; color: var(--dr-muted); font-weight: 700; text-align: center; }

@media (orientation: landscape) and (max-height: 560px) {
  .dr-garage-play { gap: 4%; padding: 2% 3% 0 1%; }
  .dr-cars { flex: 0 0 44%; }
}

/* ============================ 浮层（暂停 / 设置 / 帮助 / 挑战码） ============================ */

.dr-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
}
.dr-scrim { position: absolute; inset: 0; background: rgba(5, 3, 15, 0.7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dr-card-bg { position: absolute; pointer-events: none; }
.dr-ov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 4%; box-sizing: border-box; }
.dr-ov-head h2 { margin: 0; font-size: clamp(20px, 4vh, 28px); font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-ov-col { display: flex; flex-direction: column; gap: 8px; justify-content: center; padding: 0 4%; box-sizing: border-box; }
.dr-ov-col > .dr-btn { width: 100%; min-height: 44px; flex: 1 1 0; max-height: 60px; border-radius: 999px; font-size: 16px; }
.dr-toggle {
  flex: 1 1 0;
  max-height: 56px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1.5px solid var(--dr-glass-edge);
  background: rgba(16, 12, 52, 0.9);
  color: var(--gs-ink);
  font-family: var(--dr-font);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}
.dr-toggle img { width: 24px; height: 24px; filter: brightness(0) invert(1); flex: 0 0 auto; }
.dr-toggle .dr-toggle-label { flex: 1 1 auto; min-width: 0; line-height: 1.12; overflow-wrap: anywhere; }
.dr-switch { flex: 0 0 auto; min-width: 64px; height: 30px; border-radius: 999px; background: #3A3566; display: inline-flex; align-items: center; justify-content: flex-end; padding: 0 10px 0 34px; position: relative; font-size: 12px; font-weight: 900; color: #fff; box-sizing: border-box; }
.dr-switch::before { content: ''; position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform var(--gs-fast); }
.dr-toggle[aria-pressed='true'] .dr-switch { background: var(--dr-go); color: #0A0820; justify-content: flex-start; padding: 0 34px 0 10px; }
.dr-toggle[aria-pressed='true'] .dr-switch::before { left: auto; right: 4px; }
:root[data-contrast='on'] .dr-toggle[aria-pressed='true'] .dr-switch { background: #FFEB00; }

.dr-help-body { overflow-y: auto; padding: 4px 6% 32px; box-sizing: border-box; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; }
.dr-help-body h3 { margin: 14px 0 6px; font-size: 15px; font-weight: 900; color: var(--dr-cyan); }
.dr-help-body p { margin: 0 0 8px; font-size: 14px; line-height: 1.45; color: rgba(255, 246, 234, 0.93); }
.dr-help-row { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.dr-help-row .dr-help-ico { width: 26px; height: 26px; border-radius: 8px; background: rgba(43, 240, 255, 0.14); display: grid; place-items: center; margin-top: 1px; }
.dr-help-row .dr-help-ico img { width: 18px; height: 18px; filter: brightness(0) invert(1); }
.dr-help-body details { margin: 0 0 8px; border-radius: 12px; background: rgba(16, 12, 52, 0.7); padding: 0 12px; }
.dr-help-body summary { min-height: 44px; display: flex; align-items: center; font-weight: 800; font-size: 14px; cursor: pointer; }
.dr-help-body details p { padding-bottom: 8px; }
.dr-help-play { display: flex; align-items: center; justify-content: center; padding: 0 12%; box-sizing: border-box; }
.dr-help-play .dr-btn { width: 100%; min-height: 52px; border-radius: 999px; font-size: 17px; }

.dr-code-head { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 4%; box-sizing: border-box; }
.dr-code-head h2 { margin: 0; font-size: clamp(20px, 3.8vh, 26px); font-weight: 900; }
.dr-code-head p { margin: 0; font-size: 13px; line-height: 1.35; color: var(--dr-muted); font-weight: 700; }
.dr-code-body { display: flex; flex-direction: column; gap: 8px; padding: 2px 4%; box-sizing: border-box; }
.dr-code-text {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border-radius: 14px;
  border: 2px solid var(--dr-cyan);
  background: rgba(5, 3, 15, 0.85);
  color: #fff;
  font-family: var(--dr-mono);
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  word-break: break-all;
  -webkit-user-select: text;
  user-select: text;
}
.dr-code-body > .dr-code-text:not(.dr-code-input) { flex: 0 1 auto; height: 10.5em; }
.dr-code-input { flex: 0 0 auto; height: 30%; min-height: 64px; border-color: var(--dr-magenta); }
.dr-code-meta { font-size: 13px; font-weight: 800; color: var(--dr-muted); }
.dr-code-status { min-height: 18px; font-size: 13px; font-weight: 800; color: var(--dr-go); line-height: 1.3; }
.dr-code-status[data-tone='bad'] { color: #FF8CC6; }
.dr-code-status:empty { display: none; }
.dr-friends-head { font-size: 13px; font-weight: 900; color: var(--dr-muted); margin-top: 2px; }
.dr-friends { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; }
.dr-friend { display: flex; align-items: center; gap: 8px; }
.dr-friend-row { flex: 1 1 auto; min-width: 0; min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--dr-cyan); background: rgba(16, 12, 52, 0.9); font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-sizing: border-box; }
.dr-friend-row { gap: 8px; }
.dr-friend-row img { width: 20px; height: 30px; object-fit: contain; flex: 0 0 auto; }
.dr-friend-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dr-friend .dr-btn { flex: 0 0 auto; min-height: 44px; border-radius: 999px; font-size: 13px; padding: 4px 12px; }
.dr-code-play { display: flex; flex-direction: column; gap: 10px; padding: 0 6%; box-sizing: border-box; }
.dr-code-play .dr-btn { width: 100%; min-height: 52px; border-radius: 999px; font-size: 17px; }

/* ============================ 加载 / 错误 ============================ */

.dr-brand { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4%; }
.dr-brand .dr-logo { width: 50%; max-width: 260px; }
.dr-loading-play { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 6%; }
.dr-progress { width: 70%; height: 12px; border-radius: 999px; background: rgba(124, 77, 255, 0.28); overflow: hidden; box-shadow: 0 0 16px rgba(43, 240, 255, 0.25); }
.dr-progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--dr-cyan), var(--dr-go)); transition: width 180ms linear; }
.dr-loading-text { font-size: 14px; color: var(--dr-muted); font-weight: 700; }
.dr-error-art { display: grid; place-items: center; }
.dr-error-art canvas { width: min(70%, 280px); aspect-ratio: 1; }
.dr-error-car { position: absolute; top: 38%; left: calc(50% - 24px); width: 48px; height: 76px; object-fit: contain; transform: rotate(60deg); }
.dr-error-msg { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 8%; text-align: center; box-sizing: border-box; }
.dr-error-title { margin: 0; font-size: 24px; font-weight: 900; }
.dr-error-body { margin: 0; font-size: 15px; color: var(--dr-muted); line-height: 1.4; }
.dr-error-play { display: flex; justify-content: center; align-items: flex-start; padding: 4% 15% 0; box-sizing: border-box; }
.dr-error-play .dr-btn { width: 100%; min-height: 56px; border-radius: 999px; font-size: 18px; }
.dr-boot-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 0 12%; text-align: center; }

/* Custom controls follow the same contrast switch as the shared tokens. */
:root[data-contrast='on'] :is(.dr-toggle, .dr-icon-btn, .dr-btn.gs-btn--secondary, .dr-pill, .dr-card, .dr-car-card, .dr-friend-row, .dr-code-text) {
  background: #000;
  border-color: #FFEB00;
  color: #FFF;
}
:root[data-contrast='on'] :is(.dr-help-body p, .dr-res-text, .dr-code-status) { color: #FFF; }

/* ============================ 矮竖屏（站点框 342×403） ============================
 *
 * 站点在 375×667 的手机上交给游戏的框是 342×403：竖的（走竖屏分区），但只有 403 高，
 * 也不触发「手机画布锁定」（那一档要 min-height: 561px）。SCREEN_SPEC 的分区是按 9:16 定的比例，
 * 同一条 8% 的顶栏在这里只有 32px、10% 的抬头只有 40px，装不下 44×44 的触控下限。
 *
 * 这一档只做两件事，一个分区边界都不动、一个控件都不缩到 44 以下：
 *   ① 把排版收紧（间距、字号、按钮高度从 56 收到 44~52、两列排）；
 *   ② 收紧后仍装不下的分区让内容自己滚，并用 `safe center` 让溢出的那一侧从顶边开始，
 *      而不是居中后上下两头一起被切（玩家看到的就是 y = -6 的暂停键）。
 * 判定档位与 playtest.mjs 的 site-box-342x403 一致；s3_tools/sweep.mjs --vp=342x403 自查。
 */
@media (orientation: portrait) and (max-height: 560px) {
  /* ② 44px 的键放不进 32/40px 的条：条自己滚，键从顶边开始（不再顶出视口） */
  .dr-hud,
  .dr-map-head,
  .dr-ov-head,
  .dr-notice {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
    align-items: safe center;
  }
  .dr-hud::-webkit-scrollbar, .dr-map-head::-webkit-scrollbar, .dr-ov-head::-webkit-scrollbar, .dr-notice::-webkit-scrollbar { width: 0; height: 0; }
  .dr-notice { padding-top: 0; padding-bottom: 0; }
  .dr-notice-row { height: auto; }
  /* 英文这句在 342 宽里折三行：三行 × 12px + 上下 3px = 42，和右侧 44px 的关闭键同高，不再在第三行中间切字 */
  .dr-notice-bar { max-height: none; padding: 3px 8px; gap: 6px; }
  .dr-notice-text { font-size: 10.5px; line-height: 1.15; }
  .dr-notice-mark { width: 22px; height: 22px; }

  /* 顶栏中段：发车灯收一档，灯 + 赛道名 = 30px，落在 32px 的可见高度里 */
  .dr-hud-mid { gap: 1px; }
  .dr-lights { height: 14px; gap: 4px; }
  .dr-lights img { width: 13px; height: 13px; }
  .dr-race-timer { font-size: 22px; }

  /* 底栏 56px：清空 / 出发 52px 高居中；看铜牌线 44px 贴顶，下面 1+11px 是它的说明行 */
  .dr-bar { padding-top: 0; align-items: center; }
  .dr-bar .dr-btn { min-height: 44px; height: calc(100% - 4px); }
  .dr-bar .dr-peek { height: 44px; align-self: flex-start; }
  /* 说明行比看铜牌线键宽（伸到两侧键下方）：有它的时候三颗键都 44px 贴顶，说明行下面没有别的键 */
  .dr-bar:has(.dr-peek:not([hidden])) .dr-btn { height: 44px; align-self: flex-start; }
  .dr-peek .dr-peek-label { top: calc(100% + 1px); font-size: 10px; line-height: 1.1; }

  /* 浮层（暂停 / 设置）：开关列 4×44 + 3×8 = 200 > 161 → 从顶边排、滚；
     暂停的四颗键排成 继续（整行）/ 重开 · 地图 / 帮助（整行）三行 = 148 ≤ 153，不用滚 */
  .dr-ov-col { justify-content: flex-start; overflow-y: auto; overscroll-behavior: contain; }
  .dr-ov-col > .dr-btn, .dr-ov-col > .dr-toggle { flex: 0 0 auto; min-height: 44px; height: 44px; }
  /* 设置抬头的关闭键 44px 伸到 40px 抬头的底边下方 4px：开关列让出 8px，两键外框之间仍留足 8px */
  .dr-overlay .dr-zone[data-zone='body'].dr-ov-col { padding-top: 8px; }
  .dr-overlay[data-overlay='pause'] .dr-zone[data-zone='play'].dr-ov-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: minmax(44px, auto);
    gap: 8px;
    align-content: start;
  }
  .dr-overlay[data-overlay='pause'] .dr-zone[data-zone='play'] > .dr-btn { height: auto; font-size: 14px; padding: 4px 10px; gap: 6px; }
  .dr-overlay[data-overlay='pause'] .dr-zone[data-zone='play'] > .dr-btn:first-child,
  .dr-overlay[data-overlay='pause'] .dr-zone[data-zone='play'] > .dr-btn:last-child { grid-column: 1 / -1; }

  /* 标题：百分比间距在 226px 的分区里只剩 6.6px，低于 8px 的相邻间距下限 */
  .dr-title-play { gap: 8px; }

  /* 地图：卡片只有 56×58，最佳成绩那一行本来就挤出卡外——这一档不画它（星数仍在，成绩在结算与赛道信息里）；
     编号 13 + 名字两行 22 + 星 / 锁 18 + 上下 4 = 57，锁头不再被卡底切掉 */
  .dr-card em { display: none; }
  .dr-card { padding: 2px 3px; }
  .dr-card .dr-lock { width: 18px; height: 18px; }
  .dr-card .dr-card-stars { height: 13px; }
  .dr-card .dr-card-stars img { width: 13px; height: 13px; }

  /* 结算抬头：长句（停住 / 掉下去）只占中间一列，不再盖住左上的地图键；星与分数并排一行 */
  .dr-res-head { grid-template-columns: 52px minmax(0, 0.6fr) minmax(0, 1.4fr) 52px; column-gap: 8px; padding-top: 4px; }
  .dr-res-name { grid-column: 2 / span 2; }
  .dr-res-hero { grid-column: 2 / span 2; }
  .dr-res-hero[data-long='true'] { font-size: 13px; line-height: 1.15; }
  .dr-res-stars { grid-column: 1 / span 2; grid-row: 3; justify-self: end; height: 20px; gap: 4px; }
  .dr-res-score { grid-column: 3 / span 2; grid-row: 3; justify-self: start; font-size: 14px; gap: 6px; white-space: nowrap; }
  .dr-res-score .dr-badge-new { font-size: 11px; padding: 2px 8px; }

  /* 结算中段：奖牌梯收一档；装不下的（解锁、每日胶囊）在右栏里滚，缩略赛道不动 */
  .dr-res-side { overflow-y: auto; overscroll-behavior: contain; gap: 4px; }
  .dr-ladder { padding: 4px 6px; gap: 2px; }
  .dr-ladder-row { min-height: 22px; padding: 1px 5px; font-size: 11.5px; }
  .dr-ladder-row img { width: 18px; height: 18px; }
  .dr-legend { font-size: 10.5px; }

  /* 结算底部 125px：再来（44）+ 三键一行（44）在前，说明句放到最后；长句时分区滚 */
  .dr-res-play { overflow-y: auto; overscroll-behavior: contain; padding-top: 0; }
  .dr-res-play > .dr-btn { min-height: 44px; flex: 0 0 auto; }
  .dr-res-row { flex: 0 0 auto; }
  .dr-res-row .dr-btn { min-height: 44px; }
  .dr-res-text { order: 3; min-height: 0; font-size: 12.5px; line-height: 1.2; }
}
