/* 航校学习 APP · 共用结构（状态栏 / 标签栏 / 卡片 / 按钮） */

* { box-sizing: border-box; }

/* 手机上点按钮/链接，系统默认先闪一块蓝/灰高亮再跳页。换成各主题自己的淡主色，
   跟配色走；键盘 Tab 聚焦的轮廓保留（:focus-visible），不影响可访问性。 */
* { -webkit-tap-highlight-color: var(--primary-soft); }
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) { outline: none; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- 状态栏：顶部 54px，中间留给灵动岛 ---------- */
.statusbar {
  height: 54px;
  padding: 14px var(--page-x) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  position: relative;
  z-index: 5;
}
.statusbar .sb-right { display: flex; align-items: center; gap: 6px; color: var(--text); }
.statusbar .sb-icon { width: 17px; height: 11px; display: inline-block; }

/* ---------- 页面主体 ---------- */
.page {
  padding: 0 var(--page-x) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
  padding-top: max(48px, calc(8px + env(safe-area-inset-top, 0px)));
  max-width: 100%;
}

[hidden] { display: none !important; }

/* 大标题 */
.page-head { padding-top: var(--space-3); }
.eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}
.h1 {
  margin: var(--space-1) 0 0;
  font-family: var(--font-title);
  font-size: var(--fs-2xl);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.h1-sm {
  margin: var(--space-1) 0 0;
  font-family: var(--font-title);
  font-size: var(--fs-xl);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.h3 { margin: 0; font-size: var(--fs-base); font-weight: 700; }
.sub { color: var(--muted); font-size: var(--fs-sm); margin: 2px 0 0; }

/* 区块标题行 */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--space-5) 0 var(--space-3);
}
.section-head .more { font-size: var(--fs-sm); color: var(--primary); font-weight: 600; }

/* ---------- 卡片 ---------- */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.card-tight { padding: var(--space-3); }

/* 主卡：今日飞行 */
.flight-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
}
.flight-card::after {
  /* 斜切色块：航空条带 */
  content: "";
  position: absolute;
  top: -30px;
  right: -46px;
  width: 96px;
  height: 180px;
  background: var(--stripe);
  transform: skewX(-14deg);
  pointer-events: none;
}
.flight-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.reg {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
}
.badge-live { color: var(--primary-ink); background: var(--primary); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-line { color: var(--text-dim); border: 1px solid var(--line-strong); }

/* 航段 */
.route {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-2);
}
.route .code {
  font-family: var(--font-title);
  font-size: var(--fs-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.route .dash { flex: 1; height: 1px; background: var(--line-strong); position: relative; }
.route .dash::after {
  content: "";
  position: absolute;
  right: 0; top: -3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.meta-row { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); margin-top: var(--space-2); }
.meta { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.meta .k { font-size: var(--fs-xs); color: var(--muted); letter-spacing: 0.04em; }
.meta .v { font-size: var(--fs-base); font-weight: 700; font-variant-numeric: tabular-nums; }
.meta .v.big { font-size: var(--fs-xl); }

/* 进度条 */
.progress {
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
  margin-top: var(--space-3);
}
.progress > i {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}
.progress-row { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; }

/* ---------- 快捷入口 2×2 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-3);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-2);
  box-shadow: var(--shadow-sm);
}
.tile .ic { width: 22px; height: 22px; color: var(--primary); }
.tile .t { font-size: var(--fs-base); font-weight: 700; }
.tile .s { font-size: var(--fs-xs); color: var(--muted); }

/* ---------- 通告 / 列表行 ---------- */
.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex: 0 0 8px;
}
.row .dot.warn { background: var(--warn); }
.row .body { flex: 1; min-width: 0; }
.row .title { display: block; font-size: var(--fs-base); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .desc { display: block; font-size: var(--fs-xs); color: var(--muted); }
.row .time { font-size: var(--fs-xs); color: var(--muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 20px;
  border-radius: var(--radius);
  border: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-ink);
  width: 100%;
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-sm { height: 44px; font-size: var(--fs-sm); width: auto; padding: 0 16px; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding: 8px var(--page-x) calc(34px + env(safe-area-inset-bottom, 0px));
  background: var(--bar-bg);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: start;
  z-index: 10;
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  padding-top: 4px;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--primary); }

/* 中间「今日」：凸起的圆形按钮
   用 transform 上移、负 margin 抵消多占的高度，保证 5 个标签的文字在同一水平线；
   圆底要留在文字上方（padding 9 → 直径 40，上移 15 后圆底比文字顶高 1px） */
.tab-mid svg {
  width: 22px; height: 22px;
  padding: 9px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-ink);
  box-shadow: var(--shadow-mid);
  box-sizing: content-box;
  transform: translateY(-17px);
  margin-bottom: -18px;
}
.tab-mid.on { color: var(--primary); }
.tab-mid.on svg { background: var(--primary); color: var(--primary-ink); }
.tab .dot {
  position: absolute;
  top: 2px;
  left: 50%;
  margin-left: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg);
}

/* 顶部返回栏（层级页） */
.navbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 4px 0 0;
}
.navbar .back {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--text);
}
.navbar .nav-title { font-size: var(--fs-lg); font-weight: 800; }

/* ---------- 电脑/平板等宽屏：按手机宽度居中，手机上不受影响 ---------- */
@media (min-width: 520px) {
  .statusbar {
    max-width: 430px;
    margin: 0 auto;
  }
  .page {
    max-width: 430px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  body .tabbar {
    width: 430px;
    max-width: 430px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* ---------- 手机横屏：别只剩中间一条，放宽到 720，底栏也压扁（放在上面那段之后才能盖住 430） ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .page {
    max-width: 720px;
    margin: 0 auto;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding-top: max(24px, calc(8px + env(safe-area-inset-top, 0px)));
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  body .tabbar {
    width: 720px;
    max-width: 720px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
    height: calc(52px + env(safe-area-inset-bottom, 0px));
    padding: 4px var(--page-x) calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .tab { gap: 2px; padding-top: 2px; }
  .tab svg { width: 20px; height: 20px; }
}


/* ---------- 胶囊筛选（学习分类 / 风格切换共用） ---------- */
.chips { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
  .chip {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--line-strong);
    font-size: var(--fs-sm); font-weight: 700; color: var(--muted);
  }
  .chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }


/* ---------- 下拉框箭头：跟随主题主色（data URI 里不能用 var，所以三套各写一条） ---------- */
.acsel {
  appearance: none;
  -webkit-appearance: none;
  background-repeat: no-repeat;
  background-position: right 16px center;
}
html:not([data-theme]) .acsel,
html[data-theme="navy"] .acsel { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230b3d6b' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme="night"] .acsel { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2322d3a6' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme="chart"] .acsel { background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b23a2e' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
/* acsel-arrow */
