/* ============ テーマ変数 ============ */
:root,
:root[data-theme="light"] {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --border: #e2e5ef;
  --text: #161a2b;
  --muted: #6a7189;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0ff;
  --on-primary: #ffffff;
  --success: #059669;
  --success-soft: #e6f7ef;
  --danger: #e11d48;
  --danger-soft: #fdecef;
  --warn: #c2670a;
  --warn-soft: #fff3df;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
  --hero: linear-gradient(135deg, #4f46e5 0%, #7c3aed 60%, #a855f7 100%);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c0f1d;
  --surface: #151a2e;
  --surface-2: #1d2340;
  --border: #283052;
  --text: #e8eaf6;
  --muted: #98a0bf;
  --primary: #8b93ff;
  --primary-hover: #a3a9ff;
  --primary-soft: #232963;
  --on-primary: #0c0f1d;
  --success: #34d399;
  --success-soft: #0f2e25;
  --danger: #fb7185;
  --danger-soft: #3a1622;
  --warn: #fbbf24;
  --warn-soft: #3a2c0f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --hero: linear-gradient(135deg, #3730a3 0%, #5b21b6 60%, #7e22ce 100%);
  color-scheme: dark;
}

/* ============ ベース ============ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  transition: background .2s, color .2s;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-primary { color: var(--primary); }

/* ============ レイアウト ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--hero); color: #fff;
  display: grid; place-items: center;
}
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--muted); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 20px; font-weight: 800; }
.topbar .spacer { flex: 1; }
.main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 28px 48px; }

.bottom-nav { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { padding: max(12px, env(safe-area-inset-top)) 16px 12px; }
  .topbar h1 { font-size: 17px; }
  /* iPhone は 16px 未満の入力欄をタップすると画面を拡大してしまう */
  .input, select.input, textarea.input { font-size: 16px; }
  .main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; font-weight: 600; color: var(--muted); padding: 4px 0; border-radius: 8px;
    min-width: 0;
  }
  .bottom-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav a.active { color: var(--primary); }
}

/* ============ グリッド・カード ============ */
.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.grid-2-3 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
@media (max-width: 1000px) {
  .grid-2, .grid-3-2, .grid-2-3 { grid-template-columns: minmax(0, 1fr); }
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; margin-bottom: 14px;
}
.card-title .icon { color: var(--primary); }
.card-title .right { margin-left: auto; font-weight: 500; }

/* ヒーロー（カウントダウン） */
.hero {
  background: var(--hero); color: #fff;
  border-radius: 20px; padding: 26px 28px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  box-shadow: 0 10px 30px rgba(79, 70, 229, .28);
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.hero-main { flex: 1; min-width: 240px; position: relative; z-index: 1; }
.hero-label { font-size: 14px; opacity: .9; display: flex; align-items: center; gap: 6px; }
.hero-days { font-size: 76px; font-weight: 900; line-height: 1; letter-spacing: -.02em; margin: 8px 0 4px; }
.hero-days small { font-size: 22px; font-weight: 700; margin-left: 6px; letter-spacing: 0; }
.hero-sub { font-size: 14px; opacity: .9; }
.hero-since {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .22);
  font-size: 13px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; max-width: 520px;
}
.hero-since b { font-size: 16px; }
.hero-since-pct { opacity: .85; margin-left: 4px; }
.hero-track { flex-basis: 100%; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; margin-top: 4px; }
.hero-track > span { display: block; height: 100%; border-radius: 99px; background: #fff; }
.hero-ring { position: relative; z-index: 1; text-align: center; }
.hero-ring svg { width: 150px; height: 150px; }
.hero-ring .ring-main { font-size: 24px; font-weight: 800; fill: #fff; }
.hero-ring .ring-sub { font-size: 11px; fill: rgba(255, 255, 255, .85); }
@media (max-width: 600px) {
  .hero { padding: 20px; }
  .hero-days { font-size: 60px; }
  .hero-ring svg { width: 120px; height: 120px; }
}

/* 統計カード */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-icon.warn { background: var(--warn-soft); color: var(--warn); }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat-foot { font-size: 12px; color: var(--muted); }
.stat.highlight { border: 2px solid var(--primary); }

/* プログレスバー */
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s; }
.progress.success > span { background: var(--success); }
.progress.thin { height: 6px; }

/* ============ フォーム・ボタン ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, opacity .15s;
  white-space: nowrap; text-decoration: none; line-height: 1.3;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
:root[data-theme="dark"] .btn-success { color: #0c0f1d; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { border-color: var(--primary); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: 12px; }
.btn-icon { padding: 8px; border-radius: 10px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { resize: vertical; line-height: 1.6; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-grid { display: grid; gap: 14px; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .row-3 { grid-template-columns: 1fr 1fr; } }

/* セグメントコントロール */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label, .seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked), .seg .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* 選択カード（ラジオ） */
.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.option {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--border);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option b { font-size: 14px; display: flex; align-items: center; gap: 6px; }
.option small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.option:has(input:checked) b { color: var(--primary); }

/* チップ・バッジ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 700;
  background: var(--success-soft); color: var(--success); font-variant-numeric: tabular-nums;
}
.live-chip.paused { background: var(--warn-soft); color: var(--warn); }
.live-chip.error { background: var(--danger-soft); color: var(--danger); }
#sync-chip:not(:empty) { margin-left: 6px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* バナー */
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 12px; font-size: 14px;
  background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.banner .grow { flex: 1; min-width: 200px; }
.banner.info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }

/* ============ リスト・テーブル ============ */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 14px; }
.list-item .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); font-size: 14px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.bar-cell { min-width: 120px; }

/* ============ チャート ============ */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart rect.bar:hover { opacity: .8; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.donut { width: 170px; height: 170px; flex-shrink: 0; }
.donut .donut-main { font-size: 18px; font-weight: 800; fill: var(--text); }
.donut .donut-sub { font-size: 10px; fill: var(--muted); }
.legend { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 8px; }
.legend-row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }
.legend-row .pct { color: var(--muted); width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.legend-row b { font-variant-numeric: tabular-nums; }
.legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend-inline span { display: inline-flex; align-items: center; gap: 5px; }

/* ============ タイマー ============ */
.clock {
  font-size: 64px; font-weight: 800; text-align: center; letter-spacing: .02em;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin: 10px 0 18px;
}
.clock.running { color: var(--success); }
@media (max-width: 560px) { .clock { font-size: 48px; } }
.quick-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============ クイズ ============ */
.quiz-wrap { max-width: 860px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.quiz-top .spacer { flex: 1; }
.question-text { font-size: 17px; line-height: 1.85; white-space: pre-wrap; margin: 6px 0 18px; font-weight: 500; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex; gap: 12px; align-items: flex-start; text-align: left;
  width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.7; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.choice:disabled { cursor: default; }
.choice-no {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 800; font-size: 14px; margin-top: 1px;
}
.choice.correct { border-color: var(--success); background: var(--success-soft); }
.choice.correct .choice-no { background: var(--success); color: #fff; }
.choice.wrong { border-color: var(--danger); background: var(--danger-soft); }
.choice.wrong .choice-no { background: var(--danger); color: #fff; }
.choice.dim { opacity: .55; }
.choice-body { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.choice-exp {
  display: block; font-size: 13px; line-height: 1.75; white-space: pre-wrap;
  padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-left: 3px solid var(--border); color: var(--text);
}
.choice-exp b { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.choice.correct .choice-exp { border-left-color: var(--success); }
.choice.wrong .choice-exp { border-left-color: var(--danger); }
.site-links { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.site-links .icon { vertical-align: -2px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.tf-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-choices .choice { justify-content: center; align-items: center; font-size: 40px; font-weight: 800; padding: 18px; }
.tf-choices .choice span.lbl { font-size: 14px; font-weight: 700; }

.feedback { margin-top: 18px; border-radius: 14px; padding: 16px 18px; border: 1px solid var(--border); background: var(--surface-2); }
.feedback-head { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.feedback.ok .feedback-head { color: var(--success); }
.feedback.ng .feedback-head { color: var(--danger); }
.feedback .exp { white-space: pre-wrap; font-size: 14px; line-height: 1.85; }
.kbd { font-size: 11px; border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; color: var(--muted); }

.score-big { font-size: 56px; font-weight: 900; line-height: 1; }
.result-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.result-item:last-child { border-bottom: 0; }
.result-item .q { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 問題管理 */
.q-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 2px; border-bottom: 1px solid var(--border); }
.q-item:last-child { border-bottom: 0; }
.q-item .grow { flex: 1; min-width: 0; }
.q-item .q-text { font-size: 14px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-actions { display: flex; gap: 4px; flex-shrink: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input { width: auto; min-width: 140px; }
.toolbar .search { flex: 1; min-width: 180px; position: relative; }
.toolbar .search .input { width: 100%; padding-left: 36px; }
.toolbar .search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.choice-edit { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.choice-edit label.ans { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; cursor: pointer; }
.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px;
  background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre;
}

/* ============ モーダル・トースト ============ */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 10, 20, .55); animation: fade .15s; }
.modal {
  position: relative; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); animation: pop .18s;
}
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { font-size: 18px; flex: 1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toast-root { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 900px) { .toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.toast {
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: pop .2s; max-width: 90vw;
}
.toast.error { background: var(--danger); color: #fff; }
