/* ============================================================
   BASICS OF MECHANICAL ENGINEERING — Study Platform
   Design language: engineering blueprint / technical drawing.
   ============================================================ */

:root {
  --paper: #f6f3ea;
  --paper-2: #eee9db;
  --ink: #1c2430;
  --muted: #5b6472;
  --steel: #b9c2cc;
  --steel-2: #dfe4e9;
  --brass: #b8863b;
  --brass-2: #8f6526;
  --accent: #7c5cd6;
  --accent-2: #6346b8;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --card: #ffffff;
  --border: #e4e7ec;
  --shadow: 0 1px 2px rgba(23,26,32,0.04), 0 10px 28px rgba(23,26,32,0.08);
  --radius: 18px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-serif: Georgia, "Times New Roman", serif;
  --header-h: 56px;
  --nav-w: 250px;
}

[data-theme="dark"] {
  --paper: #12161c;
  --paper-2: #171c23;
  --ink: #e9edf2;
  --muted: #93a0b0;
  --steel: #2c3644;
  --steel-2: #232b36;
  --brass: #d9a55a;
  --brass-2: #e8bd80;
  --accent: #4bbfa1;
  --accent-2: #6fd4b9;
  --danger: #e07a5f;
  --ok: #4bbfa1;
  --warn: #e0b04c;
  --card: #1a2029;
  --border: #2a323d;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 18px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-2); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-sans); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -0.02em; font-weight: 600; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--font-mono); }
ul, ol { padding-left: 1.3em; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: var(--paper-2); font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

button, .btn {
  font-family: inherit; font-size: 0.92rem; cursor: pointer;
  background: var(--card); color: var(--ink); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; transition: background .15s, border-color .15s;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, .btn:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brass); outline-offset: 2px;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 0.82rem; }
.btn-block { width: 100%; }
select, input[type="text"], input[type="search"] {
  font-family: inherit; font-size: 0.92rem; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
}

/* ---------- Layout shell ---------- */
#app-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: var(--paper); border-bottom: 1px solid var(--border);
}
#app-header .brand { font-weight: 700; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app-header .brand small { display: block; font-weight: 400; font-size: 0.68rem; color: var(--muted); }
#header-theme-wrap { display: block; }
@media (max-width: 880px) { #header-theme-wrap { display: none; } }
#menu-toggle { display: none; }
#app-header .spacer { flex: 1; }
#theme-toggle { border-radius: 20px; }

#search-box { width: 100%; max-width: 340px; }

#app-shell { display: flex; min-height: calc(100vh - var(--header-h)); }

#sidenav {
  width: var(--nav-w); flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 14px 10px 60px; background: var(--paper-2);
  position: sticky; top: var(--header-h); align-self: flex-start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
}
#sidenav a.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 8px; color: var(--ink); font-size: 0.9rem; margin-bottom: 2px;
}
#sidenav a.nav-link:hover { background: var(--steel-2); text-decoration: none; }
#sidenav a.nav-link.active { background: var(--accent); color: #fff; }
#sidenav .nav-group-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  margin: 16px 10px 6px;
}
#sidenav .nav-group-label:first-child { margin-top: 4px; }

main#view {
  flex: 1; min-width: 0; padding: 20px 22px 80px; max-width: 980px; margin: 0 auto; width: 100%;
}

.crumbs { font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

/* ---- Subject accents (per-course tags) ---- */
.accent-maths   { --subject: #3b6ea5; }
.accent-physics { --subject: #7a4fa3; }
.accent-pps     { --subject: #b3572c; }
.accent-egd     { --subject: #2c7a72; }
.accent-bme     { --subject: #8a6d3b; }
.accent-english { --subject: #a53b6e; }
.tag-course { background: var(--steel-2); color: var(--ink); border: 1px solid var(--border); font-weight: 600; }
.tag-course.accent-maths   { background: #dce9f5; color: #24507c; border-color: transparent; }
.tag-course.accent-physics { background: #e9def5; color: #53357a; border-color: transparent; }
.tag-course.accent-pps     { background: #f7e2d5; color: #83401f; border-color: transparent; }
.tag-course.accent-egd     { background: #d8eeeb; color: #1f5a53; border-color: transparent; }
.tag-course.accent-bme     { background: #efe6d2; color: #6b5426; border-color: transparent; }
.tag-course.accent-english { background: #f5dce7; color: #7c2a52; border-color: transparent; }
[data-theme="dark"] .tag-course.accent-maths   { background: #1a2c40; color: #8ab8e8; }
[data-theme="dark"] .tag-course.accent-physics { background: #2a1f3d; color: #c39ce8; }
[data-theme="dark"] .tag-course.accent-pps     { background: #3a2315; color: #e8a97c; }
[data-theme="dark"] .tag-course.accent-egd     { background: #14322e; color: #7fd6c9; }
[data-theme="dark"] .tag-course.accent-bme     { background: #33290f; color: #d9c377; }
[data-theme="dark"] .tag-course.accent-english { background: #38162a; color: #e89cc4; }

/* ---- Static flashcards on topic pages ---- */
.flashcard-static { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; background: var(--card); }

/* ---- Hero on subject pages ---- */
.hero-subject { border-left: 4px solid var(--subject, var(--accent)); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 6px; }
.card .muted { color: var(--muted); font-size: 0.85rem; }
.card-link { display: block; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card-link:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 2px 4px rgba(28,36,48,0.08), 0 8px 20px rgba(28,36,48,0.1); transform: translateY(-1px); }
[data-theme="dark"] .card-link:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.4), 0 8px 22px rgba(0,0,0,0.5); }

.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 20px; background: var(--steel-2); color: var(--ink); margin-right: 4px;
}
.tag-unit1 { background: #dce9e4; color: #17493b; }
.tag-unit2 { background: #dbe6f2; color: #1a3f66; }
.tag-unit3 { background: #f2e3d0; color: #6b4712; }
.tag-unit4 { background: #ecdce8; color: #5c2350; }
[data-theme="dark"] .tag-unit1 { background: #163229; color: #7fd6b9; }
[data-theme="dark"] .tag-unit2 { background: #16273c; color: #86b6e8; }
[data-theme="dark"] .tag-unit3 { background: #3a2c15; color: #e8bd80; }
[data-theme="dark"] .tag-unit4 { background: #33192d; color: #e6a9d3; }

.tag-easy { background: #dcefdc; color: #235023; }
.tag-medium { background: #f5edcf; color: #6b5410; }
.tag-hard { background: #f5ddd3; color: #813a20; }
.tag-exam-challenge { background: #eadcf5; color: #4d1f77; }
[data-theme="dark"] .tag-easy { background: #16331c; color: #8fd99a; }
[data-theme="dark"] .tag-medium { background: #362c11; color: #e8cd6f; }
[data-theme="dark"] .tag-hard { background: #3a2015; color: #ef9a75; }
[data-theme="dark"] .tag-exam-challenge { background: #2b1a38; color: #cda3ec; }

.progress-bar { height: 8px; background: var(--steel-2); border-radius: 6px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--accent); }

.badge-status { font-size: 0.7rem; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.status-not-started { background: var(--steel-2); color: var(--muted); }
.status-learning { background: #f5edcf; color: #6b5410; }
.status-practiced { background: #dbe6f2; color: #1a3f66; }
.status-mastered { background: #dcefdc; color: #235023; }
[data-theme="dark"] .status-learning { background: #362c11; color: #e8cd6f; }
[data-theme="dark"] .status-practiced { background: #16273c; color: #86b6e8; }
[data-theme="dark"] .status-mastered { background: #16331c; color: #8fd99a; }

/* ---------- Topic detail ---------- */
.topic-section { margin: 26px 0; }
.topic-section > h2 { display: flex; align-items: center; gap: 8px; border-bottom: 2px solid var(--border); padding-bottom: 6px; }
.topic-section > h2 .num { color: var(--brass); font-family: var(--font-mono); font-size: 0.85em; }
.diagram-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.diagram-box svg { max-width: 100%; height: auto; }
.formula-box {
  background: var(--paper-2); border-left: 4px solid var(--brass); border-radius: 6px;
  padding: 10px 14px; margin: 10px 0; font-family: var(--font-mono); font-size: 0.95rem;
}
.quick-check li { margin-bottom: 8px; }
.quick-check details { background: var(--paper-2); border-radius: 8px; padding: 8px 12px; }
.exam-tip { background: #fff7e0; border: 1px solid #e7d19a; border-radius: var(--radius); padding: 12px 14px; }
[data-theme="dark"] .exam-tip { background: #2b2410; border-color: #4a3c15; }
.mistake-box { background: #fdeceb; border: 1px solid #f0c3bd; border-radius: var(--radius); padding: 12px 14px; }
[data-theme="dark"] .mistake-box { background: #2c1712; border-color: #4d251d; }

/* ---------- Topic extras: applications, comparisons, notes, nav ---------- */
.nice-list li { margin-bottom: 6px; }
.table-card { padding: 10px 14px; overflow-x: auto; }
.comparison-table th:first-child, .comparison-table td:first-child { white-space: nowrap; }
.comparison-table tbody td:first-child { font-weight: 600; }
.extra-notes {
  background: var(--paper-2); border-left: 4px solid var(--accent); border-radius: 6px;
  padding: 12px 16px; margin: 10px 0;
}
.extra-notes p:last-child { margin-bottom: 0; }

.topic-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.topic-nav a { display: block; }
.topic-nav .muted { display: block; font-size: 0.78rem; margin-bottom: 2px; }
.topic-nav-prev { text-align: left; }
.topic-nav-next { text-align: right; }
@media (max-width: 560px) { .topic-nav { grid-template-columns: 1fr; } .topic-nav-next { text-align: left; } }

.streak-card { border-top: 3px solid var(--brass); }

/* ---------- Quiz / exam ---------- */
.q-card { margin-bottom: 16px; }
.q-options label {
  display: block; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; cursor: pointer;
}
.q-options label:hover { border-color: var(--accent); }
.q-options input { margin-right: 8px; }
.q-options label.correct { border-color: var(--ok); background: rgba(31,111,92,0.08); }
.q-options label.incorrect { border-color: var(--danger); background: rgba(179,67,44,0.08); }
.answer-reveal { margin-top: 10px; padding: 10px 12px; background: var(--paper-2); border-radius: 8px; white-space: pre-wrap; font-size: 0.92rem; }
.timer-pill {
  font-family: var(--font-mono); font-weight: 700; background: var(--ink); color: var(--paper);
  padding: 6px 12px; border-radius: 20px; font-size: 0.9rem;
}

/* ---------- Flashcards ---------- */
.flash-wrap { max-width: 480px; margin: 0 auto; }
.flashcard {
  min-height: 220px; border-radius: 16px; border: 1px solid var(--border); background: var(--card);
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
  padding: 26px; text-align: center; font-size: 1.15rem; cursor: pointer; user-select: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.flashcard:hover { box-shadow: 0 2px 4px rgba(28,36,48,0.08), 0 8px 22px rgba(28,36,48,0.1); }
.flashcard:active { transform: scale(0.985); }
.flashcard .side-label { position: absolute; top: 10px; left: 14px; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; }
.flashcard-frame { position: relative; }
.flash-actions { display: flex; gap: 8px; margin-top: 14px; }
.flash-actions button { flex: 1; }

.deck-strip { max-width: 480px; margin: 0 auto 14px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.deck-chip {
  flex: 0 0 auto; max-width: 160px; padding: 6px 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card); cursor: pointer; text-align: left;
  font-size: 0.78rem; color: var(--ink); transition: border-color .15s, background .15s;
}
.deck-chip:hover { border-color: var(--accent); }
.deck-chip-active { border-color: var(--accent); background: var(--steel-2); }
.deck-chip-active .deck-chip-text { font-weight: 600; }
.deck-chip-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-chip-badge {
  display: inline-block; font-size: 0.62rem; font-weight: 600; padding: 1px 5px;
  border-radius: 10px; margin-top: 2px; background: var(--steel-2); color: var(--muted);
}
.deck-chip-badge.fc-badge-know { background: #dcefdc; color: #235023; }
.deck-chip-badge.fc-badge-almost { background: #f5edcf; color: #6b5410; }
.deck-chip-badge.fc-badge-dont { background: #f5ddd3; color: #813a20; }
[data-theme="dark"] .deck-chip-badge.fc-badge-know { background: #16331c; color: #8fd99a; }
[data-theme="dark"] .deck-chip-badge.fc-badge-almost { background: #362c11; color: #e8cd6f; }
[data-theme="dark"] .deck-chip-badge.fc-badge-dont { background: #3a2015; color: #ef9a75; }

/* ---------- Print ---------- */
@media print {
  #app-header, #sidenav, #bottom-nav, #scrim, .btn, .filters, .timer-pill, .flash-actions, .deck-strip { display: none !important; }
  #app-shell { display: block; }
  main#view { max-width: 100%; padding: 0; }
  body { background: #fff; color: #000; }
  .card, .diagram-box, .formula-box, .extra-notes, .exam-tip, .mistake-box, .quick-check details { box-shadow: none; break-inside: avoid; }
  a { color: #000; }
}

/* ---------- Utility ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.flex { display: flex; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-14 { gap: 14px; }
.space-between { justify-content: space-between; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; border-radius: var(--radius); padding: 28px 24px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: "⚙"; position: absolute; right: -14px; bottom: -30px; font-size: 8rem;
  opacity: 0.12; transform: rotate(-12deg); pointer-events: none;
}
.hero h1 { color: #fff; position: relative; }
.hero p { color: rgba(255,255,255,0.88); position: relative; }
.hero .btn { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.4); color: #fff; position: relative; }
.hero .btn:hover { background: rgba(255,255,255,0.28); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

.checklist-unit { margin-bottom: 22px; }
.checklist-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px solid var(--border); gap: 10px; }
.checklist-row:last-child { border-bottom: none; }
.checklist-row .label { flex: 1; }

.glossary-jump { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.glossary-jump a { padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem; }
.glossary-term { border-bottom: 1px solid var(--border); padding: 12px 0; }
.glossary-term h3 { margin-bottom: 2px; }

.timer-modes { display: flex; flex-wrap: wrap; gap: 8px; }

/* Bottom mobile nav */
#bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
#bottom-nav a { flex: 1; text-align: center; font-size: 0.68rem; color: var(--muted); padding: 4px 2px; }
#bottom-nav a.active { color: var(--accent); }
#bottom-nav .bn-icon { display: block; font-size: 1.05rem; margin-bottom: 2px; }

@media (max-width: 880px) {
  #sidenav { position: fixed; left: -280px; top: var(--header-h); height: calc(100vh - var(--header-h)); z-index: 45; transition: left .2s; box-shadow: var(--shadow); padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  #sidenav.open { left: 0; }
  #menu-toggle { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 10px; font-size: 1.15rem; }
  main#view { padding: 16px 14px calc(90px + env(safe-area-inset-bottom)); }
  #bottom-nav { display: flex; }
  #bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; }
  #search-box { max-width: 140px; min-height: 44px; }
  #theme-toggle { min-width: 44px; min-height: 44px; }
  .hero { padding: 20px 16px; }
  /* readable tables on small screens: scroll instead of squeeze */
  .card { overflow-x: auto; }
  table { min-width: 430px; }
  .table-card, .diagram-box { overflow-x: auto; }
  .formula-box, .extra-notes, .exam-tip, .mistake-box { overflow-wrap: anywhere; }
}

@media (min-width: 881px) {
  #search-box { max-width: 260px; }
}

::selection { background: var(--brass); color: #1c1408; }

.kbd { font-family: var(--font-mono); background: var(--steel-2); border-radius: 4px; padding: 1px 6px; font-size: 0.82em; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 44; display: none; }
.scrim.show { display: block; }

/* ---------- Study Plan ---------- */
.plan-exam-card input[type="date"] {
  font-family: inherit; font-size: 1rem; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  min-height: 44px; /* comfortable touch target */
}
.plan-exam-card input[type="date"] { max-width: 220px; width: 100%; }
.countdown-row { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end; }
.countdown-num { font-size: 2.2rem; font-weight: 800; color: var(--accent); line-height: 1; }
.plan-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.plan-day { display: flex; flex-direction: column; }
.plan-day-today { border-color: var(--accent); border-width: 2px; padding: 15px; }
.plan-block {
  display: flex; align-items: flex-start; gap: 8px; text-decoration: none; color: var(--ink);
  padding: 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px;
  font-size: 0.85rem; background: var(--paper-2); transition: border-color .15s;
}
.plan-block:hover { border-color: var(--accent); text-decoration: none; }
.plan-check {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 6px; margin-top: 1px;
  border: 1.5px solid var(--steel); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; color: var(--accent);
}
.plan-block-done { opacity: 0.62; }
.plan-block-done .plan-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.plan-block-done strong { text-decoration: line-through; }
.plan-block-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-kind { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--brass-2); }
.plan-why { font-size: 0.72rem; }
.plan-weak-table td { vertical-align: middle; }
.weakness-bar {
  flex: 1 1 90px; min-width: 70px; height: 8px; border-radius: 6px; background: var(--steel-2); overflow: hidden;
}
.weakness-fill { display: block; height: 100%; border-radius: 6px; }
.weakness-critical { background: var(--danger); }
.weakness-weak { background: var(--warn); }
.weakness-shaky { background: var(--brass); }
.weakness-steady { background: var(--ok); }

/* ---------- Home: exam chip, focus card, goal ring ---------- */
.exam-chip {
  display: inline-flex; align-items: center; gap: 6px; position: relative;
  margin-top: 12px; padding: 7px 14px; border-radius: 20px; font-size: 0.85rem;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.4); color: #fff;
}
.exam-chip:hover { background: rgba(255,255,255,0.28); text-decoration: none; }
.exam-chip strong { font-size: 1rem; }
.focus-card { border-left: 4px solid var(--brass); }
.goal-ring { width: 92px; height: 92px; flex: 0 0 auto; transform: rotate(-90deg); }
.goal-ring-bg { fill: none; stroke: var(--steel-2); stroke-width: 7; }
.goal-ring-fg {
  fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round;
  transition: stroke-dashoffset .5s ease;
}
.goal-ring-done .goal-ring-fg { stroke: var(--brass); }
.goal-ring-text { font-size: 15px; font-weight: 700; fill: var(--ink); transform: rotate(90deg); transform-origin: 32px 32px; }

/* ---------- Toast notifications ---------- */
#toast-root { position: fixed; bottom: calc(70px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
@media (min-width: 881px) { #toast-root { bottom: 24px; } }
.toast {
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 10px;
  font-size: 0.88rem; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease; max-width: 100%;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--accent); color: #fff; }
.toast-danger { background: var(--danger); color: #fff; }

/* ---------- Exam trend chart ---------- */
.exam-chart { width: 100%; height: auto; margin-bottom: 10px; }
.ec-grid { stroke: var(--steel-2); stroke-width: 1; }
.ec-axis { stroke: var(--steel); stroke-width: 1.5; }
.ec-label { font-size: 10px; fill: var(--muted); font-family: var(--font-mono); }
.ec-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ec-area { fill: var(--accent); opacity: 0.10; }
.ec-dot { fill: var(--accent); }
.ec-dot-low { fill: var(--danger); }

/* ---------- Reduced motion & print extras ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media print {
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
  .exam-chart, .goal-ring { max-width: 400px; }
}
