/* LULO 四驅車 — 全域主題與 UI 元件
   視覺方向：玩具模型店＋賽車場。粗黑描邊、貼紙偏移陰影、號碼牌、方格旗。 */

:root {
  --ink: #16181f;
  --ink-2: #2b2f3a;
  --paper: #fff7e6;
  --paper-2: #ffeccc;
  --card: #ffffff;
  --sun: #ffd23f;
  --sun-2: #ffb400;
  --red: #ff4136;
  --red-2: #d62b22;
  --blue: #1fa2ff;
  --blue-2: #0b6fd1;
  --green: #2ecc71;
  --purple: #9b5cff;
  --orange: #ff8a00;
  --muted: #6b7080;
  --good: #19b45a;
  --bad: #ff3b30;

  --r-N: #c9ced8;
  --r-R: #3ecf6e;
  --r-SR: #3a8dff;
  --r-SSR: #a64dff;
  --r-UR: #ffb400;

  --font: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", "Segoe UI", Roboto, sans-serif;
  --font-num: "SF Pro Rounded", ui-rounded, "Arial Rounded MT Bold", system-ui, sans-serif;
  --bw: 3px;
  --rad: 14px;
  --shadow: 0 4px 0 var(--ink);
  --shadow-lg: 0 6px 0 var(--ink);
  --tap: 48px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background-color: #ffe9b8;
  background-image: radial-gradient(circle at 12px 12px, rgba(22,24,31,.13) 2.5px, transparent 3px), linear-gradient(180deg, #ffeec7 0%, #ffd98a 100%);
  background-size: 24px 24px, 100% 100%; background-attachment: fixed; color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; }

#gl {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; z-index: 0; touch-action: none;
}
#gl.hidden { visibility: hidden; }
#app { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
#layer-modal { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
#layer-toast { position: fixed; left: 0; right: 0; top: calc(10px + var(--safe-t)); z-index: 60; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 12px; }

/* ── 背景圖樣 ───────────────────────────── */
.bg-pegboard {
  background-color: #ffe9b8;
  background-image:
    radial-gradient(circle at 12px 12px, rgba(22,24,31,.16) 2.5px, transparent 3px),
    linear-gradient(180deg, #ffeec7 0%, #ffd98a 100%);
  background-size: 24px 24px, 100% 100%;
}
.checker-strip {
  height: 18px;
  background-image:
    linear-gradient(45deg, var(--ink) 25%, transparent 25%, transparent 75%, var(--ink) 75%),
    linear-gradient(45deg, var(--ink) 25%, transparent 25%, transparent 75%, var(--ink) 75%);
  background-color: #fff;
  background-size: 18px 18px; background-position: 0 0, 9px 9px;
  border-top: var(--bw) solid var(--ink); border-bottom: var(--bw) solid var(--ink);
}

/* ── 載入畫面 ───────────────────────────── */
.boot {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px;
  background: var(--sun); transition: opacity .35s;
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-logo { display: flex; align-items: baseline; gap: 8px; transform: skewX(-10deg); }
.boot-logo span, .boot-logo b {
  font-weight: 900; font-size: 44px; letter-spacing: 1px;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink);
}
.boot-logo span { color: var(--red); }
.boot-logo b { color: #fff; }
.boot-bar { width: min(260px, 70vw); height: 16px; border: var(--bw) solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--red) 0 10px, var(--red-2) 10px 20px); transition: width .25s; }
.boot p { font-weight: 700; }

/* ── 畫面容器 ───────────────────────────── */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
  overflow: hidden;
}
.screen.enter { animation: scr-in .22s ease-out; }
@keyframes scr-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.screen.clear { background: transparent; pointer-events: none; }
.screen.clear > * { pointer-events: auto; }
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; min-height: 0; }

/* ── 標題字 ─────────────────────────────── */
.h-title {
  margin: 0; font-weight: 900; font-style: italic; letter-spacing: .5px;
  color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
  transform: skewX(-6deg);
}
.h-title.red { color: var(--red); }
.h-title.sun { color: var(--sun); }
.h-sub { margin: 0; font-weight: 800; font-size: 14px; color: var(--ink-2); }

.topbar {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); flex: none;
}
.topbar .h-title { font-size: 26px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px 6px 4px 2px; }

/* ── 按鈕 ───────────────────────────────── */
.btn {
  appearance: none; cursor: pointer; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); min-width: var(--tap); padding: 8px 16px;
  border: var(--bw) solid var(--ink); border-radius: var(--rad);
  background: #fff; color: var(--ink); font-weight: 900; font-size: 16px; letter-spacing: .5px;
  box-shadow: var(--shadow); transition: transform .06s, box-shadow .06s, filter .1s;
  touch-action: manipulation; white-space: nowrap;
}
.btn:hover { filter: brightness(1.04); }
.btn:active, .btn.pressed { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow); }
.btn.primary { background: var(--red); color: #fff; }
.btn.sun { background: var(--sun); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.dark { background: var(--ink); color: #fff; box-shadow: 0 4px 0 #000; }
.btn.ghost { background: rgba(255,255,255,.7); }
.btn.big { min-height: 60px; font-size: 20px; padding: 10px 24px; border-radius: 18px; }
.btn.icon { padding: 0; width: var(--tap); }
.btn.sm { min-height: 44px; font-size: 14px; padding: 6px 12px; }
.btn .ico { width: 22px; height: 22px; flex: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── 卡片／面板 ─────────────────────────── */
.panel {
  background: var(--card); border: var(--bw) solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow-lg); padding: 12px;
}
.panel.paper { background: var(--paper); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px;
  border: 2px solid var(--ink); background: #fff; font-weight: 800; font-size: 12px; white-space: nowrap;
}
.chip.sand { background: #ffd89a; } .chip.water { background: #9fd8ff; } .chip.trap { background: #ffb3ad; }
.chip.jump { background: #d9c2ff; } .chip.slope { background: #c3f0c8; } .chip.curve { background: #ffe680; }

/* 號碼牌（賽車號碼貼紙） */
.plate {
  display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 32px; padding: 0 8px;
  background: #fff; border: var(--bw) solid var(--ink); border-radius: 50% / 45%;
  font-family: var(--font-num); font-weight: 900; font-size: 18px; font-style: italic;
}

/* ── 分頁 ───────────────────────────────── */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px 2px 8px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 44px; padding: 6px 14px; border: var(--bw) solid var(--ink); border-radius: 12px 12px 12px 4px;
  background: #fff; font-weight: 900; cursor: pointer; box-shadow: 0 3px 0 var(--ink);
}
.tab[aria-selected="true"] { background: var(--sun); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

/* ── 彈窗 ───────────────────────────────── */
.modal-back {
  position: absolute; inset: 0; background: rgba(22,24,31,.55); display: flex; align-items: center; justify-content: center;
  padding: calc(14px + var(--safe-t)) 14px calc(14px + var(--safe-b)); pointer-events: auto; animation: fade .15s;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(480px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: var(--bw) solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 var(--ink);
  animation: pop .2s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.modal-head { padding: 12px 16px 8px; background: var(--sun); border-bottom: var(--bw) solid var(--ink); }
.modal-head .h-title { font-size: 22px; }
.modal-body { padding: 14px 16px; overflow-y: auto; font-weight: 600; }
.modal-foot { padding: 10px 16px 14px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .btn { flex: 1 1 120px; }

/* ── 提示 Toast ─────────────────────────── */
.toast {
  max-width: min(460px, 100%); padding: 10px 16px; border: var(--bw) solid var(--ink); border-radius: 14px;
  background: #fff; font-weight: 800; box-shadow: var(--shadow); animation: toast-in .25s cubic-bezier(.2,1.4,.4,1);
}
.toast.good { background: #c9f7d9; } .toast.bad { background: #ffd2cf; } .toast.info { background: #d6eeff; }
.toast.out { animation: toast-out .25s forwards; }
@keyframes toast-in { from { transform: translateY(-20px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-20px); opacity: 0; } }

/* ── 數值條 ─────────────────────────────── */
.stat-row { display: grid; grid-template-columns: 4.6em 1fr 3.4em; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; min-height: 22px; }
.stat-row .lbl { white-space: nowrap; }
.stat-row .val { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.stat-row .val.up { color: var(--good); } .stat-row .val.down { color: var(--bad); }
.bar { position: relative; height: 12px; border: 2px solid var(--ink); border-radius: 99px; background: #eef0f4; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue); border-radius: 99px; transition: width .25s; }
.bar > i.ghost { background: transparent; border-right: 3px solid var(--ink); border-radius: 0; z-index: 2; opacity: .6; }
.bar > i.up { background: var(--good); } .bar > i.down { background: var(--bad); }

/* 雷達圖 */
.radar { width: 100%; max-width: 240px; aspect-ratio: 1; margin: 0 auto; }
.radar text { font-weight: 900; font-size: 11px; fill: var(--ink); }

/* ── 稀有度外框／零件卡 ─────────────────── */
.rar { --rc: var(--r-N); }
.rar-N { --rc: var(--r-N); } .rar-R { --rc: var(--r-R); } .rar-SR { --rc: var(--r-SR); } .rar-SSR { --rc: var(--r-SSR); } .rar-UR { --rc: var(--r-UR); }
.rar-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 22px; padding: 0 6px;
  border: 2px solid var(--ink); border-radius: 6px; background: var(--rc); color: var(--ink); font-weight: 900; font-size: 12px; font-style: italic;
}
.part-card {
  position: relative; display: flex; gap: 10px; align-items: center; width: 100%; min-height: 64px; padding: 8px 10px;
  border: var(--bw) solid var(--ink); border-radius: 14px; background: #fff; cursor: pointer; text-align: left;
  box-shadow: 0 3px 0 var(--ink), inset 6px 0 0 var(--rc);
}
.part-card.rar-UR { background: linear-gradient(100deg, #fff 60%, #fff1c2); }
.part-card.rar-SSR { background: linear-gradient(100deg, #fff 60%, #f1e3ff); }
.part-card[aria-pressed="true"] { outline: 4px solid var(--sun); outline-offset: -1px; }
.part-card.equipped::after {
  content: '裝備中'; position: absolute; right: 8px; top: -10px; padding: 1px 8px; border: 2px solid var(--ink); border-radius: 99px;
  background: var(--green); color: #fff; font-size: 11px; font-weight: 900;
}
.part-card .pc-ico { flex: none; width: 46px; height: 46px; border: 2px solid var(--ink); border-radius: 10px; background: var(--rc); display: grid; place-items: center; }
.part-card .pc-ico svg { width: 32px; height: 32px; }
.part-card .pc-main { flex: 1; min-width: 0; }
.part-card .pc-name { font-weight: 900; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.part-card .pc-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-top: 2px; }
.part-card .pc-meta b { font-family: var(--font-num); }

/* ── 表單元件 ───────────────────────────── */
.field { display: grid; gap: 4px; margin: 10px 0; font-weight: 800; }
.range { width: 100%; height: 44px; accent-color: var(--red); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg .btn { flex: 1 1 auto; min-width: 64px; box-shadow: 0 3px 0 var(--ink); }
.seg .btn[aria-pressed="true"] { background: var(--sun); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; font-weight: 800; }
.switch { position: relative; width: 66px; height: 40px; flex: none; border: var(--bw) solid var(--ink); border-radius: 99px; background: #dfe3ea; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--green); }
.switch[aria-checked="true"]::after { left: 29px; }
.keycap {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 0 8px;
  border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 8px; background: #fff; font-weight: 900; font-size: 13px; cursor: pointer;
}
.keycap.listening { background: var(--sun); animation: blink .6s infinite; }
@keyframes blink { 50% { background: #fff; } }
.swatch { width: 44px; height: 44px; border: var(--bw) solid var(--ink); border-radius: 10px; cursor: pointer; }
.swatch[aria-pressed="true"] { outline: 4px solid var(--ink); outline-offset: 2px; }

/* ── 標題畫面 ───────────────────────────── */
.title-screen { align-items: center; justify-content: center; text-align: center; background: transparent; }
.title-screen .logo { position: relative; transform: rotate(-4deg); margin-bottom: 8px; }
.title-screen .logo .l1 { font-size: clamp(34px, min(13vw, 15vh), 92px); line-height: .95; color: var(--red); }
.title-screen .logo .l2 { font-size: clamp(40px, min(16vw, 19vh), 116px); line-height: .95; color: #fff; }
.title-screen .logo .tag {
  display: inline-block; margin-top: 10px; padding: 4px 14px; background: var(--ink); color: var(--sun);
  font-weight: 900; font-style: italic; letter-spacing: 4px; border-radius: 8px; transform: skewX(-10deg); font-size: clamp(14px, 4vw, 20px);
}
.title-screen .press { margin-top: 28px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.version-tag {
  position: absolute; right: calc(10px + var(--safe-r)); bottom: calc(8px + var(--safe-b));
  font-family: var(--font-num); font-weight: 800; font-size: 12px; padding: 2px 8px; background: rgba(255,255,255,.85);
  border: 2px solid var(--ink); border-radius: 8px;
}
@media (min-aspect-ratio: 6/5) {
  .title-screen { align-items: flex-start; }
  .title-screen .title-main { margin-left: 7vw; text-align: center; }
}
.title-shade { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(255,247,230,.0) 30%, rgba(255,210,63,.55) 100%); }
.title-stripes { position: absolute; left: -10%; right: -10%; height: 70px; transform: rotate(-4deg); opacity: .95; }

/* ── 主選單 ─────────────────────────────── */
.menu-grid {
  display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); padding: 4px 4px 16px;
}
.tile {
  position: relative; min-height: 104px; padding: 12px; text-align: left; cursor: pointer;
  border: var(--bw) solid var(--ink); border-radius: 18px; background: #fff; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  transition: transform .06s, box-shadow .06s;
}
.tile:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.tile .t-name { font-weight: 900; font-size: 19px; font-style: italic; position: relative; z-index: 1; }
.tile .t-desc { font-weight: 700; font-size: 12px; color: var(--ink-2); position: relative; z-index: 1; }
.tile .t-ico { position: absolute; right: -6px; bottom: -8px; width: 74px; height: 74px; opacity: .9; }
.tile.hero { grid-column: span 2; min-height: 140px; background: var(--red); color: #fff; }
.tile.hero .t-name { font-size: 30px; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); }
.tile.hero .t-desc { color: #fff; }
.tile.sun { background: var(--sun); } .tile.blue { background: var(--blue); color: #fff; } .tile.blue .t-desc { color: #eaf6ff; }
.tile.locked { background: #eceef2; color: var(--muted); }
.tile.locked .t-ico { width: 54px; height: 54px; opacity: .35; }
.tile.locked::after { content: '即將開放'; position: absolute; top: 8px; right: 8px; font-size: 10px; font-weight: 900; padding: 1px 5px; border: 2px solid var(--muted); border-radius: 6px; background: #eceef2; }
.tile.locked .t-name { padding-right: 58px; }
@media (max-width: 420px) {
  .menu-grid { gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 96px; padding: 10px; }
  .tile .t-name { font-size: 17px; }
  .tile .t-ico { width: 52px; height: 52px; opacity: .35; }
  .tile.hero .t-ico { width: 74px; height: 74px; opacity: .9; }
  .tile.locked .t-name { padding-right: 0; margin-top: 16px; }
}
.profile-card { display: flex; align-items: center; gap: 10px; }
.avatar { width: 48px; height: 48px; border: var(--bw) solid var(--ink); border-radius: 50%; background: var(--blue); display: grid; place-items: center; font-weight: 900; color: #fff; font-size: 20px; flex: none; }

/* ── 車庫 ───────────────────────────────── */
.garage { display: grid; grid-template-rows: auto minmax(150px, 36%) auto minmax(0, 1fr); gap: 8px; background: transparent; pointer-events: none; }
.garage > * { pointer-events: auto; }
.garage .viewport { pointer-events: auto; border-radius: 18px; position: relative; touch-action: none; }
.garage .viewport .car-name { position: absolute; left: 6px; bottom: 6px; }
.garage .viewport .hint { position: absolute; right: 8px; bottom: 8px; font-size: 11px; font-weight: 800; background: rgba(255,255,255,.8); padding: 2px 6px; border-radius: 6px; border: 2px solid var(--ink); }
.slot-bar { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.slot-btn {
  min-height: 58px; padding: 4px 2px; border: var(--bw) solid var(--ink); border-radius: 12px; background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer; box-shadow: 0 3px 0 var(--ink);
  font-weight: 900; font-size: 12px; position: relative; overflow: hidden;
}
.slot-btn svg { width: 24px; height: 24px; }
.slot-btn i { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--rc); }
.slot-btn[aria-selected="true"] { background: var(--sun); transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.garage-panel { display: flex; flex-direction: column; min-height: 0; padding: 10px; }
.garage-cols { display: grid; grid-template-columns: 1fr; gap: 10px; min-height: 0; flex: 1; }
.part-list { display: grid; gap: 8px; align-content: start; padding: 6px 2px 10px; }
.terrain-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.terrain-cell { border: 2px solid var(--ink); border-radius: 10px; padding: 4px; text-align: center; font-weight: 900; font-size: 12px; background: #fff; }
.terrain-cell b { display: block; font-size: 16px; font-family: var(--font-num); }
.grade-S { background: #ffe680; } .grade-A { background: #c9f7d9; } .grade-B { background: #e7f2ff; } .grade-C { background: #fff; } .grade-D { background: #ffd2cf; }

@media (orientation: landscape) and (min-width: 700px) {
  .garage { grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .garage .topbar { grid-column: 1 / -1; }
  .garage .viewport { grid-column: 1; grid-row: 2 / 4; }
  .garage .slot-bar { grid-column: 2; grid-row: 2; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .garage .garage-panel { grid-column: 2; grid-row: 3; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .garage { grid-template-columns: minmax(0, 1fr) minmax(280px, 1.1fr); grid-template-rows: auto auto minmax(0, 1fr); gap: 6px; }
  .garage .topbar { grid-column: 1 / -1; min-height: 44px; }
  .garage .topbar .h-title { font-size: 20px; }
  .garage .viewport { grid-column: 1; grid-row: 2 / 4; }
  .garage .slot-bar { grid-column: 2; grid-row: 2; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; }
  .garage .slot-btn { min-height: 44px; font-size: 10px; }
  .garage .slot-btn svg { width: 18px; height: 18px; }
  .garage .garage-panel { grid-column: 2; grid-row: 3; }
}
@media (max-width: 380px) {
  .slot-btn { font-size: 10px; min-height: 50px; } .slot-btn svg { width: 18px; height: 18px; }
  .topbar .h-title { font-size: 21px; }
  .btn { padding: 8px 10px; }
}

/* ── 練習賽設定 ─────────────────────────── */
.track-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.track-card { position: relative; padding: 0; overflow: hidden; cursor: pointer; text-align: left; border: var(--bw) solid var(--ink); border-radius: 16px; background: #fff; box-shadow: 0 4px 0 var(--ink); }
.track-card[aria-pressed="true"] { outline: 5px solid var(--red); outline-offset: -2px; }
.track-card .tc-art { height: 86px; position: relative; border-bottom: var(--bw) solid var(--ink); }
.track-card .tc-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.track-card .tc-body { padding: 8px 10px 10px; }
.track-card .tc-name { font-weight: 900; font-size: 16px; }
.track-card .tc-env { position: absolute; top: 8px; left: 8px; }
.track-card .tc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.env-indoor { background: linear-gradient(160deg, #ffe7a8, #ffb86b); }
.env-desert { background: linear-gradient(160deg, #ffd890, #e79a4b); }
.env-rain { background: linear-gradient(160deg, #a9c3dd, #5f7d9c); }
.env-hill { background: linear-gradient(160deg, #bfe9a8, #5aa86b); }
.env-boss { background: linear-gradient(160deg, #7a5cff, #2a1b5c); }

/* ── 比賽 HUD ───────────────────────────── */
.race-ui { position: absolute; inset: 0; pointer-events: none; font-family: var(--font); }
.race-ui .pe { pointer-events: auto; }
.hud-top { position: absolute; top: calc(6px + var(--safe-t)); left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); display: flex; gap: 8px; align-items: flex-start; }
.hud-box { background: rgba(255,255,255,.92); border: var(--bw) solid var(--ink); border-radius: 12px; padding: 4px 10px; box-shadow: 0 3px 0 var(--ink); font-weight: 900; }
.hud-pos { font-family: var(--font-num); font-style: italic; font-size: 30px; line-height: 1; padding: 4px 10px; background: var(--sun); }
.hud-pos small { font-size: 14px; }
.hud-lap { font-size: 13px; line-height: 1.15; }
.hud-lap b { font-family: var(--font-num); font-size: 18px; }
.hud-time { font-family: var(--font-num); font-size: 16px; font-variant-numeric: tabular-nums; }
.hud-spacer { flex: 1; }
.hud-minimap { width: 92px; height: 92px; padding: 2px; }
.hud-minimap canvas { width: 100%; height: 100%; display: block; }
.hud-speed {
  position: absolute; display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  right: calc(10px + var(--safe-r)); top: calc(110px + var(--safe-t));
}
.hud-speed .spd { font-family: var(--font-num); font-style: italic; font-weight: 900; font-size: 40px; line-height: .9; color: #fff;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink); }
.hud-speed .unit { font-weight: 900; font-size: 12px; background: var(--ink); color: #fff; padding: 1px 6px; border-radius: 6px; }
.gauges { display: grid; gap: 5px; width: 132px; }
.gauge { display: grid; grid-template-columns: 30px 1fr; gap: 4px; align-items: center; font-size: 11px; font-weight: 900; }
.gauge .lab { text-align: center; background: var(--ink); color: #fff; border-radius: 6px; padding: 1px 0; }
.gauge .bar { height: 14px; background: rgba(255,255,255,.9); }
.gauge.nitro .bar > i { background: linear-gradient(90deg, #19c3ff, #9b5cff); }
.gauge.nitro.full .bar { box-shadow: 0 0 0 3px var(--sun); animation: blink .5s infinite; }
.gauge.heat .bar > i { background: linear-gradient(90deg, #ffd23f, #ff4136); }
.gauge.heat.hot .lab { background: var(--red); }
.gauge.batt .bar > i { background: var(--green); }
.gauge.batt.low .bar > i { background: var(--orange); }
.gauge.stam .bar > i { background: #ffb400; }
.corner-warn {
  position: absolute; left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: var(--bw) solid var(--ink); border-radius: 14px;
  background: #fff; font-weight: 900; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; transition: background .1s;
}
.corner-warn .cw-arrow { width: 28px; height: 28px; }
.corner-warn .cw-txt { display: flex; flex-direction: column; line-height: 1.05; }
.corner-warn .cw-txt small { font-size: 11px; color: var(--ink-2); }
.corner-warn .cw-txt b { font-family: var(--font-num); font-size: 18px; }
.corner-warn.ok { background: #c9f7d9; }
.corner-warn.caution { background: #ffe680; }
.corner-warn.danger { background: var(--red); color: #fff; animation: shake .25s infinite; }
.corner-warn.danger small { color: #fff; }
.corner-warn.hidden { opacity: 0; }
@keyframes shake { 25% { transform: translateX(calc(-50% - 3px)); } 75% { transform: translateX(calc(-50% + 3px)); } }
.attitude {
  position: absolute; left: 50%; top: 38%; width: 150px; height: 78px; margin-left: -75px; border: var(--bw) solid var(--ink); border-radius: 14px;
  background: rgba(255,255,255,.9); box-shadow: 0 3px 0 var(--ink); display: none;
}
.attitude.on { display: block; }
.attitude svg { width: 100%; height: 100%; }
.event-pop {
  position: absolute; left: 50%; top: 28%; transform: translateX(-50%) rotate(-3deg); white-space: nowrap;
  font-weight: 900; font-style: italic; font-size: clamp(26px, 7vw, 44px); color: var(--sun);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 4px 4px 0 var(--ink);
  animation: evpop 1.1s forwards; pointer-events: none;
}
.event-pop.bad { color: var(--red); } .event-pop.cool { color: #7fe1ff; } .event-pop.good { color: #7dff9e; }
@keyframes evpop { 0% { transform: translateX(-50%) scale(.3) rotate(-3deg); opacity: 0; } 15% { transform: translateX(-50%) scale(1.15) rotate(-3deg); opacity: 1; } 25% { transform: translateX(-50%) scale(1) rotate(-3deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-20px) rotate(-3deg); } }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.countdown span { font-weight: 900; font-style: italic; font-size: clamp(90px, 30vw, 200px); color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 8px 8px 0 var(--ink); animation: cd .9s forwards; }
.countdown span.go { color: var(--sun); }
@keyframes cd { 0% { transform: scale(2); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(.8); opacity: 0; } }
.pause-btn { position: absolute; top: calc(6px + var(--safe-t)); right: calc(108px + var(--safe-r)); }
.fps { position: absolute; left: calc(8px + var(--safe-l)); bottom: calc(4px + var(--safe-b)); font: 700 11px monospace; color: #fff; background: rgba(0,0,0,.5); padding: 1px 4px; border-radius: 4px; }

/* 觸控按鍵：左手換道／姿態，右手煞車／氮氣 */
.touch-pad { position: absolute; bottom: calc(10px + var(--safe-b)); display: grid; gap: 10px; }
.touch-pad.left { left: calc(10px + var(--safe-l)); grid-template-columns: repeat(2, 72px); grid-template-rows: 60px 72px; }
.touch-pad.right { right: calc(10px + var(--safe-r)); grid-template-columns: 76px 96px; grid-template-rows: 96px; align-items: end; }
.tbtn {
  pointer-events: auto; touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: var(--bw) solid var(--ink); border-radius: 20px; background: rgba(255,255,255,.82); box-shadow: 0 4px 0 var(--ink);
  font-weight: 900; font-size: 12px; color: var(--ink); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.tbtn svg { width: 30px; height: 30px; }
.tbtn.on { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); filter: brightness(.9); }
.tbtn.brake { background: rgba(255,65,54,.92); color: #fff; width: 96px; height: 96px; border-radius: 50%; }
.tbtn.boost { background: rgba(31,162,255,.92); color: #fff; width: 76px; height: 76px; border-radius: 50%; }
.tbtn.boost.ready { background: rgba(155,92,255,.95); box-shadow: 0 4px 0 var(--ink), 0 0 0 4px var(--sun); }
.tbtn.lane { height: 72px; } .tbtn.pitch { height: 60px; font-size: 11px; }
.tbtn.pitch.hl { background: var(--sun); }
@media (orientation: portrait) {
  .touch-pad.left { grid-template-columns: repeat(2, 66px); grid-template-rows: 54px 66px; }
  .tbtn.lane { height: 66px; }
  .tbtn.pitch { height: 54px; }
}
@media (max-width: 360px) {
  .touch-pad.left { grid-template-columns: repeat(2, 58px); gap: 6px; }
  .touch-pad.right { grid-template-columns: 66px 84px; grid-template-rows: 84px; gap: 6px; }
  .tbtn.brake { width: 84px; height: 84px; } .tbtn.boost { width: 66px; height: 66px; }
  .gauges { width: 108px; }
  .hud-speed .spd { font-size: 32px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .hud-speed { top: calc(56px + var(--safe-t)); right: calc(110px + var(--safe-r)); }
  .corner-warn { top: calc(8px + var(--safe-t)); }
  .hud-minimap { width: 84px; height: 84px; }
  .touch-pad.left { grid-template-rows: 56px 66px; grid-template-columns: repeat(2, 68px); }
  .tbtn.lane { height: 66px; } .tbtn.pitch { height: 56px; }
}
body.no-touch .touch-pad { display: none; }
.kbd-help { position: absolute; left: 50%; bottom: calc(8px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  font-size: 12px; font-weight: 800; background: rgba(255,255,255,.85); border: 2px solid var(--ink); border-radius: 10px; padding: 3px 10px; }
body.touch .kbd-help { display: none; }

/* 教學提示（暫停式） */
.tutor { position: absolute; inset: 0; background: rgba(22,24,31,.45); display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: auto; }
.tutor .panel { max-width: 380px; text-align: center; animation: pop .2s cubic-bezier(.2,1.4,.4,1); }
.tutor .panel h3 { margin: 0 0 6px; font-size: 22px; }
.tutor .panel p { margin: 6px 0 12px; font-weight: 700; }

/* ── 結算 ───────────────────────────────── */
.result { background: transparent; }
.result .rank-big { font-family: var(--font-num); font-style: italic; font-weight: 900; font-size: 72px; line-height: 1; color: var(--sun); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 5px 0 var(--ink); }
.result-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); padding-bottom: 12px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kv > div { border: 2px solid var(--ink); border-radius: 10px; padding: 6px; background: #fff; text-align: center; }
.kv small { display: block; font-size: 11px; font-weight: 800; color: var(--ink-2); }
.kv b { font-family: var(--font-num); font-size: 18px; }
.standings { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-weight: 800; font-size: 14px; }
.standings td { padding: 6px 6px; background: #fff; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.standings td:first-child { border-left: 2px solid var(--ink); border-radius: 10px 0 0 10px; width: 38px; text-align: center; font-family: var(--font-num); font-style: italic; font-size: 18px; }
.standings td:last-child { border-right: 2px solid var(--ink); border-radius: 0 10px 10px 0; text-align: right; font-family: var(--font-num); }
.standings tr.me td { background: #fff3c4; }
.wear-row { display: grid; grid-template-columns: 4em 1fr 3.5em; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; }
.wear-row .bar > i { background: var(--green); } .wear-row .bar > i.lost { background: var(--red); left: auto; right: 0; border-radius: 0; }

.muted { color: var(--muted); }
.center { text-align: center; }
.grow { flex: 1; min-height: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.sp { height: 8px; flex: none; }
.small { font-size: 12px; }
.bold { font-weight: 900; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════ v0.2.0（L4-P2）線上核心循環（C2a） ═══════════════ */
.screen > .scroll.grow, .screen .scroll.grow { min-width: 0; }
.modal-body p { white-space: pre-line; }
.pre { white-space: pre-line; }
.bad-text { color: var(--bad); font-weight: 800; }
.ico.inline-ico { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.big-ico { width: 64px; height: 64px; margin: 0 auto 6px; }
.text-input { flex: 1; min-width: 0; width: 100%; min-height: 48px; padding: 8px 12px; border: var(--bw) solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; font-size: 16px; user-select: text; -webkit-user-select: text; }
.text-input:focus { outline: 3px solid var(--blue); outline-offset: 1px; }
.sel { min-height: 44px; padding: 4px 8px; border: var(--bw) solid var(--ink); border-radius: 12px; background: #fff; font-weight: 800; font-size: 14px; min-width: 0; max-width: 100%; }
.btn.is-busy { cursor: progress; }
.btn.is-busy::after { content: ''; width: 14px; height: 14px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bottom-bar { flex: none; padding-top: 8px; flex-wrap: wrap; }
.bottom-bar > .small { min-width: 140px; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.chip.up { background: #c9f7d9; } .chip.down { background: #ffd2cf; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); margin-right: 6px; }

/* 錢包 */
.wallet { display: flex; gap: 6px; flex: none; }
.wallet[hidden] { display: none; }
.w-item { display: inline-flex; align-items: center; gap: 3px; height: 34px; padding: 0 9px 0 4px; background: #fff; border: var(--bw) solid var(--ink); border-radius: 99px; font-family: var(--font-num); font-weight: 900; font-size: 14px; box-shadow: 0 2px 0 var(--ink); }
.w-ico { width: 24px; height: 24px; }
.w-item b.bump { animation: bump .5s; }
@keyframes bump { 30% { transform: scale(1.35); color: var(--good); } }
@media (max-width: 430px) {
  .topbar .wallet { gap: 3px; }
  .topbar .w-item { height: 30px; font-size: 12px; padding: 0 6px 0 2px; }
  .topbar .w-ico { width: 20px; height: 20px; }
  .topbar .h-title { font-size: 21px; }
}
@media (max-width: 359px) {
  .topbar { gap: 5px; }
  .topbar .wallet { gap: 2px; }
  .topbar .w-item { height: 28px; font-size: 11px; padding: 0 5px 0 1px; gap: 1px; box-shadow: none; }
  .topbar .w-ico { width: 17px; height: 17px; }
  .topbar .h-title { font-size: 19px; }
  .topbar > .btn.sm { padding: 6px 8px; }
}
.badge { position: absolute; top: -8px; right: -6px; min-width: 22px; height: 22px; padding: 0 5px; border: 2px solid var(--ink); border-radius: 99px; background: var(--red); color: #fff; font-style: normal; font-weight: 900; font-size: 12px; line-height: 18px; text-align: center; z-index: 3; }
.badge[hidden] { display: none; }
.tab { position: relative; }
.tabs .badge { top: -6px; right: -6px; }

/* 主選單 */
.menu .profile-card { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; min-height: 48px; min-width: 0; flex: 1 1 auto; }
.menu .topbar > div[style] { display: none; }
.menu .pc-txt .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 430px) { .menu .avatar { width: 42px; height: 42px; } }
.menu-logo-row { flex: none; justify-content: space-between; }
.test-mode[hidden] { display: none; }
.menu .profile-card .avatar svg { width: 30px; height: 30px; }
.pc-txt { min-width: 0; }
.pc-nm { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 17px; }
.title-tag { display: inline-block; margin: 0 4px 0 0; padding: 0 6px; border: 2px solid var(--ink); border-radius: 6px; background: var(--sun); color: var(--ink); font-size: 11px; font-weight: 900; }
.test-mode { background: #ffd2cf; }
.menu-logo { font-size: clamp(26px, 8vw, 40px); margin: 2px 6px 8px; flex: none; }
.ob-hint { display: flex; align-items: center; gap: 8px; padding: 8px 12px; margin: 0 2px 10px; border: var(--bw) solid var(--ink); border-radius: 14px; background: var(--sun); font-weight: 900; box-shadow: var(--shadow); animation: bob 1.4s ease-in-out infinite; flex: none; }
.ob-hint[hidden] { display: none; }
.ob-hint .ico { width: 24px; height: 24px; flex: none; }
.tile.ob-glow { outline: 5px solid var(--sun); outline-offset: 2px; animation: glow 1s ease-in-out infinite; }
@keyframes glow { 50% { outline-color: var(--red); } }
.tile.locked.offline::after { content: '需連線'; }
.tile .badge { top: 6px; right: 6px; }
.legal-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; padding: 6px 4px 14px; font-size: 12px; font-weight: 800; }
.legal-foot a { color: var(--ink-2); min-height: 32px; display: inline-flex; align-items: center; }

/* 標題 */
.title-art { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity .4s; }
.title-art.on { opacity: 1; }
.title-status { margin-top: 14px; font-size: 13px; }
.title-status.bad { background: #ffd2cf; }

/* 新手／離線 */
.center-col { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px 0; }
.onboard-card, .offline-panel { width: min(520px, 100%); margin: auto; display: grid; gap: 8px; }
.onboard-card .h-title { font-size: clamp(22px, 6vw, 30px); }
.ob-badge { width: 64px; height: 64px; border: var(--bw) solid var(--ink); border-radius: 50%; background: var(--sun); display: grid; place-items: center; margin: 0 auto; }
.ob-badge svg { width: 40px; height: 40px; }

/* 零件實例卡 */
.part-card .pc-ico { position: relative; }
.pc-lv { position: absolute; right: -8px; bottom: -8px; padding: 0 4px; border: 2px solid var(--ink); border-radius: 6px; background: var(--red); color: #fff; font-size: 11px; font-style: italic; font-family: var(--font-num); }
.dur-bar { height: 6px; margin-top: 4px; border: 2px solid var(--ink); border-radius: 99px; background: #eef0f4; overflow: hidden; }
.dur-bar i { display: block; height: 100%; background: var(--green); }
.dur-bar.dur-low i { background: var(--orange); } .dur-bar.dur-zero i, .dur-bar.dur-damaged i { background: var(--bad); }
.tag { padding: 0 5px; border: 2px solid var(--ink); border-radius: 6px; font-size: 11px; font-weight: 900; background: #fff; }
.tag-low { background: #ffe0b0; } .tag-zero, .tag-damaged { background: var(--bad); color: #fff; } .tag-listed { background: #d6eeff; } .tag-bound { background: #eceef2; }
.part-card.is-damaged { background: repeating-linear-gradient(-45deg, #fff 0 12px, #ffe9e7 12px 24px); }
.part-card.is-listed { opacity: .75; }
.slot-btn.warn::before { content: '!'; position: absolute; top: -6px; right: -4px; width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; background: var(--orange); color: #fff; font-size: 11px; font-weight: 900; line-height: 14px; text-align: center; }
.slot-btn.warn-damaged::before, .slot-btn.warn-zero::before { background: var(--bad); }
.vp-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 6px; }
.repair-btn[hidden] { display: none; }
.repair-btn .ico { width: 20px; height: 20px; }
.repair-btn.urgent { background: var(--sun); animation: glow2 1s ease-in-out infinite; }
@keyframes glow2 { 50% { background: #ffb3ad; } }
.car-row { min-height: 40px; }

/* 獎勵 */
.rw-list { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0; }
.rw-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; font-size: 12px; font-weight: 800; }
.rw-chip .ico { width: 20px; height: 20px; }
.rw-chip.rar { box-shadow: inset 0 -4px 0 var(--rc); padding-left: 3px; }
.rw-chip.big { font-size: 15px; padding: 4px 12px 4px 5px; } .rw-chip.big .ico { width: 26px; height: 26px; }
.rw-chip.gold { background: #fff3c4; } .rw-chip.dia { background: #dff5ff; }
.rw-pop { text-align: center; }
.rw-pop .rw-list { justify-content: center; }
.rw-burst { width: 72px; height: 72px; margin: 0 auto 8px; animation: pop .4s cubic-bezier(.2,1.6,.4,1), spin 6s linear infinite .4s; }
.rw-burst .ico { width: 72px; height: 72px; }

/* 結算（線上） */
.reward-panel { background: #fffbea; }
.reward-panel.rejected { background: #ffe9e7; }
.stars-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 6px; }
.star-cell { flex: 1; max-width: 120px; text-align: center; opacity: .35; filter: grayscale(1); }
.star-cell .ico { width: 44px; height: 44px; margin: 0 auto; }
.star-cell.on { opacity: 1; filter: none; animation: pop .4s cubic-bezier(.2,1.6,.4,1) both; }
.star-cell:nth-child(2).on { animation-delay: .15s; } .star-cell:nth-child(3).on { animation-delay: .3s; }
.star-cell small { display: block; font-size: 11px; font-weight: 800; }
.first-clear, .new-title { display: flex; align-items: center; gap: 6px; padding: 6px 10px; margin: 6px 0; border: 2px solid var(--ink); border-radius: 12px; background: var(--sun); font-weight: 900; }
.first-clear .ico, .new-title .ico { width: 26px; height: 26px; }
.rating-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 900; font-size: 16px; margin-top: 6px; }
.result-actions { padding-top: 8px; flex: none; justify-content: center; }

/* 生涯關卡 */
.career .tabs .tab { font-size: 14px; }
.ch-head { margin: 2px 2px 8px; font-size: 13px; }
.env-chip.env-indoor { background: #d6eeff; } .env-chip.env-desert { background: #ffd89a; } .env-chip.env-rain { background: #9fd8ff; } .env-chip.env-hill { background: #c3f0c8; } .env-chip.env-boss { background: #ffb3ad; }
.stage-map { overflow-x: auto; padding: 6px 4px 14px; }
.map-road { position: relative; display: flex; gap: 14px; align-items: center; min-width: max-content; padding: 10px 8px; }
.map-road::before { content: ''; position: absolute; left: 30px; right: 30px; top: 50%; height: 10px; margin-top: -5px; background: repeating-linear-gradient(90deg, var(--ink) 0 14px, #fff 14px 28px); border: 2px solid var(--ink); border-radius: 99px; }
.map-node { position: relative; z-index: 1; width: 64px; height: 64px; flex: none; border: var(--bw) solid var(--ink); border-radius: 50%; background: #fff; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; transform: translateY(calc(sin(var(--i) * 1.6rad) * 10px)); }
.map-node .mn-id { font-family: var(--font-num); font-weight: 900; font-style: italic; font-size: 15px; }
.map-node.boss { width: 76px; height: 76px; background: var(--red); color: #fff; }
.map-node.cleared { background: #c9f7d9; } .map-node.boss.cleared { background: #ff8a7f; }
.map-node.sel { outline: 5px solid var(--sun); outline-offset: 2px; }
.map-node.locked { background: #e4e6eb; color: var(--muted); box-shadow: 0 2px 0 var(--ink); }
.map-node.locked .ico { width: 22px; height: 22px; opacity: .6; }
.mn-stars { display: flex; gap: 1px; }
.mn-stars i { width: 11px; height: 11px; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); background: #c9ced8; }
.mn-stars i.on { background: var(--orange); }
.stage-card.boss { background: linear-gradient(160deg, #fff 60%, #ffe2df); }
.stage-name { font-size: clamp(20px, 5.5vw, 26px); }
.stage-cols { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 8px 0; }
@media (min-width: 720px) { .stage-cols { grid-template-columns: 1fr 1fr; } }
.track-mini { position: relative; height: 92px; border: var(--bw) solid var(--ink); border-radius: 12px; overflow: hidden; margin-bottom: 6px; }
.track-mini .tc-art { position: absolute; inset: 0; height: auto; border: 0; }
.track-mini .tc-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.track-mini .tc-env { position: absolute; top: 6px; left: 6px; }
.tc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.opp-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.opp-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; }
.opp-ava { flex: none; width: 36px; height: 36px; border: 2px solid var(--ink); border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; text-shadow: 1px 1px 0 var(--ink); }
.star-conds { display: grid; gap: 4px; margin: 4px 0; }
.star-cond { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; }
.star-cond .ico { width: 22px; height: 22px; opacity: .3; filter: grayscale(1); }
.star-cond.on .ico { opacity: 1; filter: none; }
.rw-box { padding: 8px 10px; border: 2px dashed var(--ink); border-radius: 12px; background: #fffbea; margin: 6px 0; }
.advice { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: #e7f2ff; margin: 6px 0; }
.advice > .ico { width: 28px; height: 28px; flex: none; }
.car-pick { margin: 6px 0; }
.stage-actions { margin-top: 8px; }

/* 工坊 */
.ws-sub { flex: none; align-items: flex-start; }
.ws-sub .tabs { flex: 1; min-width: 0; }
.cap-chip { margin-top: 10px; }
@media (max-width: 520px) { .cap-chip { display: none; } }
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.filter-bar .sel { flex: 1 1 120px; }
.ws-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.ws-foot { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; background: rgba(255,247,230,.95); border: var(--bw) solid var(--ink); border-radius: 14px; }
.part-detail { display: grid; gap: 6px; }
.tag-eq { background: var(--green); color: #fff; }
.enh-wrap { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .enh-wrap { grid-template-columns: 1.1fr 1fr; } .enh-table { grid-column: 1 / -1; } }
.enh-card { display: grid; gap: 8px; text-align: center; }
.enh-part .part-card { text-align: left; }
.enh-lv { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: var(--font-num); font-weight: 900; font-style: italic; }
.enh-lv .ico { width: 30px; height: 30px; }
.lv-from { font-size: 30px; color: var(--muted); } .lv-to { font-size: 44px; color: var(--red); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.enh-rate { display: flex; align-items: baseline; justify-content: center; gap: 8px; flex-wrap: wrap; }
.enh-rate b { font-family: var(--font-num); font-size: 40px; font-style: italic; }
.chip.bonus { background: #c9f7d9; }
.enh-rate-bar { height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: #ffd2cf; overflow: hidden; }
.enh-rate-bar i { display: block; height: 100%; background: var(--green); }
.enh-fail { margin: 0; font-weight: 900; padding: 6px; border-radius: 10px; border: 2px solid var(--ink); }
.enh-fail.fail-none { background: #e7f2ff; } .enh-fail.fail-down { background: #ffe0b0; } .enh-fail.fail-damage { background: #ffd2cf; }
.enh-cost { display: grid; gap: 6px; }
.cost-row { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.cost-row .ico { width: 24px; height: 24px; }
.cost-row.short b { color: var(--bad); }
.protect-toggle.disabled { opacity: .6; }
.enh-cost .btn.big { width: 100%; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; font-weight: 800; }
.mini-table th, .mini-table td { padding: 5px 6px; border-bottom: 2px solid #e4e6eb; text-align: center; white-space: nowrap; }
.mini-table tr.cur td { background: #fff3c4; }
.enh-back { background: rgba(22,24,31,.7); }
.enh-anim { width: min(360px, 100%); padding: 22px 18px; border: var(--bw) solid var(--ink); border-radius: 22px; background: var(--paper); box-shadow: 0 8px 0 var(--ink); text-align: center; display: grid; gap: 8px; justify-items: center; }
.enh-spin { width: 96px; height: 96px; animation: spin 0.5s linear infinite, shake .12s infinite; }
.enh-spin .ico { width: 96px; height: 96px; }
@keyframes shake { 50% { translate: 2px -1px; } }
.enh-name { font-weight: 900; font-size: 18px; }
.enh-msg { font-weight: 900; font-size: 22px; font-style: italic; }
.enh-anim.done .enh-spin { animation: pop .4s cubic-bezier(.2,1.6,.4,1); }
.enh-anim.good { background: #fff3c4; } .enh-anim.good .enh-msg { color: var(--good); font-size: 30px; }
.enh-anim.bad { background: #ffe2df; } .enh-anim.bad .enh-msg { color: var(--bad); }
.enh-anim.meh .enh-msg { color: var(--ink-2); }
.fix-card { display: grid; gap: 6px; margin: 6px 0 10px; }
.box-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.box-card { display: flex; gap: 10px; align-items: flex-start; }
.box-card .row { margin-top: 6px; }
.box-art { flex: none; width: 64px; height: 64px; border: var(--bw) solid var(--ink); border-radius: 14px; background: var(--rc, #ffe3c2); display: grid; place-items: center; }
.box-art .ico, .box-art svg { width: 46px; height: 46px; }
.box-box_fine .box-art { background: #c9f7d9; } .box-box_rare .box-art { background: #d6eeff; } .box-box_boss .box-art { background: #ffd2cf; }
.odds-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.box-back { background: rgba(22,24,31,.75); }
.box-pop { width: min(560px, 100%); max-height: 100%; overflow-y: auto; padding: 18px; border: var(--bw) solid var(--ink); border-radius: 22px; background: var(--paper); box-shadow: 0 8px 0 var(--ink); }
.box-stage { display: grid; gap: 10px; justify-items: center; text-align: center; }
.box-shake { width: 120px; height: 120px; animation: boxshake .3s infinite; }
.box-shake .ico, .box-shake svg { width: 120px; height: 120px; }
@keyframes boxshake { 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
.box-stage.revealed.best-SSR, .box-stage.revealed.best-UR { background: radial-gradient(circle, #fff3c4 0%, transparent 70%); }
.reveal-grid { display: grid; gap: 8px; width: 100%; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.reveal-card { display: grid; gap: 3px; justify-items: center; padding: 10px 6px; border: var(--bw) solid var(--ink); border-radius: 14px; background: #fff; box-shadow: inset 0 -8px 0 var(--rc); animation: flipin .45s cubic-bezier(.2,1.4,.4,1) both; font-size: 13px; }
.reveal-card.rar-UR, .reveal-card.rar-SSR { box-shadow: inset 0 -8px 0 var(--rc), 0 0 0 4px var(--rc); }
.rc-ico { width: 48px; height: 48px; border: 2px solid var(--ink); border-radius: 10px; background: var(--rc); display: grid; place-items: center; }
.rc-ico svg { width: 34px; height: 34px; }
@keyframes flipin { from { transform: rotateY(90deg) scale(.6); opacity: 0; } }
.shard-bar { margin: 6px 0 2px; }
.shard-bar > i { background: var(--r-UR, #ffb400); }
.item-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.item-cell { display: flex; gap: 10px; align-items: center; padding: 10px; }
.item-cell > .ico { width: 40px; height: 40px; flex: none; }
.item-n { font-family: var(--font-num); font-size: 20px; }

/* 排位／公平賽 */
.tier-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 4px; border: 2px solid var(--ink); border-radius: 99px; background: var(--tc); font-weight: 900; font-size: 13px; white-space: nowrap; }
.tier-badge .ico { width: 20px; height: 20px; }
.tier-badge.big { font-size: 20px; padding: 4px 14px 4px 6px; } .tier-badge.big .ico { width: 34px; height: 34px; }
.rank-card { display: grid; gap: 8px; margin-bottom: 10px; }
.rank-rating { font-family: var(--font-num); font-size: 44px; font-weight: 900; font-style: italic; line-height: 1; }
.rank-pos { text-align: center; } .rank-pos small { display: block; font-size: 11px; font-weight: 800; } .rank-pos b { font-family: var(--font-num); font-size: 24px; }
.tier-bar { height: 16px; }
.season-card { margin-bottom: 10px; }
.tier-ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; margin-top: 6px; }
.tier-step { display: grid; gap: 2px; justify-items: center; padding: 6px; border: 2px solid #e4e6eb; border-radius: 12px; }
.tier-step.cur { border-color: var(--ink); background: #fff3c4; }
.board-table { width: 100%; border-collapse: collapse; font-weight: 800; font-size: 14px; }
.board-table th { font-size: 12px; color: var(--ink-2); text-align: left; padding: 4px 6px; }
.board-table td { padding: 6px; border-top: 2px solid #e4e6eb; white-space: nowrap; }
.board-table td.num { font-family: var(--font-num); text-align: right; }
.board-table tr.me td { background: #fff3c4; }
.reward-list { display: grid; gap: 8px; margin: 8px 0; }
.reward-tier { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 10px; }
.prep { display: grid; gap: 6px; }
.prep-timer { font-family: var(--font-num); font-size: 30px; font-style: italic; color: var(--red); }
.fair-head { flex: none; margin-bottom: 6px; }
.fair-track { display: flex; gap: 10px; align-items: stretch; padding: 8px; }
.fair-track .track-mini { width: 38%; max-width: 220px; height: auto; min-height: 90px; flex: none; margin: 0; }
.fair-tname { font-size: 18px; }
.fair-cols { display: grid; gap: 10px; grid-template-columns: 1fr; margin-top: 8px; }
@media (min-width: 760px) { .fair-cols { grid-template-columns: 1.2fr 1fr; } }
.fair .slot-bar { margin-top: 4px; }
@media (max-height: 460px) { .fair-track .track-mini { display: none; } }

/* 信件 */
.mail-list { display: grid; gap: 8px; padding-bottom: 8px; }
.mail-row { display: flex; gap: 10px; align-items: center; width: 100%; min-height: 60px; padding: 8px 10px; border: var(--bw) solid var(--ink); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; text-align: left; }
.mail-row.read { background: #f4f5f7; }
.mail-row.unread .mail-title { font-weight: 900; }
.mail-row.unread .mail-ico::after { content: ''; position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); }
.mail-ico { position: relative; flex: none; width: 40px; height: 40px; }
.mail-ico .ico { width: 40px; height: 40px; }
.mail-main { min-width: 0; }
.mail-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.claim-chip { background: var(--sun); }

/* 任務／通行證 */
.quest-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; padding: 10px; }
.quest-row.done { background: #fffbea; } .quest-row.claimed { opacity: .6; }
.q-bar { height: 12px; margin: 4px 0 2px; } .q-bar > i { background: var(--green); }
.pass-head { margin-bottom: 8px; }
.pass-lv { width: 64px; height: 64px; border: var(--bw) solid var(--ink); border-radius: 50%; background: var(--purple); color: #fff; display: grid; place-items: center; text-align: center; line-height: 1; flex: none; }
.pass-lv small { font-size: 10px; } .pass-lv b { font-family: var(--font-num); font-size: 26px; }
.premium-chip { background: var(--sun); }
.pass-legend { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 6px; font-weight: 900; font-size: 13px; padding: 0 2px 4px; }
.pass-legend span:first-child { grid-column: 2; }
.pass-grid { display: grid; gap: 6px; padding-bottom: 8px; }
.pass-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; align-items: stretch; }
.pass-num { display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 10px; background: #e4e6eb; font-family: var(--font-num); font-weight: 900; font-size: 18px; }
.pass-row.reach .pass-num { background: var(--purple); color: #fff; }
.pass-cell { display: flex; flex-direction: column; gap: 4px; justify-content: space-between; padding: 6px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; min-width: 0; }
.pass-cell.premium { background: #f6efff; }
.pass-cell.can { outline: 3px solid var(--sun); }
.pass-cell.got { opacity: .55; }
.pass-cell .rw-chip { font-size: 11px; }
.pass-cell .btn { min-height: 40px; }

/* 稱號 */
.title-list { display: grid; gap: 8px; padding: 6px 0 8px; }
.title-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px; }
.title-row.locked { background: #f4f5f7; }
.title-row.eq { outline: 4px solid var(--sun); }
.title-name { display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 4px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; min-width: 130px; }
.title-name .ico { width: 26px; height: 26px; }
.title-row.locked .title-name { opacity: .5; }
.ts-gold, .ts-animated_gold { background: linear-gradient(90deg, #ffe680, #ffb400); }
.ts-glow { background: #d6eeff; box-shadow: 0 0 10px #1fa2ff; }
.ts-flame { background: linear-gradient(90deg, #ffb3ad, #ff8a00); }
.ts-rainbow { background: linear-gradient(90deg, #ffb3ad, #ffe680, #c9f7d9, #d6eeff, #e6d6ff); }
.ts-animated_gold { background-size: 200% 100%; animation: shine 2s linear infinite; }
@keyframes shine { to { background-position: 200% 0; } }
.effect { color: var(--blue-2); }
.titles .seg .btn { min-width: 56px; }

/* 外觀 */
.wd-layout { flex: 1; min-height: 0; display: grid; gap: 8px; grid-template-rows: minmax(140px, 34%) minmax(0, 1fr); }
@media (min-aspect-ratio: 6/5) { .wd-layout { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(300px, 1fr); } }
.wd-preview { position: relative; padding: 0; overflow: hidden; background: transparent; }
.wd-view { position: absolute; inset: 3px; border-radius: 14px; touch-action: none; }
.wd-cap { position: absolute; left: 8px; bottom: 8px; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 8px; background: rgba(255,255,255,.85); font-weight: 800; }
.wd-side { display: flex; flex-direction: column; min-height: 0; }
.wd-grid { display: grid; gap: 8px; padding-bottom: 8px; }
.wd-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; box-shadow: 0 3px 0 var(--ink), inset 6px 0 0 var(--rc); }
.wd-item.locked { background: #f4f5f7; }
.wd-item.on { outline: 4px solid var(--sun); }
.wd-swatch { flex: none; width: 40px; height: 40px; border: 2px solid var(--ink); border-radius: 10px; }
.wardrobe { pointer-events: none; background: transparent; }
.wardrobe > * { pointer-events: auto; }
.wardrobe .wd-preview, .wardrobe .wd-view { pointer-events: auto; }

/* 個人檔案 */
.profile-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.avatar.big { width: 72px; height: 72px; } .avatar.big svg, .avatar svg { width: 70%; height: 70%; }
.pf-name { font-size: 20px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.uid { padding: 2px 6px; border: 2px solid var(--ink); border-radius: 6px; background: #fff; font-size: 12px; user-select: all; -webkit-user-select: all; word-break: break-all; }
.guest-chip { background: #ffe0b0; }
.profile .panel { margin-bottom: 10px; }
.acct-panel form { display: grid; gap: 2px; }

/* ── 比賽 HUD v3：只剩氮氣（C2a） ── */
.nitro-btn { position: absolute; right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); width: 118px; height: 118px; border-radius: 50%;
  border: var(--bw) solid var(--ink); background: radial-gradient(circle at 40% 35%, #8f6bff, #4b2fd1); color: #fff; box-shadow: 0 5px 0 var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.nitro-btn .ico { width: 34px; height: 34px; }
.nitro-btn .n-lab { font-weight: 900; font-style: italic; font-size: 17px; -webkit-text-stroke: 1px var(--ink); paint-order: stroke fill; }
.nitro-btn .n-cells { display: flex; gap: 3px; }
.n-cell { width: 20px; height: 9px; border: 2px solid var(--ink); border-radius: 3px; background: rgba(255,255,255,.35); overflow: hidden; display: block; }
.n-cell b { display: block; height: 100%; width: 0; background: #7fe1ff; }
.nitro-btn .n-adv { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); padding: 1px 8px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 900; white-space: nowrap; }
.nitro-btn .n-adv:empty { display: none; }
.nitro-btn .n-ring { position: absolute; inset: -9px; border-radius: 50%; border: 6px solid transparent; pointer-events: none; }
.nitro-btn.adv-none { filter: saturate(.35) brightness(.9); }
.nitro-btn.adv-good .n-ring { border-color: #2ecc71; animation: ring .7s ease-in-out infinite; }
.nitro-btn.adv-good .n-adv { background: #2ecc71; color: #fff; }
.nitro-btn.adv-ok .n-ring { border-color: var(--sun); }
.nitro-btn.adv-ok .n-adv { background: var(--sun); }
.nitro-btn.adv-risky .n-ring { border-color: var(--red); }
.nitro-btn.adv-risky .n-adv { background: var(--red); color: #fff; }
.nitro-btn.adv-firing { background: radial-gradient(circle at 40% 35%, #b6f2ff, #19c3ff); }
.nitro-btn.adv-firing .n-adv { background: #19c3ff; color: #fff; }
.nitro-btn.on { transform: translateY(4px) scale(.97); box-shadow: 0 1px 0 var(--ink); }
@keyframes ring { 50% { transform: scale(1.08); opacity: .6; } }
.boost-hint { position: absolute; left: 50%; bottom: calc(10px + var(--safe-b)); transform: translateX(-50%); font-size: 12px; font-weight: 800; background: rgba(255,255,255,.85); border: 2px solid var(--ink); border-radius: 10px; padding: 3px 10px; white-space: nowrap; }
body.touch .boost-hint .bh-key { display: none; } body.no-touch .boost-hint .bh-touch { display: none; }
.corner-warn.good { background: #c9f7d9; }
.drv-state { font-size: 12px; font-weight: 900; padding: 2px 8px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; opacity: 0; transition: opacity .2s; }
.drv-state.on { opacity: 1; }
.drv-state.bad { background: var(--red); color: #fff; } .drv-state.cool { background: #d6eeff; } .drv-state.meh { background: #fff3c4; }
.drv-bubble { position: absolute; left: calc(10px + var(--safe-l)); top: calc(118px + var(--safe-t)); display: flex; align-items: center; gap: 6px; max-width: min(62vw, 320px);
  opacity: 0; transform: translateX(-20px) scale(.9); transition: opacity .15s, transform .2s cubic-bezier(.2,1.4,.4,1); }
.drv-bubble.show { opacity: 1; transform: none; }
.drv-ava { flex: none; width: 42px; height: 42px; border: var(--bw) solid var(--ink); border-radius: 50%; background: var(--blue); display: grid; place-items: center; }
.drv-ava .ico { width: 30px; height: 30px; }
.drv-txt { position: relative; padding: 6px 12px; border: var(--bw) solid var(--ink); border-radius: 14px; background: #fff; font-weight: 900; font-size: 15px; box-shadow: 0 3px 0 var(--ink); }
.drv-txt::before { content: ''; position: absolute; left: -10px; top: 50%; margin-top: -7px; border: 7px solid transparent; border-right: 9px solid var(--ink); border-left: 0; }
.drv-bubble.good .drv-txt { background: #c9f7d9; } .drv-bubble.bad .drv-txt { background: #ffd2cf; } .drv-bubble.cool .drv-txt { background: #d6eeff; } .drv-bubble.meh .drv-txt { background: #fff3c4; }
@media (max-width: 400px) { .nitro-btn { width: 100px; height: 100px; } .drv-txt { font-size: 13px; } }
@media (orientation: landscape) and (max-height: 500px) {
  .nitro-btn { width: 96px; height: 96px; }
  .drv-bubble { top: calc(70px + var(--safe-t)); }
  .boost-hint { display: none; }
}
/* 結算：駕駛師表現 */
.dv-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 6px 0; }
.dv-item { text-align: center; padding: 4px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; }
.dv-item b { display: block; font-family: var(--font-num); font-size: 22px; line-height: 1.1; }
.dv-item small { font-size: 11px; font-weight: 800; }
.dv-item.good { background: #e3fbe9; } .dv-item.bad { background: #ffe9e7; } .dv-item.cool { background: #e7f2ff; } .dv-item.meh { background: #fff8dc; }
.dv-item.zero { opacity: .45; }
.boost-sum { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 4px 0; }
.chip.adv-good { background: #c9f7d9; } .chip.adv-ok { background: #fff3c4; } .chip.adv-risky { background: #ffd2cf; }
.dv-growth { margin-top: 6px; padding: 6px 8px; border: 2px dashed var(--ink); border-radius: 10px; background: #fffbea; display: grid; gap: 4px; }
.ob-result { animation: none; margin-top: 4px; }

/* 駕駛師畫面 */
.tile.green { background: var(--green); color: #fff; } .tile.green .t-desc { color: #eafff0; }
.drv-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; flex: none; }
.drv-ava.big { width: 64px; height: 64px; } .drv-ava.big .ico { width: 44px; height: 44px; }
.drv-lv { font-family: var(--font-num); font-style: italic; font-size: 28px; }
.exp-bar { height: 14px; margin: 4px 0 2px; } .exp-bar > i { background: linear-gradient(90deg, var(--sun), var(--orange)); }
.attr-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 2px dashed #e5d6b8; }
.attr-name { width: 52px; flex: none; text-align: center; }
.attr-name b { display: block; font-size: 17px; } .attr-name small { font-size: 10px; font-weight: 900; color: var(--muted); }
.attr-bar { height: 14px; margin-bottom: 3px; }
.attr-bar > i { background: var(--blue); } .attr-bar > i.add { background: var(--green); border-radius: 0; }
.attr-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.attr-ctl .btn { min-width: 44px; padding: 4px; font-size: 20px; }
.attr-val { width: 34px; text-align: center; font-family: var(--font-num); font-size: 20px; }
.attr-val.up { color: var(--good); }
.prof-row { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.prof-row > b { width: 3em; flex: none; }
.prof-bar { height: 14px; } .prof-bar > i { background: var(--purple); }
.fam-name { width: 8.5em; flex: none; font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.driver-scr .panel { margin-bottom: 10px; }
.trait-slot.locked { background: #f4f5f7; }
.trait-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); margin-top: 6px; }
.trait-card { display: grid; gap: 3px; text-align: left; padding: 10px; min-height: 64px; border: var(--bw) solid var(--ink); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.trait-card small { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.trait-card.on { background: #c9f7d9; outline: 3px solid var(--green); }
.trait-card[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.style-table { display: grid; gap: 6px; margin-top: 8px; }
.style-row { display: grid; grid-template-columns: 3.5em 3.5em 1fr; gap: 6px; align-items: center; }
.drv-prep { display: grid; gap: 6px; padding: 8px 10px; margin: 6px 0; border: 2px solid var(--ink); border-radius: 12px; background: #f1f8ff; }
.drv-prep .drv-ava { width: 40px; height: 40px; font-size: 12px; color: #fff; font-family: var(--font-num); }

/* v0.3：主選單磚塊——圖示移到右上角，說明文字不再被蓋住 */
.menu-grid .tile .t-ico { right: 8px; top: 8px; bottom: auto; width: 40px; height: 40px; opacity: .95; }
.menu-grid .tile .t-name { padding-right: 44px; }
.menu-grid .tile .t-desc { padding-right: 0; }
.menu-grid .tile.hero .t-ico { right: 10px; bottom: 10px; top: auto; width: 68px; height: 68px; }
.menu-grid .tile.hero .t-name { padding-right: 0; }
.menu-grid .tile.hero .t-desc { padding-right: 78px; }
.menu-grid .tile .badge { top: 6px; right: 50px; }
@media (max-width: 520px) { .menu-grid .tile .badge { right: 42px; } }
.menu-grid .tile.locked .t-ico { width: 32px; height: 32px; opacity: .45; }
.menu-grid .tile.locked .t-name { padding-right: 44px; margin-top: 0; }
.menu-grid .tile.locked::after { top: auto; bottom: 8px; right: 8px; }
@media (max-width: 520px) {
  .menu-grid .tile .t-ico { width: 32px; height: 32px; opacity: .9; }
  .menu-grid .tile .t-name { padding-right: 34px; }
  .menu-grid .tile.hero .t-ico { width: 58px; height: 58px; opacity: .9; }
  .menu-grid .tile.hero .t-desc { padding-right: 64px; }
}
.eff-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; margin: 6px 0; flex: none; }

/* 貼紙工坊 */
.sticker-ed { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 2px dashed #e5d6b8; }
.st-stage { position: relative; border: var(--bw) solid var(--ink); border-radius: 12px; overflow: hidden; background: #fff; }
.st-canvas { display: block; width: 100%; height: auto; aspect-ratio: 2 / 1; touch-action: none; cursor: grab; }
.st-zone { position: absolute; left: 6px; font-size: 10px; font-weight: 900; padding: 0 5px; border-radius: 5px; background: rgba(22,24,31,.6); color: #fff; pointer-events: none; }
.st-zone.z-r { top: 6px; } .st-zone.z-t { top: 50%; transform: translateY(-50%); } .st-zone.z-l { bottom: 6px; }
.st-palette { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.st-pick { display: grid; justify-items: center; gap: 1px; min-height: 64px; padding: 4px 2px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; cursor: pointer; box-shadow: 0 2px 0 var(--ink); }
.st-pick canvas { width: 40px; height: 40px; }
.st-pick small { font-size: 10px; font-weight: 800; white-space: nowrap; }
.st-ctl { display: grid; gap: 2px; }
.st-ctl:empty { display: none; }
.st-ctl-head { margin-top: 4px; }
.swatch.sm { width: 40px; height: 40px; }
.st-layers { display: grid; gap: 5px; }
.st-layer { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border: 2px solid var(--ink); border-radius: 10px; background: #fff; cursor: pointer; }
.st-layer.on { background: #fff3c4; outline: 3px solid var(--sun); }
.st-layer .btn.sm { min-width: 44px; min-height: 44px; padding: 0; }
.st-layer .up-btn .ico, .st-layer .down-btn .ico { transform: rotate(-90deg); }
.st-dot { width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 50%; flex: none; }
.st-digit { width: 64px; min-height: 44px; }
.dv-advice { display: grid; gap: 5px; margin-top: 6px; }
.dv-tip { display: flex; gap: 6px; align-items: flex-start; }
.dv-tip .chip { flex: none; } .chip.tip-attr { background: #d6eeff; } .chip.tip-style { background: #fff3c4; } .chip.tip-tip { background: #e6d6ff; }
.dv-advice .btn { justify-self: start; }
.btn.green { background: var(--green); color: #fff; }
