/* vkt Shatter 样式：极简（设计稿 5.3）。画布铺满全屏，UI 全部浮层。
   深浅主题走 CSS 变量（canvas 是内容，不随主题变）。 */

:root {
  --bg: #10131A;
  --fg: #E8EDF4;
  --fg-dim: rgba(232, 237, 244, 0.62);
  --chip-bg: rgba(255, 255, 255, 0.08);
  --chip-fg: #DDE5EF;
  --chip-active-bg: rgba(150, 200, 255, 0.22);
  --pill-bg: rgba(10, 12, 18, 0.55);
  --btn-bg: rgba(16, 19, 26, 0.82);
  --sheet-bg: rgba(24, 28, 36, 0.96);
  --card-bg: rgba(30, 34, 44, 0.97);
  --line: rgba(255, 255, 255, 0.09);
  --accent: #9CC8FF;
}

/* 浅色主题（body.theme-light，由 main.applyThemeClass 挂载；auto 按系统解析） */
body.theme-light {
  --bg: #E9EEF5;
  --fg: #1D2430;
  --fg-dim: rgba(29, 36, 48, 0.62);
  --chip-bg: rgba(20, 30, 45, 0.07);
  --chip-fg: #2A3342;
  --chip-active-bg: rgba(70, 130, 210, 0.18);
  --pill-bg: rgba(240, 245, 252, 0.72);
  --btn-bg: rgba(248, 251, 255, 0.9);
  --sheet-bg: rgba(246, 249, 253, 0.97);
  --card-bg: rgba(250, 252, 255, 0.98);
  --line: rgba(20, 30, 45, 0.12);
  --accent: #3E7CC4;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 -apple-system, "PingFang SC", "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

#glassCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;          /* 手势全归画布，页面不滚 */
}

/* ---------------- 顶栏 ---------------- */

#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  pointer-events: none;
  background: linear-gradient(rgba(8, 10, 16, 0.55), rgba(8, 10, 16, 0));
}

.brand { font-weight: 700; letter-spacing: 0.02em; }

.mini {
  font-size: 12px;
  color: var(--fg-dim);
  max-width: 88px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pill {
  margin-left: auto;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pill-bg);
  border: 1px solid var(--line);
  color: var(--fg);
  white-space: nowrap;
}

.icon-btn {
  pointer-events: auto;
  border: none;
  background: var(--pill-bg);
  color: var(--fg);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

/* ---------------- 提示与工具坞 ---------------- */

.hint {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(86px + env(safe-area-inset-bottom));
  text-align: center;
  font-size: 13px;
  color: var(--fg-dim);
  pointer-events: none;
  animation: hintFade 9s ease forwards;
}

@keyframes hintFade {
  0%, 55% { opacity: 1; }
  100% { opacity: 0; }
}

/* 首敲即收起：提示不该压在正在敲的玻璃上（main 加 class）。
   animation:none 是必须的——动画会盖过普通声明，不清掉则 opacity:0 不生效。 */
.hint.gone {
  animation: none;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .hint { animation: none; }
}

#dock {
  position: fixed;
  right: 14px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  align-items: center;
}

.tool-btn {
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--fg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  /* 刻意不用 backdrop-filter：画布每帧都在变，模糊层会让合成器每帧重做一次
     背景读取+模糊（低端安卓上很贵）。改用略高不透明度的底色，观感几乎一样。 */
}

.tool-btn.icon-only { width: 44px; padding: 0; text-align: center; font-size: 17px; }
.tool-btn.icon-only.muted { opacity: 0.45; }

/* ---------------- 设置抽屉 ---------------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 8;
}

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 9;
  max-height: 84vh;            /* 老 iOS 不认 dvh 的兜底行 */
  max-height: 84dvh;
  overflow-y: auto;
  background: var(--sheet-bg);
  border-radius: 18px 18px 0 0;
  padding: 6px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(0);
  transition: transform 0.24s ease;
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.sheet-head h2 { margin: 0; font-size: 17px; }

.field { padding: 10px 0; border-top: 1px solid var(--line); }
.field-label { font-size: 13px; color: var(--fg-dim); margin-bottom: 8px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sw-label { font-size: 15px; }
.switch-row input { width: 22px; height: 22px; accent-color: var(--accent); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--chip-fg);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.chip.active {
  background: var(--chip-active-bg);
  border-color: var(--accent);
  color: #fff;
}

.lang-row { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-chip { min-width: 64px; text-align: center; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  background: var(--chip-bg);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat b { font-size: 20px; }
.stat span { font-size: 12px; color: var(--fg-dim); }

.note { font-size: 12px; color: var(--fg-dim); margin: 10px 0 0; }

/* ---------------- 配额卡片 / toast ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 24px;
}

.modal-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 22px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}

.modal-card h3 { margin: 0 0 8px; font-size: 17px; }
.modal-card p { margin: 6px 0; font-size: 14px; color: var(--fg-dim); }
.rest-count { font-size: 22px !important; color: var(--fg) !important; font-variant-numeric: tabular-nums; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  flex: 1;
  border-radius: 12px;
  padding: 11px 0;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.btn.ghost { background: var(--chip-bg); color: var(--fg); border: 1px solid var(--line); }
.btn.primary { background: var(--accent); color: #10203A; font-weight: 600; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(120px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(18, 22, 30, 0.92);
  color: var(--fg);
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  z-index: 11;
  pointer-events: none;
  white-space: nowrap;
}

.hidden { display: none !important; }
