:root {
  --night: #101312;
  --forest: #101312;
  --forest-2: #252d2b;
  --accent: #2456f4;
  --signal: #b8e52e;
  --signal-ink: #101312;
  --surface: #e9ece9;
  --surface-2: #f4f5f0;
  --line: #a8afac;
  --ink: #101312;
  --muted: #59605e;
  --white: #ffffff;
  --danger: #bc3b35;
  --shadow: 0 20px 48px rgba(7, 29, 25, 0.14);
  --font: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --route: "Barlow Condensed", "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--surface); }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--surface); font-family: var(--font); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { width: 1.15em; height: 1.15em; stroke-width: 1.85; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(216, 255, 62, 0.78); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100dvh; background: var(--surface); }
.topbar { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 0 clamp(18px, 4vw, 58px); color: var(--white); background: var(--forest); border-bottom: 1px solid rgba(255,255,255,.16); }
.brand { display: inline-flex; align-items: center; gap: 12px; padding: 0; color: inherit; border: 0; background: transparent; cursor: pointer; font-size: 18px; font-weight: 800; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; color: var(--signal-ink); background: var(--signal); border-radius: 6px; }
.brand-mark svg { width: 20px; height: 20px; stroke-width: 2.5; }
.brand-sub { display: block; margin-top: 1px; color: rgba(255,255,255,.6); font: 600 11px/1 var(--route); letter-spacing: .1em; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav button { min-height: 42px; padding: 0 12px; color: rgba(255,255,255,.72); border: 0; background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; }
.topnav button.active { color: var(--white); background: rgba(255,255,255,.11); }
.topnav button:hover { color: var(--signal); }

.route-chip { display: inline-flex; align-items: center; gap: 8px; width: max-content; min-height: 30px; padding: 0 11px; color: var(--signal-ink); background: var(--signal); border-radius: 999px; font: 700 13px/1 var(--route); letter-spacing: .07em; }
.route-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--forest); }
.button-primary, .button-secondary, .button-icon { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 48px; border: 0; cursor: pointer; font-weight: 800; transition: transform .2s ease, background-color .2s ease, color .2s ease; }
.button-primary { padding: 0 18px; color: var(--white); background: var(--accent); border-radius: 6px; box-shadow: 0 12px 22px rgba(16,19,18,.18); }
.button-primary:hover { background: #173fd1; transform: translateY(-1px); }
.button-primary:active { transform: translateY(1px); }
.button-secondary { padding: 0 16px; color: var(--forest); background: transparent; border: 1px solid var(--line); border-radius: 6px; }
.button-secondary:hover { background: var(--surface-2); }
.button-icon { width: 42px; padding: 0; color: var(--forest); background: transparent; border: 1px solid var(--line); border-radius: 6px; }
.button-icon:hover { color: var(--signal-ink); background: var(--signal); border-color: var(--signal); }

/* Home */
.home-stage { display: grid; min-height: calc(100dvh - 76px); grid-template-columns: minmax(0, 1.05fr) minmax(370px, .95fr); }
.arrival-panel { position: relative; display: flex; min-height: 620px; overflow: hidden; flex-direction: column; justify-content: space-between; padding: clamp(28px, 5vw, 72px); color: var(--white); background: var(--forest); }
.arrival-panel::after { position: absolute; inset: 0; content: ""; pointer-events: none; background: linear-gradient(100deg, rgba(7,29,25,.22), transparent 62%); }
.arrival-copy, .arrival-route { position: relative; z-index: 1; }
.arrival-copy h1 { max-width: 640px; margin: 20px 0 15px; font-size: clamp(42px, 5.1vw, 78px); font-weight: 800; line-height: 1.08; letter-spacing: 0; }
.arrival-copy h1 strong { color: var(--signal); font-weight: 800; }
.arrival-copy p { max-width: 480px; margin: 0; color: rgba(255,255,255,.7); font-size: 16px; line-height: 1.8; }
.route-map { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; opacity: .85; }
.route-map path { fill: none; stroke: rgba(255,255,255,.2); stroke-width: 2; }
.route-map .route-active { stroke: var(--signal); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 14 16; animation: route-flow 3.4s linear infinite; }
.route-map circle { fill: var(--forest); stroke: rgba(255,255,255,.7); stroke-width: 4; }
.route-map .destination { fill: var(--signal); stroke: var(--signal); }
.arrival-route { display: grid; gap: 15px; max-width: 570px; }
.station-row { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 14px; min-height: 70px; padding: 0 16px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; backdrop-filter: blur(6px); }
.station-code { color: var(--signal); font: 700 26px/1 var(--route); letter-spacing: .04em; }
.station-row small, .station-row strong { display: block; }
.station-row small { color: rgba(255,255,255,.55); font-size: 11px; }
.station-row strong { margin-top: 2px; font-size: 15px; }
.station-status { color: var(--signal); font-size: 12px; font-weight: 800; }

.mission-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(30px, 5vw, 80px); background: var(--surface); }
.mission-panel h2 { max-width: 470px; margin: 19px 0 10px; font-size: clamp(30px, 3.4vw, 48px); line-height: 1.2; }
.mission-panel > p { max-width: 470px; margin: 0 0 30px; color: var(--muted); line-height: 1.8; }
.destination-board { display: grid; overflow: hidden; margin-top: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.board-line { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; min-height: 69px; gap: 14px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.board-line:last-child { border-bottom: 0; }
.board-line.active { color: var(--white); background: var(--accent); }
.board-line .line-number { color: var(--forest); font: 700 30px/1 var(--route); }
.board-line.active .line-number { color: var(--signal); }
.board-line h3, .board-line p { margin: 0; }
.board-line h3 { font-size: 15px; }
.board-line p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.board-line.active p { color: rgba(255,255,255,.58); }
.board-line .arrow { color: var(--forest); }
.board-line.active .arrow { color: var(--signal); }
.mission-actions { display: flex; align-items: center; gap: 12px; margin-top: 25px; }
.mission-actions .button-primary { min-width: 168px; }

/* Registration */
.register-layout { display: grid; min-height: calc(100dvh - 76px); grid-template-columns: minmax(260px, .36fr) minmax(0, .64fr); }
.register-rail { display: flex; flex-direction: column; padding: clamp(28px, 4.5vw, 64px); color: var(--night); background: var(--signal); }
.register-rail h1 { margin: 22px 0 12px; color: var(--night); font-size: clamp(36px, 4vw, 56px); line-height: 1.05; }
.register-rail > p { max-width: 320px; margin: 0; color: rgba(16,19,18,.68); line-height: 1.8; }
.step-track { display: grid; gap: 0; margin: auto 0 0; padding: 28px 0 0; list-style: none; }
.step-track li { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 12px; min-height: 100px; color: rgba(16,19,18,.46); }
.step-track li::before { position: absolute; top: 38px; bottom: 0; left: 18px; width: 1px; content: ""; background: rgba(16,19,18,.22); }
.step-track li:last-child::before { display: none; }
.step-track .step-node { display: grid; width: 38px; height: 38px; place-items: center; color: var(--white); background: rgba(16,19,18,.42); border-radius: 50%; font: 700 18px/1 var(--route); }
.step-track li.active { color: var(--night); }
.step-track li.active .step-node { color: var(--white); background: var(--accent); }
.step-track strong, .step-track small { display: block; }
.step-track strong { margin-top: 1px; font-size: 15px; }
.step-track small { margin-top: 3px; font-size: 12px; }
.rail-footnote { margin-top: 25px; color: rgba(16,19,18,.48); font: 600 12px/1.4 var(--route); letter-spacing: .08em; }
.register-workspace { padding: clamp(28px, 5vw, 72px); background: var(--surface); }
.form-frame { width: min(100%, 760px); margin: 0 auto; }
.form-topline { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.form-topline .back-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); border: 0; background: transparent; cursor: pointer; font-weight: 700; }
.form-topline .back-link:hover { color: var(--forest); }
.form-topline .current-station { color: var(--forest); font: 700 15px/1 var(--route); letter-spacing: .08em; }
.form-page { padding-top: clamp(34px, 5vw, 62px); }
.form-page h2 { max-width: 540px; margin: 0 0 9px; font-size: clamp(28px, 4vw, 45px); line-height: 1.15; }
.form-page > p { margin: 0 0 31px; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span, .choice-set legend { color: var(--ink); font-size: 13px; font-weight: 800; }
.field b, .choice-set b { color: var(--danger); }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 0 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 6px; background: var(--white); outline: none; transition: border-color .2s ease, box-shadow .2s ease; }
.field textarea { min-height: 104px; padding-top: 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36,86,244,.12); }
.field input::placeholder, .field textarea::placeholder { color: #8b9990; }
.choice-set { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.choice-set legend { padding: 0; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); min-height: 50px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.segmented label { display: grid; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: grid; place-items: center; color: var(--muted); border-radius: 4px; font-size: 13px; font-weight: 700; }
.segmented input:checked + span { color: var(--signal-ink); background: var(--signal); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-top: 36px; padding-top: 23px; border-top: 1px solid var(--line); }
.form-actions > p { max-width: 340px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; font-weight: 700; }
.success-panel { display: grid; place-items: center; min-height: min(590px, calc(100dvh - 180px)); text-align: center; }
.success-panel > div { max-width: 480px; }
.success-symbol { display: grid; width: 74px; height: 74px; margin: 0 auto 24px; place-items: center; color: var(--signal-ink); background: var(--signal); border-radius: 50%; box-shadow: 0 14px 30px rgba(18,61,55,.2); }
.success-symbol svg { width: 34px; height: 34px; stroke-width: 2.4; }
.success-panel h2 { margin: 0 0 9px; font-size: 38px; }
.success-panel p { margin: 0; color: var(--muted); line-height: 1.8; }
.reference-code { display: inline-block; margin: 24px 0 28px; padding: 11px 14px; color: var(--forest); border: 1px dashed var(--forest); background: var(--white); font: 700 22px/1 var(--route); letter-spacing: .08em; }

/* Admin */
.admin-layout { display: grid; min-height: calc(100dvh - 76px); grid-template-columns: 250px minmax(0, 1fr); }
.admin-side { display: flex; flex-direction: column; padding: 30px 16px; color: var(--white); background: var(--night); }
.admin-side h1 { margin: 0 12px 28px; color: var(--signal); font-size: 28px; }
.admin-side p { margin: 0 12px 7px; color: rgba(255,255,255,.48); font: 700 12px/1 var(--route); letter-spacing: .08em; }
.side-links { display: grid; gap: 5px; }
.side-links button { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; min-height: 48px; gap: 10px; padding: 0 12px; color: rgba(255,255,255,.58); border: 0; background: transparent; cursor: pointer; text-align: left; }
.side-links button.active, .side-links button:hover { color: var(--night); background: var(--signal); }
.side-links button strong { display: grid; min-width: 21px; height: 21px; place-items: center; color: inherit; border: 1px solid currentColor; border-radius: 50%; font: 700 13px/1 var(--route); }
.admin-side .side-bottom { margin-top: auto; }
.admin-side .side-bottom button { display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; color: rgba(255,255,255,.55); border: 0; background: transparent; cursor: pointer; }
.admin-workspace { min-width: 0; padding: clamp(26px, 4vw, 60px); background: var(--surface); }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.admin-head h2 { margin: 0; font-size: clamp(32px, 4vw, 52px); line-height: 1; }
.admin-head p { margin: 10px 0 0; color: var(--muted); }
.admin-head .date-stamp { color: var(--forest); font: 700 17px/1 var(--route); letter-spacing: .08em; }
.admin-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 37px 0 26px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.summary-cell { min-height: 108px; padding: 19px 22px; border-right: 1px solid var(--line); }
.summary-cell:last-child { border: 0; }
.summary-cell span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-cell strong { display: block; margin-top: 8px; color: var(--forest); font: 700 42px/1 var(--route); }
.summary-cell small { color: var(--muted); font-size: 12px; }
.filter-row { display: grid; grid-template-columns: minmax(220px, 1fr) 150px 150px auto; align-items: end; gap: 10px; margin-bottom: 15px; }
.filter-row label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.filter-row input { min-height: 45px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); }
.filter-row .search-control { position: relative; display: block; }
.filter-row .search-control svg { position: absolute; top: 13px; left: 12px; color: var(--muted); }
.filter-row .search-control input { width: 100%; padding-left: 39px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: var(--shadow); }
.records-table { width: 100%; min-width: 780px; border-collapse: collapse; }
.records-table th { padding: 14px 18px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 12px; text-align: left; }
.records-table td { padding: 17px 18px; border-bottom: 1px solid var(--line); font-size: 13px; }
.records-table tr:last-child td { border-bottom: 0; }
.records-table tbody tr { cursor: pointer; transition: background-color .2s ease; }
.records-table tbody tr:hover { background: #f6f9eb; }
.records-table strong, .records-table small { display: block; }
.records-table small { margin-top: 3px; color: var(--muted); }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: 12px; font-weight: 800; }
.status-label::before { width: 7px; height: 7px; content: ""; background: var(--signal); border-radius: 50%; }
.detail-sheet { width: min(560px, calc(100vw - 32px)); padding: 0; color: var(--ink); border: 0; border-radius: 8px; box-shadow: 0 32px 90px rgba(0,0,0,.34); }
.detail-sheet::backdrop { background: rgba(7,29,25,.56); backdrop-filter: blur(4px); }
.detail-top { display: flex; align-items: center; justify-content: space-between; padding: 22px; color: var(--white); background: var(--forest); }
.detail-top h3, .detail-top p { margin: 0; }
.detail-top p { margin-bottom: 5px; color: var(--signal); font: 700 13px/1 var(--route); letter-spacing: .07em; }
.detail-top .button-icon { color: var(--white); border-color: rgba(255,255,255,.3); }
.detail-content { padding: 24px; background: var(--surface); }
.detail-content dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.detail-content dl div { padding: 15px 0; border-bottom: 1px solid var(--line); }
.detail-content dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-content dd { margin: 5px 0 0; font-weight: 700; }

.mobile-dock { display: none; }
.reveal { animation: reveal .7s cubic-bezier(.2,.8,.2,1) both; }
.reveal-delay { animation: reveal .7s .12s cubic-bezier(.2,.8,.2,1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes route-flow { to { stroke-dashoffset: -90; } }

@media (max-width: 920px) {
  .home-stage, .register-layout, .admin-layout { grid-template-columns: 1fr; }
  .home-stage { min-height: auto; }
  .arrival-panel { min-height: 520px; }
  .register-rail { min-height: 330px; }
  .step-track { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 30px; }
  .step-track li { grid-template-columns: 1fr; min-height: 84px; gap: 7px; }
  .step-track li::before { top: 18px; right: 0; bottom: auto; left: 38px; width: auto; height: 1px; }
  .step-track .step-node { width: 36px; height: 36px; }
  .step-track small { display: none; }
  .admin-side { display: none; }
  .mobile-dock { position: sticky; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(2, 1fr); padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); color: var(--white); background: var(--night); }
  .mobile-dock button { display: grid; min-height: 46px; place-items: center; gap: 1px; color: rgba(255,255,255,.6); border: 0; background: transparent; cursor: pointer; font-size: 11px; }
  .mobile-dock button.active { color: var(--signal); }
  .mobile-dock button svg { width: 19px; height: 19px; }
}

@media (max-width: 620px) {
  .topbar { min-height: 66px; padding: 0 18px; }
  .brand { font-size: 16px; }
  .brand-sub, .topnav { display: none; }
  .arrival-panel { min-height: 520px; padding: 28px 22px; }
  .arrival-copy h1 { max-width: 350px; font-size: 43px; }
  .arrival-copy p { font-size: 14px; }
  .station-row { grid-template-columns: 42px 1fr; min-height: 64px; padding: 0 12px; }
  .station-status { display: none; }
  .mission-panel { padding: 38px 22px 42px; }
  .mission-panel h2 { font-size: 32px; }
  .board-line { grid-template-columns: 42px 1fr auto; min-height: 66px; padding: 0 13px; }
  .board-line .line-number { font-size: 25px; }
  .mission-actions { align-items: stretch; flex-direction: column; }
  .mission-actions .button-primary { width: 100%; }
  .register-rail { min-height: 312px; padding: 30px 22px; }
  .register-rail h1 { font-size: 39px; }
  .register-workspace { padding: 26px 18px 38px; }
  .form-topline .current-station { font-size: 13px; }
  .field-grid { grid-template-columns: 1fr; gap: 17px; }
  .field.wide { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button-primary { width: 100%; }
  .form-actions > p { max-width: none; }
  .admin-workspace { padding: 28px 18px 34px; }
  .admin-head { align-items: flex-start; flex-direction: column; }
  .admin-head .date-stamp { display: none; }
  .admin-summary { margin: 27px 0 20px; }
  .summary-cell { min-height: 92px; padding: 14px 12px; }
  .summary-cell strong { font-size: 32px; }
  .summary-cell small { display: none; }
  .filter-row { grid-template-columns: 1fr 1fr; }
  .filter-row .search-control { grid-column: 1 / -1; }
  .filter-row .button-primary { grid-column: 1 / -1; }
  .detail-content dl { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
