:root {
  --bg: #05060b;
  --glass: rgba(12, 16, 26, 0.62);
  --line: rgba(160, 190, 230, 0.16);
  --text: #e9eef6;
  --dim: #8a94a6;
  --accent: #ff3b45;
  --cyan: #5fd6ff;
  --green: #50ffaa;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-user-select: none; user-select: none; touch-action: none; }
canvas { display: block; }
.hidden { display: none !important; }

.panel { position: absolute; background: var(--glass); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.row { display: flex; justify-content: space-between; gap: 18px; font-size: 12px; color: var(--dim); margin-top: 4px; }
.row b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.row.dim b { color: var(--dim); }

.hud-tl { top: 16px; left: 16px; padding: 12px 16px; min-width: 190px; }
.brand { font-weight: 800; letter-spacing: 0.32em; font-size: 12px; color: var(--dim); }
.brand span { color: var(--accent); margin-left: 4px; }
.timer { font-family: var(--mono); font-size: 28px; font-weight: 700; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }

.hud-tr { top: 16px; right: 16px; padding: 12px 16px; min-width: 170px; text-align: right; }
.speed b { font-family: var(--mono); font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.speed span { color: var(--dim); font-size: 12px; margin-left: 6px; }
.hud-tr .row { justify-content: flex-end; }
.state { margin-top: 8px; display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 99px; background: rgba(95, 214, 255, 0.14); color: var(--cyan); border: 1px solid rgba(95, 214, 255, 0.3); }
.state.inv { background: rgba(255, 59, 69, 0.15); color: #ff8088; border-color: rgba(255, 59, 69, 0.4); }
.state.air { background: rgba(255, 200, 80, 0.14); color: #ffd27a; border-color: rgba(255, 200, 80, 0.35); }
.state.warn { background: rgba(255, 59, 69, 0.3); color: #fff; border-color: var(--accent); animation: blink 0.5s infinite alternate; }
@keyframes blink { to { opacity: 0.5; } }

.hint { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); max-width: min(640px, 60vw); text-align: center; font-size: 14px; padding: 9px 18px; border-radius: 99px; background: rgba(8, 10, 18, 0.7); border: 1px solid var(--line); transition: opacity 0.3s; opacity: 0; pointer-events: none; }
.hint.show { opacity: 1; }

#popups { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.pop { font-weight: 800; font-size: 22px; letter-spacing: 0.04em; color: #fff; text-shadow: 0 0 18px rgba(95, 214, 255, 0.7); animation: pop 1.8s ease-out forwards; white-space: nowrap; }
.pop small { display: block; text-align: center; font-size: 13px; color: var(--cyan); font-weight: 600; }
.pop.gold { text-shadow: 0 0 18px rgba(255, 200, 80, 0.8); }
.pop.green { text-shadow: 0 0 18px rgba(80, 255, 170, 0.8); }
@keyframes pop { 0% { opacity: 0; transform: translateY(14px) scale(0.85); } 12% { opacity: 1; transform: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }

#flash { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
#flash.on { opacity: 0.85; transition: none; }

.devices { left: 50%; bottom: 16px; transform: translateX(-50%); display: grid; grid-template-columns: 210px 170px 120px; gap: 20px; padding: 12px 18px; }
.dev-head { font-size: 12px; color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dev-head i { font-style: normal; font-family: var(--mono); font-size: 10px; padding: 0 4px; height: 16px; line-height: 16px; text-align: center; border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--dim); }
.dev-head em { font-style: normal; color: var(--dim); font-size: 10px; margin-left: auto; }
.bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.07); margin: 8px 0 6px; overflow: hidden; }
.bar .set { position: absolute; inset: 0 auto 0 0; background: rgba(95, 214, 255, 0.22); width: 0; }
.bar .out { position: absolute; inset: 0 auto 0 0; background: var(--cyan); width: 0; box-shadow: 0 0 10px var(--cyan); transition: width 0.06s linear; }
.jet .out { background: #fff; box-shadow: 0 0 10px #9fe3ff; }
.bar .need { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; box-shadow: 0 0 6px #fff; display: none; }
.bar .need.show { display: block; }
.bar:has(.need) { overflow: visible; }
.dev-head em.ok { color: var(--green); }
.dev-head em.bad { color: #ff6b73; animation: blink 0.4s infinite alternate; }
.dev-head em.waste { color: #ffd27a; }
.row b.ok { color: var(--green); }
.row b.mid { color: #ffd27a; }
.row b.bad { color: #ff6b73; }
.jet .dev-ctl { justify-content: flex-end; }
.energy .out { background: var(--green); box-shadow: 0 0 10px var(--green); }
.energy.low .out { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dev-ctl { display: flex; align-items: center; gap: 8px; }
.dev-ctl .val { font-family: var(--mono); font-size: 12px; min-width: 38px; text-align: right; }
.energy .dev-ctl { justify-content: flex-end; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; width: 100%; height: 4px; background: rgba(255, 255, 255, 0.12); border-radius: 2px; outline: none; touch-action: auto; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--cyan); cursor: pointer; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--cyan); cursor: pointer; }

.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(5, 6, 11, 0.55), rgba(5, 6, 11, 0.92)); padding: 16px; overflow-y: auto; }
.card { width: min(560px, 100%); padding: 32px 36px; border-radius: 18px; background: rgba(12, 16, 26, 0.85); border: 1px solid var(--line); text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.card.small { width: min(320px, 100%); }
.eyebrow { font-size: 11px; letter-spacing: 0.35em; color: var(--dim); }
h1 { font-size: 46px; letter-spacing: 0.18em; margin: 10px 0 8px; font-weight: 800; }
h1 span, h2 span { color: var(--accent); margin-left: 6px; }
h2 { margin: 8px 0 14px; font-size: 26px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.22); border-bottom-width: 2px; background: rgba(255, 255, 255, 0.06); color: #fff; min-width: 22px; text-align: center; }
.cta, .ghost { font: inherit; font-weight: 700; font-size: 15px; padding: 12px 34px; border-radius: 99px; border: 0; cursor: pointer; margin: 4px; }
.cta { background: var(--accent); color: #fff; box-shadow: 0 8px 30px rgba(255, 59, 69, 0.35); }
.cta:hover { filter: brightness(1.1); }
.ghost { background: rgba(255, 255, 255, 0.07); color: var(--text); border: 1px solid var(--line); display: block; width: 100%; margin: 8px 0 0; }
.card.small .cta { width: 100%; margin: 0; }
.best-line { margin-top: 12px; font-size: 12px; color: var(--dim); font-family: var(--mono); }
.result-time { font-family: var(--mono); font-size: 44px; font-weight: 700; color: var(--green); margin-bottom: 14px; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; text-align: left; font-size: 13px; color: var(--dim); margin-bottom: 18px; }
.result-grid div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; }
.result-grid b { color: var(--text); font-family: var(--mono); }

/* 触屏 */
#touch { position: absolute; inset: auto 0 0 0; height: 0; }
.tc { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; gap: 10px; align-items: flex-end; }
.tc-left { left: 16px; }
.tc-right { right: 16px; }
.tc-col { display: flex; flex-direction: column; gap: 8px; }
.tc button { font: inherit; font-size: 22px; font-weight: 700; color: #fff; width: 76px; height: 76px; border-radius: 18px; background: rgba(20, 26, 40, 0.6); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: none; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tc button small { font-size: 10px; font-weight: 500; color: var(--dim); margin-top: 2px; }
.tc button.sm { width: 64px; height: 34px; font-size: 12px; border-radius: 10px; }
.tc button.big { width: 92px; height: 92px; background: rgba(95, 214, 255, 0.18); border-color: rgba(95, 214, 255, 0.45); }
.tc button.on { background: rgba(95, 214, 255, 0.4); }

body.touch .devices { bottom: auto; top: 12px; grid-template-columns: 150px 110px 80px; gap: 10px; padding: 8px 10px; }
body.touch .dev-head em { display: none; }
body.touch .hud-tl, body.touch .hud-tr { top: 96px; }
body.touch .hint { top: auto; bottom: 120px; }

@media (max-width: 980px) {
  .devices { grid-template-columns: 170px 130px 90px; gap: 12px; }
  .dev-head { font-size: 11px; }
  .dev-head em { display: none; }
  .hint { max-width: 80vw; font-size: 12px; }
}
@media (max-width: 720px) {
  .devices { grid-template-columns: 1.4fr 1fr 0.8fr; width: calc(100% - 24px); padding: 8px 10px; gap: 8px; }
  .dev-head { font-size: 10px; }
  .hud-tl, .hud-tr { padding: 8px 10px; min-width: 0; transform: scale(0.85); transform-origin: top left; }
  .hud-tr { transform-origin: top right; }
  .speed b { font-size: 30px; }
  .timer { font-size: 22px; }
  .card { padding: 22px 18px; }
  .tc button { width: 64px; height: 64px; }
  .tc button.big { width: 76px; height: 76px; }
}

/* 手机横屏：HUD 缩小，留出赛道视野 */
@media (max-height: 560px) {
  body.touch .devices { transform: translateX(-50%) scale(0.78); transform-origin: top center; top: 6px; }
  body.touch .hud-tl, body.touch .hud-tr { top: 78px; padding: 8px 12px; min-width: 0; }
  body.touch .hud-tl { transform: scale(0.68); transform-origin: top left; }
  body.touch .hud-tr { transform: scale(0.68); transform-origin: top right; }
  body.touch .row.dim { display: none; }
  body.touch .hint { bottom: 104px; font-size: 12px; padding: 6px 14px; }
  body.touch .tc button { width: 60px; height: 60px; }
  body.touch .tc button.big { width: 74px; height: 74px; }
  body.touch .tc button.sm { width: 56px; height: 28px; }
  body.touch .card { padding: 18px 20px; }
}

.ghost.inline { display: inline-block; width: auto; padding: 12px 26px; }
.card { width: min(620px, 100%); }

/* 玩家名 */
.net { font-size: 11px; white-space: nowrap; color: var(--dim); }
.net.on { color: var(--green); }
.net.off { color: #ffd27a; }
.err { min-height: 18px; font-size: 12px; color: #ff6b73; text-align: left; margin-bottom: 6px; }
.cta:disabled { opacity: 0.6; cursor: wait; }

/* 结算 */
.card.result { width: min(600px, 100%); padding: 26px 30px; }
.grade-row { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 6px 0 10px; }
.grade { font-family: var(--mono); font-size: 76px; font-weight: 900; line-height: 1; width: 104px; height: 104px; display: flex; align-items: center; justify-content: center; border-radius: 22px; border: 2px solid currentColor; text-shadow: 0 0 24px currentColor; animation: stamp 0.5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: scale(2.2) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.g-S { color: #ffd166; } .g-A { color: #50ffaa; } .g-B { color: #5fd6ff; } .g-C { color: #c3a6ff; } .g-D { color: #9aa3b2; } .g-F { color: #ff5a63; }
.grade-info { text-align: left; }
.grade-title { font-size: 18px; font-weight: 800; }
.result-score b { font-family: var(--mono); font-size: 40px; color: var(--text); }
.result-score span { color: var(--dim); margin-left: 6px; }
.parts { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 12px; }
.parts span { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: rgba(80, 255, 170, 0.1); color: #a8ffd6; border: 1px solid rgba(80, 255, 170, 0.25); }
.parts span.neg { background: rgba(255, 90, 99, 0.12); color: #ff9aa0; border-color: rgba(255, 90, 99, 0.35); }
.rank-line { font-size: 14px; margin-bottom: 12px; line-height: 1.6; }
.rank-line b { color: #ffd166; font-size: 17px; }
.rank-line .dim, .dim { color: var(--dim); font-size: 12px; }
.ai-box { position: relative; text-align: left; background: linear-gradient(135deg, rgba(95, 214, 255, 0.08), rgba(255, 59, 69, 0.06)); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 12px; margin-bottom: 12px; }
.ai-badge { position: absolute; top: -9px; left: 12px; font-size: 10px; letter-spacing: 0.1em; padding: 2px 8px; border-radius: 99px; background: #1b2236; border: 1px solid var(--line); color: var(--cyan); }
.ai-comment { margin: 2px 0 6px; font-size: 15px; line-height: 1.6; }
.ai-comment.loading { color: var(--dim); animation: blink 0.8s infinite alternate; }
.ai-tip { margin: 0; font-size: 12px; color: #ffd27a; line-height: 1.5; }
.card.result .result-grid { grid-template-columns: 1fr 1fr 1fr; margin-bottom: 12px; font-size: 12px; }
.top-list { text-align: left; margin-bottom: 14px; }
.top-head { font-size: 11px; letter-spacing: 0.2em; color: var(--dim); margin-bottom: 6px; }

/* 排行榜 */
.card.board { width: min(460px, 100%); }
.btabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.btab { font: inherit; font-size: 13px; color: var(--text); padding: 7px 16px; border-radius: 99px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); cursor: pointer; }
.btab.on { border-color: var(--accent); background: rgba(255, 59, 69, 0.15); }
.board-total { font-size: 12px; color: var(--dim); margin-bottom: 8px; }
.board-list { max-height: 50vh; overflow-y: auto; text-align: left; }
.brow { display: grid; grid-template-columns: 30px 1fr 30px 64px; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px dashed var(--line); font-size: 13px; }
.brow .no { font-family: var(--mono); color: var(--dim); }
.brow:nth-child(1) .no { color: #ffd166; } .brow:nth-child(2) .no { color: #d9dee6; } .brow:nth-child(3) .no { color: #e0a36a; }
.brow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .gr { font-family: var(--mono); font-weight: 900; text-align: center; }
.brow b { font-family: var(--mono); text-align: right; }
.brow.me { background: rgba(95, 214, 255, 0.1); border-radius: 8px; }
.empty { color: var(--dim); font-size: 13px; padding: 18px 0; text-align: center; line-height: 1.7; }
@media (max-width: 720px) {
  .grade { font-size: 56px; width: 80px; height: 80px; }
  .card.result .result-grid { grid-template-columns: 1fr 1fr; }
}
body.touch .card.result { padding: 16px 18px; }
body.touch .grade { font-size: 48px; width: 70px; height: 70px; }

/* 弹层内容比屏幕高时可以完整滚动（居中的 flex 容器溢出时顶部会被裁掉，改用 margin:auto 居中） */
.overlay { align-items: flex-start; }
.overlay > .card { margin: auto; }
@media (max-height: 560px) {
  .card.result .result-grid { display: none; }
  .grade-row { margin: 0 0 6px; }
  .ai-comment { font-size: 13px; }
}

h1, h2, .grade-title, .pop { text-wrap: balance; }
.lang button { font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--dim); background: transparent; border: 0; padding: 5px 11px; cursor: pointer; }
.lang button.on { background: rgba(255, 255, 255, 0.12); color: var(--text); }
kbd.wide { min-width: 52px; }
.sub-row { display: flex; justify-content: center; gap: 10px; min-height: 18px; margin: 2px 0 10px; font-size: 12px; }
.sub-row .err { min-height: 0; margin: 0; text-align: center; }
.sub-row .err:not(:empty) + * , .sub-row .err:not(:empty) { display: inline; }
.sub-row:has(.err:not(:empty)) .net { display: none; }
.actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.actions .cta, .actions .ghost { margin: 0; }
.actions .cta { min-width: 168px; }
.privacy-link { display: inline-block; margin-top: 8px; font-size: 11px; color: var(--dim); text-decoration: none; border-bottom: 1px dotted var(--dim); }
.privacy-link:hover { color: var(--text); }
.link-btn { font: inherit; font-size: 11px; color: var(--dim); background: none; border: 0; margin-top: 10px; cursor: pointer; text-decoration: underline dotted; }
.link-btn:hover { color: #ff9aa0; }
.row.hidden { display: none !important; }
.row b.ok { color: var(--green); } .row b.mid { color: #ffd27a; } .row b.bad { color: #ff6b73; }
.nw { white-space: nowrap; }
/* 设备面板标题过长时省略，不与相邻列重叠 */
.dev { min-width: 0; }
.dev-head { overflow: hidden; }
.dev-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* 触屏：提示条放到顶部两块 HUD 之间，不压住底部按钮 */
body.touch .hint { top: 74px; bottom: auto; max-width: 50vw; font-size: 12px; padding: 6px 14px; }
@media (max-height: 560px) { body.touch .hint { top: 64px; bottom: auto; } }

/* ════════════ 开始页（GRAVOFF 着陆页）════════════
 * 不再是一个大对话框：标题在上方，关卡 / 昵称 / 开始按钮在下方，中间让游戏场景透出来 */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:where(button, a, input, [tabindex]):focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

#menu.landing {
  --pad-top: max(22px, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(4, 5, 10, 0.86) 0%, rgba(4, 5, 10, 0.4) 24%, rgba(4, 5, 10, 0) 40%, rgba(4, 5, 10, 0) 50%, rgba(4, 5, 10, 0.72) 70%, rgba(4, 5, 10, 0.94) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: var(--pad-top) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  gap: 18px;
}
#menu .lang { position: absolute; top: var(--pad-top); right: max(16px, env(safe-area-inset-right)); display: flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; background: rgba(10, 12, 20, 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 1; }
#menu .lang button { min-height: 34px; padding: 0 14px; font-size: 12px; }

.hero { text-align: center; margin-top: clamp(8px, 5vh, 64px); }
.hero-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.42em; color: var(--dim); text-transform: uppercase; }
.logo {
  margin: 10px 0 8px; font-weight: 900; line-height: 0.92; color: #f4f6f9;
  font-family: "Avenir Next Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(54px, min(12vw, 15vh), 140px); letter-spacing: 0.04em;
  transform: skewX(-9deg); text-wrap: nowrap;
}
.logo span { color: var(--accent); margin: 0; text-shadow: 0 0 28px rgba(255, 59, 69, 0.35); }
.slogan { margin: 0; font-size: clamp(13px, 1.5vw, 17px); letter-spacing: 0.08em; color: #d4d9e1; font-weight: 500; }

.launch { width: min(680px, 100%); display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: auto; }

.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#menu .mode {
  font: inherit; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; text-align: left; cursor: pointer;
  color: var(--dim); background: rgba(10, 12, 20, 0.62); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: border-color 0.15s, background 0.15s, color 0.15s;
}
#menu .mode:hover { border-color: rgba(255, 255, 255, 0.32); color: #c3cbd8; }
#menu .mode.on { color: var(--text); border-color: var(--accent); background: rgba(255, 59, 69, 0.11); box-shadow: inset 0 0 0 1px var(--accent); }
.lvl-ico { flex: none; width: 46px; height: 31px; color: #6f7889; }
.lvl-ico .ico-car { fill: #8a94a6; }
#menu .mode.on .lvl-ico { color: #e9eef6; }
#menu .mode.on .lvl-ico .ico-car { fill: var(--accent); }
.lvl-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lvl-name { display: flex; align-items: baseline; gap: 8px; font-size: 15px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: inherit; }
.lvl-name i { font-style: normal; font-family: var(--mono); font-size: 11px; color: var(--accent); }
.lvl-desc { font-size: 12px; line-height: 1.4; color: var(--dim); }
#menu .mode.on .lvl-desc { color: #b9c1ce; }

.pilot { display: flex; gap: 10px; margin: 4px 0 0; }
.pilot input {
  flex: 1; min-width: 0; height: 52px; padding: 0 16px; font: inherit; font-size: 16px; color: var(--text);
  background: rgba(10, 12, 20, 0.72); border: 1px solid var(--line); border-radius: 12px; outline: none;
  user-select: text; -webkit-user-select: text; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.pilot input::placeholder { color: #7d8698; }
.pilot input:focus { border-color: rgba(255, 255, 255, 0.45); }
.pilot .cta {
  margin: 0; height: 52px; padding: 0 30px; border-radius: 12px; white-space: nowrap;
  font-size: 16px; font-weight: 900; letter-spacing: 0.14em;
  box-shadow: 0 10px 28px rgba(255, 59, 69, 0.32); transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
}
.pilot .cta:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 12px 32px rgba(255, 59, 69, 0.42); }
.pilot .cta:active { transform: translateY(1px) scale(0.98); filter: brightness(0.95); }
#menu .sub-row { margin: 0; min-height: 16px; }

.secondary { display: flex; justify-content: center; gap: 10px; }
.ghost-btn {
  font: inherit; min-height: 40px; padding: 0 18px; border-radius: 99px; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text); background: rgba(10, 12, 20, 0.5); border: 1px solid var(--line);
  transition: border-color 0.15s, background 0.15s;
}
.ghost-btn:hover { border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.06); }
.ghost-btn b { display: inline-flex; width: 18px; height: 18px; margin-left: 6px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid currentColor; font-size: 10px; }
#menu .best-line { margin: 0; text-align: center; min-height: 14px; }
.foot { font-size: 11px; }
.foot a { color: #6f7889; text-decoration: none; }
.foot a:hover { color: var(--text); text-decoration: underline; }

/* 操作说明弹窗 */
#howto { z-index: 5; }
.card.how { width: min(460px, 100%); text-align: left; padding: 26px 28px 22px; }
.card.how h2 { margin: 0 0 16px; text-align: center; }
.keys-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin: 0 0 14px; font-size: 14px; color: #c3cbd8; }
.keys-list dt { display: flex; gap: 4px; margin: 0; }
.keys-list dd { margin: 0; line-height: 1.45; text-wrap: pretty; }
.keys-mini { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--dim); padding-top: 12px; border-top: 1px solid var(--line); }
.how-note { font-size: 12px; color: var(--dim); margin: 12px 0 16px; line-height: 1.6; }
.card.how .cta { display: block; width: 100%; margin: 0; }

/* 笔记本小屏（1366×768 等） */
@media (max-height: 820px) {
  .hero { margin-top: clamp(4px, 2vh, 24px); }
  #menu.landing { gap: 12px; }
}
/* 手机竖屏 */
@media (max-width: 560px) {
  #menu .lang { top: 12px; right: 12px; }
  .hero { margin-top: 44px; }
  .hero-eyebrow { font-size: 10px; letter-spacing: 0.3em; }
  .logo { font-size: clamp(48px, 17vw, 76px); }
  .levels { grid-template-columns: 1fr; gap: 8px; }
  #menu .mode { min-height: 58px; padding: 8px 12px; }
  .pilot { flex-direction: column; }
  .pilot .cta { width: 100%; }
  .secondary .ghost-btn { flex: 1; padding: 0 10px; }
}
@media (max-width: 380px), (max-height: 700px) and (max-width: 560px) {
  .hero { margin-top: 36px; }
  .logo { margin: 6px 0 4px; }
  #menu .mode { min-height: 52px; }
  .lvl-ico { width: 38px; height: 26px; }
  .pilot input, .pilot .cta { height: 48px; }
}
/* 手机横屏：标题压缩，关卡保持两列 */
@media (max-height: 500px) and (min-width: 561px) {
  .hero { margin-top: 0; }
  .hero-eyebrow { display: none; }
  .logo { font-size: clamp(40px, 13vh, 64px); margin: 0 0 4px; }
  #menu.landing { gap: 8px; }
  #menu .mode { min-height: 50px; padding: 6px 12px; }
  .lvl-desc { font-size: 11px; }
  .pilot input, .pilot .cta { height: 44px; }
  .secondary .ghost-btn { min-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media (max-width: 560px) { .pilot input { flex: none; width: 100%; } }
/* 最高评级 SS */
.g-SS { color: #ff4d5a; }
.grade.g-SS { font-size: 58px; letter-spacing: -0.04em; text-shadow: 0 0 18px rgba(255, 77, 90, 0.8), 0 0 40px rgba(255, 209, 102, 0.35); border-width: 3px; }
@media (max-width: 720px) { .grade.g-SS { font-size: 44px; } }
body.touch .grade.g-SS { font-size: 38px; }
.brand span { margin-left: 0; }

/* GDPR 同意弹窗：两个选项同等显眼（不诱导） */
#consent { z-index: 8; background: rgba(4, 5, 10, 0.78); }
.card.consent { width: min(520px, 100%); text-align: left; padding: 26px 28px 22px; }
.card.consent h2 { margin: 6px 0 12px; }
.card.consent p { color: #c3cbd8; font-size: 14px; line-height: 1.6; margin: 0 0 8px; text-wrap: pretty; }
.consent-list { margin: 0 0 10px; padding-left: 20px; color: #c3cbd8; font-size: 13px; line-height: 1.6; }
.consent-list li { margin-bottom: 4px; text-wrap: pretty; }
.card.consent .consent-note { font-size: 12px; color: var(--dim); }
.consent-note a { color: var(--cyan); }
.card.consent .consent-current { font-size: 12px; color: #ffd27a; min-height: 0; margin: 0 0 8px; }
.card.consent .consent-current:empty { display: none; }
.consent-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.choice { font: inherit; font-size: 14px; font-weight: 800; min-height: 48px; padding: 0 12px; border-radius: 12px; cursor: pointer; color: var(--text); background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.28); }
.choice:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.5); }
@media (max-width: 480px) { .consent-actions { grid-template-columns: 1fr; } .card.consent { padding: 22px 18px 18px; } }
.foot { display: flex; gap: 8px; align-items: center; color: #4a5162; }
.foot-btn { font: inherit; font-size: 11px; color: #6f7889; background: none; border: 0; padding: 4px 2px; cursor: pointer; }
.foot-btn:hover { color: var(--text); text-decoration: underline; }
.foot { flex-wrap: wrap; justify-content: center; text-align: center; max-width: 640px; }
.disclaimer-line { flex-basis: 100%; margin: 0 0 2px; font-size: 10.5px; line-height: 1.5; color: #5d6576; text-wrap: balance; }
@media (max-height: 500px) { .disclaimer-line { display: none; } }

/* ── 开始页 v2：卡片对比度 / 按钮质感 / 昵称框居中 ── */
/* 未选中：浅一点的玻璃面板 + 冷色图标，在暗背景上清楚可见 */
#menu .mode {
  background: linear-gradient(160deg, rgba(42, 48, 66, 0.82), rgba(20, 24, 36, 0.82));
  border: 1px solid rgba(255, 255, 255, 0.16); color: #e9eef6;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
#menu .mode .lvl-desc { color: #a9b3c4; }
#menu .mode .lvl-ico { color: #7fc8ff; }
#menu .mode .lvl-ico .ico-car { fill: #cfe9ff; }
#menu .mode:hover { transform: translateY(-2px); border-color: rgba(127, 200, 255, 0.55); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45); color: #fff; }
/* 选中：电光红实色渐变 + 白字，一眼看出选的是哪关 */
#menu .mode.on {
  background: linear-gradient(135deg, rgba(120, 44, 52, 0.88) 0%, rgba(62, 26, 34, 0.9) 100%);
  border-color: rgba(232, 112, 120, 0.85); color: #fff;
  box-shadow: 0 0 0 1px rgba(232, 112, 120, 0.35) inset, 0 8px 22px rgba(0, 0, 0, 0.4);
}
#menu .mode.on .lvl-desc { color: #e3c9cc; }
#menu .mode.on .lvl-name i { color: #f0a0a6; }
#menu .mode.on .lvl-ico { color: #f3d6d8; }
#menu .mode.on .lvl-ico .ico-car { fill: #f2b24c; }

/* 昵称框缩小，和开始按钮一起居中 */
.pilot { justify-content: center; align-items: stretch; }
.pilot input { flex: 0 1 260px; width: 260px; text-align: center; }

/* 开始按钮：渐变 + 高光 + 扫光，按下有回弹 */
.pilot .cta {
  position: relative; overflow: hidden; padding: 0 34px 0 30px;
  background: linear-gradient(180deg, #f6c35c 0%, #eda33c 55%, #d9862a 100%);
  border: 1px solid #f8d488; color: #241503;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 -2px 0 rgba(0, 0, 0, 0.15) inset, 0 10px 26px rgba(237, 163, 60, 0.3);
  text-shadow: 0 1px 0 rgba(255, 240, 210, 0.45);
}
.pilot .cta::after {   /* 右侧小三角，像"点火" */
  content: ''; display: inline-block; margin-left: 12px; vertical-align: middle;
  border-left: 9px solid #241503; border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.pilot .cta::before {   /* 扫光 */
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg); transition: left 0.5s ease;
}
.pilot .cta:hover::before { left: 120%; }
.pilot .cta:hover { filter: brightness(1.05); transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45) inset, 0 14px 30px rgba(237, 163, 60, 0.4); }
.pilot .cta:active { transform: translateY(1px) scale(0.97); }
.pilot .cta:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.pilot .cta:disabled { opacity: 0.7; }

/* 次要按钮：更清楚的描边 */
.ghost-btn { border-color: rgba(255, 255, 255, 0.28); background: rgba(20, 24, 36, 0.66); }
.ghost-btn:hover { border-color: rgba(127, 200, 255, 0.6); color: #fff; }

@media (max-width: 560px) {
  .pilot input { flex: none; width: min(320px, 100%); align-self: center; }
  .pilot .cta { width: min(320px, 100%); align-self: center; }
}
@media (prefers-reduced-motion: reduce) { .pilot .cta::before { display: none; } }
.brow .nm .tag { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--dim); margin-left: 2px; }
