/* ══════════════════════════════════════════════════════════════════════
   Дневник Mini App — Styles v2.0
   ══════════════════════════════════════════════════════════════════════ */

/* ── Reset & Tokens ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #080d1a;
  --bg-2:        #0e1528;
  --surface:     #131d33;
  --card:        #192036;
  --card-hover:  #1f2a45;
  --border:      rgba(255,255,255,0.07);
  --border-2:    rgba(255,255,255,0.13);

  --accent:      #4db6ff;
  --accent-dim:  rgba(77,182,255,0.15);
  --accent-glow: rgba(77,182,255,0.08);

  --good:        #4ade80;
  --good-bg:     rgba(74,222,128,0.12);
  --avg:         #fbbf24;
  --avg-bg:      rgba(251,191,36,0.12);
  --bad:         #f87171;
  --bad-bg:      rgba(248,113,113,0.12);

  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #475569;
  --text-inv:    #0f172a;

  --nav-h:       64px;
  --header-h:    60px;
  --radius:      14px;
  --radius-sm:   8px;
  --radius-lg:   20px;

  --font:        'Nunito', sans-serif;
  --mono:        'JetBrains Mono', monospace;

  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --shadow-sm:   0 2px 10px rgba(0,0,0,0.3);
  --shadow-lg:   0 12px 48px rgba(0,0,0,0.7);

  color-scheme: dark;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ── Utility ─────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-24  { margin-top: 24px; }

/* ── Splash ──────────────────────────────────────────────────────────── */
#splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  background: var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#splash.fade-out { opacity: 0; visibility: hidden; }

.splash-logo { animation: pulse-logo 2s ease-in-out infinite; }
@keyframes pulse-logo {
  0%,100% { transform: scale(1); filter: drop-shadow(0 0 12px rgba(77,182,255,0.3)); }
  50%      { transform: scale(1.06); filter: drop-shadow(0 0 22px rgba(77,182,255,0.6)); }
}
.splash-name {
  font-size: 22px; font-weight: 800; letter-spacing: -0.3px;
  background: linear-gradient(135deg, #4db6ff, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.splash-dot-row { display: flex; gap: 8px; }
.splash-dot-row span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: dot-bounce 1.2s ease-in-out infinite;
}
.splash-dot-row span:nth-child(2) { animation-delay: 0.2s; }
.splash-dot-row span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce {
  0%,100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(-6px); opacity: 1; }
}

/* ── Login ───────────────────────────────────────────────────────────── */
#page-login {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: env(safe-area-inset-top,16px) 20px env(safe-area-inset-bottom,20px);
}
.login-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; max-width: 340px; width: 100%; text-align: center;
}
.login-icon { animation: float 4s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.login-title { font-size: 28px; font-weight: 800; }
.login-sub   { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.login-hint  { color: var(--text-3); font-size: 12px; line-height: 1.5; }

/* ── Header ──────────────────────────────────────────────────────────── */
#app-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(8,13,26,0.94);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.header-left  { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #1e4bad, #0e2a6b);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.header-name  { display: block; font-size: 14px; font-weight: 700; }
.header-class { display: block; font-size: 11px; color: var(--text-2); }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-label { font-size: 11px; font-weight: 700; color: var(--text-2); min-width: 76px; text-align: center; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.9); background: var(--card); }

/* ── Main / Content ──────────────────────────────────────────────────── */
#app { height: 100%; display: flex; flex-direction: column; }
#content {
  position: fixed;
  top: var(--header-h);
  bottom: var(--nav-h);
  left: 0; right: 0;
  overflow-y: auto;
  padding: 14px 14px;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}
.section { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

/* ── Bottom Nav ──────────────────────────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center;
  background: rgba(9,14,26,0.97);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text-3); cursor: pointer;
  background: none; border: none;
  font-family: var(--font); padding: 6px 2px;
  transition: color 0.18s; -webkit-tap-highlight-color: transparent;
}
.nav-btn span { font-size: 10px; font-weight: 700; letter-spacing: 0.2px; }
.nav-btn svg  { transition: transform 0.18s; }
.nav-btn:active svg { transform: scale(0.86); }
.nav-btn.active { color: var(--accent); }
.nav-btn.active svg { filter: drop-shadow(0 0 5px rgba(77,182,255,0.5)); }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Day block ───────────────────────────────────────────────────────── */
.day-block { margin-bottom: 14px; }
.day-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--accent); margin-bottom: 7px;
  padding-left: 2px;
}
.no-lessons { padding: 14px; color: var(--text-3); font-size: 13px; }

/* ── Lesson rows ─────────────────────────────────────────────────────── */
.lesson-row {
  display: flex; align-items: flex-start;
  gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:active { background: var(--card-hover); }

.lesson-num {
  min-width: 24px; height: 24px; border-radius: 7px;
  background: var(--accent-dim); color: var(--accent);
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.lesson-info { flex: 1; min-width: 0; }
.lesson-name {
  font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lesson-details {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
}
.lesson-detail-item {
  font-size: 11px; color: var(--text-2);
  background: var(--surface); padding: 2px 7px;
  border-radius: 5px; border: 1px solid var(--border);
}
.lesson-time { font-family: var(--mono); }

/* ── Inline HW in schedule ───────────────────────────────────────────── */
.lesson-hw-badge {
  margin-top: 6px; padding: 6px 9px;
  background: rgba(77,182,255,0.05);
  border: 1px solid rgba(77,182,255,0.14);
  border-radius: 8px;
}
.lesson-hw-label {
  font-size: 10px; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.5px;
  display: block; margin-bottom: 3px;
}
.lesson-hw-text { font-size: 12px; color: var(--text-2); line-height: 1.5; display: block; }

/* ── HW items ────────────────────────────────────────────────────────── */
.hw-item {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.hw-item:last-child { border-bottom: none; }
.hw-subject {
  font-size: 11px; font-weight: 800; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 5px;
}
.hw-text { font-size: 13px; line-height: 1.6; color: var(--text); }
.hw-files { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.hw-file-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700;
  color: var(--accent); text-decoration: none;
  background: var(--accent-dim);
  padding: 4px 10px; border-radius: 7px;
  border: 1px solid rgba(77,182,255,0.2);
  transition: background 0.15s;
}
.hw-file-link:active { background: rgba(77,182,255,0.25); }

/* ── Marks ───────────────────────────────────────────────────────────── */
.week-avg-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px; margin-bottom: 14px; text-align: center;
}
.week-avg-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; }
.week-avg-value {
  font-family: var(--mono); font-size: 44px; font-weight: 800;
  line-height: 1.1; margin: 6px 0 2px;
}
.week-avg-value.good { color: var(--good); }
.week-avg-value.avg  { color: var(--avg);  }
.week-avg-value.bad  { color: var(--bad);  }
.week-avg-sub { font-size: 12px; color: var(--text-3); }

.marks-subject-block { margin-bottom: 10px; }
.marks-subj-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; cursor: pointer; transition: background 0.15s;
}
.marks-subj-header:active { background: var(--card-hover); }
.marks-subj-left  { display: flex; align-items: center; gap: 8px; }
.marks-subj-right { display: flex; align-items: center; gap: 8px; }
.marks-subj-name  { font-size: 14px; font-weight: 700; }
.marks-subj-count { font-size: 11px; color: var(--text-3); background: var(--surface); padding: 2px 7px; border-radius: 5px; }
.marks-avg {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  padding: 3px 10px; border-radius: 8px;
}
.marks-avg.good { color: var(--good); background: var(--good-bg); }
.marks-avg.avg  { color: var(--avg);  background: var(--avg-bg);  }
.marks-avg.bad  { color: var(--bad);  background: var(--bad-bg);  }
.expand-arrow { font-size: 13px; color: var(--text-3); transition: transform 0.2s; }

.marks-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}
.mark-chip-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.mark-chip {
  font-family: var(--mono); font-size: 16px; font-weight: 800;
  padding: 7px 13px; border-radius: 10px;
  transition: transform 0.12s, opacity 0.12s;
  display: block; min-width: 40px; text-align: center;
}
.mark-chip:active { transform: scale(0.88); opacity: 0.8; }
.mark-chip.good { color: var(--good); background: var(--good-bg); border: 1px solid rgba(74,222,128,0.2); }
.mark-chip.avg  { color: var(--avg);  background: var(--avg-bg);  border: 1px solid rgba(251,191,36,0.2);  }
.mark-chip.bad  { color: var(--bad);  background: var(--bad-bg);  border: 1px solid rgba(248,113,113,0.2); }
.mark-date { font-size: 10px; color: var(--text-3); white-space: nowrap; }

/* ── Mark Detail Modal ───────────────────────────────────────────────── */
#mark-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,0);
  transition: background 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
#mark-modal.visible { background: rgba(0,0,0,0.65); }
#mark-modal-content {
  width: 100%; max-width: 480px;
  background: var(--bg-2);
  border-top: 1px solid var(--border-2);
  border-radius: 24px 24px 0 0;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.34,1.3,0.64,1);
  overflow: hidden;
  max-height: 82vh;
  display: flex; flex-direction: column;
}
#mark-modal.visible #mark-modal-content { transform: translateY(0); }

.mark-modal-header {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 18px 16px; position: relative;
  border-bottom: 1px solid var(--border);
}
.mark-modal-grade {
  font-family: var(--mono); font-size: 48px; font-weight: 900;
  padding: 8px 20px; border-radius: 16px;
  flex-shrink: 0; line-height: 1;
}
.mark-modal-grade.good { color: var(--good); background: var(--good-bg); }
.mark-modal-grade.avg  { color: var(--avg);  background: var(--avg-bg);  }
.mark-modal-grade.bad  { color: var(--bad);  background: var(--bad-bg);  }
.mark-modal-subject { font-size: 16px; font-weight: 800; flex: 1; line-height: 1.3; }
.modal-close-btn {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border-2);
  color: var(--text-2); font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.modal-close-btn:active { transform: scale(0.9); }

.mark-modal-body {
  overflow-y: auto; padding: 14px 18px 24px;
  flex: 1;
}
.mark-detail-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.detail-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 12px;
  background: var(--surface); border-radius: 10px;
  border: 1px solid var(--border);
}
.detail-icon { font-size: 14px; flex-shrink: 0; line-height: 1.4; }
.detail-val  { font-size: 13px; line-height: 1.5; color: var(--text); }

.modal-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.7px; color: var(--text-3); margin-bottom: 10px;
}

/* ── Distribution bars ───────────────────────────────────────────────── */
.dist-bars { display: flex; flex-direction: column; gap: 8px; }
.dist-row { display: flex; align-items: center; gap: 10px; }
.dist-grade {
  font-family: var(--mono); font-size: 14px; font-weight: 800;
  width: 22px; text-align: center; flex-shrink: 0;
}
.dist-grade.good { color: var(--good); }
.dist-grade.avg  { color: var(--avg);  }
.dist-grade.bad  { color: var(--bad);  }
.dist-bar-wrap {
  flex: 1; height: 10px; background: var(--surface);
  border-radius: 5px; overflow: hidden;
}
.dist-bar {
  height: 100%; border-radius: 5px;
  min-width: 6px;
  transition: width 0.6s cubic-bezier(0.34,1.2,0.64,1);
}
.dist-bar.good { background: var(--good); }
.dist-bar.avg  { background: var(--avg);  }
.dist-bar.bad  { background: var(--bad);  }
.dist-cnt { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-2); min-width: 20px; text-align: right; }
.dist-total { font-size: 11px; color: var(--text-3); text-align: right; margin-top: 4px; }

/* ── Period tabs ─────────────────────────────────────────────────────── */
.period-tabs {
  display: flex; gap: 6px; overflow-x: auto;
  padding-bottom: 12px; scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }
.period-tab {
  flex-shrink: 0; padding: 7px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer; transition: all 0.15s;
  font-family: var(--font); -webkit-tap-highlight-color: transparent;
}
.period-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.period-tab:active { opacity: 0.75; }

/* ── Results ─────────────────────────────────────────────────────────── */
.gpa-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px; margin-bottom: 14px; text-align: center;
}
.gpa-label { font-size: 11px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.6px; }
.gpa-value {
  font-family: var(--mono); font-size: 52px; font-weight: 900;
  line-height: 1.1; margin: 8px 0 4px;
}
.gpa-value.good { color: var(--good); }
.gpa-value.avg  { color: var(--avg);  }
.gpa-value.bad  { color: var(--bad);  }
.gpa-sub { font-size: 12px; color: var(--text-3); }
.period-title-card { padding: 10px 0; font-size: 13px; font-weight: 700; color: var(--text-2); }

.results-card { margin-bottom: 14px; }
.results-row {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.results-row:last-child { border-bottom: none; }
.results-subj { font-size: 13px; font-weight: 500; flex: 1; padding-right: 12px; }
.results-mark {
  font-family: var(--mono); font-size: 16px; font-weight: 800;
  min-width: 38px; text-align: center; padding: 4px 10px; border-radius: 9px;
  flex-shrink: 0;
}
.results-mark.good { color: var(--good); background: var(--good-bg); }
.results-mark.avg  { color: var(--avg);  background: var(--avg-bg);  }
.results-mark.bad  { color: var(--bad);  background: var(--bad-bg);  }

/* ── Ratings ─────────────────────────────────────────────────────────── */
.my-rank-card { margin-bottom: 14px; }
.my-rank-inner { display: flex; align-items: center; gap: 14px; padding: 16px; }
.my-rank-badge { font-size: 32px; flex-shrink: 0; }
.my-rank-info  { flex: 1; }
.my-rank-num   { font-family: var(--mono); font-size: 26px; font-weight: 900; line-height: 1.1; }
.my-rank-of    { font-size: 14px; font-weight: 600; color: var(--text-3); }
.my-rank-class { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.my-rank-avg   {
  font-family: var(--mono); font-size: 26px; font-weight: 900;
  padding: 8px 14px; border-radius: 12px;
}
.my-rank-avg.good { color: var(--good); background: var(--good-bg); }
.my-rank-avg.avg  { color: var(--avg);  background: var(--avg-bg);  }
.my-rank-avg.bad  { color: var(--bad);  background: var(--bad-bg);  }

.ratings-list-card { margin-bottom: 14px; }
.rating-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.rating-row:last-child { border-bottom: none; }
.rating-row.me-row { background: var(--accent-glow); }
.rating-rank {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--text-3); min-width: 28px; text-align: center;
}
.rating-rank.top-1 { color: #fbbf24; font-size: 18px; }
.rating-rank.top-2 { color: #94a3b8; font-size: 18px; }
.rating-rank.top-3 { color: #b45309; font-size: 18px; }
.rating-name { flex: 1; font-size: 13px; font-weight: 500; }
.rating-name.me { color: var(--accent); font-weight: 800; }
.rating-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rating-score {
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  padding: 3px 10px; border-radius: 8px;
}
.rating-score.good { color: var(--good); background: var(--good-bg); }
.rating-score.avg  { color: var(--avg);  background: var(--avg-bg);  }
.rating-score.bad  { color: var(--bad);  background: var(--bad-bg);  }
.rating-count { font-size: 10px; color: var(--text-3); }

/* ── Settings / Profile ──────────────────────────────────────────────── */
.settings-wrap { padding-bottom: 24px; }
.section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-3); margin-bottom: 10px;
}
.profile-card { display: flex; align-items: center; gap: 16px; padding: 16px; }
.profile-avatar {
  width: 52px; height: 52px; border-radius: 15px;
  background: linear-gradient(135deg, #1e4bad, #0e2a6b);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.profile-info  { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.profile-name  { font-size: 16px; font-weight: 700; }
.profile-school { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-class-badge {
  display: inline-block; font-size: 11px; font-weight: 700;
  color: var(--accent); background: var(--accent-dim);
  padding: 2px 8px; border-radius: 6px; width: fit-content;
}
.notif-card { display: flex; flex-direction: column; }
.notif-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: none; }
.notif-info  { display: flex; flex-direction: column; gap: 2px; }
.notif-title { font-size: 14px; font-weight: 600; }
.notif-desc  { font-size: 12px; color: var(--text-2); }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border-2);
  cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; left: 2px; top: 2px;
  border-radius: 50%; background: var(--text-3);
  transition: transform 0.2s, background 0.2s;
}
input:checked + .slider { background: var(--accent-dim); border-color: var(--accent); }
input:checked + .slider::before { transform: translateX(20px); background: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(135deg, #1e5bbf, #0e3a8a);
  color: #fff; border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 15px; font-weight: 700;
  padding: 14px 24px; cursor: pointer; width: 100%;
  box-shadow: 0 4px 20px rgba(30,91,191,0.4);
  transition: transform 0.15s, box-shadow 0.15s; -webkit-tap-highlight-color: transparent;
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 10px rgba(30,91,191,0.3); }
.btn-lg { padding: 16px 28px; font-size: 16px; }
.btn-danger {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(248,113,113,0.1); color: var(--bad);
  border: 1px solid rgba(248,113,113,0.2); border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 700;
  padding: 13px 20px; cursor: pointer; width: 100%;
  transition: background 0.15s; -webkit-tap-highlight-color: transparent;
}
.btn-danger:active { background: rgba(248,113,113,0.18); }
.btn-ghost {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; font-weight: 700;
  padding: 11px 20px; cursor: pointer; width: 100%;
  transition: background 0.15s; -webkit-tap-highlight-color: transparent;
}
.btn-ghost:active { background: var(--card-hover); }

/* ── Loading / Empty ──────────────────────────────────────────────────── */
.loading-block {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 56px 20px; gap: 14px; color: var(--text-2);
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--surface); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.spinner-sm {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--surface); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-block {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 56px 20px; gap: 8px; color: var(--text-3);
}
.empty-icon { font-size: 44px; }
.empty-text { font-size: 14px; text-align: center; font-weight: 600; color: var(--text-2); }
.empty-sub  { font-size: 12px; text-align: center; }

/* ── Toast ────────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(var(--nav-h) + 14px); left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--card); border: 1px solid var(--border-2);
  color: var(--text); font-size: 13px; font-weight: 700;
  padding: 10px 18px; border-radius: 20px;
  box-shadow: var(--shadow); white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s; z-index: 9000;
}
#toast.show     { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-ok  { color: var(--good); border-color: rgba(74,222,128,0.3); }
#toast.toast-err { color: var(--bad);  border-color: rgba(248,113,113,0.3); }

/* ── Version label ────────────────────────────────────────────────────── */
.version-label { text-align: center; font-size: 11px; color: var(--text-3); margin-top: 20px; padding-bottom: 8px; }

/* ── Scrollbar ────────────────────────────────────────────────────────── */
#content::-webkit-scrollbar { width: 3px; }
#content::-webkit-scrollbar-track { background: transparent; }
#content::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }
.mark-modal-body::-webkit-scrollbar { width: 3px; }
.mark-modal-body::-webkit-scrollbar-track { background: transparent; }
.mark-modal-body::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (min-width: 600px) {
  #content { padding: 18px 24px; }
  .card { border-radius: 18px; }
}