* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #8FD0F5; overscroll-behavior: none; touch-action: none; -webkit-user-select: none; user-select: none; }
body { font-family: "Noto Sans SC", system-ui, -apple-system, sans-serif; font-weight: 500; color: #15171C; }
#app { position: fixed; inset: 0; overflow: hidden; --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px); }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
.hidden { display: none !important; }
.card { background: #fff; border-radius: 18px; box-shadow: 0 6px 18px rgba(15,25,45,.18), 0 1px 2px rgba(15,25,45,.12); }

/* 右上角品牌角标 */
.badge { position: absolute; right: 0; top: 0; z-index: 5; background: #15171C; color: #fff; font-weight: 900; font-size: 13px; letter-spacing: .04em; padding: calc(10px + var(--st)) calc(16px + var(--sr)) 10px 20px; border-bottom-left-radius: 22px; pointer-events: none; }

/* ---------- 游戏中：常驻只有「下一站」「驾照/满意」「刹车 油门」 ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud .pedal, #hud .ib { pointer-events: auto; }
.top { position: absolute; left: calc(12px + var(--sl)); right: calc(12px + var(--sr)); top: calc(48px + var(--st)); display: flex; gap: 10px; align-items: flex-start; }
.next { flex: 1; max-width: 420px; padding: 9px 14px 11px; }
.next .lbl { font-size: 11px; font-weight: 700; color: #8A909C; }
.next .nm { display: flex; align-items: baseline; gap: 8px; }
.next .nm b { font-size: 24px; font-weight: 900; line-height: 1.2; white-space: nowrap; }
.next .nm span { font-size: 16px; font-weight: 900; color: #E0453A; white-space: nowrap; }
.next .sub { font-size: 12.5px; font-weight: 700; color: #3A404C; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next .sub .bell { color: #D13A2F; }
.side { display: flex; flex-direction: column; gap: 8px; margin-left: auto; }
.ib { width: 52px; height: 50px; border-radius: 16px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(15,25,45,.18); }
.ib.st b { font-size: 18px; font-weight: 900; line-height: 1.05; }
.ib.st small { font-size: 9.5px; font-weight: 700; color: #8A909C; }
.ib.st.warn b { color: #E0453A; }
#pauseBtn { flex-direction: row; gap: 5px; } #pauseBtn i { width: 5px; height: 16px; border-radius: 2px; background: #15171C; }

#toasts { position: absolute; left: 50%; top: calc(150px + var(--st)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: max-content; max-width: 92vw; }
.toast { font-weight: 900; font-size: 14px; padding: 7px 14px; border-radius: 14px; background: #fff; box-shadow: 0 4px 14px rgba(15,25,45,.2); animation: pop .25s cubic-bezier(.3,1.6,.6,1); transition: opacity .4s, transform .4s; white-space: nowrap; }
.toast.bad { background: #E0453A; color: #fff; }
.toast.good { background: #1FA36D; color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }

.hint { position: absolute; left: 50%; bottom: calc(200px + var(--sb)); transform: translateX(-50%); max-width: 86vw; text-align: center; font-weight: 900; font-size: 15px; color: #fff; background: rgba(21,23,28,.86); padding: 9px 16px; border-radius: 16px; display: none; animation: pop .25s cubic-bezier(.3,1.6,.6,1); }
.hint.show { display: block; }
.hint b { color: #FFD24A; }

.say { position: absolute; left: calc(12px + var(--sl)); top: 46%; max-width: min(78vw, 360px); display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 18px; padding: 10px 14px 11px 10px; box-shadow: 0 6px 18px rgba(15,25,45,.22); opacity: 0; transform: translateX(-20px); transition: opacity .2s, transform .25s; }
.say.show { opacity: 1; transform: none; }
.say .av { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #FFE3DF; color: #D13A2F; font-weight: 900; font-size: 17px; }
.say b { font-size: 11px; color: #E0453A; display: block; }
.say p { font-size: 15px; font-weight: 900; line-height: 1.35; }

.controls { position: absolute; left: calc(14px + var(--sl)); right: calc(14px + var(--sr)); bottom: calc(20px + var(--sb)); display: flex; align-items: flex-end; justify-content: space-between; }
#hud .wheel { pointer-events: auto; }
.wheel { position: relative; width: clamp(128px, 36vw, 156px); aspect-ratio: 1; touch-action: none; }
.wheel svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 6px 10px rgba(15,25,45,.35)); }
.wheel .hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46%; aspect-ratio: 1; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(15,25,45,.3); pointer-events: none; line-height: 1; }
.wheel .hub b { font-size: 22px; font-weight: 900; } .wheel .hub span { font-size: 9.5px; font-weight: 700; color: #8A909C; margin-top: 2px; }
.wheel .wl { position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); font-size: 10.5px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); white-space: nowrap; pointer-events: none; }
.pedcol { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.pedal { width: clamp(108px, 30vw, 150px); border-radius: 22px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: 0 8px 20px rgba(15,25,45,.28), inset 0 -7px 0 rgba(0,0,0,.18); touch-action: none; transition: transform .06s, box-shadow .06s; }
.pedal.gas { height: 92px; } .pedal.brake { height: 70px; }
.pedal b { font-size: 28px; font-weight: 900; letter-spacing: .14em; }
.pedal span { font-size: 11px; font-weight: 700; opacity: .9; }
.pedal.down { transform: translateY(4px) scale(.98); box-shadow: 0 3px 8px rgba(15,25,45,.25), inset 0 -3px 0 rgba(0,0,0,.18); }
.brake { background: linear-gradient(180deg, #EF5247, #D73A31); }
.gas { background: linear-gradient(180deg, #27B57B, #1A9963); }
.pedal.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(39,181,123,.35), 0 8px 20px rgba(15,25,45,.28); } }
.ib.st b.sm { font-size: 13px; }

/* 世界锚点：站牌提示、吐槽、拟声字 */
#world { position: absolute; inset: 0; overflow: hidden; }
.w { position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform; }
.w.marker { background: #1E9E6A; color: #fff; font-weight: 900; font-size: 14px; padding: 5px 12px; border-radius: 12px; box-shadow: 0 4px 10px rgba(15,25,45,.25); }
.w.marker::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 0; border-top-color: #1E9E6A; }
.w.wait { background: #fff; font-weight: 900; font-size: 12.5px; padding: 4px 10px; border-radius: 12px; box-shadow: 0 4px 10px rgba(15,25,45,.2); }
.w.say { background: #fff; font-weight: 900; font-size: 14px; padding: 7px 12px; border-radius: 14px; box-shadow: 0 4px 12px rgba(15,25,45,.25); }
.w.say::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-bottom: 0; border-top-color: #fff; }
.w.say.police { background: #1F4F9A; color: #fff; } .w.say.police::after { border-top-color: #1F4F9A; }
.w.sfx { font-weight: 900; color: #fff; -webkit-text-stroke: 1.5px #15171C; paint-order: stroke fill; text-shadow: 0 3px 0 #15171C; animation: sfx .35s cubic-bezier(.3,1.8,.6,1); }
.w.sfx.small { font-size: 24px; } .w.sfx.big { font-size: 42px; color: #FFD24A; }
@keyframes sfx { from { scale: .3; } }

/* ---------- 开始 / 结算 / 暂停 / 加载 ---------- */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; }
.loading { background: linear-gradient(180deg, #2C98EA, #CDEEFB); }
.ld-card { width: min(80vw, 320px); text-align: center; color: #fff; }
.ld-title { font-size: 30px; font-weight: 900; text-shadow: 0 3px 12px rgba(0,0,0,.2); }
.ld-card .bar { height: 10px; border-radius: 5px; background: rgba(255,255,255,.35); margin: 16px 0 10px; overflow: hidden; }
.ld-card .bar i { display: block; height: 100%; width: 0; background: #fff; border-radius: 5px; transition: width .2s; }
.ld-txt { font-weight: 700; font-size: 13px; }
#start { align-items: flex-end; padding-bottom: calc(28px + var(--sb)); }
.start-card { width: min(92vw, 420px); padding: 18px 20px 20px; }
.kicker { font-size: 13px; font-weight: 900; color: #E0453A; }
.start-card h1 { font-size: 30px; font-weight: 900; line-height: 1.2; }
.desc { font-size: 13.5px; color: #4A505C; margin-top: 4px; line-height: 1.55; }
.rules { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 16px; }
.rules div { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 700; }
.rules .r { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-style: normal; font-weight: 900; color: #fff; font-size: 14px; }
.r.g { background: #1FA36D; } .r.b { background: #E0453A; } .r.z { background: #2F8FDB; } .r.w { background: #3A3F4A; }
.big { width: 100%; height: 56px; border-radius: 18px; background: linear-gradient(180deg, #27B57B, #1A9963); color: #fff; font-size: 22px; font-weight: 900; letter-spacing: .3em; box-shadow: 0 6px 16px rgba(26,153,99,.35), inset 0 -5px 0 rgba(0,0,0,.15); }
.big:active { transform: translateY(2px); }
.big.alt { background: #F1F3F6; color: #15171C; box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); letter-spacing: .1em; }
#end, #pause { background: rgba(15,20,30,.45); }
.end-card { width: min(92vw, 420px); max-height: 92vh; overflow: auto; padding: 18px 20px 20px; text-align: center; }
.stars { display: flex; justify-content: center; gap: 10px; }
.stars i { width: 52px; aspect-ratio: 1; background: #E6E8EC; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 78%, 20% 100%, 30% 60%, 0 38%, 38% 35%); }
.stars i:nth-child(2) { transform: translateY(-8px) scale(1.12); }
.stars i.on { background: #FFC23A; animation: star .5s cubic-bezier(.3,1.8,.6,1) both; }
@keyframes star { from { scale: 0; rotate: -90deg; } }
.end-card h2, .pause-card h2 { font-size: 26px; font-weight: 900; margin-top: 6px; }
#end[data-fail="1"] h2 { color: #E0453A; }
.quote { font-weight: 900; font-size: 14px; color: #3A404C; margin-top: 2px; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 8px; }
.end-stats div { background: #F4F6F8; border-radius: 12px; padding: 7px 4px; }
.end-stats span { display: block; font-size: 11px; color: #8A909C; font-weight: 700; }
.end-stats b { font-size: 16px; font-weight: 900; }
.note { font-size: 11.5px; color: #8A909C; margin-bottom: 12px; }
.btns { display: flex; gap: 10px; }
.btns .big { font-size: 18px; letter-spacing: .1em; }
.pause-card { width: min(80vw, 320px); padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.toggles { display: flex; gap: 10px; }
.tg { flex: 1; height: 42px; border-radius: 14px; font-weight: 900; background: #E8F7EF; color: #1A9963; }
.tg[data-on="0"] { background: #F1F3F6; color: #8A909C; }
.tg[data-on="1"]::after { content: " 开"; } .tg[data-on="0"]::after { content: " 关"; }
.tg.wide { width: 100%; flex: none; }
.tg-note { font-size: 11px; color: #8A909C; margin-top: -4px; }

/* 横屏：卡片收窄，踏板分到两边 */
@media (orientation: landscape) {
  .top { top: calc(10px + var(--st)); right: calc(150px + var(--sr)); }
  .side { flex-direction: row; position: fixed; right: calc(12px + var(--sr)); top: calc(56px + var(--st)); }
  .pedal.gas { height: 80px; } .pedal.brake { height: 62px; }
  .wheel { width: clamp(120px, 30vh, 150px); }
  .say { top: 34%; }
  #toasts { top: calc(86px + var(--st)); }
  .hint { bottom: calc(126px + var(--sb)); }
  #start { align-items: center; justify-content: flex-start; padding-left: calc(24px + var(--sl)); }
  .start-card { width: min(46vw, 420px); }
}
/* 自动方向模式：方向盘只做显示 */
body.auto-steer .wheel { opacity: .55; pointer-events: none !important; }
body.auto-steer .wheel .wl { display: none; }
