:root {
  --bg: #0d1418;
  --panel: #141d22;
  --panel-strong: #1b262c;
  --ink: #eef2f0;
  --muted: #8fa0a8;
  --line: #26343b;
  --flight: #4d9bff;
  --rail: #2fb98f;
  --ship: #a78bfa;
  --road: #e08a3c;
  --accent: #e05b4a;
  --shadow: 0 24px 50px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

/* hidden 属性必须生效：否则覆盖层会一直挡住地图 */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(224, 91, 74, 0.18), transparent 34%),
    linear-gradient(45deg, rgba(47, 185, 143, 0.12), transparent 52%),
    var(--bg);
}

.auth-card {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(20, 29, 34, 0.96);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.auth-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg);
}

.auth-tab {
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.auth-tab.active {
  background: #2a3a43;
  color: var(--ink);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-field input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel-strong);
  color: var(--ink);
}

.auth-field input:focus {
  border-color: #4a6b78;
  outline: 0;
}

.auth-message {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-message.error {
  color: #ff8a7c;
}

.auth-message.success {
  color: #7fd8b8;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

/* ---------- 顶栏：品牌 + 快速登记 ---------- */

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(360px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  width: 202px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}

.view-tab {
  min-width: 0;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.view-tab.active {
  background: #2a3a43;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.quick-add {
  display: grid;
  grid-template-columns: 1fr 92px 140px 84px;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.input-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.quick-add input,
.quick-add select {
  min-width: 0;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 12px;
  background: var(--panel-strong);
  color: var(--ink);
}

.quick-add input:focus,
.quick-add select:focus {
  border-color: #4a6b78;
  outline: 0;
  background: #223038;
}

.primary-button {
  height: 38px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover {
  background: #e86a58;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding-left: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  background: var(--bg);
}

.user-chip span {
  color: var(--ink);
  font-weight: 700;
}

.user-name {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 160px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}

.user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover {
  border-color: #4a6b78;
  color: var(--ink);
}

.ghost-button.small {
  padding: 5px 10px;
  font-size: 12px;
}

.danger-button.small {
  padding: 5px 10px;
  font-size: 12px;
}

.danger-button {
  border: 1px solid rgba(224, 91, 74, 0.45);
  border-radius: 7px;
  padding: 8px 14px;
  background: transparent;
  color: #ff8a7c;
}

.danger-button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* ---------- 主区：Hero 大卡片 + 底部行程条 ---------- */

.main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  padding: 10px 12px;
}

.app-view {
  flex: 1;
  min-height: 0;
}

.home-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-card {
  position: relative;
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-canvas {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(115deg, rgba(94, 139, 114, 0.18), transparent 34%),
    linear-gradient(30deg, rgba(77, 155, 255, 0.14), transparent 42%),
    #18222a;
}

.leaflet-map {
  position: absolute;
  inset: 0;
  min-height: 0;
  z-index: 0;
  font: inherit;
}

.map-fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 24px;
  background: rgba(13, 20, 24, 0.92);
  text-align: center;
  color: var(--muted);
}

.map-fallback strong {
  color: var(--ink);
}

.leaflet-overlay-pane .route-flight {
  filter: drop-shadow(0 2px 7px rgba(77, 155, 255, 0.65));
  stroke-linecap: round;
}

.leaflet-overlay-pane .route-flight.selected {
  filter: drop-shadow(0 3px 10px rgba(77, 155, 255, 0.85));
}

.flight-path-marker {
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: rgba(47, 128, 237, 0.9);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(13, 20, 24, 0.32);
}

/* Hero 覆盖层：底部渐变承载行程信息 */

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px 26px;
  background: linear-gradient(
    180deg,
    rgba(13, 20, 24, 0) 38%,
    rgba(13, 20, 24, 0.55) 68%,
    rgba(13, 20, 24, 0.92) 100%
  );
}

.hero-overlay > * {
  pointer-events: auto;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: auto;
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(13, 20, 24, 0.72);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(6px);
}

.mode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.mode-badge.flight .mode-dot {
  background: var(--flight);
}

.mode-badge.rail .mode-dot {
  background: var(--rail);
}

.mode-badge.ship .mode-dot {
  background: var(--ship);
}

.mode-badge.road .mode-dot {
  background: var(--road);
}

.mode-dot.flight {
  background: var(--flight);
}

.mode-dot.rail {
  background: var(--rail);
}

.mode-dot.ship {
  background: var(--ship);
}

.mode-dot.road {
  background: var(--road);
}

.hero-actions {
  display: flex;
  gap: 8px;
}

.hero-actions .ghost-button,
.hero-actions .danger-button {
  background: rgba(13, 20, 24, 0.6);
  backdrop-filter: blur(6px);
}

.hero-route {
  margin: 0;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.hero-route .arrow {
  margin: 0 12px;
  color: var(--muted);
  font-weight: 400;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.hero-meta strong {
  color: var(--ink);
}

.hero-meta .mode-line {
  color: var(--muted);
}

/* 编辑表单（Hero 内） */

.edit-form {
  display: grid;
  gap: 8px;
  width: min(560px, 100%);
  margin-left: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 20, 24, 0.9);
  backdrop-filter: blur(10px);
}

.edit-form h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.edit-field {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.edit-field input,
.edit-field select,
.edit-field textarea {
  min-width: 0;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  color: var(--ink);
  font: inherit;
}

.edit-field textarea {
  resize: vertical;
}

.edit-field input:focus,
.edit-field select:focus,
.edit-field textarea:focus {
  border-color: #4a6b78;
  outline: 0;
}

.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.edit-actions .primary-button {
  height: 34px;
  padding: 0 18px;
}

/* 查询面板（Hero 内） */

.ticket-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  width: min(620px, 100%);
  max-height: 100%;
  margin-left: auto;
  padding: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(13, 20, 24, 0.9);
  backdrop-filter: blur(10px);
}

.ticket-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.flight-registration-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.flight-registration-grid .edit-field {
  grid-template-columns: 56px 1fr;
}

.ticket-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.ticket-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.ticket-loading {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ticket-error {
  margin: 0;
  color: #ff8a7c;
  font-size: 13px;
}

/* 经停站选择（Hero 内） */

.station-panel {
  width: min(560px, 100%);
}

.station-date {
  display: flex;
  align-items: center;
  gap: 12px;
}

.station-date .edit-field {
  grid-template-columns: 44px 160px;
}

.station-date #dateHint {
  margin: 0;
}

.station-list {
  display: grid;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}

.station-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.station-preview {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.station-route {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* 车站联想下拉（区间输入/编辑表单共用） */

.suggest-field {
  position: relative;
}

.suggest-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 70px;
  right: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.suggest-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  width: 100%;
  font-size: 13px;
}

.suggest-item:hover,
.suggest-item.active {
  background: #2a3a43;
}

.suggest-item .suggest-sub {
  color: var(--muted);
  font-size: 11px;
}

/* 成功提示 */

.ticket-success {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(47, 185, 143, 0.4);
  border-radius: 8px;
  background: rgba(47, 185, 143, 0.12);
  color: #7fd8b8;
  font-size: 13px;
}

/* ---------- 底部面板：筛选 + 统计 + 行程条 ---------- */

.bottom-panel {
  display: grid;
  grid-template-rows: auto 86px;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.bottom-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  width: 260px;
  padding: 3px;
  border-radius: 9px;
  background: var(--panel-strong);
}

.segment {
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segment.active {
  background: #2a3a43;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.stats-line {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.stats-line strong {
  color: var(--ink);
  font-weight: 600;
}

.tile-source {
  color: var(--muted);
  font-size: 12px;
}

/* 横向行程条 */

.trip-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.trip-card {
  flex: 0 0 196px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--road);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-strong);
  color: var(--ink);
  text-align: left;
}

.trip-card.flight {
  border-left-color: var(--flight);
}

.trip-card.rail {
  border-left-color: var(--rail);
}

.trip-card.ship {
  border-left-color: var(--ship);
}

.trip-card.road {
  border-left-color: var(--road);
}

.trip-card.active {
  border-color: #5a7d8c;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

/* 选中态保留左侧模式色（active 的 border-color 会覆盖全边框） */
.trip-card.active.flight {
  border-left-color: var(--flight);
}

.trip-card.active.rail {
  border-left-color: var(--rail);
}

.trip-card.active.ship {
  border-left-color: var(--ship);
}

.trip-card.active.road {
  border-left-color: var(--road);
}

.trip-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}

.trip-title .mode-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.trip-meta {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
}

.trip-meta .route {
  color: #c9d4d8;
}

/* ---------- 数据看板 / 成就 ---------- */

.dashboard-view,
.achievements-view {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 4px;
  scrollbar-width: thin;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 10px;
  border-bottom: 1px solid var(--line);
}

.page-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.page-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.page-summary {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.insight-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.mode-breakdown {
  display: grid;
  gap: 10px;
}

.mode-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.mode-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.mode-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-strong);
}

.mode-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rail), var(--flight), var(--accent));
}

.mode-row strong {
  color: var(--ink);
  font-size: 12px;
  text-align: right;
}

.timeline-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 190px;
}

.timeline-item {
  display: grid;
  grid-template-rows: 1fr auto auto auto;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.timeline-track {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 112px;
  border-radius: 8px;
  background: var(--panel-strong);
}

.timeline-track i {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent), var(--rail));
}

.timeline-item strong {
  color: var(--ink);
  font-size: 13px;
}

.timeline-item small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-list {
  display: grid;
  gap: 8px;
}

.rank-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.rank-no {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #2a3a43;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.rank-no.flight {
  background: rgba(77, 155, 255, 0.2);
  color: #8fc1ff;
}

.rank-no.rail {
  background: rgba(47, 185, 143, 0.2);
  color: #7fd8b8;
}

.rank-no.ship {
  background: rgba(167, 139, 250, 0.2);
  color: #c8b6ff;
}

.rank-no.road {
  background: rgba(224, 138, 60, 0.2);
  color: #ffc08a;
}

.rank-item div {
  min-width: 0;
}

.rank-item strong,
.rank-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-item strong {
  color: var(--ink);
  font-size: 13px;
}

.rank-item small,
.rank-item > span:last-child {
  color: var(--muted);
  font-size: 11px;
}

.rank-item > span:last-child {
  text-align: right;
  white-space: nowrap;
}

.empty-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.achievement-progress {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-copy strong {
  font-size: 20px;
}

.progress-copy span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.progress-meter,
.mini-meter {
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-strong);
}

.progress-meter {
  height: 10px;
}

.mini-meter {
  height: 6px;
}

.progress-meter i,
.mini-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rail), var(--accent));
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.achievement-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.achievement-card.locked {
  opacity: 0.66;
}

.achievement-card.unlocked {
  border-color: rgba(47, 185, 143, 0.55);
}

.achievement-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #2a3a43;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.achievement-card.unlocked .achievement-mark {
  background: linear-gradient(135deg, var(--rail), var(--accent));
}

.achievement-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.achievement-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.achievement-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.achievement-title span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.achievement-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Leaflet 控件适配深色 ---------- */

.leaflet-control-zoom a {
  background: var(--panel-strong) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

.leaflet-control-attribution {
  background: rgba(13, 20, 24, 0.7) !important;
  color: var(--muted) !important;
}

.leaflet-control-attribution a {
  color: #8fb6c8 !important;
}

.leaflet-tooltip {
  background: var(--panel-strong) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

@media (max-width: 1280px) {
  .hero-route {
    font-size: 38px;
  }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
  }

  .view-tabs {
    justify-self: start;
  }

  .top-actions {
    grid-column: 1 / -1;
    position: static;
    width: 100%;
    justify-content: flex-end;
    min-width: 0;
  }

  .quick-add {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) 92px 132px 78px;
  }

  .hero-route {
    font-size: 32px;
  }

  .flight-registration-grid,
  .station-pick {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .achievement-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-gate {
    padding: 12px;
  }

  .auth-card {
    padding: 18px;
    border-radius: 10px;
  }

  .topbar {
    gap: 8px;
    padding: 8px;
  }

  .brand {
    gap: 8px;
    font-size: 16px;
  }

  .view-tabs {
    justify-self: end;
    width: min(196px, 100%);
  }

  .view-tab {
    height: 28px;
    font-size: 11px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .top-actions {
    gap: 6px;
  }

  .user-chip {
    flex: 1;
    min-width: 0;
    padding-left: 8px;
  }

  .user-name {
    max-width: 100%;
  }

  .ghost-button.small,
  .danger-button.small {
    padding: 5px 8px;
  }

  .quick-add {
    grid-template-columns: 78px minmax(0, 1fr) 68px;
    gap: 6px;
    padding: 5px;
    border-radius: 9px;
  }

  .quick-add #tripInput {
    grid-column: 1 / -1;
  }

  .quick-add input,
  .quick-add select,
  .quick-add .primary-button {
    height: 34px;
    padding: 0 8px;
    font-size: 13px;
  }

  .quick-add .primary-button {
    padding: 0;
  }

  .main {
    gap: 8px;
    padding: 8px;
  }

  .home-view {
    gap: 8px;
  }

  .hero-card {
    min-height: 0;
    border-radius: 10px;
    box-shadow: none;
  }

  .hero-overlay {
    padding: 12px;
    background: linear-gradient(
      180deg,
      rgba(13, 20, 24, 0) 28%,
      rgba(13, 20, 24, 0.62) 58%,
      rgba(13, 20, 24, 0.94) 100%
    );
  }

  .hero-topline {
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
  }

  .hero-actions {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
  }

  .mode-badge {
    padding: 4px 8px;
    font-size: 11px;
  }

  .hero-route {
    font-size: 26px;
    line-height: 1.12;
  }

  .hero-route .arrow {
    margin: 0 6px;
  }

  .hero-meta {
    gap: 4px 10px;
    margin-top: 8px;
    font-size: 12px;
  }

  .edit-form,
  .ticket-panel {
    width: 100%;
    margin-left: 0;
    padding: 12px;
    border-radius: 10px;
  }

  .ticket-panel-head {
    align-items: center;
  }

  .ticket-title {
    font-size: 17px;
  }

  .station-date {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .edit-field,
  .station-date .edit-field,
  .flight-registration-grid .edit-field {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 8px;
  }

  .edit-actions {
    flex-wrap: wrap;
  }

  .edit-actions button {
    flex: 1 1 auto;
  }

  .suggest-list {
    left: 58px;
    max-height: 180px;
  }

  .bottom-panel {
    grid-template-rows: auto 72px;
    gap: 6px;
    padding: 8px;
    border-radius: 10px;
  }

  .bottom-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px;
    align-items: center;
  }

  .segmented {
    grid-column: 1 / -1;
    width: 100%;
  }

  .tile-source {
    display: none;
  }

  .stats-line {
    margin-left: 0;
    justify-self: end;
    font-size: 11px;
  }

  .trip-strip {
    gap: 6px;
    padding-bottom: 2px;
  }

  .trip-card {
    flex-basis: 160px;
    min-height: 0;
    padding: 8px 10px;
    border-radius: 8px;
    overflow: hidden;
  }

  .trip-title {
    margin-bottom: 4px;
    font-size: 13px;
  }

  .trip-meta {
    font-size: 10px;
  }

  .dashboard-view,
  .achievements-view {
    gap: 8px;
    padding: 0;
  }

  .page-head {
    align-items: start;
    padding-bottom: 8px;
  }

  .page-head h2 {
    font-size: 18px;
  }

  .page-summary {
    font-size: 16px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric-card,
  .insight-panel,
  .achievement-progress,
  .achievement-card {
    padding: 10px;
  }

  .metric-card strong {
    font-size: 20px;
  }

  .timeline-bars {
    min-height: 150px;
    gap: 5px;
  }

  .timeline-track {
    min-height: 84px;
  }

  .rank-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .rank-item > span:last-child {
    grid-column: 2;
    text-align: left;
  }

  .achievement-card {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 10px;
  }

  .achievement-mark {
    width: 40px;
    height: 40px;
  }

}

@media (max-width: 720px) and (max-height: 700px) {
  .quick-add input,
  .quick-add select,
  .quick-add .primary-button {
    height: 32px;
  }

  .main {
    gap: 6px;
    padding: 6px;
  }

  .hero-route {
    font-size: 24px;
  }

  .bottom-panel {
    grid-template-rows: auto 62px;
  }

  .trip-card {
    flex-basis: 150px;
    padding: 7px 9px;
  }
}
