/* ==========================================================
   投掷骰子 · 设计系统
   配色：翡翠绿主色（课堂亲和）+ 暖金强调色（任务完成/高亮）
   风格：现代教育产品——大圆角、柔和多层阴影、轻盈留白、微动效
   适配：一体机 1920×1080 横屏 / 讯飞平板横竖屏 / 手机
   ========================================================== */
:root {
  --brand-900: #065f46;
  --brand-800: #047857;
  --brand-700: #059669;
  --brand-600: #10b981;
  --brand-500: #34d399;
  --brand-100: #d1fae5;
  --brand-50: #ecfdf5;

  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-100: #fef3c7;

  --sky-600: #0ea5e9;
  --sky-100: #e0f2fe;

  --ink-900: #0f172a;
  --ink-700: #334155;
  --ink-500: #64748b;
  --ink-300: #cbd5e1;
  --ink-100: #e2e8f0;
  --ink-50: #f1f5f9;

  --danger: #ef4444;
  --bg: #f6faf8;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --sh-2: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --sh-3: 0 12px 24px -6px rgba(6, 95, 70, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --sh-4: 0 24px 48px -12px rgba(6, 95, 70, .22);

  --ff: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Source Han Sans SC",
        "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ff-num: "DIN Alternate", "Bahnschrift", "Avenir Next", var(--ff);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
/* iOS Safari 地址栏收起时仍有短暂白边，用 100vh 兜底 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff);
  color: var(--ink-900);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  /* 老版 WebKit 不支持 dvh 时兜底 */
  min-height: 100%;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
.num { font-family: var(--ff-num); font-variant-numeric: tabular-nums; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 26px;
  border-radius: 999px; font-size: 20px; font-weight: 700; letter-spacing: .5px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, filter .2s;
  touch-action: manipulation;
}
.btn:active { transform: scale(.965); }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
  box-shadow: 0 10px 20px -8px rgba(5, 150, 105, .65), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-gold {
  color: #5b3a00;
  background: linear-gradient(180deg, var(--gold-400), var(--gold-500));
  box-shadow: 0 10px 20px -8px rgba(245, 158, 11, .65), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-ghost {
  background: #fff; color: var(--ink-700);
  border: 1.5px solid var(--ink-100);
  box-shadow: var(--sh-1);
}
.btn-ghost:hover { border-color: var(--brand-500); color: var(--brand-700); }
.btn-soft { background: var(--brand-50); color: var(--brand-800); border: 1.5px solid var(--brand-100); }
.btn-danger { background: #fff; color: var(--danger); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.card {
  background: #fff; border-radius: var(--r-lg);
  box-shadow: var(--sh-2); border: 1px solid rgba(15, 23, 42, .04);
}

/* ---------- 背景装饰 ---------- */
.bg-deco { position: fixed; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.bg-deco .blob { position: absolute; border-radius: 50%; -webkit-filter: blur(60px); filter: blur(60px); opacity: .55; }
.bg-deco .b1 { width: 520px; height: 520px; left: -160px; top: -180px; background: #a7f3d0; }
.bg-deco .b2 { width: 460px; height: 460px; right: -140px; bottom: -180px; background: #bae6fd; opacity: .4; }
.bg-deco .b3 { width: 300px; height: 300px; right: 18%; top: -120px; background: #fde68a; opacity: .28; }
.bg-deco .grid {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background-image: radial-gradient(rgba(6, 95, 70, .10) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
}

/* ---------- Toast ---------- */
#toast-root {
  position: fixed; left: 50%; top: 26px; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 12px 22px; border-radius: 999px; font-size: 18px; font-weight: 600;
  background: rgba(15, 23, 42, .88); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: var(--sh-3); animation: toastIn .25s cubic-bezier(.2, .9, .3, 1.3);
}
.toast.ok { background: rgba(4, 120, 87, .94); }
.toast.warn { background: rgba(180, 83, 9, .94); }
.toast.err { background: rgba(185, 28, 28, .94); }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 900;
  display: -webkit-box; display: -ms-flexbox; display: flex;
  -webkit-box-align: center; -ms-flex-align: center; align-items: center;
  -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center;
  background: rgba(15, 23, 42, .42);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  animation: fadeIn .18s ease;
}
.modal {
  width: 92vw; max-width: 560px; background: #fff; border-radius: var(--r-xl);
  box-shadow: var(--sh-4); padding: 32px; animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
.modal h3 { margin: 0 0 10px; font-size: 26px; }
.modal p { margin: 0 0 24px; color: var(--ink-500); font-size: 18px; line-height: 1.7; }
.modal .row { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }

/* ---------- 横向滚动条美化 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 工具类 ---------- */
.hide { display: none !important; }
.grow { flex: 1; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- SVG 图标统一尺寸（部分内核不约束会撑满容器） ---------- */
.ic svg, .mini-btn svg, .btn svg, .hbtn svg { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -0.22em; }
svg { max-width: 100%; }
