/* 前台功能页（激活、迁移、找回、转换器等）共用版式，建立在 tokens.css 之上。
 * 版式：左侧深色“铭牌”（大标题、步骤、提示），右侧纸面表单；颜色一律取自 tokens.css 变量，日夜切换自动生效。
 */

:root,
:root[data-theme="light"] {
  --danger: #b4281f;
  --danger-soft: rgba(196, 48, 38, 0.1);
  --danger-line: rgba(196, 48, 38, 0.38);
}
:root[data-theme="dark"] {
  --danger: #ff8a80;
  --danger-soft: rgba(255, 110, 96, 0.12);
  --danger-line: rgba(255, 110, 96, 0.4);
}

body.has-stage { display: flex; flex-direction: column; min-height: 100vh; }
body.has-stage > .stage { flex: 1; }
body.has-stage .foot { padding: 22px 0 26px; }

/* ---------- 铭牌：左右两部分是同一块面板（同高、同外框），背后是淡淡的制图方格 ---------- */
.stage {
  display: grid; place-items: center; min-width: 0;
  padding: clamp(28px, 5vw, 72px) clamp(14px, 3.5vw, 48px);
  background-image:
    linear-gradient(color-mix(in srgb, var(--rule) 60%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--rule) 60%, transparent) 1px, transparent 1px);
  background-size: 56px 56px; background-position: center top;
}
.plate {
  width: min(1180px, 100%); display: grid; grid-template-columns: minmax(340px, 5fr) minmax(0, 6fr);
  border-radius: 16px; overflow: hidden; background: var(--paper-3);
  box-shadow: 0 0 0 1px var(--rule-2), var(--shadow);
}
.stage-side {
  position: relative; overflow: hidden; isolation: isolate;
  background: var(--night); color: var(--night-ink);
  padding: clamp(36px, 4.4vw, 64px) clamp(28px, 3.8vw, 56px);
  display: flex; flex-direction: column; gap: clamp(28px, 3.4vw, 44px);
}
.stage-side .idx { color: var(--night-mute); }
.stage-copy { display: grid; gap: 22px; align-content: start; }
.stage-title { font-size: clamp(40px, 4.6vw, 64px); line-height: 1.08; letter-spacing: -0.026em; font-weight: 700; }
html[lang^="en"] .stage-title, html[lang^="ru"] .stage-title { line-height: 1.04; letter-spacing: -0.03em; }
.stage-lead { color: #b6bbc4; font-size: 16.5px; line-height: 1.85; max-width: 36ch; }
.stage-side .btn { justify-self: start; }
.btn-l { height: 54px; padding: 0 26px; font-size: 16px; }
.stage-note { color: var(--night-mute); font-size: 13.5px; line-height: 1.9; max-width: 46ch; padding-left: 16px; border-left: 2px solid var(--signal); }
.stage-note strong { display: block; margin-bottom: 4px; font: 600 11.5px/1.4 var(--mono); letter-spacing: 0.08em; color: var(--night-ink); }
.stage-gauge { position: absolute; z-index: -1; right: -110px; bottom: -120px; width: 420px; aspect-ratio: 1; color: var(--night-ink); opacity: 0.16; pointer-events: none; }
.stage-gauge .g-arc { color: var(--signal); }

/* 大号步骤数字（沿用官网规格栏的 DIN 数字气质） */
.spec-steps { counter-reset: s; border-top: 1px solid var(--night-rule); }
.spec-steps li { counter-increment: s; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 18px 0; border-bottom: 1px solid var(--night-rule); font-size: 15.5px; line-height: 1.75; color: #d2d5db; }
.spec-steps li::before { content: counter(s, decimal-leading-zero); font: 700 34px/1 var(--din); color: var(--signal); letter-spacing: 0.01em; }
/* 提示清单（无编号） */
.notes { display: grid; gap: 12px; }
.notes li { position: relative; padding-left: 22px; font-size: 14.5px; line-height: 1.8; color: #b6bbc4; }
.notes li::before { content: ""; position: absolute; left: 0; top: 0.78em; width: 8px; height: 2px; background: var(--signal); }
.notes-h { font: 600 11.5px/1.4 var(--mono); letter-spacing: 0.08em; color: var(--night-ink); margin-bottom: 14px; }
.stage-info { display: grid; gap: clamp(22px, 2.6vw, 32px); }

/* ---------- 右侧表单区 ---------- */
.stage-form { display: grid; align-content: center; padding: clamp(32px, 4.4vw, 64px) clamp(24px, 4vw, 60px); min-width: 0; background: var(--paper-3); }
.stage-form-in { width: 100%; max-width: 560px; }
.form-kicker { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; font: 700 14px/1 var(--din); letter-spacing: 0.08em; color: var(--ink); }
.form-kicker::after { content: ""; flex: 1; height: 1px; background: var(--rule-2); }
.form-kicker span { color: var(--mute); font: 500 12px/1 var(--mono); letter-spacing: 0.06em; }

.stage-form label, .fld-l { display: block; margin: 26px 0 10px; font-size: 14.5px; font-weight: 650; line-height: 1.4; color: var(--ink); }
.stage-form form > label:first-child, .stage-form .hp-field + label { margin-top: 0; }
.stage-form input[type="text"], .stage-form input[type="search"], .stage-form input[type="number"], .stage-form textarea, .stage-form select {
  width: 100%; height: 58px; padding: 0 18px; background: var(--paper-3); border: 1.5px solid var(--ink); border-radius: 6px;
  font: 500 18px/1.3 var(--mono); letter-spacing: 0.02em; color: var(--ink); transition: box-shadow 0.15s, background 0.15s;
}
.stage-form textarea { height: auto; padding: 14px 18px; line-height: 1.6; }
.stage-form input::placeholder, .stage-form textarea::placeholder { color: var(--faint); font: 400 15.5px var(--sans); letter-spacing: 0; }
.stage-form input[type="text"]:focus, .stage-form textarea:focus, .stage-form select:focus { outline: none; background: var(--paper-3); box-shadow: 0 0 0 4px var(--signal-soft), 0 0 0 1.5px var(--signal) inset; }
.hint, .field-note { font-size: 13.5px; line-height: 1.75; color: var(--mute); margin-top: 8px; }
.hp-field { display: none !important; }
.captcha-row { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: 12px; align-items: stretch; }
.captcha-question { display: grid; place-items: center; min-height: 58px; background: var(--ink); color: var(--paper); border-radius: 6px; font: 700 20px/1 var(--din); letter-spacing: 0.06em; }
.btn-xl { height: 60px; padding: 0 24px; font-size: 17px; justify-content: space-between; width: 100%; margin-top: 34px; }
.stage-form .btn-xl:first-child { margin-top: 0; }
.btn-xl .icon { width: 1.15em; height: 1.15em; transition: transform 0.2s; }
.btn-xl:hover .icon { transform: translateX(4px); }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: 0.55; pointer-events: none; }
.link-quiet { display: inline-block; margin-top: 18px; font-size: 14px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 5px; }
.link-quiet:hover { color: var(--ink); text-decoration-color: var(--signal); }
.link-center { display: block; text-align: center; }

/* ---------- 提示、结果 ---------- */
.alert { display: block; padding: 14px 18px; border-radius: 6px; font-size: 14.5px; line-height: 1.75; border: 1.5px solid var(--rule-2); background: var(--paper-3); color: var(--ink-2); margin-bottom: 26px; }
.alert-err, .error-card, .flash-error { border-color: var(--danger-line); border-left: 4px solid var(--danger); background: var(--danger-soft); color: var(--danger); font-weight: 550; }
.done, .success-card { position: relative; padding: 34px 32px 30px; border-radius: 4px; background: var(--paper-3); border: 1.5px solid var(--ink); }
.done::before, .success-card::before { content: ""; position: absolute; top: -1.5px; left: -1.5px; right: -1.5px; height: 5px; background: var(--signal); }
.success-card h2, .success-card h3 { display: flex; align-items: center; gap: 14px; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; margin: 0 0 14px; }
.success-card h2::before, .success-card h3::before { content: ""; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--signal) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b0c0f' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4L18.5 8'/%3E%3C/svg%3E") center / 22px no-repeat; }
.success-card p, .success-box p { margin: 10px 0; font-size: 15.5px; line-height: 1.85; color: var(--ink-2); }
.success-card code { font: 600 15px/1.5 var(--mono); padding: 2px 8px; background: var(--paper-2); border-radius: 3px; word-break: break-all; }
.code-box, .success-box .code, .device-id {
  display: block; margin: 14px 0 6px; padding: 18px 20px; background: var(--ink); color: var(--paper); border-radius: 4px;
  font: 700 clamp(22px, 3vw, 30px)/1.3 var(--mono); letter-spacing: 0.06em; word-break: break-all; user-select: all; text-align: center;
}
.device-id { font-size: clamp(22px, 3vw, 30px); }

/* ---------- 步骤式向导（找回设备 ID） ---------- */
.step-panel { margin-top: 28px; }
.step-title { font-size: 20px; font-weight: 700; line-height: 1.35; margin-bottom: 8px; letter-spacing: -0.005em; }
.step-copy { font-size: 14.5px; line-height: 1.8; color: var(--mute); margin-bottom: 16px; }
.vin-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; margin-bottom: 22px; background: var(--paper-2); border-radius: 4px; font: 500 12px/1.4 var(--mono); letter-spacing: 0.04em; color: var(--mute); }
.vin-summary strong { color: var(--ink); font-size: 15px; letter-spacing: 0.04em; word-break: break-all; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.choice-card { display: grid; align-content: center; justify-items: start; gap: 6px; min-height: 104px; padding: 18px 20px; margin: 0; background: var(--paper-3); border: 1.5px solid var(--rule-2); border-radius: 6px; text-align: left; color: var(--ink); transition: border-color 0.15s, background 0.15s; cursor: pointer; }
.choice-card strong { font-size: 17px; line-height: 1.3; font-weight: 700; }
.choice-card span { font-size: 13.5px; line-height: 1.55; color: var(--mute); }
.choice-card:hover { border-color: var(--ink); }
.choice-card.active { border-color: var(--ink); background: var(--signal-soft); box-shadow: inset 4px 0 0 var(--signal); }
.field-block { margin-top: 10px; }
.form-actions { display: grid; gap: 12px; margin-top: 30px; }
.form-actions .btn, .form-actions button { margin-top: 0; }
.mini-button { display: inline-flex; width: auto; height: auto; padding: 0; margin: 0; font-size: 13.5px; font-weight: 650; color: var(--signal-ink); text-decoration: underline; text-underline-offset: 3px; }
.section-title { margin-top: 22px; font-size: 14px; font-weight: 650; }
.stage-form #vinNextBtn, .stage-form .button-link {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 60px; margin-top: 30px; border-radius: 6px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 17px; transition: opacity 0.15s;
}
.stage-form #vinNextBtn:hover, .stage-form .button-link:hover { opacity: 0.86; }
.stage-form .text-button { display: flex; align-items: center; justify-content: center; width: 100%; height: 52px; margin-top: 4px; border: 1.5px solid var(--ink); border-radius: 6px; font-size: 15.5px; font-weight: 600; color: var(--ink); }
.stage-form .text-button:hover { background: var(--ink); color: var(--paper); }

@media (max-width: 1000px) {
  .stage { padding: 12px 12px 34px; background-size: 40px 40px; }
  /* 手机/窄屏：标题 → 表单 → 步骤与提示，第一屏直接看到表单 */
  .plate { display: flex; flex-direction: column; border-radius: 12px; }
  .stage-side { display: contents; }
  .stage-gauge { display: none; }
  .stage-copy { order: 1; gap: 14px; padding: 26px 22px 24px; background: var(--night); color: var(--night-ink); }
  .stage-form { order: 2; padding: 26px 20px 32px; }
  .stage-info { order: 3; padding: 28px 22px 32px; background: var(--night); color: var(--night-ink); }
  .stage-title { font-size: clamp(32px, 9.4vw, 46px); }
  .stage-lead { max-width: none; font-size: 15px; line-height: 1.7; }
  .btn-l { height: 48px; padding: 0 22px; font-size: 15.5px; }
  .stage-copy .btn { width: 100%; justify-content: center; }
  .form-kicker { margin-bottom: 22px; }
}
@media (max-width: 600px) {
  .choice-row, .captcha-row { grid-template-columns: 1fr; }
  .top .pg-home-t { display: none; }
  .done, .success-card { padding: 26px 20px 22px; }
  .spec-steps li { grid-template-columns: 52px minmax(0, 1fr); }
  .spec-steps li::before { font-size: 28px; }
}

/* ---------- 语言选择器（与官网同款） ---------- */
.top .lang { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.lang-picker { position: relative; flex: none; }
.lang .icon { width: 15px; height: 15px; }
.lang-caret { width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); margin: -3px 1px 0 2px; }
.lang-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 180px; padding: 6px; background: var(--paper-3); border: 1px solid var(--rule-2); border-radius: 10px; box-shadow: 0 14px 40px -16px rgba(0, 0, 0, .45); }
.lang-menu button { width: 100%; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; border-radius: 6px; text-align: left; font-size: 14px; line-height: 1.3; }
.lang-menu button:hover, .lang-menu button:focus-visible { background: var(--paper-2); }
.lang-menu button[aria-checked="true"] { color: var(--signal-ink); background: var(--signal-soft); font-weight: 600; }
.lang-menu .icon { width: 15px; height: 15px; opacity: 0; }
.lang-menu button[aria-checked="true"] .icon { opacity: 1; }
