:root {
  --bg: #14100c;
  --bg2: #1d1812;
  --panel: #241d16;
  --panel2: #2c241b;
  --line: #3a3025;
  --text: #ece3d4;
  --muted: #a99c87;
  --accent: #d9a441;
  --accent2: #c8862f;
  --danger: #c0503b;
  --ok: #5aa86b;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0,0,0,.5);
  --appbar-h: 52px;
  --tabbar-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #2a2014 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-top: calc(var(--appbar-h) + env(safe-area-inset-top));
  overscroll-behavior-y: none;
}
h2, h3 { font-weight: 700; }

/* ---------- inputs / buttons ---------- */
select, input, textarea {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit;
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent2); outline-offset: 0; }
.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; cursor: pointer; font: inherit; transition: .12s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:active { transform: scale(.97); }
.btn:hover { border-color: var(--accent2); }
.btn.primary { background: var(--accent); color: #2a1d05; border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: transparent; padding: 10px; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- app bar ---------- */
.appbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  height: calc(var(--appbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: #14100c;
  border-bottom: 1px solid var(--line);
}
.appbar-logo { flex: none; }
.deck-switch {
  flex: 1; max-width: 360px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 22px; padding: 8px 14px; cursor: pointer; font: inherit;
}
.deck-switch:active { transform: scale(.98); }
.deck-switch-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deck-switch-count { background: var(--accent); color: #2a1d05; font-size: 12px; font-weight: 800; border-radius: 11px; padding: 1px 8px; flex: none; }
.deck-switch .chev { color: var(--muted); flex: none; }
.net-status { flex: none; color: var(--danger); font-size: 18px; }
.install-btn { flex: none; background: var(--accent); color: #2a1d05; border: none; border-radius: 18px; padding: 7px 12px; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
.install-btn:active { transform: scale(.96); }
.install-btn[hidden] { display: none; }

/* ---------- views ---------- */
main { padding: 14px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 32px); max-width: 1000px; margin: 0 auto; }
.view { display: none; animation: fade .18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- search ---------- */
.search-bar-wrap { position: relative; margin-bottom: 8px; }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; }
.search-bar:focus-within { border-color: var(--accent2); }
.search-ico { color: var(--muted); flex: none; }
.search-bar input { flex: 1; background: none; border: none; padding: 10px 4px; }
.search-bar input:focus { outline: none; }
.search-clear { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; flex: none; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 2px 12px; }
.hint code { background: var(--panel); padding: 1px 5px; border-radius: 4px; color: var(--accent); }

/* advanced search */
.adv-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pill-btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 20px; padding: 7px 14px; cursor: pointer; font: inherit; font-size: 13px; }
.pill-btn:active { transform: scale(.97); }
.pill-btn.on { border-color: var(--accent); color: var(--accent); }
.adv-count { background: var(--accent); color: #2a1d05; font-style: normal; font-weight: 800; font-size: 11px; border-radius: 9px; padding: 0 6px; }
.sort-wrap { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-left: auto; }
.sort-wrap select { padding: 7px 10px; border-radius: 10px; }

.adv-panel { background: var(--panel); border: 1px solid var(--accent2); border-radius: 14px; padding: 14px; margin-bottom: 12px; display: grid; gap: 14px; animation: fade .18s; }
.adv-panel[hidden] { display: none; }
.adv-field { display: grid; gap: 8px; }
.adv-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.adv-mode { padding: 4px 8px; border-radius: 8px; font-size: 12px; }
.adv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.adv-chip { background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 16px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.adv-chip:active { transform: scale(.96); }
.adv-chip.active { background: var(--accent); color: #2a1d05; border-color: var(--accent); font-weight: 700; }
.adv-chip.pip { padding: 5px; border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; }
.adv-chip.pip.active { box-shadow: 0 0 0 2px var(--accent); background: var(--panel2); }
.adv-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adv-range input { width: 78px; padding: 8px 10px; }
.adv-range .dash { color: var(--muted); }
.adv-sub { color: var(--muted); font-size: 13px; margin-left: 6px; }
.adv-select { width: 100%; }
.adv-actions { display: flex; gap: 8px; }
.adv-actions .btn { flex: 1; justify-content: center; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.card-cell { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-img { cursor: zoom-in; aspect-ratio: 488/680; background: #0d0a07; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.noimg { display: grid; place-items: center; height: 100%; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; }
.noimg.big { aspect-ratio: 488/680; font-size: 16px; }
.card-cell-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px; }
.add-btn { padding: 7px 10px; font-size: 13px; }
.more-row { display: grid; place-items: center; margin: 18px 0; }
.empty { color: var(--muted); padding: 24px 12px; text-align: center; grid-column: 1/-1; }
.empty.error { color: #ffb9a9; }
.skeleton { aspect-ratio: 488/680; background: linear-gradient(100deg, var(--panel) 30%, var(--panel2) 50%, var(--panel) 70%); background-size: 200% 100%; animation: sh 1.1s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- autocomplete ---------- */
.ac {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  margin: 0; padding: 5px; list-style: none;
  background: var(--panel2); border: 1px solid var(--accent2); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 50vh; overflow: auto;
}
.ac[hidden] { display: none; }
.ac-item { padding: 11px 12px; border-radius: 8px; cursor: pointer; }
.ac-item.active, .ac-item:hover { background: var(--accent); color: #2a1d05; }

/* ---------- deck view ---------- */
.deck-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.count-pill { background: var(--accent); color: #2a1d05; font-weight: 800; padding: 6px 12px; border-radius: 20px; font-size: 13px; white-space: nowrap; }
.deck-toolbar select { flex: 1; }
.deck-list { padding-bottom: 8px; }
.group-head { color: var(--accent); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; margin: 16px 2px 6px; }
.deck-row { display: grid; grid-template-columns: 26px 30px 30px 1fr auto 30px; align-items: center; gap: 5px; padding: 6px 2px; border-radius: 8px; }
.deck-row:hover { background: var(--panel2); }
.row-qty { text-align: center; font-weight: 800; color: var(--accent); }
.row-name { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name:active { color: var(--accent); }
.row-mana { white-space: nowrap; }
.qbtn { background: var(--panel2); border: 1px solid var(--line); color: var(--text); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; line-height: 1; padding: 0; font-size: 16px; }
.qbtn:active { transform: scale(.92); }
.qbtn.del:active { border-color: var(--danger); color: #ffb9a9; }
.deck-row.bad-ci .row-name { color: #ffb9a9; }

/* ---------- commander / color-identity ---------- */
.ci-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }
.ci-banner[hidden] { display: none; }
.ci-text { color: var(--muted); }
.ci-toggle { padding: 5px 10px; font-size: 12px; }
.commander-slot { display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, #2e2415, var(--panel2)); border: 1px solid var(--accent2); border-radius: 12px; padding: 8px 10px; margin-bottom: 12px; }
.commander-slot[hidden] { display: none; }
.cmd-star { color: var(--accent); font-size: 18px; }
.cmd-thumb { width: 48px; height: 36px; object-fit: cover; object-position: center 22%; border-radius: 6px; cursor: pointer; }
.cmd-name { flex: 1; font-weight: 700; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-empty { color: var(--muted); font-size: 13px; }

/* ---------- mana symbols ---------- */
.ms { display: inline-grid; place-items: center; width: 19px; height: 19px; border-radius: 50%; font-size: 11px; font-weight: 800; color: #1c1813; margin: 0 1px; vertical-align: middle; }
.ms-generic, .ms-other { background: #c9bfa8; }
.ms-W { background: #f5edc9; } .ms-U { background: #5b9bd6; }
.ms-B { background: #595149; color: #e9e2d6; } .ms-R { background: #e07a5f; }
.ms-G { background: #6bbf7a; } .ms-C { background: #c2bbb0; }

/* ---------- stats ---------- */
.stats-wrap { display: grid; gap: 16px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 10px; text-align: center; }
.stat-val { display: block; font-size: 24px; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 12px; }
.chart-block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.chart-block h3 { margin: 0 0 14px; }
.curve-chart { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; align-items: end; height: 170px; }
.curve-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.curve-bar { width: 72%; min-height: 2px; background: linear-gradient(180deg, var(--accent), var(--accent2)); border-radius: 6px 6px 0 0; transition: height .3s; }
.curve-val { font-size: 12px; color: var(--muted); height: 14px; }
.curve-label { font-size: 12px; color: var(--muted); }
.bar-row { display: grid; grid-template-columns: 96px 1fr 64px; align-items: center; gap: 10px; margin-bottom: 9px; }
.bar-key { font-size: 13px; }
.bar-track { background: var(--bg); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.bar-fill.c-W { background: #e9e0b8; } .bar-fill.c-U { background: #5b9bd6; }
.bar-fill.c-B { background: #6e6459; } .bar-fill.c-R { background: #e07a5f; }
.bar-fill.c-G { background: #6bbf7a; } .bar-fill.c-C { background: #c2bbb0; }
.bar-num { font-size: 13px; color: var(--muted); text-align: right; }

/* ---------- advice ---------- */
.advice { display: grid; gap: 8px; }
.tip { padding: 11px 14px; border-radius: 10px; font-size: 14px; border: 1px solid var(--line); background: var(--panel); }
.tip-ok { border-color: #3c5e44; background: #1c2a1f; }
.tip-warn { border-color: #6b5a2a; background: #2a2417; }
.tip-bad { border-color: #6b3a30; background: #2c1d18; color: #ffcabd; }

/* ---------- playtest ---------- */
.play-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.play-controls .btn { flex: 1; justify-content: center; }
.play-info { color: var(--muted); font-size: 14px; margin: 12px 2px; }
.play-hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.play-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; aspect-ratio: 488/680; }
.play-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- import / export ---------- */
.io-wrap { display: grid; gap: 18px; }
@media (min-width: 720px) { .io-wrap { grid-template-columns: 1fr 1fr; } }
.io-col h3 { margin: 0 0 6px; }
.io-col textarea { width: 100%; height: 240px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.io-actions { display: flex; gap: 8px; margin-top: 10px; }
.io-actions .btn { flex: 1; justify-content: center; }
.import-log { margin-top: 12px; font-size: 13px; }
.import-log .ok { color: var(--ok); }
.import-log .error { color: #ffb9a9; }

/* ---------- learn ---------- */
.seg { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg-btn { flex: 1; background: none; border: none; color: var(--muted); padding: 9px 6px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 600; }
.seg-btn.active { background: var(--accent); color: #2a1d05; }
.learn-pane { display: none; }
.learn-pane.active { display: block; }

.level-filter { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.chip { background: var(--panel2); border: 1px solid var(--line); color: var(--muted); border-radius: 18px; padding: 6px 14px; cursor: pointer; font: inherit; font-size: 13px; }
.chip.active { background: var(--accent); color: #2a1d05; border-color: var(--accent); font-weight: 700; }

.lesson-list { display: grid; gap: 8px; }
.lesson { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lesson.open { border-color: var(--accent2); }
.lesson-head { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: none; color: var(--text); padding: 13px 14px; cursor: pointer; font: inherit; text-align: left; }
.lesson-title { flex: 1; font-weight: 600; }
.lesson-tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; flex: none; }
.tag-Beginner { background: #2c4a33; color: #aef0bf; }
.tag-Strategy { background: #4a3a16; color: var(--accent); }
.lesson-chev { color: var(--muted); transition: transform .2s; }
.lesson.open .lesson-chev { transform: rotate(180deg); }
.lesson-body { line-height: 1.65; color: var(--text); }
.lesson-body b { color: var(--accent); }

/* course cards / navigation */
.course-card { width: 100%; display: flex; gap: 14px; align-items: center; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; color: var(--text); cursor: pointer; font: inherit; }
.course-card:active { transform: scale(.99); }
.course-card:hover { border-color: var(--accent2); }
.course-icon { font-size: 34px; flex: none; }
.course-meta { flex: 1; min-width: 0; }
.course-title { font-size: 18px; font-weight: 800; }
.course-sub { color: var(--muted); font-size: 13px; margin: 2px 0 10px; }
.course-prog { color: var(--muted); font-size: 12px; margin-top: 6px; }
.progress-track { height: 7px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.progress-track.big { height: 9px; margin-top: 8px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); border-radius: 5px; transition: width .35s; }
.back-link { background: none; border: none; color: var(--accent); font: inherit; cursor: pointer; padding: 4px 0; margin-bottom: 8px; }
.course-head { margin-bottom: 14px; }
.course-head h2 { margin: 0 0 4px; }

.lesson-row { width: 100%; display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.lesson-row:active { transform: scale(.99); }
.lesson-row.locked { opacity: .5; cursor: default; }
.lesson-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.lesson-num.done { background: var(--ok); color: #0f1a12; border-color: var(--ok); }
.lesson-chev { color: var(--muted); }

.lesson-detail { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.lesson-detail h2 { margin: 4px 0 12px; }
.lesson-step { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }

.check-box { background: var(--panel); border: 1px solid var(--accent2); border-radius: 14px; padding: 16px; }
.check-q { font-weight: 700; margin-bottom: 12px; }
.check-opts { display: grid; gap: 8px; }
.check-fb { display: none; margin-top: 12px; }
.check-fb.show { display: block; animation: fade .2s; }
.check-fb p { padding: 12px 14px; border-radius: 10px; margin: 0 0 12px; }
.check-fb.ok p { background: #1c2a1f; border: 1px solid #3c5e44; }
.check-fb.bad p { background: #2c1d18; border: 1px solid #6b3a30; color: #ffcabd; }

.quiz-tracks { display: flex; flex-direction: column; gap: 8px; }
.quiz-tracks .btn { justify-content: center; }
.quiz-progress { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.quiz-q { font-size: 17px; font-weight: 600; margin-bottom: 16px; line-height: 1.4; }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt { text-align: left; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: 14px; cursor: pointer; font: inherit; transition: .12s; }
.quiz-opt:active { transform: scale(.99); }
.quiz-opt:disabled { cursor: default; }
.quiz-opt.right { border-color: var(--ok); background: #1c2a1f; }
.quiz-opt.wrong { border-color: var(--danger); background: #2c1d18; }
.quiz-feedback { display: none; margin-top: 14px; }
.quiz-feedback.show { display: block; animation: fade .2s; }
.quiz-feedback p { padding: 12px 14px; border-radius: 10px; margin: 0 0 12px; }
.quiz-feedback.ok p { background: #1c2a1f; border: 1px solid #3c5e44; }
.quiz-feedback.bad p { background: #2c1d18; border: 1px solid #6b3a30; color: #ffcabd; }
.quiz-feedback .btn { width: 100%; justify-content: center; }
.quiz-result { text-align: center; padding: 24px 12px; }
.quiz-score { font-size: 44px; font-weight: 800; color: var(--accent); }
.quiz-result .btn { margin-top: 14px; }

.trainer-info { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.trainer-actions { display: flex; gap: 8px; margin-top: 14px; }
.trainer-actions .btn { flex: 1; justify-content: center; }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex;
  background: rgba(20,16,12,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px; background: none; border: none; color: var(--muted);
  font: inherit; font-size: 11px; cursor: pointer; position: relative;
}
.tabbtn svg { width: 23px; height: 23px; }
.tabbtn:active { transform: scale(.93); }
.tabbtn.active { color: var(--accent); }
.tabbtn.active::before { content: ''; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab-badge { position: absolute; top: 4px; left: 56%; background: var(--accent); color: #2a1d05; font-size: 10px; font-weight: 800; font-style: normal; border-radius: 9px; padding: 0 5px; line-height: 16px; }

/* ---------- bottom sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--panel); border-radius: 20px 20px 0 0;
  padding: 6px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 82vh; overflow: auto; box-shadow: var(--shadow);
  animation: slideup .24s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grip { width: 42px; height: 4px; background: var(--line); border-radius: 2px; margin: 8px auto 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sheet-head h3 { margin: 0; }
.sheet-close { background: var(--panel2); border: 1px solid var(--line); color: var(--text); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }
.deck-sheet-list { display: grid; gap: 8px; margin-bottom: 16px; }
.deck-sheet-row { display: flex; gap: 6px; }
.deck-sheet-row.active .dsr-main { border-color: var(--accent2); background: #2e2516; }
.dsr-main { flex: 1; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.dsr-main:active { transform: scale(.99); }
.dsr-name { font-weight: 700; }
.dsr-meta { font-size: 12px; color: var(--muted); }
.dsr-act { width: 46px; border: 1px solid var(--line); background: var(--panel2); border-radius: 12px; color: var(--text); cursor: pointer; font-size: 15px; }
.dsr-act.danger:active { border-color: var(--danger); color: #ffb9a9; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.modal-body { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); max-width: 720px; width: calc(100% - 28px); max-height: calc(100vh - 28px); overflow: auto; padding: 18px; }
.modal-close { position: absolute; top: 10px; right: 10px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; z-index: 1; }
.modal-grid { display: grid; gap: 16px; }
@media (min-width: 560px) { .modal-grid { grid-template-columns: 260px 1fr; } }
.modal-img { width: 100%; max-width: 320px; margin: 0 auto; border-radius: 12px; display: block; }
.modal-info h2 { margin: 0 0 8px; }
.modal-info .type { color: var(--muted); font-weight: 600; }
.modal-info .oracle { white-space: pre-wrap; line-height: 1.5; }
.modal-info .pt { font-weight: 700; }
.modal-info .sub { color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; justify-content: center; }
.modal-actions a { text-decoration: none; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel2); border: 1px solid var(--accent2); color: var(--text); padding: 11px 18px; border-radius: 24px; box-shadow: var(--shadow); opacity: 0; transition: .25s; z-index: 80; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
