/**
 * 基础样式：字体、设计令牌、重置样式与公共组件。
 *
 * 设计方向为「出发板 × 票根」——用机场航显牌的高对比数字排版，
 * 结合纸质号票的撕裂线与打孔缺口的物理质感。
 */

/* ── 自托管等宽字体（仅含拉丁字符，中文回落到系统字体） ───────────── */
@font-face {
  font-family: 'Azeret Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/azeret-mono-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Azeret Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/azeret-mono-700.woff2') format('woff2');
}

:root {
  /* 中文字体栈：按平台优先级排列，均为系统内置字体，无需下载 */
  --font-cjk: 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei UI', 'Microsoft YaHei',
    'Source Han Sans SC', 'Noto Sans SC', sans-serif;
  --font-mono: 'Azeret Mono', ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;

  /* 用户端：纸感配色 */
  --paper: #f6f3ec;
  --paper-raised: #fffdf8;
  --paper-sunk: #e9e4d8;
  --ink: #16130f;
  --ink-soft: #4a4238;
  --ink-faint: #8c8377;
  --rule: #d9d2c2;
  --accent: #e2531f;
  --accent-deep: #b83c12;
  --accent-tint: #fdeee7;
  --signal-green: #1f7a4d;
  --signal-green-tint: #e6f4ec;
  --signal-amber: #b0740a;
  --signal-amber-tint: #fdf3e0;
  --signal-grey: #6b655c;

  /* 管理端：航显板配色 */
  --board: #0a0d12;
  --board-panel: #131922;
  --board-panel-2: #1a222e;
  --board-line: #26303d;
  --board-text: #e8eef6;
  --board-dim: #7b8a9d;
  --board-amber: #ffb020;
  --board-amber-dim: #6b4a0a;
  --board-green: #3dd68c;
  --board-red: #ff6b6b;
  --board-blue: #5aa9ff;

  /* 圆角与阴影 */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(22, 19, 15, 0.05), 0 12px 32px -12px rgba(22, 19, 15, 0.22);
  --shadow-board: 0 24px 60px -24px rgba(0, 0, 0, 0.8);

  /* 动效时长 */
  --ease: cubic-bezier(0.22, 0.68, 0.35, 1);
  --dur-fast: 160ms;
  --dur: 260ms;
  --dur-slow: 620ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-cjk);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* 移动端点击不出现灰色高亮块，交互反馈由组件自身的 :active 态负责 */
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  /* 移动端表单字号不得小于 16px，否则 iOS Safari 聚焦时会自动放大页面 */
  font-size: 16px;
  color: inherit;
}

/* 消除移动端点击的 300ms 延迟，让按钮响应更跟手 */
button,
input,
select,
textarea,
label,
a {
  touch-action: manipulation;
}

a {
  color: inherit;
}

/* ── 通用隐藏与状态辅助类 ───────────────────────────────────────── */
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 通用小标签：等宽大写，用于航显风格的字段名 ──────────────────── */
.meta-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ── 连接状态指示灯 ─────────────────────────────────────────────── */
.link-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal-green);
  box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.14);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.link-dot.is-stale {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 83, 31, 0.16);
}

/* ── 轻提示条 ───────────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  width: max-content;
  max-width: min(92vw, 460px);
}

.toast {
  font-size: 14px;
  padding: 11px 20px;
  border-radius: 999px;
  color: #fff;
  background: rgba(22, 19, 15, 0.92);
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.5);
  animation: toast-in var(--dur) var(--ease) both;
  backdrop-filter: blur(8px);
}

.toast--error {
  background: rgba(184, 60, 18, 0.96);
}

.toast--ok {
  background: rgba(31, 122, 77, 0.96);
}

.toast.is-leaving {
  animation: toast-out var(--dur) var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

/* ── 按钮基础样式 ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius);
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
  user-select: none;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--block {
  width: 100%;
}

.btn--ghost {
  border: 1px solid currentColor;
  background: transparent;
}

/* 请求进行中的加载态：降低透明度并拦截点击，避免重复提交 */
.is-busy {
  opacity: 0.55;
  pointer-events: none;
  cursor: progress;
}

/* ── 表单控件 ───────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.field__hint {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.45;
}

.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(226, 83, 31, 0.14);
}

.input--mono {
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

/* 减弱动效偏好：尊重系统设置 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
