/* ===== 基础布局 ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

html {
  background: var(--bg);
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 82% -4%, rgba(14, 140, 127, 0.14), transparent 22rem),
    radial-gradient(circle at 8% 102%, rgba(211, 118, 63, 0.10), transparent 20rem);
}

html[data-theme="dark"] body::before {
  background:
    radial-gradient(circle at 82% -4%, rgba(71, 211, 189, 0.10), transparent 22rem),
    radial-gradient(circle at 8% 102%, rgba(232, 151, 95, 0.07), transparent 20rem);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent-ink); text-decoration: none; }
img { display: block; max-width: 100%; }

/* 图标默认尺寸，避免无尺寸 SVG 撑破布局 */
.ico { width: 18px; height: 18px; flex: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* ===== 应用外壳 ===== */
#app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  background: transparent;
}

@supports (height: 100dvh) {
  #app { height: 100dvh; }
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { width: 0; height: 0; }

.pad { padding: 0 16px; }

/* 顶部安全区 */
.safe-top { padding-top: max(8px, var(--safe-t)); }

/* 底部固定操作区 */
.dock {
  flex: none;
  padding: 10px 16px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .dock { background: var(--bg); }
}

/* ===== 通用文字 ===== */
.t-title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.t-sub { color: var(--muted); font-size: var(--fs-sm); }
.t-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.t-center { text-align: center; }

.c-accent { color: var(--accent-ink); }
.c-warm { color: var(--warm); }
.c-danger { color: var(--danger); }
.c-ok { color: var(--ok); }
.c-muted { color: var(--muted); }

/* ===== 动效 ===== */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop {
  0% { opacity: 0; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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