/* ═══════════════════════════════════════════════════
   飞翔国度数据链接 — 夜航玻璃座舱主题
   ═══════════════════════════════════════════════════ */
:root {
  --bg-0: #05070d;
  --bg-1: #0a0f1a;
  --panel: rgba(13, 20, 34, 0.72);
  --panel-solid: #0d1422;
  --panel-2: rgba(20, 30, 48, 0.6);
  --line: rgba(148, 184, 255, 0.14);
  --line-strong: rgba(148, 184, 255, 0.28);
  --ink: #d7e4f5;
  --ink-dim: #8ba3c4;
  --ink-faint: #5a7196;
  --accent: #5eead4;
  --accent-2: #22d3ee;
  --amber: #fbbf24;
  --red: #f87171;
  --green: #4ade80;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --disp: 'Rajdhani', 'DIN Alternate', 'Avenir Next Condensed', sans-serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  --glow: 0 0 22px rgba(94, 234, 212, 0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(34, 211, 238, 0.09), transparent 60%),
    radial-gradient(900px 600px at 8% 110%, rgba(251, 191, 36, 0.05), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── 背景纹理 ── */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(94, 234, 212, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 234, 212, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 75%);
}
.bg-glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(600px 320px at 50% 0%, rgba(34, 211, 238, 0.07), transparent 70%);
}

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mono { font-family: var(--mono); }

/* ── 顶栏 ── */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1280px; margin: 0 auto; padding: 14px 22px;
  position: sticky; top: 10px; z-index: 50;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(251,191,36,.35)); }
.brand-text b { display: block; font-family: var(--disp); font-size: 1.05rem; letter-spacing: .12em; color: var(--amber); text-shadow: 0 0 14px rgba(251,191,36,.35); }
.brand-text small { display: block; font-size: .62rem; letter-spacing: .22em; color: var(--ink-faint); text-transform: uppercase; }
.header-right { display: flex; align-items: center; gap: 18px; }
.sys-status { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; color: var(--ink-dim); }
.lamp { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); display: inline-block; }
.lamp.on { background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,.8); animation: lampPulse 2.4s infinite; }
.utc { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); }
.utc-label { font-size: .6rem; letter-spacing: .18em; color: var(--ink-faint); }
.utc time { font-size: 1.1rem; font-weight: 700; color: var(--accent); letter-spacing: .06em; text-shadow: 0 0 12px rgba(94,234,212,.4); }
.utc .cst { font-size: .62rem; color: var(--ink-dim); }

/* ── 布局 ── */
.layout {
  max-width: 1280px; margin: 22px auto 0; padding: 0 22px;
  display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: stretch;
}

/* ── 左列控制台 ── */
.console { padding: 20px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }
.console-title { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.t-label { font-family: var(--disp); font-size: .86rem; font-weight: 700; letter-spacing: .22em; color: var(--accent); }
.t-zh { font-size: .7rem; color: var(--ink-faint); letter-spacing: .3em; }

.field-label { display: block; font-family: var(--mono); font-size: .6rem; letter-spacing: .18em; color: var(--ink-dim); text-transform: uppercase; }
.field-label.small { font-size: .58rem; margin-bottom: 8px; }

.icao-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(4, 8, 16, 0.75);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 12px 14px; margin-top: 8px;
  transition: border-color .18s, box-shadow .18s;
}
.icao-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94,234,212,.12), var(--glow); }
.prompt { color: var(--amber); font-family: var(--mono); font-weight: 700; }
#icao-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--mono); font-size: 1.7rem; font-weight: 700;
  letter-spacing: .42em; color: #f0f9ff; caret-color: var(--accent);
  min-width: 0;
}
#icao-input::placeholder { color: var(--ink-faint); letter-spacing: .42em; }
.caret { width: 2px; height: 26px; background: var(--accent); animation: blink 1s steps(1) infinite; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .08em;
  padding: 5px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--ink-dim); cursor: pointer;
  transition: all .15s;
}
.chips .chip:hover { color: var(--accent); border-color: var(--accent); background: rgba(94,234,212,.08); transform: translateY(-1px); }

.type-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border-radius: var(--r-sm);
  background: var(--panel-2); border: 1px solid var(--line); cursor: pointer;
  transition: all .15s; font-family: inherit; color: var(--ink-dim);
}
.type-btn b { font-family: var(--mono); font-size: .74rem; letter-spacing: .04em; }
.type-btn small { font-size: .58rem; color: var(--ink-faint); }
.type-btn:hover { border-color: var(--line-strong); color: var(--ink); transform: translateY(-1px); }
.type-btn.active { background: rgba(94,234,212,.1); border-color: var(--accent); color: var(--accent); box-shadow: var(--glow); }
.type-btn.active b { color: var(--accent); }
.type-btn.all { border-style: dashed; }
.type-btn.all.active { border-style: solid; }

.send-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, rgba(94,234,212,.2), rgba(34,211,238,.14));
  border: 1px solid rgba(94,234,212,.5); border-radius: var(--r-md);
  color: var(--accent); cursor: pointer; font-family: var(--disp);
  font-size: .95rem; font-weight: 700; letter-spacing: .2em;
  transition: all .18s;
}
.send-btn:hover { background: linear-gradient(135deg, rgba(94,234,212,.32), rgba(34,211,238,.22)); box-shadow: 0 0 24px rgba(94,234,212,.25); transform: translateY(-1px); }
.send-btn:active { transform: translateY(0); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.send-btn .send-icon { font-size: .8rem; }
.send-btn kbd { font-family: var(--mono); font-size: .6rem; background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; color: var(--ink-dim); }

.history { display: flex; flex-direction: column; gap: 8px; }

.notice {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm);
  background: rgba(251,191,36,.05); border: 1px solid rgba(251,191,36,.18);
}
.notice-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-top: 8px; flex: none; box-shadow: 0 0 8px rgba(251,191,36,.6); }
.notice p { font-size: .68rem; color: var(--ink-dim); line-height: 1.65; }
.notice b { color: var(--amber); }

/* ── 右列显示面板 ── */
.display-panel { display: flex; flex-direction: column; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  background: rgba(8, 14, 26, 0.5);
}
.panel-title { display: flex; align-items: baseline; gap: 12px; }
.p-code { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; letter-spacing: .2em; color: #f0f9ff; }
.p-type { font-family: var(--disp); font-size: .8rem; letter-spacing: .26em; color: var(--accent); }
.panel-tools { display: flex; align-items: center; gap: 12px; }
.cache-tag { font-family: var(--mono); font-size: .58rem; letter-spacing: .12em; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-dim); }
.cache-tag.live { color: var(--green); border-color: rgba(74,222,128,.4); }
.cache-tag.cached { color: var(--amber); border-color: rgba(251,191,36,.4); }
.src-time { font-family: var(--mono); font-size: .62rem; color: var(--ink-faint); }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink-dim); cursor: pointer; font-size: .9rem;
  transition: all .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

/* 结果态 */
.result { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 16px 20px; overflow-y: auto; max-height: 72vh; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mini-btn { font-family: var(--mono); font-size: .6rem; color: var(--ink-faint); background: none; border: none; cursor: pointer; letter-spacing: .1em; }
.mini-btn:hover { color: var(--accent); }
.raw-block { background: rgba(4,8,16,.6); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.raw { font-size: .78rem; line-height: 1.7; color: #b8d4e8; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); }
.raw.collapsed { max-height: 5.6em; overflow: hidden; }

.decoded-block { display: flex; flex-direction: column; gap: 10px; }
.decode-group { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.decode-group h3 { font-family: var(--disp); font-size: .74rem; font-weight: 700; letter-spacing: .14em; color: var(--accent-2); margin-bottom: 8px; }
.decode-note { font-size: .64rem; color: var(--ink-faint); margin-bottom: 8px; }
.decode-group dl { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.decode-group dl > div { display: flex; gap: 8px; align-items: baseline; font-size: .76rem; }
.decode-group dt { font-family: var(--mono); color: var(--amber); white-space: nowrap; }
.decode-group dd { color: var(--ink); }
.decode-item { display: flex; gap: 8px; align-items: baseline; font-size: .76rem; }
.decode-item .code { font-family: var(--mono); color: var(--amber); }
.decode-item .text { color: var(--ink); }

/* NOTAM */
.notam-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.notam-filters { display: flex; gap: 8px; }
.notam-filters select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--r-sm); padding: 6px 8px; font-family: var(--mono); font-size: .62rem;
  cursor: pointer; outline: none;
}
.notam-filters select:focus { border-color: var(--accent); }
.notam-list { display: flex; flex-direction: column; gap: 10px; }
.notam-item {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 14px; cursor: pointer; transition: all .15s;
}
.notam-item:hover { border-color: var(--accent); transform: translateX(3px); }
.notam-item .ni-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ni-partno { font-family: var(--mono); font-size: .72rem; font-weight: 700; color: #eaf6ff; letter-spacing: .06em; }
.ni-badge { font-family: var(--mono); font-size: .56rem; letter-spacing: .06em; padding: 2px 7px; border-radius: 4px; }
.ni-badge.new { background: rgba(74,222,128,.12); color: var(--green); border: 1px solid rgba(74,222,128,.35); }
.ni-badge.rep { background: rgba(251,191,36,.12); color: var(--amber); border: 1px solid rgba(251,191,36,.35); }
.ni-badge.can { background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.35); }
.ni-badge.imp { background: rgba(248,113,113,.2); color: #fca5a5; border: 1px solid rgba(248,113,113,.6); animation: lampPulse 2s infinite; }
.ni-type { font-size: .68rem; color: var(--ink-dim); }
.ni-time { font-family: var(--mono); font-size: .6rem; color: var(--ink-faint); margin-left: auto; }
.ni-text { font-size: .76rem; color: var(--ink); line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.notam-empty { text-align: center; padding: 40px 20px; color: var(--ink-faint); font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; }

/* 状态栏 */
.status-line {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: .62rem; letter-spacing: .16em; color: var(--ink-faint);
  background: rgba(8, 14, 26, 0.5);
}
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(74,222,128,.7); animation: lampPulse 2s infinite; }

/* 底部 */
.site-footer {
  max-width: 1280px; margin: 0 auto; padding: 22px;
  display: flex; flex-direction: column; gap: 10px;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .16em; color: var(--ink-faint);
}
.footer-line { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap; }
.footer-line.top { width: 100%; justify-content: space-between; }
.beian { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-faint); text-decoration: none; }
a.beian:hover { color: var(--ink); }
.gongan-icon { width: 14px; height: auto; flex: none; }
.footer-line.copy { letter-spacing: .22em; }

/* 对话框 */
.notam-dialog {
  width: min(560px, 92vw); max-height: 84vh; overflow-y: auto; margin: auto;
  background: var(--panel-solid); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow); padding: 0;
}
.notam-dialog::backdrop { background: rgba(3,6,12,.7); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head strong { font-family: var(--mono); letter-spacing: .1em; color: var(--accent); }
.dialog-head button { background: none; border: none; color: var(--ink-dim); font-size: 1rem; cursor: pointer; }
.dialog-head button:hover { color: var(--red); }
.dialog-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-badges { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px; }
.dialog-meta { padding: 0 20px; display: flex; flex-direction: column; gap: 4px; font-size: .72rem; color: var(--ink-dim); }
.dialog-meta .m-row { display: flex; gap: 8px; }
.dialog-meta .m-k { font-family: var(--mono); color: var(--ink-faint); min-width: 56px; }
.dialog-copy { padding: 12px 20px 20px; }
.dialog-copy pre { background: rgba(4,8,16,.6); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; font-size: .76rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); color: #b8d4e8; }
.dialog-extra { padding: 0 20px; }
.dialog-extra pre { background: rgba(4,8,16,.6); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; font-size: .74rem; line-height: 1.7; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); color: var(--ink-dim); }
.dialog-img-wrap { padding: 0 20px 20px; }
.dialog-img-wrap img { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--line); }

/* 动画 */
@keyframes blink { 50% { opacity: 0; } }
@keyframes lampPulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* 入场动画 */
.glass { animation: rise .5s ease both; }
.console { animation-delay: .05s; }
.display-panel { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* 响应式 */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .console { position: static; }
  .console, .display-panel { min-width: 0; }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
  .result { max-height: none; }
}
@media (max-width: 560px) {
  .site-header { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 14px; }
  .header-right { width: 100%; justify-content: space-between; }
  .brand-mark { width: 30px; }
  .layout { padding: 0 12px; margin-top: 14px; gap: 14px; }
  .console, .display-panel { padding: 14px; }
  .type-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .type-btn { padding: 9px 2px; }
  .type-btn b { font-size: .68rem; }
  .utc time { font-size: .95rem; }
  .panel-head { flex-wrap: wrap; gap: 8px; }
  .panel-tools { margin-left: auto; }
  .notam-filters { width: 100%; }
  .notam-filters select { flex: 1; min-width: 0; }
  .result { padding: 12px 14px; }
  .raw-block { padding: 12px; }
  .dialog-meta { flex-wrap: wrap; }
}

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

/* 数据龄期标记 */
.src-age { color: var(--accent); font-weight: 700; }
.src-age.old { color: var(--amber); }
.src-age.stale { color: var(--red); }

/* NOAA 来源徽标 */
.cache-tag.noaa { color: var(--green); border-color: rgba(74,222,128,.5); background: rgba(74,222,128,.08); }

/* AVWX 来源徽标 */
.cache-tag.avwx { color: var(--accent-2); border-color: rgba(34,211,238,.5); background: rgba(34,211,238,.08); }

/* 页脚彩虹渐变文字 */
.footer-line {
  width: fit-content;
  align-self: center;
  background: linear-gradient(90deg, #ff1744, #ff9100, #ffe600, #00e676, #00e5ff, #2979ff, #7c4dff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.footer-line .beian:hover { filter: brightness(1.3); }
