/* ═══════════════════════════════════════════════════════════
   Base —— reset / 排版 / 通用组件（按钮、面板、条、标签）
   ═══════════════════════════════════════════════════════════ */

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

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--ink-950);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

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

input,
textarea {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

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

.up { color: var(--pepper); }
.down { color: var(--chili); }
.warn { color: var(--neon); }
.hot { color: var(--chili); }

.empty,
.empty-big {
  color: var(--text-mute);
  font-size: 13px;
  padding: 14px 0;
  text-align: center;
}

.empty-big {
  padding: 34px 16px;
  line-height: 2;
  font-family: var(--font-serif);
  font-size: 15px;
}

.link {
  color: var(--pepper);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─────────────── 滚动条 ─────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(140, 160, 210, 0.22);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 160, 210, 0.35);
}

/* ─────────────── 按钮 ─────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast),
    box-shadow var(--t-fast), filter var(--t-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.975);
}

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

.btn-primary {
  background: linear-gradient(160deg, var(--chili), var(--chili-deep));
  color: #fff;
  box-shadow: 0 4px 18px rgba(255, 77, 61, 0.24);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 6px 26px rgba(255, 77, 61, 0.36);
}

.btn-ghost {
  background: var(--ink-700);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--ink-600);
  border-color: var(--ink-400);
}

.btn-violet {
  background: linear-gradient(160deg, var(--violet), #6a5cb8);
  color: #fff;
  box-shadow: 0 4px 18px rgba(139, 127, 212, 0.26);
}
.btn-violet:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn-danger {
  background: transparent;
  border-color: rgba(255, 77, 61, 0.4);
  color: var(--chili);
}
.btn-danger:hover {
  background: rgba(255, 77, 61, 0.1);
}

.btn-lg {
  padding: 14px 26px;
  font-size: 15px;
}
.btn-wide {
  width: 100%;
}
.btn-next {
  width: 100%;
  padding: 14px;
  background: linear-gradient(100deg, var(--pepper), #23a98a);
  color: #04140f;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(47, 211, 168, 0.22);
}
.btn-next:hover {
  filter: brightness(1.08);
}

/* ─────────────── 面板 ─────────────── */

.panel {
  background: var(--ink-800);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-bottom: 12px;
}

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

.panel-head h3 {
  font-size: 15px;
  letter-spacing: 0.01em;
}

.panel-sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-bottom: 12px;
}

.panel-alert {
  border-color: rgba(255, 209, 102, 0.32);
  background: linear-gradient(160deg, rgba(255, 209, 102, 0.07), transparent 60%), var(--ink-800);
}

.panel-go {
  border-color: rgba(47, 211, 168, 0.3);
}

/* ─────────────── 数值条 / 点阵 ─────────────── */

.bar {
  display: inline-block;
  position: relative;
  height: 5px;
  width: 100%;
  background: var(--ink-600);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--pepper);
  border-radius: 3px;
  transition: width var(--t-mid) var(--ease-out);
}
.bar.chili i { background: linear-gradient(90deg, var(--chili-deep), var(--chili)); }
.bar.violet i { background: linear-gradient(90deg, #6a5cb8, var(--violet)); }
.bar.neon i { background: linear-gradient(90deg, #c9a13f, var(--neon)); }
.bar.pepper i { background: linear-gradient(90deg, #23a98a, var(--pepper)); }

.pips {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}
.pips i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink-500);
  display: block;
}
.pips i.on {
  background: var(--pepper);
  box-shadow: 0 0 8px rgba(47, 211, 168, 0.5);
}
.pips.big i {
  width: 12px;
  height: 12px;
}

.prog {
  display: inline-block;
  height: 5px;
  flex: 1;
  background: var(--ink-600);
  border-radius: 3px;
  overflow: hidden;
}
.prog i {
  display: block;
  height: 100%;
  background: var(--violet);
  border-radius: 3px;
}

/* ─────────────── 头像 ─────────────── */

.av {
  width: var(--av-size, 36px);
  height: var(--av-size, 36px);
  flex: none;
  border-radius: 6px;
  background: linear-gradient(150deg, var(--av-a), var(--av-b));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: calc(var(--av-size, 36px) * 0.42);
  font-weight: 600;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.av i {
  font-style: normal;
  line-height: 1;
  transform: translateY(-0.02em);
}
.av-core::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 209, 102, 0.5);
  pointer-events: none;
}
.av-ring {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.07), 0 0 26px hsl(var(--hue, 200) 60% 40% / 0.5);
}

/* ─────────────── Toast ─────────────── */

.phone-toasts {
  position: absolute;
  left: 0;
  right: 0;
  top: 96px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  padding: 0 16px;
}

.toast {
  max-width: 100%;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: rgba(20, 26, 43, 0.94);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
  backdrop-filter: blur(14px);
  transform: translateY(-10px) scale(0.96);
  opacity: 0;
  transition: all var(--t-mid) var(--ease-spring);
  box-shadow: var(--sh-2);
}
.toast.in {
  transform: none;
  opacity: 1;
}
.toast-ok { border-color: rgba(47, 211, 168, 0.45); }
.toast-err { border-color: rgba(255, 77, 61, 0.5); color: #ffb3ab; }
.toast-warn { border-color: rgba(255, 209, 102, 0.45); color: #ffe0a3; }
.toast-money-up { border-color: rgba(255, 209, 102, 0.5); color: var(--neon); }
.toast-money-down { border-color: rgba(255, 77, 61, 0.4); }
.toast-mood-up { border-color: rgba(139, 127, 212, 0.5); color: #c3bbf0; }
.toast-mood-down { border-color: rgba(255, 77, 61, 0.4); }
.toast-stage { border-color: rgba(139, 127, 212, 0.6); color: #cfc7ff; font-weight: 500; }
.toast-muted { opacity: 0.8; }

/* ─────────────── 通用动画 ─────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes popIn {
  0% { opacity: 0; transform: translateY(8px) scale(0.9); }
  60% { opacity: 1; transform: translateY(-1px) scale(1.02); }
  100% { opacity: 1; transform: none; }
}

@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}

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