/* 公共动效底座：极简双主题令牌、时序缩放变量、基础组件、按压反馈与 reduced-motion 降级 */
:root {
  --bg: #0a0a0c;
  --panel: #131316;
  --panel-2: #1a1a1f;
  --panel-3: #24242b;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f5f5f7;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #f5f5f7;
  --accent-ink: #0a0a0c;
  --ok: #22c55e;
  --danger: #ef4444;
  --info: #3b82f6;
  --pink: #ec4899;

  --r-s: 12px;
  --r-m: 20px;
  --r-l: 28px;

  --um-speed: 1;
  --dur-xs: calc(140ms / var(--um-speed));
  --dur-s: calc(200ms / var(--um-speed));
  --dur-m: calc(350ms / var(--um-speed));
  --dur-panel: calc(450ms / var(--um-speed));
  --dur-page: calc(550ms / var(--um-speed));

  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-io: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: "Inter", "SF Pro Text", "Segoe UI Variable Text", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", system-ui, sans-serif;
  --font-display: "Inter", "SF Pro Display", "Segoe UI Variable Display", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", "Cascadia Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.36), 0 10px 28px -10px rgba(0, 0, 0, 0.55), 0 28px 56px -24px rgba(0, 0, 0, 0.62);
}

html[data-theme="light"] {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --panel-2: #f0f0ed;
  --panel-3: #e5e5e1;
  --line: rgba(17, 17, 17, 0.07);
  --line-2: rgba(17, 17, 17, 0.13);
  --text: #111111;
  --muted: #5c5c62;
  --faint: #8e8e93;
  --accent: #111111;
  --accent-ink: #ffffff;
  --ok: #16a34a;
  --danger: #dc2626;
  --info: #2563eb;
  --pink: #db2777;
  --shadow: 0 1px 2px rgba(17, 17, 17, 0.04), 0 8px 24px -8px rgba(17, 17, 17, 0.08), 0 24px 48px -20px rgba(17, 17, 17, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}
body {
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  gap: 16px;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 136, 0.28) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(128, 128, 136, 0.26); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(128, 128, 136, 0.44); }
html[data-embed="true"] body {
  background: transparent;
  padding: 20px 16px;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: color-mix(in srgb, var(--accent) 18%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 舞台与手机容器 */
.stage {
  width: min(100%, 440px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
}
.stage.wide { width: min(100%, 760px); }
.stage.full { width: 100%; max-width: 1080px; }
.stage-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 14px;
}
.col { display: flex; flex-direction: column; gap: 12px; }
.row-flex { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }

/* 手机外框：340x620，干净的硬件轮廓 */
.phone {
  width: 340px;
  height: 620px;
  border-radius: 42px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  overflow: hidden;
  position: relative;
  flex: none;
  box-shadow: 0 0 0 8px #18181b, 0 0 0 9px rgba(255, 255, 255, 0.06), 0 36px 72px -24px rgba(0, 0, 0, 0.65);
}
html[data-theme="light"] .phone {
  box-shadow: 0 0 0 7px #e5e5e3, 0 0 0 8px rgba(17, 17, 17, 0.06), 0 32px 64px -24px rgba(17, 17, 17, 0.22);
}
.phone-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font: 600 12px var(--font);
  position: relative;
  z-index: 5;
  user-select: none;
}
.phone-bar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  width: 88px;
  height: 22px;
  margin-left: -44px;
  border-radius: 12px;
  background: #09090b;
}
html[data-theme="light"] .phone-bar::after { background: #18181b; }
.phone-bar span:last-child { letter-spacing: 0.06em; }
.phone-body {
  position: absolute;
  inset: 44px 0 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.phone-body::-webkit-scrollbar { display: none; }
.phone-body.pad { padding: 16px; }

.navbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(19, 19, 22, 0.84);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
html[data-theme="light"] .navbar { background: rgba(255, 255, 255, 0.86); }
.navbar .title { font-weight: 600; font-size: 15px; flex: 1; text-align: center; margin-right: 36px; }

.back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}
.back::before {
  content: "";
  width: 9px;
  height: 9px;
  border-left: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  transform: rotate(45deg);
  margin-left: 3px;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding-top: 8px;
  background: rgba(19, 19, 22, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 4;
}
html[data-theme="light"] .tabbar { background: rgba(255, 255, 255, 0.9); }
.tabbar button {
  display: grid;
  justify-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--faint);
  min-width: 56px;
  min-height: 44px;
  align-content: center;
}
.tabbar button.on { color: var(--accent); }
.tabbar svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* 按钮与按压反馈 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  font-weight: 600;
  font-size: 14px;
  transition: transform var(--dur-s) var(--ease-out), background var(--dur-s), border-color var(--dur-s), opacity var(--dur-s);
  touch-action: manipulation;
  user-select: none;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: scale(0.97); transition-duration: 60ms; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-pri { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn-pri:hover { background: var(--accent); opacity: 0.88; }
.btn-ok { background: var(--ok); border-color: transparent; color: #ffffff; }
.btn-danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); color: var(--danger); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  transition: transform var(--dur-s) var(--ease-out), background var(--dur-s);
  flex: none;
}
.icon-btn:hover { background: var(--panel-3); }
.icon-btn:active { transform: scale(0.94); transition-duration: 60ms; }
.icon-btn svg, .btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.fab {
  position: absolute;
  right: 20px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.35);
  z-index: 6;
  transition: transform var(--dur-s) var(--ease-out);
}
.fab:active { transform: scale(0.94); transition-duration: 60ms; }
.fab svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  transition: transform var(--dur-s) var(--ease-out), background var(--dur-s), color var(--dur-s), border-color var(--dur-s);
  user-select: none;
}
.chip:hover { background: var(--panel-3); color: var(--text); }
.chip:active { transform: scale(0.96); transition-duration: 60ms; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }

/* 列表与卡片 */
.list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px;
  border-radius: var(--r-s);
  position: relative;
  transition: background var(--dur-s);
}
.row:hover { background: var(--panel-2); }
.av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--c, #3b82f6), color-mix(in srgb, var(--c, #3b82f6) 55%, #000));
}
.av.sq { border-radius: 12px; }
.av.lg { width: 56px; height: 56px; font-size: 18px; }
.row .txt { flex: 1; min-width: 0; }
.row .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { font-size: 12px; color: var(--faint); flex: none; }

.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-s); padding: 14px; }
.card .t { font-weight: 600; margin-bottom: 4px; }
.card .s { font-size: 12px; color: var(--muted); line-height: 1.6; }
.cover { width: 100%; aspect-ratio: 16 / 10; border-radius: var(--r-s); object-fit: cover; background: var(--panel-3); }
.sec { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); margin: 4px 0 8px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* 表单 */
.field { position: relative; margin-top: 22px; }
.field input, .field textarea {
  width: 100%;
  height: 50px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  padding: 0 14px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color var(--dur-s), box-shadow var(--dur-s);
}
.field textarea { height: auto; min-height: 90px; padding: 12px 14px; resize: none; }
.field input:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.field label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
  transform-origin: left center;
  transition: transform var(--dur-s) var(--ease-out), color var(--dur-s);
  padding: 0 4px;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label {
  transform: translateY(-27px) scale(0.78);
  background: var(--panel);
  color: var(--muted);
}
.field input:focus + label { color: var(--accent); }
.field.ok input { border-color: var(--ok); }
.field.err input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16); }
.msg { min-height: 18px; font-size: 12px; color: var(--faint); padding: 4px 4px 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--faint);
}
.search input { flex: 1; background: none; border: 0; outline: none; font-size: 14px; min-width: 0; color: var(--text); }

/* 骨架扫光：整页共用一道光带 */
.skel {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: var(--panel-2);
  background-image: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
  background-size: 200vw 100%;
  background-attachment: fixed;
  animation: skel calc(1.5s / var(--um-speed)) linear infinite;
}
html[data-theme="light"] .skel {
  background-color: #e6e7eb;
  background-image: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.78) 50%, transparent 60%);
}
@keyframes skel {
  from { background-position-x: 100vw; }
  to { background-position-x: -100vw; }
}

/* 遮罩、弹层、开关、提示 */
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-m) var(--ease-out);
}
.scrim.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--panel);
  border-radius: var(--r-l) var(--r-l) 0 0;
  padding: 10px 16px 24px;
  transform: translateY(105%);
  transition: transform var(--dur-panel) var(--ease-out);
  box-shadow: 0 -20px 40px -20px rgba(0, 0, 0, 0.35);
  touch-action: none;
  user-select: none;
  z-index: 8;
}
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line-2); margin: 0 auto 14px; }

.hint { font-size: 12px; color: var(--faint); text-align: center; max-width: 440px; line-height: 1.6; }
.badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font: 700 11px/18px var(--font);
  text-align: center;
}
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--panel-3); position: relative; transition: background var(--dur-m); flex: none; }
.switch.on { background: var(--ok); }
.switch i { position: absolute; left: 2px; top: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform var(--dur-m) var(--spring); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.switch.on i { transform: translateX(20px); }

.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  background: var(--panel);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-s) var(--ease-out), transform var(--dur-s) var(--ease-out);
  white-space: nowrap;
  z-index: 50;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.kbd { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); }

/* 进度条 */
.bar { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--accent); transition: width var(--dur-m) var(--ease-out); }

/* 通用按压态 */
[data-press] { transition: transform var(--dur-s) var(--ease-out); }
[data-press]:active { transform: scale(0.97); transition-duration: 60ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.15s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
    scroll-behavior: auto !important;
  }
  .skel { animation: none !important; }
}

html[data-reduce="true"] *,
html[data-reduce="true"] *::before,
html[data-reduce="true"] *::after {
  animation-duration: 0.15s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.15s !important;
  scroll-behavior: auto !important;
}
html[data-reduce="true"] .skel { animation: none !important; }
