/* ---------- Tokens: one calm palette (sage + warm neutrals) ---------- */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --border: #e2dfd6;
  --text: #2b2d2a;
  --muted: #6d716a;
  --accent: #4f7a6a;
  --accent-soft: #e2ece7;
  --accent-text: #ffffff;
  --warn: #b7793a;
  --danger: #b45a52;
  --success: #4f7a6a;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 16px rgb(0 0 0 / .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  --nav-w: 220px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  --bg: #171a19;
  --surface: #1f2321;
  --surface-2: #272c29;
  --border: #323834;
  --text: #e6e8e3;
  --muted: #9aa19a;
  --accent: #7fb09c;
  --accent-soft: #2a3a33;
  --accent-text: #11201a;
  --warn: #d6a066;
  --danger: #d8847c;
  --success: #7fb09c;
  --shadow: 0 1px 2px rgb(0 0 0 / .3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: .9375rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 600; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, ::backdrop { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.main { padding: 32px clamp(16px, 4vw, 48px) 48px; max-width: 1100px; width: 100%; outline: none; }

.nav {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 600; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.theme-toggle { justify-content: flex-start; }
.nav-more { display: none; }
.nav-more .nav-link { border: 0; background: none; font-family: inherit; color: var(--muted); cursor: pointer; }
@media (max-width: 760px) { .nav-more { display: list-item; list-style: none; } }
.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.more-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); text-decoration: none; font-size: .85rem; }
.more-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* Mobile: bottom tab bar */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 96px; }
  .nav {
    position: fixed; inset: auto 0 0 0; height: auto; z-index: 10;
    flex-direction: row; align-items: center; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
  }
  .brand { display: none; }
  .nav-list { flex-direction: row; justify-content: space-around; }
  .nav-link { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: .7rem; }
  .theme-toggle .label { display: none; }
}

/* ---------- Components ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header p { color: var(--muted); margin: 0; }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card-link { color: inherit; text-decoration: none; display: block; transition: transform .15s var(--ease), border-color .15s; }
.card-link svg { width: 24px; height: 24px; }
.card-link:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .muted, .muted { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.label { font-size: .85rem; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .75rem; background: var(--surface-2); color: var(--muted); }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty svg { width: 36px; height: 36px; opacity: .6; margin-bottom: 8px; }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .5s var(--ease); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) { .toast { bottom: 88px; } }

.fade-in { animation: fade-in .25s var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Shared bits (stages 2–5) ---------- */
.small { font-size: .85rem; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.between { justify-content: space-between; }
.mono { font-family: var(--mono); }
.toast { display: flex; align-items: center; gap: 12px; }
.toast.show { pointer-events: auto; }
.toast-action { background: none; border: 0; color: var(--accent-soft); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
[data-theme="dark"] .toast-action { color: var(--accent-text); }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-flex; align-items: center; gap: 4px; }
.badge svg { width: 12px; height: 12px; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge-danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 4px; }
.check-field { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check-field input { width: 18px; height: 18px; accent-color: var(--accent); }
.textarea { resize: vertical; min-height: 60px; }
.select-sm { width: auto; padding: 6px 10px; font-size: .85rem; }

/* Dialog */
.dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--text); width: min(480px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgb(0 0 0 / .2);
}
.dialog::backdrop { background: rgb(20 24 22 / .35); backdrop-filter: blur(2px); }
.dialog[open] { animation: fade-in .2s var(--ease); }
.dialog-form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }

/* Stat tiles */
.stats-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 24px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.tile-head { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: .85rem; font-weight: 500; }
.tile-head span { color: var(--muted); }
.tile-value { font-size: 1.45rem; font-weight: 600; letter-spacing: -.01em; }
.tile p { margin: 0; }

/* Tabs & chips */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 500; padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chips:empty { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 99px; padding: 2px 10px; font: inherit; font-size: .8rem; cursor: pointer;
}
.chip:hover, .chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .select { width: auto; }
.search { position: relative; flex: 1; min-width: 180px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search .input { padding-left: 34px; }

/* Round check button (plans, notes, words, stuck) */
.check {
  width: 24px; height: 24px; flex: none; border-radius: 50%; padding: 0; cursor: pointer;
  border: 1.6px solid var(--border); background: transparent; color: transparent;
  display: grid; place-items: center; transition: background .2s, border-color .2s, color .2s;
}
.check svg { width: 14px; height: 14px; stroke-width: 2.6; }
.check:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 45%, transparent); }
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.just-done .check { animation: pop .4s var(--ease); }
.just-done { animation: glow .9s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes glow { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

/* Plan */
.quote { margin: 0 0 20px; padding: 14px 18px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.quote blockquote { margin: 0; font-style: italic; }
.quote figcaption { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.week-nav { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.week-label { min-width: 190px; text-align: center; }
.week { display: flex; flex-direction: column; gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.day.past { opacity: .85; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-head > div { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.day-name { font-weight: 600; }
.day-date { color: var(--muted); font-size: .85rem; }
.day-empty { color: var(--muted); font-size: .85rem; margin: 2px 0 0; }
.plan-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.plan-item { display: flex; align-items: center; gap: 12px; padding: 6px 6px; border-radius: var(--radius-sm); }
.plan-item:hover { background: var(--surface-2); }
.plan-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-title {
  width: fit-content; max-width: 100%;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 55% / 0 1.5px;
  transition: background-size .35s var(--ease), color .3s;
}
.plan-item.done .plan-title { background-size: 100% 1.5px; color: var(--muted); }
.plan-meta { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Notes */
.section-title { display: flex; align-items: center; gap: 8px; font-size: .95rem; color: var(--muted); font-weight: 600; margin: 4px 0 10px; }
.section-title .count { font-size: .75rem; background: var(--surface-2); border-radius: 99px; padding: 0 8px; }
.attention .section-title { color: var(--accent); }
.note-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.note-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; border-left-width: 3px; }
.note-card.note-prio-high { border-left-color: var(--danger); }
.note-card.note-prio-med { border-left-color: var(--warn); }
.note-card.note-prio-low { border-left-color: var(--border); }
.note-card.done { opacity: .6; }
.note-card.done .note-title { text-decoration: line-through; }
.note-top { display: flex; align-items: center; gap: 10px; }
.note-title { flex: 1; margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.note-body { margin: 0; color: var(--muted); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prio { font-size: .75rem; font-weight: 600; }
.prio-high { color: var(--danger); }
.prio-med { color: var(--warn); }
.prio-low { color: var(--muted); }
.muted-section { opacity: .9; }
.compact { gap: 10px; }

/* English */
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.inline-form .field { min-width: 110px; }
.inline-form .field.grow { flex: 1; min-width: 180px; }
.stack-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.list-card { padding: 14px 16px; }
.list { list-style: none; margin: 0; padding: 0; }
ul.card.list { padding: 6px 12px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.done .word-text, .list-item.done .stuck-text { color: var(--muted); text-decoration: line-through; }
.word-example { color: var(--muted); font-style: italic; font-size: .9rem; margin-top: 2px; }
.dots { display: flex; gap: 6px; }
.dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; background: var(--surface-2); color: var(--muted); }
.dot.on { background: var(--accent); color: var(--accent-text); }
.dot.today { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Home */
.home-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.card-head { margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.quick-add { display: flex; gap: 8px; margin-top: 12px; }
.home-grid .note-card { box-shadow: none; }

/* Code */
.ide { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 16px; align-items: start; }
.ide-files { padding: 14px; position: sticky; top: 16px; }
.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.file-row { display: flex; align-items: center; border-radius: var(--radius-sm); }
.file-row.active { background: var(--accent-soft); }
.file-row .icon-btn { width: 28px; height: 28px; }
.file-open {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border: 0; background: none; color: inherit; font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.file-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-open svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.file-row.active .file-open { color: var(--accent); font-weight: 500; }
.ide-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ide-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.file-name { font-family: var(--mono); }
.editor-card { padding: 0; overflow: hidden; }
.editor-host { height: max(320px, 52vh); }
.code-fallback {
  width: 100%; height: 100%; border: 0; padding: 12px 16px; resize: none; outline: none;
  background: var(--surface); color: var(--text); font-family: var(--mono); line-height: 1.5; tab-size: 4;
}
.output-card { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.output {
  margin: 0; min-height: 90px; max-height: 300px; overflow: auto; padding: 10px 12px;
  background: var(--surface-2); border-radius: var(--radius-sm); font: .9rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.output:empty::before { content: 'Run your code to see output here.'; color: var(--muted); }
.out-err { color: var(--danger); }
.stdin summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.stdin .textarea { margin-top: 6px; }

@media (max-width: 760px) {
  .ide { grid-template-columns: 1fr; }
  .ide-files { position: static; }
  .editor-host { height: 50vh; }
  .week-label { min-width: 0; flex: 1; }
  .inline-form .field, .inline-form .field.grow { min-width: 100%; }
  .inline-form .btn { width: 100%; }
}

/* ---------- Sync status bar ---------- */
.content { min-width: 0; display: flex; flex-direction: column; }
.sync-bar {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 10px clamp(16px, 4vw, 48px) 0; max-width: 1100px; width: 100%;
  font-size: .8rem; color: var(--muted); min-height: 38px;
}
.sync-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sync-bar .btn-sm { padding: 3px 10px; flex: none; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.sync-bar[data-state="ok"] .sync-dot { background: var(--success); }
.sync-bar[data-state="busy"] .sync-dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
.sync-bar[data-state="warn"] .sync-dot { background: var(--danger); }
.sync-bar[data-state="warn"] { color: var(--danger); }
.sync-bar + .main { padding-top: 12px; }
@keyframes pulse { 50% { opacity: .3; } }
@media (max-width: 760px) {
  .sync-bar { padding: 8px 16px 0; justify-content: space-between; }
  .nav { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
}

/* Self-check table */
.check-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.check-table th, .check-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.check-table th { color: var(--muted); font-weight: 500; }
.check-table .ok { color: var(--success); font-weight: 600; }
.check-table .bad { color: var(--danger); font-weight: 600; }
.check-table .err { color: var(--danger); font-size: .8rem; }
.table-wrap { overflow-x: auto; }

/* ================= v0.5: look & feel ================= */
/* Accent choices (soft accent derives from the accent itself) */
:root { --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
[data-accent="teal"]  { --accent: #2f7a80; }  [data-theme="dark"][data-accent="teal"]  { --accent: #7cbcc0; }
[data-accent="blue"]  { --accent: #4a6c9b; }  [data-theme="dark"][data-accent="blue"]  { --accent: #93b1da; }
[data-accent="plum"]  { --accent: #7a5a8a; }  [data-theme="dark"][data-accent="plum"]  { --accent: #bfa0cf; }
[data-accent="rose"]  { --accent: #a85a66; }  [data-theme="dark"][data-accent="rose"]  { --accent: #dc9aa4; }
[data-accent="amber"] { --accent: #a57630; }  [data-theme="dark"][data-accent="amber"] { --accent: #d9ac6a; }
[data-theme="dark"] { --accent-text: #121614; }

/* One soft color per section */
:root {
  --c-home: var(--accent); --c-plan: #4f7a6a; --c-routines: #2f7a80; --c-notes: #a57630; --c-english: #4a6c9b;
  --c-uni: #7a5a8a; --c-gym: #a85a66; --c-datacamp: #3f8a5a; --c-ide: #5a6472; --c-settings: #6d716a; --c-course: #7a5a8a;
}
[data-theme="dark"] {
  --c-plan: #8fbfa9; --c-routines: #7cbcc0; --c-notes: #d9ac6a; --c-english: #93b1da;
  --c-uni: #bfa0cf; --c-gym: #dc9aa4; --c-datacamp: #8fcca2; --c-ide: #a7b0bd; --c-settings: #a3a8a0; --c-course: #bfa0cf;
}
.nav-link[data-path] { --sec: var(--c-home); }
.nav-link[data-path="plan"] { --sec: var(--c-plan); } .nav-link[data-path="routines"] { --sec: var(--c-routines); }
.nav-link[data-path="notes"] { --sec: var(--c-notes); } .nav-link[data-path="english"] { --sec: var(--c-english); }
.nav-link[data-path="uni"] { --sec: var(--c-uni); } .nav-link[data-path="gym"] { --sec: var(--c-gym); }
.nav-link[data-path="datacamp"] { --sec: var(--c-datacamp); } .nav-link[data-path="ide"] { --sec: var(--c-ide); }
.nav-link[data-path="settings"] { --sec: var(--c-settings); }
.nav-link[aria-current="page"] { color: var(--sec); background: color-mix(in srgb, var(--sec) 13%, transparent); }
.nav-link svg { color: color-mix(in srgb, var(--sec) 75%, var(--muted)); }
.main[data-section] { --sec: var(--accent); }
.main[data-section="plan"] { --sec: var(--c-plan); } .main[data-section="routines"] { --sec: var(--c-routines); }
.main[data-section="notes"] { --sec: var(--c-notes); } .main[data-section="english"] { --sec: var(--c-english); }
.main[data-section="uni"] { --sec: var(--c-uni); } .main[data-section="gym"] { --sec: var(--c-gym); }
.main[data-section="datacamp"] { --sec: var(--c-datacamp); } .main[data-section="ide"] { --sec: var(--c-ide); }
.main[data-section="settings"] { --sec: var(--c-settings); }
.sec-badge {
  display: inline-grid; place-items: center; width: 34px; height: 34px; margin-right: 10px; vertical-align: -6px;
  border-radius: 10px; color: var(--sec); background: color-mix(in srgb, var(--sec) 14%, var(--surface));
}
.sec-badge svg { width: 19px; height: 19px; }
.main[data-section] .progress > span { background: var(--sec); }

/* Compact layout */
[data-density="compact"] .card { padding: 14px; }
[data-density="compact"] .stack, [data-density="compact"] .grid, [data-density="compact"] .home-grid, [data-density="compact"] .stats-row { gap: 10px; }
[data-density="compact"] .page-header { margin-bottom: 14px; }
[data-density="compact"] .main { padding-top: 16px; }
[data-density="compact"] .plan-item { padding: 3px 6px; }
[data-density="compact"] .stats-row { margin-bottom: 14px; }

/* Chip pickers */
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem;
  padding: 5px 12px; border-radius: 99px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.choice:hover { color: var(--text); }
.choice:active { transform: scale(.96); }
.choice[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 500; }
.choice svg { width: 18px; height: 18px; }
.choice.swatch { width: 30px; height: 30px; padding: 0; background: var(--sw); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.choice.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--sw); }
.pref-row { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pref-label { font-weight: 500; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--sec, var(--accent)); }

/* Weekly routine grid */
.week-grid { width: 100%; border-collapse: collapse; font-size: .9rem; }
.week-grid th, .week-grid td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--border); }
.week-grid th { font-weight: 500; color: var(--muted); font-size: .8rem; }
.week-grid th small { display: block; font-size: .75rem; }
.week-grid .is-today { background: color-mix(in srgb, var(--sec) 8%, transparent); }
.week-grid th.is-today { color: var(--sec); }
.week-grid .wg-task { text-align: left; min-width: 140px; }
.week-grid .wg-task small { display: block; color: var(--muted); }
.week-grid .check { margin: 0 auto; }
.wg-off { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--border); }
.week-grid tbody tr:last-child td { border-bottom: 0; }

/* Home dashboard */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.hero h1 { font-size: 1.8rem; margin: 2px 0 6px; }
.quote-line { margin: 0; max-width: 60ch; font-size: .9rem; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .8s var(--ease); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ring-label strong { font-size: 1.05rem; }
.ring-label span { font-size: .7rem; color: var(--muted); }
.dashboard { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.widget { border-top: 3px solid color-mix(in srgb, var(--w, var(--accent)) 55%, transparent); animation: rise .35s var(--ease) both; }
.widget:nth-child(2) { animation-delay: .04s; } .widget:nth-child(3) { animation-delay: .08s; } .widget:nth-child(4) { animation-delay: .12s; } .widget:nth-child(n+5) { animation-delay: .16s; }
.w-today { --w: var(--c-plan); } .w-routines { --w: var(--c-routines); } .w-uni { --w: var(--c-uni); }
.w-gym { --w: var(--c-gym); } .w-notes { --w: var(--c-notes); } .w-datacamp { --w: var(--c-datacamp); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 760px) {
  .hero h1 { font-size: 1.45rem; }
  .ring { width: 68px; height: 68px; }
  .nav-list li { flex: 1; }
  .nav-list .nav-extra { display: none; }
  .nav-link { min-width: 0; width: 100%; }
  .nav-more .nav-link[data-active] { color: var(--accent); }
  .theme-toggle { display: none; }
}
.week-grid th:first-child { text-align: left; }

/* ================= University ================= */
.section-title { margin-top: 24px; }
.timetable { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 10px; align-items: start; }
.timetable > .empty { grid-column: 1 / -1; }
.tt-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.tt-day > header { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: .9rem; padding: 2px 4px; }
.tt-day.today { border-color: var(--sec); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 15%, transparent); }
.lesson {
  position: relative; border-radius: 10px; padding: 10px 34px 10px 12px;
  background: color-mix(in srgb, var(--course) 12%, var(--surface)); border-left: 4px solid var(--course);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.lesson:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.lesson.now { box-shadow: 0 0 0 2px var(--course); }
.lesson-link { display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.lesson-time { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-name { display: flex; align-items: center; gap: 6px; line-height: 1.25; }
.lesson-room { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); }
.lesson-room svg { width: 13px; height: 13px; }
.lesson-edit { position: absolute; top: 4px; right: 2px; width: 28px; height: 28px; opacity: .5; }
.lesson:hover .lesson-edit, .lesson-edit:focus-visible { opacity: 1; }
.course-ico {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
  color: var(--course); background: color-mix(in srgb, var(--course) 16%, var(--surface));
}
.course-ico svg { width: 19px; height: 19px; }
.course-ico.sm { width: 22px; height: 22px; border-radius: 6px; } .course-ico.sm svg { width: 14px; height: 14px; }
.course-ico.lg { width: 64px; height: 64px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); } .course-ico.lg svg { width: 32px; height: 32px; }
.course-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.course-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, transform .15s var(--ease);
}
.course-card:hover { border-color: var(--course); transform: translateY(-1px); }
.course-card > .grow { display: flex; flex-direction: column; min-width: 0; }
.course-card > svg { color: var(--muted); width: 18px; }
.lesson-list, .deadline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lesson-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: inherit; background: color-mix(in srgb, var(--course) 9%, var(--surface)); }
.lesson-chip > .grow { display: flex; flex-direction: column; min-width: 0; }
.lesson-chip.now { box-shadow: inset 0 0 0 2px var(--course); }
.deadline-list a { display: flex; align-items: center; gap: 10px; padding: 6px 4px; color: inherit; text-decoration: none; border-radius: 8px; }
.deadline-list a:hover { background: var(--surface-2); }
.dl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--course); flex: none; }
/* Course page */
.course-page { --sec: var(--course); }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; margin-bottom: 10px; }
.back-link svg { width: 16px; height: 16px; }
.course-banner {
  display: flex; align-items: center; gap: 18px; padding: 22px; margin-bottom: 18px; border-radius: 18px; flex-wrap: wrap;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--course) 28%, transparent), transparent 60%),
    color-mix(in srgb, var(--course) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--course) 25%, var(--border));
  animation: rise .35s var(--ease) both;
}
.course-banner h1 { margin: 0 0 4px; font-size: 1.6rem; }
.banner-meta { margin: 0; color: var(--muted); font-size: .88rem; white-space: pre-wrap; }
.course-page .tab[aria-selected="true"] { color: var(--course); }
.course-page .btn-primary { background: var(--course); border-color: var(--course); }
.course-page .check[aria-pressed="true"] { background: var(--course); border-color: var(--course); }
.course-note { cursor: pointer; border-left: 3px solid var(--course); }
.course-note:hover { box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--course) 40%, transparent); }
@media (max-width: 900px) {
  .timetable { grid-template-columns: 1fr; }
  .tt-day { min-height: 0; }
}

/* ================= Files ================= */
.file-panel { display: flex; flex-direction: column; gap: 12px; }
.dropzone {
  display: flex; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--border); border-radius: var(--radius);
  cursor: pointer; color: var(--muted); transition: border-color .15s, background .15s;
}
.dropzone svg { width: 26px; height: 26px; color: var(--sec, var(--accent)); }
.dropzone strong { color: var(--text); }
.dropzone:hover, .dropzone.over { border-color: var(--sec, var(--accent)); background: color-mix(in srgb, var(--sec, var(--accent)) 6%, transparent); }
.uploads { display: flex; flex-direction: column; gap: 8px; }
.uploads:empty { display: none; }
.upload-row { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.upload-row.failed { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.upload-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-error { color: var(--danger); font-size: .85rem; }
.rot45 svg { transform: rotate(45deg); }
.file-items { list-style: none; margin: 0; padding: 0; }
.file-item { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--border); }
.file-item:last-child { border-bottom: 0; }
.file-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 4px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.file-link:hover .file-name-text { color: var(--sec, var(--accent)); text-decoration: underline; }
.file-link .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-ico { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2); color: var(--muted); flex: none; }
.file-ico svg { width: 16px; height: 16px; }
.empty-files { padding: 6px 0; }
@media (max-width: 760px) {
  .course-banner { padding: 16px; gap: 12px; }
  .course-banner h1 { font-size: 1.3rem; }
  .course-ico.lg { width: 50px; height: 50px; border-radius: 14px; }
}

/* ================= Gym ================= */
.workout { display: flex; flex-direction: column; gap: 8px; }
.bars { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 110px; margin: 10px 0 4px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bar > span { width: 100%; max-width: 28px; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--sec) 35%, var(--surface-2)); transition: height .6s var(--ease); }
.bar.current > span { background: var(--sec); }
.bar small { font-size: .7rem; color: var(--muted); }
.program { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.program-day { padding: 14px 16px; border-top: 3px solid color-mix(in srgb, var(--sec) 45%, transparent); }
.program-day.today { border-top-color: var(--sec); }
.ex-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: .9rem; }
.ex-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.ex-list li:last-child { border-bottom: 0; }
.ex-head, .ex-row { display: grid; grid-template-columns: minmax(0, 1fr) 50px 76px 72px 32px; gap: 6px; align-items: center; }
.ex-row .ex-note { grid-column: 1 / -1; padding: 5px 8px; font-size: .82rem; margin-bottom: 4px; }
.ex-note-text { display: block; color: var(--muted); font-size: .78rem; }
.ex-dose { white-space: nowrap; font-size: .85rem; }
.import-day { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border-left: 3px solid var(--sec, var(--accent)); }
.import-day p { margin: 4px 0 0; }
.ex-rows { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.ex-row .input { padding: 7px 8px; }
.dialog:has(.ex-rows) { width: min(560px, calc(100vw - 24px)); }
@media (max-width: 480px) {
  /* Phone: exercise name on its own line, then sets · reps · kg · delete */
  .ex-head { grid-template-columns: 1fr 1.3fr 1.2fr 32px; gap: 4px; }
  .ex-head span:first-child { display: none; }
  .ex-row { grid-template-columns: 1fr 1.3fr 1.2fr 32px; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
  .ex-row:first-child { border-top: 0; padding-top: 0; }
  .ex-row .ex-name { grid-column: 1 / -1; font-weight: 500; }
}
.main[data-section] .check[aria-pressed="true"] { background: var(--sec); border-color: var(--sec); }
@media (max-width: 760px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stats-row .tile { padding: 14px; }
  .stats-row .tile-value { font-size: 1.15rem; }
  .stats-row .tile:first-child { grid-column: 1 / -1; }
  .dots { gap: 4px; }
  .dot { width: 22px; height: 22px; }
}

/* ================= DataCamp ================= */
.dc-week { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.dc-day { padding: 14px 16px; }
.dc-day.today { border-color: var(--sec); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 14%, transparent); }
.dc-courses { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.dc-course { display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .15s var(--ease), border-color .15s; }
.dc-course:hover { transform: translateY(-2px); border-color: var(--sec); }
.dc-course h3 { margin: 0; font-size: 1.05rem; }
.dc-course .progress { flex: 1; }
.dc-course .pct { font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.dc-course.status-done { background: color-mix(in srgb, var(--sec) 6%, var(--surface)); }
.dc-note { cursor: pointer; border-left: 3px solid var(--sec); }
.type-career { background: color-mix(in srgb, var(--c-uni) 16%, var(--surface)); color: var(--c-uni); }
.type-skill { background: color-mix(in srgb, var(--c-english) 16%, var(--surface)); color: var(--c-english); }
.status-chip { font-size: .75rem; font-weight: 600; }
.s-todo { color: var(--muted); } .s-doing { color: var(--warn); } .s-done { color: var(--sec); }

/* ================= Drive, previews, attachments ================= */
.drive-status { display: flex; align-items: center; gap: 8px; }
.drive-status[data-state="ok"] .sync-dot { background: var(--success); }
.drive-status[data-state="busy"] .sync-dot { background: var(--accent); animation: pulse 1.2s infinite; }
.drive-status[data-state="warn"] .sync-dot { background: var(--danger); }
.dropzone.compact { padding: 10px 12px; gap: 10px; }
.dropzone.compact svg { width: 20px; height: 20px; }
.cam-btn { margin-left: auto; }
@media (hover: hover) and (pointer: fine) { .cam-btn { display: none; } }
.dialog.preview { width: min(920px, calc(100vw - 24px)); }
.preview-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.preview-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-body { padding: 14px; display: grid; place-items: center; min-height: 200px; }
.preview-body img { max-width: 100%; max-height: 72vh; border-radius: var(--radius-sm); }
.preview-body iframe { width: 100%; height: 72vh; border: 0; border-radius: var(--radius-sm); background: var(--surface-2); }
.preview-loading img { max-width: 240px; filter: blur(2px); opacity: .7; }
.preview-loading svg { width: 40px; height: 40px; color: var(--muted); }
.thumb { border: 1px solid var(--border); background: var(--surface-2); padding: 0; cursor: pointer; border-radius: 8px; overflow: hidden; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: inherit; font-size: .78rem; transition: transform .12s var(--ease), border-color .12s; }
.thumb:hover { border-color: var(--sec, var(--accent)); transform: translateY(-1px); }
.thumb img { display: block; object-fit: cover; }
.thumb-sm img { width: 40px; height: 40px; }
.thumb-sm.no-img { height: 40px; padding: 0 10px 0 8px; max-width: 180px; }
.thumb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-ico svg { width: 16px; height: 16px; }
.thumb-lg { width: 100%; aspect-ratio: 1; }
.thumb-lg img { width: 100%; height: 100%; }
.thumb-lg.no-img { justify-content: center; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.photo { position: relative; }
.photo-del { position: absolute; top: 4px; right: 4px; background: color-mix(in srgb, var(--surface) 85%, transparent); opacity: 0; transition: opacity .15s; }
.photo:hover .photo-del, .photo-del:focus-visible { opacity: 1; }
@media (hover: none) { .photo-del { opacity: 1; } }
img.file-ico { object-fit: cover; padding: 0; }
.att-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.att-count { display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; color: var(--muted); }
.att-count svg { width: 13px; height: 13px; }
.ex-list li { align-items: center; }
.ex-clip { width: 28px; height: 28px; margin-left: 2px; }
.ex-clip svg { width: 15px; height: 15px; }
.note-card .att-strip { margin-top: 0; }
/* DataCamp course page */
.dc-page { --course: var(--c-datacamp); --sec: var(--c-datacamp); }
.dc-banner h1 { margin: 6px 0; }
.banner-progress { max-width: 420px; }
.banner-progress .progress { flex: 1; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.banner-progress .progress > span { background: var(--c-datacamp); }
a.dc-course { color: inherit; text-decoration: none; }
.range { flex: 1; accent-color: var(--sec); }
.dc-page .deadline-list a { --course: var(--c-datacamp); }

/* ================= Motion (subtle; all disabled by prefers-reduced-motion above) ================= */
/* Page transition: fade + short slide */
.fade-in { animation: page-in .28s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Cards rise in, lightly staggered (only on navigation, not on live refreshes) */
.fade-in .card, .fade-in .tt-day, .fade-in .course-card, .fade-in .day { animation: rise .38s var(--ease) both; }
.fade-in .card:nth-of-type(2), .fade-in .day:nth-of-type(2), .fade-in .tt-day:nth-of-type(2) { animation-delay: .04s; }
.fade-in .card:nth-of-type(3), .fade-in .day:nth-of-type(3), .fade-in .tt-day:nth-of-type(3) { animation-delay: .08s; }
.fade-in .card:nth-of-type(n+4), .fade-in .day:nth-of-type(n+4), .fade-in .tt-day:nth-of-type(n+4) { animation-delay: .12s; }
/* Press feedback */
.btn:active, .icon-btn:active, .chip:active, .tab:active, .check:active { transform: scale(.96); }
.icon-btn, .chip, .tab { transition: background .15s, color .15s, transform .1s; }
/* Soft check: pop + the tick draws itself */
.just-done .check svg path { stroke-dasharray: 24; animation: draw .35s var(--ease) both; }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
/* Progress bars fill on appear, then glide on change */
.fade-in .progress > span, .widget .progress > span { transform-origin: left center; animation: fill .7s var(--ease) both; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ring-fg { animation: ring .9s var(--ease) both; }
@keyframes ring { from { stroke-dashoffset: var(--c); } }
/* Dialogs scale in */
.dialog[open] { animation: dialog-in .22s var(--ease) both; }
.dialog[open]::backdrop { animation: fade .22s ease both; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
/* Uploads / thumbnails appear gently */
.upload-row, .file-item, .photo, .thumb { animation: page-in .25s var(--ease) both; }
@media (max-width: 760px) {
  .fade-in .card:nth-of-type(n), .fade-in .day:nth-of-type(n), .fade-in .tt-day:nth-of-type(n) { animation-duration: .3s; }
}

/* ================= Photos: carousel, rows, chips, viewer ================= */
.media { position: relative; width: 100%; max-width: 480px; margin-top: 4px; }
.media-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  border-radius: 14px; background: var(--surface-2); overscroll-behavior-x: contain;
}
.media-track::-webkit-scrollbar { display: none; }
.media-slide { flex: 0 0 100%; scroll-snap-align: center; position: relative; aspect-ratio: var(--ar, 4/3); max-height: 60vh; cursor: zoom-in; overflow: hidden; }
.media-slide img, .mini img, .viewer-slide img { position: absolute; inset: 0; width: 100%; height: 100%; }
.media-slide img, .mini img { object-fit: cover; }
.ph { filter: blur(10px); transform: scale(1.06); }
.ph-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); filter: none; transform: none; }
.ph-empty svg { width: 28px; height: 28px; opacity: .6; }
img.full { opacity: 0; transition: opacity .3s var(--ease); }
.loading img.full { opacity: 0; } :not(.loading) > img.full { opacity: 1; }
.media-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
.media-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--border); transition: background .2s, transform .2s; }
.media-dots span.on { background: var(--sec, var(--accent)); transform: scale(1.2); }
.media-count { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 99px; font-size: .72rem; color: #fff; background: rgb(0 0 0 / .45); }
.media-retry {
  position: absolute; inset: auto 10px 10px 10px; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px; border: 0; border-radius: 10px; font: inherit; font-size: .82rem; color: #fff; background: rgb(0 0 0 / .55); cursor: pointer;
}
.media-retry svg { width: 16px; height: 16px; }
.media-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mini { position: relative; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; flex: none; }
.mini .media-retry { inset: 0; border-radius: 0; padding: 0; font-size: 0; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 5px 10px 5px 8px; border-radius: 99px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .8rem; cursor: pointer;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.file-chip:hover { border-color: var(--sec, var(--accent)); }
.att-media { margin-top: 2px; }
.list-item > .grow .att-row, .plan-body + .att-row { flex-basis: 100%; }
.plan-item, .list-item { flex-wrap: wrap; }
.plan-item > .att-row, .list-item > .att-row { order: 9; flex-basis: 100%; padding-left: 36px; margin-top: 0; }
body.no-scroll { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 100; background: #000; display: flex; flex-direction: column; animation: fade .18s ease both;
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: #fff; }
.viewer:not([open]) { display: none; }
.viewer::backdrop { background: #000; }
.viewer.closing { opacity: 0; transition: opacity .15s; }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; color: #fff; }
.viewer-count { font-size: .9rem; opacity: .85; }
.viewer-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer-btn svg { width: 20px; height: 20px; } .viewer-btn:last-child svg { transform: rotate(45deg); }
.viewer-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-track.zoomed { overflow: hidden; }
.viewer-slide { flex: 0 0 100%; scroll-snap-align: center; position: relative; touch-action: pan-x; overflow: hidden; }
.viewer-track.zoomed .viewer-slide { touch-action: none; }
.viewer-slide img { object-fit: contain; transform-origin: center; transition: transform .05s linear; }
.viewer-slide .ph { object-fit: contain; }
@media (prefers-reduced-motion: reduce) { .viewer-slide img { transition: none; } }

/* ================= Music ================= */
body.in-music {
  --bg: #121413; --surface: #1b1e1d; --surface-2: #252a28; --border: #2e3431; --text: #e8eae6; --muted: #9aa19a;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent); --shadow: none;
  background: var(--bg); color: var(--text); color-scheme: dark;
}
body.in-music .app, body.in-music .main { background: var(--bg); }
.music { padding-bottom: 24px; }
.music h1 { font-size: 1.6rem; margin: 4px 0 16px; }
.music section { margin-top: 22px; }
.music-nav { display: none; }
@media (max-width: 760px) {
  body.in-music .nav { display: none; }
  .music-nav {
    display: flex; position: fixed; inset: auto 0 0 0; z-index: 11; justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(transparent, var(--bg) 30%); backdrop-filter: blur(6px);
  }
  .music-nav-link { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px; font-size: .7rem; color: var(--muted); text-decoration: none; }
  .music-nav-link[aria-current="page"] { color: var(--text); }
  .music-nav-link[aria-current="page"] svg { color: var(--accent); }
}
@media (min-width: 761px) {
  .music { padding-top: 40px; }
  .music-nav { display: flex; gap: 6px; position: fixed; top: 12px; right: 24px; z-index: 11; background: var(--surface); padding: 4px; border-radius: 99px; }
  .music-nav-link { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 99px; color: var(--muted); text-decoration: none; }
  .music-nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--text); }
}
.m-cover { width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.m-cover.sm { width: 48px; height: 48px; flex: none; border-radius: 6px; }
.m-cover.lg { width: min(42vw, 180px); flex: none; box-shadow: 0 8px 30px rgb(0 0 0 / .45); }
.m-cover.round { border-radius: 50%; }
.m-cover.mosaic { display: grid; grid-template-columns: 1fr 1fr; }
.m-cover.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.liked-cover { background: linear-gradient(135deg, var(--accent), #2b3a8f); color: #fff; }
.m-list { list-style: none; margin: 0; padding: 0; }
.m-row { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.m-row:hover { background: var(--surface); }
.m-row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 6px; background: none; border: 0; color: inherit; text-align: left; font: inherit; cursor: pointer; text-decoration: none; }
.m-row-text { min-width: 0; display: flex; flex-direction: column; }
.m-row-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row-text strong { font-weight: 500; }
.m-row-text span { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: 4px; }
.m-row.current .m-row-text strong { color: var(--accent); }
.m-row.unavailable { opacity: .4; }
.m-dur { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.offline-badge svg, .liked-dot svg { width: 14px; height: 14px; color: var(--accent); }
.reorder { display: flex; }
.reorder .icon-btn { width: 32px; height: 32px; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; margin-right: 6px; vertical-align: middle; }
.eq i { width: 3px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; height: 40%; }
.eq i:nth-child(2) { animation-delay: .2s; } .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 50% { height: 100%; } }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
.m-shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 140px; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
.m-tile { display: flex; flex-direction: column; gap: 6px; min-width: 0; background: none; border: 0; padding: 0; color: inherit; text-align: left; font: inherit; cursor: pointer; text-decoration: none; scroll-snap-align: start; }
.m-tile strong, .m-tile span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-tile span { color: var(--muted); font-size: .85rem; }
.m-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-quick-item { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; color: inherit; text-decoration: none; font-size: .9rem; min-width: 0; }
.m-quick-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.m-quick-item .m-cover { border-radius: 0; }
.m-chips .chip { text-decoration: none; }
.m-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.m-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 12px; }
.m-head h1 { margin: 0; }
.m-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin: 12px 0; }
.m-search { font-size: 1rem; margin-bottom: 12px; }
.m-empty { text-align: center; }
.storage-line { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; padding: 4px 0; cursor: pointer; }
.storage-line svg { width: 16px; height: 16px; }
.uploads-music:empty { display: none; }
.uploads-music { display: grid; gap: 8px; margin: 8px 0; }
.upload-row { background: var(--surface); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-ui { width: 40px; height: 22px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); position: relative; transition: background .2s; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s var(--ease); }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }
.offline-toggle { display: flex; flex-direction: column; gap: 2px; }
.cover-field { display: flex; gap: 12px; align-items: flex-start; }
.cover-edit { width: 110px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.cover-edit img { width: 100%; height: 100%; object-fit: cover; }
.action-sheet .sheet-item { display: flex; gap: 12px; align-items: center; width: 100%; padding: 12px 6px; background: none; border: 0; color: inherit; font: inherit; text-align: left; border-radius: 8px; cursor: pointer; }
.action-sheet .sheet-item:hover { background: var(--surface-2); }
.action-sheet .sheet-item.danger { color: var(--danger); }
@media (max-width: 760px) {
  .action-sheet { margin: auto 0 0; width: 100%; max-width: none; border-radius: 16px 16px 0 0; }
}
.tip summary { cursor: pointer; color: var(--accent); }
.tip ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* Mini player */
.mini-player {
  position: fixed; z-index: 12; left: 8px; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px; border-radius: 10px;
  background: #22302a; background: color-mix(in srgb, var(--accent) 30%, #161917); color: #eef0ec;
  box-shadow: 0 6px 24px rgb(0 0 0 / .35); overflow: hidden;
}
.mini-player[hidden] { display: none; }
@media (min-width: 761px) { .mini-player { left: calc(var(--nav-w) + 16px); right: 16px; bottom: 16px; max-width: 760px; margin: 0 auto; } }
body.has-mini .main { padding-bottom: 170px; }
@media (max-width: 760px) { body.has-mini .toast { bottom: 150px; } }
@media (min-width: 761px) { body.has-mini .toast { bottom: 96px; } }
.mini-progress { position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; background: rgb(255 255 255 / .15); border-radius: 2px; }
.mini-progress span { display: block; height: 100%; background: #fff; border-radius: inherit; }
.mini-progress span.loading { background: var(--accent); }
.mini-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; }
.mini-text { min-width: 0; display: flex; flex-direction: column; }
.mini-text > * { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text strong { font-weight: 500; font-size: .92rem; }
.mini-text span { font-size: .8rem; opacity: .75; }
.pl-cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: rgb(255 255 255 / .08); display: grid; place-items: center; }
.pl-cover.sm { width: 40px; height: 40px; flex: none; border-radius: 6px; }
.pl-btn { width: 44px; height: 44px; display: grid; place-items: center; background: none; border: 0; color: inherit; border-radius: 50%; cursor: pointer; flex: none; }
.pl-btn svg { width: 24px; height: 24px; }
.pl-btn.on, .pl-btn.liked { color: var(--accent); }
.pl-btn.rot45 svg { transform: rotate(45deg); }

/* Fullscreen player */
.player-full {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; gap: 14px;
  padding: calc(12px + env(safe-area-inset-top)) 22px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, color-mix(in srgb, var(--tint, var(--accent)) 45%, #121413) 0%, #121413 70%);
  color: #eef0ec; animation: pf-in .28s var(--ease); overflow-y: auto;
}
.player-full.closing { animation: pf-out .18s ease-in forwards; }
@keyframes pf-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes pf-out { to { transform: translateY(40px); opacity: 0; } }
.pf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pf-context { font-size: .8rem; opacity: .8; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-art { flex: 1; display: grid; place-items: center; min-height: 0; }
.pf-art .pl-cover { width: min(100%, 52vh, 420px); box-shadow: 0 16px 50px rgb(0 0 0 / .5); }
.pf-meta { display: flex; align-items: center; gap: 8px; max-width: 520px; width: 100%; margin: 0 auto; }
.pf-meta h2 { margin: 0; font-size: 1.35rem; }
.pf-meta p { margin: 2px 0 0; opacity: .75; }
.pf-meta .grow { min-width: 0; }
.pf-meta .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-seek, .player-full > .progress, .pf-controls, .pf-foot, .pf-error { max-width: 520px; width: 100%; margin: 0 auto; }
.pl-seek { width: 100%; accent-color: #fff; }
.pf-times { display: flex; justify-content: space-between; font-size: .75rem; opacity: .7; font-variant-numeric: tabular-nums; }
.pf-controls { display: flex; justify-content: space-between; align-items: center; }
.pl-play-lg { width: 66px; height: 66px; background: #fff; color: #121413; }
.pl-play-lg svg { width: 30px; height: 30px; }
.pf-foot { display: flex; gap: 10px; align-items: center; }
.pf-tab { display: inline-flex; gap: 6px; align-items: center; background: rgb(255 255 255 / .08); border: 0; color: inherit; font: inherit; font-size: .85rem; padding: 8px 14px; border-radius: 99px; cursor: pointer; }
.pf-tab.on { background: #fff; color: #121413; }
.pf-sleep { margin-left: auto; display: inline-flex; gap: 4px; align-items: center; font-size: .8rem; color: var(--accent); }
.pf-error { color: #ffb4a8; font-size: .9rem; }
.pf-sheet { flex: 1; min-height: 0; overflow-y: auto; max-width: 520px; width: 100%; margin: 0 auto; background: rgb(0 0 0 / .2); border-radius: 12px; padding: 12px; }
.pf-lyrics { white-space: pre-wrap; line-height: 1.7; font-size: 1.05rem; }
.pf-queue { list-style: none; margin: 0; }
.pf-queue li { display: flex; align-items: center; }
.pf-queue li.current strong { color: var(--accent); }
.pfq-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: none; border: 0; color: inherit; font: inherit; text-align: left; padding: 6px; cursor: pointer; }
.pfq-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfq-main span { font-size: .8rem; opacity: .7; }
.pf-queue .pl-btn { width: 36px; height: 36px; }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 70%; } }

/* ================= Celebrations ================= */
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }
.fx-bounce { animation: fx-bounce .55s var(--ease); }
@keyframes fx-bounce { 30% { transform: scale(1.025); } 60% { transform: scale(.995); } }
.nudge { margin: 6px 0 0; font-weight: 500; color: var(--accent); }
.ring-done .ring-fg { filter: drop-shadow(0 0 6px var(--accent)); animation: ring-glow 2.4s ease-in-out infinite; }
.ring-done .ring-label strong { color: var(--accent); font-size: .85em; }
@keyframes ring-glow { 50% { filter: drop-shadow(0 0 1px var(--accent)); } }
.flame-on svg { color: #e8843c; animation: flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.08) rotate(-3deg); } 60% { transform: scale(.96) rotate(2deg); } }
.progress > span { position: relative; overflow: hidden; }
.progress > span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(255 255 255 / .35), transparent); transform: translateX(-100%); animation: shimmer 2.8s ease-in-out 0.6s 2; }
@keyframes shimmer { to { transform: translateX(100%); } }
.just-done .check { box-shadow: 0 0 0 0 var(--accent); animation: pop .4s var(--ease), halo .7s ease-out; }
@keyframes halo { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } to { box-shadow: 0 0 0 12px transparent; } }

/* ================= Career skills & code links ================= */
.skill-meter { display: flex; gap: 4px; }
.skill-meter span { flex: 1; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--p), var(--surface-2) var(--p)); }
.skill-meter span.on { background: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 50%, transparent); }
.skill-card { display: grid; gap: 10px; transition: border-color .3s, box-shadow .3s; }
.skill-card .range { flex: 1; }
.skill-card.mastered { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); }
.skill-title { gap: 10px; min-width: 0; }
.skill-title strong { overflow: hidden; text-overflow: ellipsis; }
.skill-badge { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.skill-badge svg { width: 16px; height: 16px; }
.mastered .skill-badge { background: var(--accent); color: var(--accent-text); animation: pop .5s var(--ease); }
.code-chips:empty { display: none; }
.code-chip { text-decoration: none; }
.code-open { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.code-open:hover span:first-of-type { color: var(--accent); }
.ide-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .82rem; }
.ide-links a { color: var(--accent); }

/* ================= pip terminal ================= */
.terminal-card { display: grid; gap: 8px; }
.term-out { margin: 0; min-height: 90px; max-height: 260px; overflow: auto; padding: 10px 12px; border-radius: var(--radius-sm); background: #14181a; color: #d7e0da; font: .82rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.term-out .term-cmd { color: #8fd3a8; }
.term-out .out-err { color: #ff9e93; }
.term-out .muted { color: #8b968f; }
.term-line { display: flex; align-items: center; gap: 8px; background: #14181a; border-radius: var(--radius-sm); padding: 4px 12px; }
.term-prompt { color: #8fd3a8; font-family: var(--mono); }
.term-input { flex: 1; min-width: 0; border: 0; background: transparent; color: #eef3ef; font: .9rem var(--mono); padding: 8px 0; outline: none; }
.term-input:disabled { opacity: .5; }
.term-line:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.term-saved { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-static { cursor: default; font-family: var(--mono); font-size: .78rem; }

/* ================= Exercise technique guide ================= */
.ex-how { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ex-how svg { width: 14px; height: 14px; color: var(--sec, var(--accent)); opacity: .75; flex: none; }
.ex-how:hover span, .ex-how:focus-visible span { color: var(--sec, var(--accent)); text-decoration: underline; text-underline-offset: 3px; }
.guide-sheet { width: min(560px, calc(100vw - 24px)); }
.guide-sheet .dialog-form { gap: 14px; }
.guide-head { display: flex; align-items: flex-start; gap: 8px; }
.guide-head h2 { margin: 2px 0 0; }
.guide-dose { margin: 4px 0 0; font-weight: 600; color: var(--c-gym, var(--accent)); }
.guide-sheet h3 { display: flex; align-items: center; gap: 6px; font-size: .95rem; margin: 0 0 6px; }
.guide-sheet h3 svg { width: 16px; height: 16px; }
.guide-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
.guide-list.steps li::marker { font-weight: 700; color: var(--c-gym, var(--accent)); }
.guide-good, .guide-bad { padding: 10px 12px; border-radius: var(--radius-sm); }
.guide-good { background: color-mix(in srgb, var(--success) 12%, transparent); }
.guide-good h3 { color: var(--success); }
.guide-bad { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.guide-bad h3 { color: var(--danger); }
.guide-bad h3 svg { transform: rotate(45deg); }
.guide-variant { margin: 0; padding: 10px 12px; border-left: 3px solid var(--c-gym, var(--accent)); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.guide-breathe { margin: 0; }
.guide-alt summary { cursor: pointer; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
.guide-foot { display: grid; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.guide-foot .btn { justify-self: start; }
@media (max-width: 760px) { .guide-sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; } }
.guide-foot .btn { text-decoration: none; }
.ex-fig { margin: 0; border-radius: var(--radius); background: color-mix(in srgb, var(--c-gym, var(--accent)) 7%, var(--surface-2)); padding: 8px 8px 6px; }
.ex-fig svg { display: block; width: 100%; max-height: 240px; }
.ex-fig.two { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ex-fig.two figcaption { grid-column: 1 / -1; }
.ex-fig figcaption { text-align: center; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.ex-fig .fig-static { stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; fill: var(--muted); fill-opacity: .18; opacity: .7; }
.ex-fig .fig-body { stroke: var(--text); stroke-width: 6; stroke-linecap: round; fill: var(--text); }
.ex-fig .fig-back { stroke: var(--muted); stroke-width: 6; stroke-linecap: round; opacity: .8; }
.ex-fig .fig-cable { stroke: var(--muted); stroke-width: 1.5; }
.ex-fig .fig-prop { stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
.ex-fig .fig-plate { stroke: var(--muted); stroke-width: 5; stroke-linecap: round; }
.ex-fig .fig-weight { fill: var(--c-gym, var(--accent)); }
.ex-fig .fig-pad { fill: var(--muted); opacity: .6; }
.guide-photos .file-panel { margin-top: 4px; }

/* Guide: real photos + muscle map + facts */
.guide-media { display: grid; grid-template-columns: 1.5fr 1fr; gap: 10px; align-items: stretch; }
@media (max-width: 520px) { .guide-media { grid-template-columns: 1fr; } }
.ex-photo { margin: 0; display: grid; gap: 4px; cursor: pointer; }
.ex-photo-frame { position: relative; border-radius: var(--radius); overflow: hidden; background: #111; aspect-ratio: 3 / 2; }
.ex-photo-frame img, .ex-photo-top img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ex-photo-top { position: absolute; inset: 0; animation: ex-rep 3.4s ease-in-out infinite; }
@keyframes ex-rep { 0%, 32% { opacity: 0; } 45%, 78% { opacity: 1; } 92%, 100% { opacity: 0; } }
.ex-photo.paused .ex-photo-top { animation-play-state: paused; }
.ex-photo-play { position: absolute; inset: 0; display: none; place-items: center; background: rgb(0 0 0 / .25); color: #fff; }
.ex-photo-play svg { width: 44px; height: 44px; }
.ex-photo.paused .ex-photo-play { display: grid; }
.ex-photo figcaption, .guide-muscles figcaption { font-size: .76rem; color: var(--muted); text-align: center; }
.ex-photo.still { grid-template-columns: 1fr 1fr; cursor: default; }
.ex-photo.still img { width: 100%; border-radius: var(--radius-sm); }
.ex-photo.still figcaption { grid-column: 1 / -1; }
.guide-muscles { margin: 0; padding: 8px; border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 4px; align-content: center; }
.guide-muscles figcaption { text-align: left; line-height: 1.5; }
.muscle-map { width: 100%; max-height: 240px; display: block; }
.mm-body { fill: color-mix(in srgb, var(--text) 6%, var(--surface)); stroke: color-mix(in srgb, var(--text) 18%, transparent); stroke-width: .8; }
.mm { stroke: var(--surface); stroke-width: .6; transition: fill .3s; }
.mm-off { fill: color-mix(in srgb, var(--text) 13%, var(--surface)); }
.mm-on { fill: var(--c-gym, #c0485a); animation: mm-pulse 2.2s ease-in-out infinite; }
.mm-sec { fill: color-mix(in srgb, var(--c-gym, #c0485a) 45%, var(--surface)); }
@keyframes mm-pulse { 50% { opacity: .75; } }
.muscle-map text { font-size: 9px; fill: var(--muted); }
.mm-key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; }
.mm-key.on { background: var(--c-gym, #c0485a); }
.mm-key.sec { background: color-mix(in srgb, var(--c-gym, #c0485a) 45%, var(--surface)); }
.guide-feel { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--c-gym, var(--accent)) 10%, transparent); }
.guide-facts, .guide-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.guide-facts > div, .guide-levels > div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.guide-facts p, .guide-levels p { margin: 4px 0 0; font-size: .88rem; line-height: 1.45; }
.guide-credit { margin: 0; font-size: .72rem; }
@media (max-width: 520px) { .muscle-map { max-height: 190px; } }

/* Body page */
.mm-weak { fill: var(--warn); }
.mm-ok { fill: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.mm-strong { fill: var(--accent); }
.mm-key.weak { background: var(--warn); } .mm-key.ok { background: color-mix(in srgb, var(--accent) 40%, var(--surface)); } .mm-key.strong { background: var(--accent); }
.body-map .muscle-map { max-height: 320px; }
.body-rows, .body-verdicts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.body-row { display: grid; gap: 6px; }
.body-row p, .body-verdicts p { margin: 0; }
.body-verdicts > li { padding-bottom: 10px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.body-verdicts > li.row { display: flex; }
.body-verdicts > li:last-child { border-bottom: 0; padding-bottom: 0; }

/* 3D Models */
.m3 { padding: 0; overflow: hidden; }
.m3-stage { position: relative; height: min(72vh, 680px); min-height: 380px; background: #0d1218; touch-action: none; }
.m3-stage canvas { display: block; width: 100%; height: 100%; }
.m3-status { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #c9d4e2; }
.m3-controls { display: grid; gap: 12px; padding: 14px 16px 16px; }
.m3-controls .row.wrap { flex-wrap: wrap; gap: 8px; }
.m3-controls p { margin: 0; }
.m3-range { width: 100%; accent-color: var(--accent); }
.m3-quality p { margin: 6px 0 0; } .m3-quality .btn { margin-top: 8px; }

/* ---------- Command palette ---------- */
.pal-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); font: inherit; cursor: pointer; transition: border-color .15s, color .15s; }
.pal-btn:hover { color: var(--text); border-color: var(--accent); }
.pal-btn kbd { margin-left: auto; }
.nav-search { margin: 0 0 8px; }
kbd { font: .72rem/1 var(--mono); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border); border-bottom-width: 2px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.pal-top { display: none; }
@media (max-width: 760px) { .nav-search { display: none; } .pal-top { display: inline-grid; margin-right: 2px; } }
.palette { width: min(640px, calc(100vw - 24px)); margin: 10vh auto auto; padding: 0; overflow: hidden; }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.pal-input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: 1.05rem/1.4 var(--font); min-width: 0; }
.pal-input::-webkit-search-cancel-button { display: none; }
.pal-list { max-height: min(60vh, 520px); overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.pal-group + .pal-group { margin-top: 4px; }
.pal-group-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pal-item[aria-selected="true"] { background: var(--accent-soft); }
.pal-ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.pal-ico.add { background: var(--accent); color: var(--accent-text); }
.pal-item[aria-selected="true"] .pal-ico:not(.add) { color: var(--accent); background: var(--surface); }
.pal-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pal-title, .pal-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-sub { font-size: .82rem; color: var(--muted); }
.pal-title mark { background: none; color: var(--accent); font-weight: 600; }
.pal-kind { font-size: .75rem; color: var(--muted); flex: none; }
.pal-empty { padding: 18px; text-align: center; margin: 0; }
.pal-foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pal-btn-wide { justify-content: flex-start; padding: 12px; font-size: 1rem; }
.kbd-list { display: grid; gap: 10px; }
@media (max-width: 760px) {
  .palette { margin: 0; width: 100%; max-width: none; height: 100%; max-height: none; border-radius: 0; display: flex; flex-direction: column; }
  .palette[open] { display: flex; }
  .pal-list { max-height: none; flex: 1; }
  .pal-foot { display: none; }
}
@keyframes pal-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); background-color: var(--accent-soft); } 100% { box-shadow: 0 0 0 0 transparent; } }
.pal-flash { animation: pal-flash 1.8s var(--ease); border-radius: var(--radius-sm); }
.pal-cancel { display: none; }
@media (max-width: 760px) { .pal-esc { display: none; } .pal-cancel { display: inline-flex; } }

/* ---------- Focus ---------- */
.focus-pill { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; padding: 3px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font: 600 .82rem/1.4 var(--font); font-variant-numeric: tabular-nums; text-decoration: none; }
.focus-pill svg { width: 15px; height: 15px; }
.focus-pill[data-mode="short"], .focus-pill[data-mode="long"] { background: #6b8fb8; color: #fff; }
.fc-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.fc-side { display: grid; gap: 16px; }
.fc-lower { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
@media (max-width: 900px) { .fc-grid, .fc-lower { grid-template-columns: 1fr; } }
.fc-timer { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; --fc: var(--accent); }
.fc-timer[data-mode="short"], .fc-timer[data-mode="long"] { --fc: #6b8fb8; }
.fc-tabs { align-self: stretch; justify-content: center; }
.fc-dial { position: relative; width: min(300px, 78vw); aspect-ratio: 1; }
.fc-ring { width: 100%; height: 100%; }
.fc-track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.fc-arc { fill: none; stroke: var(--fc); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .3s linear, stroke .3s; }
.fc-timer[data-running] .fc-arc { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--fc) 55%, transparent)); }
.fc-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.fc-digits { font: 300 clamp(2.8rem, 12vw, 4rem)/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.fc-mode-label { color: var(--muted); font-size: .9rem; max-width: 70%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-dots { display: flex; gap: 6px; margin-top: 6px; }
.fc-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); }
.fc-dots span.on { background: var(--fc); border-color: var(--fc); }
.fc-controls { display: flex; align-items: center; gap: 10px; }
.fc-main { min-width: 150px; justify-content: center; padding: 12px 22px; font-size: 1.05rem; border-radius: 999px; }
.fc-sub { align-self: stretch; gap: 8px; }
.fc-task { flex: 1; min-width: 0; }
.fc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.fc-stat { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.fc-stat > svg { color: var(--accent); flex: none; }
.fc-stat > div { display: flex; flex-direction: column; min-width: 0; }
.fc-stat strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.fc-stat-ring { --p: 0; width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.fc-stat-ring span { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: .62rem; font-weight: 600; }
@media (max-width: 520px) { .fc-stats { grid-template-columns: 1fr; } }
.fc-presets { margin: 4px 0 12px; flex-wrap: wrap; }
.fc-sounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.fc-sound { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; background: var(--surface); transition: border-color .2s, background .2s; }
.fc-sound.on { border-color: var(--accent); background: var(--accent-soft); }
.fc-sound-btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.fc-emoji { font-size: 1.25rem; }
.fc-vol { width: 100%; accent-color: var(--accent); }
.fc-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; align-items: end; }
.fc-bar { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.fc-bar-fill { width: 100%; max-width: 38px; min-height: 3px; border-radius: 6px 6px 3px 3px; background: color-mix(in srgb, var(--accent) 70%, transparent); display: flex; justify-content: center; transition: height .5s var(--ease); }
.fc-bar.today .fc-bar-fill { background: var(--accent); }
.fc-bar-fill span { font-size: .7rem; color: var(--accent-text); padding-top: 2px; font-variant-numeric: tabular-nums; }
.fc-bar-day { font-size: .75rem; color: var(--muted); }
.fc-goal-line { margin-top: 8px; }
.fc-heatmap { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.fc-cell { display: inline-block; width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }
.fc-cell.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); }
.fc-cell.l2 { background: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.fc-cell.l3 { background: color-mix(in srgb, var(--accent) 80%, var(--surface-2)); }
.fc-cell.l4 { background: var(--accent); }
.fc-cell.future { opacity: .35; }
.fc-legend { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.fc-top-list { display: grid; gap: 10px; }
.fc-top-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) auto; gap: 10px; align-items: center; }
.fc-top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-top-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.fc-top-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.fc-recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
/* zen: rain on the window */
.zen { position: fixed; inset: 0; z-index: 1000; background: #0b1020; color: #fff; animation: fade-in .4s var(--ease); }
.zen-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.zen-ui { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-shadow: 0 2px 24px rgb(0 0 0 / .6); pointer-events: none; }
.zen-digits { font: 200 clamp(4.5rem, 18vw, 10rem)/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.zen-label { font-size: 1.1rem; opacity: .8; max-width: 80vw; text-align: center; }
.zen-actions { display: flex; gap: 14px; pointer-events: auto; margin-top: 10px; }
.zen-btn { width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgb(255 255 255 / .35); background: rgb(255 255 255 / .1); color: #fff; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(6px); }
.zen-btn:hover { background: rgb(255 255 255 / .2); }
.zen-hint { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; font-size: .8rem; opacity: .5; }

/* ---------- Journal ---------- */
.jr-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.jr-main, .jr-side { display: grid; gap: 16px; }
@media (max-width: 960px) { .jr-grid { grid-template-columns: 1fr; } }
.jr-entry { display: flex; flex-direction: column; gap: 10px; }
.jr-date { margin: 0; }
.jr-sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin: 8px 0 0; }
.jr-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.jr-mood { --mc: var(--accent); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; transition: transform .15s var(--ease), border-color .2s, background .2s; }
.jr-mood:hover { transform: translateY(-2px); }
.jr-mood[aria-checked="true"] { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 16%, var(--surface)); color: var(--text); font-weight: 600; }
.jr-face { font-size: 1.7rem; line-height: 1; filter: grayscale(.6); transition: filter .2s, transform .2s; }
.jr-mood[aria-checked="true"] .jr-face { filter: none; transform: scale(1.15); }
.jr-energy-row { align-items: center; gap: 12px; }
.jr-energy-row .jr-sub { margin: 0; }
.jr-energy { display: flex; gap: 4px; }
.jr-bolt { border: 0; background: none; font-size: 1.3rem; cursor: pointer; filter: grayscale(1); opacity: .35; transition: filter .15s, opacity .15s, transform .15s; padding: 2px; }
.jr-bolt[aria-checked="true"] { filter: none; opacity: 1; }
.jr-bolt:hover { transform: scale(1.15); }
.jr-tags { flex-wrap: wrap; }
.jr-grats { display: grid; gap: 8px; }
.jr-grat { display: flex; align-items: center; gap: 10px; }
.jr-num { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: .78rem; font-weight: 700; }
.jr-grat .input { flex: 1; }
.jr-prompt-row { align-items: end; margin-top: 8px; }
.jr-prompt { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); font-style: italic; font-weight: 500; }
.jr-text { min-height: 180px; line-height: 1.7; }
.jr-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.jr-chip { cursor: default; display: inline-flex; align-items: center; gap: 6px; }
.jr-facts svg { width: 16px; height: 16px; }
.jr-memory { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.jr-memory:hover { background: var(--surface-2); }
.jr-memory > span:last-child { display: flex; flex-direction: column; }
.jr-pixgrid { display: grid; grid-template-columns: 14px repeat(31, minmax(0, 1fr)); gap: 2px; margin: 6px 0 4px; }
.jr-pix { aspect-ratio: 1; border-radius: 2px; background: var(--surface-2); display: block; }
.jr-pix.future { opacity: .35; }
.jr-pix.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.jr-pix-m, .jr-pix-d { font-size: .6rem; line-height: 1; align-self: center; }
.jr-trend { width: 100%; height: 80px; }
.jr-trend .jr-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.jr-trend .jr-mid { stroke: var(--border); stroke-dasharray: 3 4; }
.jr-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .75rem; color: var(--muted); }
.jr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.jr-ins-list { display: grid; gap: 8px; }
.jr-ins-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.jr-ins-row.up span:nth-child(2) { color: var(--success); font-weight: 600; }
.jr-ins-row.down span:nth-child(2) { color: var(--danger); font-weight: 600; }

/* ---------- Word review ---------- */
.rv-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-text); color: var(--accent); font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.rv-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .rv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rv-top { margin: 18px 0 8px; gap: 10px; flex-wrap: wrap; }
.rv-progress { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-bottom: 18px; }
.rv-progress span { display: block; height: 100%; background: var(--accent); transition: width .4s var(--ease); width: 0; }
.rv-stage { display: flex; flex-direction: column; align-items: center; gap: 16px; perspective: 1400px; }
.rv-card { position: relative; width: min(560px, 100%); min-height: 280px; transform-style: preserve-3d; transition: transform .55s var(--ease); cursor: pointer; outline: none; }
.rv-card.flipped { transform: rotateY(180deg); }
.rv-card:focus-visible .rv-face { box-shadow: 0 0 0 2px var(--accent); }
.rv-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow), 0 18px 40px rgb(0 0 0 / .06); }
.rv-back { transform: rotateY(180deg); background: linear-gradient(160deg, var(--surface), var(--accent-soft)); }
.rv-side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rv-word { font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 600; letter-spacing: -.01em; }
.rv-meaning { font-size: clamp(1.3rem, 4.5vw, 1.7rem); }
.rv-example { color: var(--muted); font-style: italic; max-width: 440px; margin: 0; }
.rv-example mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; padding: 0 2px; font-style: normal; }
.rv-hint { position: absolute; bottom: 14px; }
.rv-new { position: absolute; top: 14px; left: 14px; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.rv-grades { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: min(560px, 100%); }
.rv-g { flex-direction: column; gap: 2px; padding: 10px 6px; position: relative; }
.rv-g kbd { position: absolute; top: 6px; right: 6px; font-size: .62rem; padding: 1px 4px; }
.rv-int { font-size: .75rem; color: var(--muted); }
.rv-g0 { border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.rv-g3 { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.rv-g.suggested { box-shadow: 0 0 0 2px var(--accent); }
@media (hover: none) { .rv-g kbd { display: none; } }
.rv-typebox { display: flex; gap: 8px; width: min(560px, 100%); flex-wrap: wrap; }
.rv-type { flex: 1; min-width: 160px; font-size: 1.1rem; }
.rv-result { width: 100%; margin: 0; font-weight: 600; }
.rv-result.ok { color: var(--success); } .rv-result.close { color: var(--warn); } .rv-result.bad { color: var(--danger); }
.rv-done { text-align: center; padding: 34px; width: min(560px, 100%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rv-done-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-text); margin-bottom: 8px; }
.rv-done-icon svg { width: 32px; height: 32px; }
a.btn { text-decoration: none; }

/* ---------- Calendar ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .cal-wrap { grid-template-columns: 1fr; } }
.cal-main { padding: 16px; }
.cal-bar { margin-bottom: 10px; }
.cal-title { margin: 0; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; touch-action: pan-y; }
.cal-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; padding: 4px 0; }
.cal-day { position: relative; min-height: 96px; display: flex; flex-direction: column; gap: 3px; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; }
.cal-day:hover { border-color: var(--accent); }
.cal-day.other { opacity: .45; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-text); }
.cal-day.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--accent-soft); }
.cal-num { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; font-size: .82rem; font-weight: 600; justify-content: center; }
.cal-mood { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-chip { --c: var(--accent); display: block; font-size: .7rem; line-height: 1.35; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--c) 16%, transparent); border-left: 3px solid var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip.done { text-decoration: line-through; opacity: .6; }
.cal-more { font-size: .68rem; padding-left: 4px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.cal-focus { position: absolute; left: 0; bottom: 0; height: 3px; background: #6b8fb8; border-radius: 0 2px 0 0; }
@media (max-width: 760px) {
  .cal-day { min-height: 58px; padding: 4px; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
  .cal-num { font-size: .78rem; }
}
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.cal-panel { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.cal-panel-title { margin: 0; }
.cal-panel-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.cal-meta { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }
.cal-meta svg { width: 15px; height: 15px; }
.cal-agenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cal-ag { --c: var(--accent); display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 8%, var(--surface)); color: inherit; text-decoration: none; }
.cal-ag:hover { background: color-mix(in srgb, var(--c) 16%, var(--surface)); }
.cal-ag.done strong { text-decoration: line-through; opacity: .65; }
.cal-ag-time { font-size: .8rem; font-variant-numeric: tabular-nums; }
.cal-ag-main { display: flex; flex-direction: column; min-width: 0; }
.cal-ag-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cal-ag svg { color: var(--success); }
.cal-empty { margin: 0; }
.cal-jr { align-self: flex-start; }

/* ---------- Insights ---------- */
.in-hero { display: flex; gap: 26px; align-items: center; padding: 24px; background: linear-gradient(135deg, var(--surface), var(--accent-soft)); }
.in-ring { --p: 0; width: 132px; height: 132px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); box-shadow: 0 8px 30px color-mix(in srgb, var(--accent) 25%, transparent); }
.in-ring > div { width: 108px; height: 108px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.in-lvl-num { font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--accent); }
.in-hero-text { flex: 1; min-width: 0; }
.in-hero-text h2 { font-size: 1.5rem; margin: 0 0 2px; }
.in-xpbar { margin: 10px 0 16px; }
.in-hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.in-stat { display: flex; flex-direction: column; }
.in-stat strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .in-hero { flex-direction: column; text-align: center; } .in-hero-stats { justify-content: center; } }
.in-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin: 16px 0; }
@media (max-width: 900px) { .in-grid { grid-template-columns: 1fr; } }
.in-review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.in-metric { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.in-metric strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.in-delta { font-size: .74rem; }
.in-delta.up { color: var(--success); } .in-delta.down { color: var(--danger); } .in-delta.same { color: var(--muted); }
.in-pat { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.in-pat strong { font-size: 1.1rem; text-transform: capitalize; }
.in-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 70px; align-items: end; margin-top: 6px; }
.in-dow-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 3px; }
.in-dow-col span { width: 100%; max-width: 26px; min-height: 3px; background: color-mix(in srgb, var(--accent) 45%, var(--surface-2)); border-radius: 4px 4px 2px 2px; }
.in-dow-col.best span { background: var(--accent); }
.in-dow-col em { font-style: normal; font-size: .7rem; color: var(--muted); }
.in-hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; height: 56px; align-items: end; margin-top: 6px; }
.in-hours span { background: color-mix(in srgb, #6b8fb8 45%, var(--surface-2)); border-radius: 2px; }
.in-hours span.best { background: #6b8fb8; }
.in-year { margin-bottom: 16px; }
.in-yeargrid { display: grid; grid-template-rows: auto repeat(7, 1fr); grid-auto-flow: column; gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.in-yeargrid .fc-cell { width: 12px; height: 12px; }
.in-month { grid-row: 1; font-size: .68rem; white-space: nowrap; width: 12px; overflow: visible; }
.in-stack { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 170px; align-items: end; }
.in-stack-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.in-stack-bar { width: 100%; max-width: 30px; min-height: 2px; display: flex; flex-direction: column-reverse; border-radius: 5px 5px 2px 2px; overflow: hidden; transition: height .6s var(--ease); }
.in-stack-bar span { display: block; min-height: 1px; }
.in-stack-lbl { font-size: .62rem; }
.in-kinds { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: .75rem; color: var(--muted); }
.in-kinds i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.in-ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 520px; overflow-y: auto; padding: 2px; }
.in-badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; padding: 12px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.in-badge .in-badge-emoji { font-size: 1.9rem; filter: grayscale(1); opacity: .45; }
.in-badge.done { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: linear-gradient(160deg, var(--surface), var(--accent-soft)); }
.in-badge.done .in-badge-emoji { filter: none; opacity: 1; }
.in-badge strong { font-size: .88rem; }
.in-badge-ok { font-size: .72rem; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.in-badge-prog { width: 100%; display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.in-rules summary { cursor: pointer; font-weight: 600; }
.in-rules-list { display: grid; gap: 6px; margin: 12px 0; max-width: 420px; }

/* ---------- Home: at a glance ---------- */
.glance { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 16px; }
@media (max-width: 900px) { .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.glance-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; text-decoration: none; min-width: 0; transition: border-color .15s, transform .15s var(--ease); }
a.glance-item:hover { border-color: var(--accent); transform: translateY(-1px); }
.glance-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.glance-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.glance-ico { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.glance-lvl { --p: 0; width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.glance-lvl b { width: 30px; height: 30px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--accent); font-size: .9rem; }
.glance-face { font-size: 1.8rem; line-height: 1; }
.glance-btn { flex: none; }
.glance-mood { flex-direction: column; align-items: flex-start; gap: 4px; }
.glance-faces { display: flex; gap: 2px; }
.glance-faces button { border: 0; background: none; font-size: 1.45rem; cursor: pointer; padding: 2px 3px; border-radius: 8px; transition: transform .15s var(--ease), background .15s; filter: grayscale(.4); }
.glance-faces button:hover { transform: scale(1.2); background: var(--surface-2); filter: none; }

/* ---------- What's new ---------- */
.wn { width: min(760px, calc(100vw - 24px)); }
.wn-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.wn-head { display: flex; gap: 14px; align-items: center; }
.wn-head h2 { margin: 0; font-size: 1.35rem; }
.wn-head p { margin: 2px 0 0; }
.wn-spark { font-size: 2.2rem; animation: wn-pop .6s var(--ease) both; }
.wn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.wn-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: inherit; text-decoration: none; font: inherit; text-align: left; cursor: pointer; animation: wn-in .45s var(--ease) both; animation-delay: calc(var(--i) * 60ms); transition: border-color .15s, transform .15s var(--ease); }
.wn-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.wn-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
@keyframes wn-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wn-pop { from { transform: scale(.3) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 760px) { .wn { margin: auto 0 0; width: 100%; max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; } .wn-grid { grid-template-columns: 1fr; } }

/* Schedule */
.sc-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 12px; }
.sc-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.sc-day small { color: var(--muted); font-size: .75rem; }
.sc-day.is-today { border-color: var(--accent); }
.sc-day[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.sc-day[aria-selected="true"] small { color: inherit; opacity: .85; }
.sc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sc-item { display: flex; align-items: center; gap: 12px; }
.sc-time { flex: 0 0 48px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; }
.sc-time small { color: var(--muted); font-weight: 400; }
.sc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.sc-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-lesson .sc-body { padding: 8px 12px; border-radius: var(--radius-sm); border-left: 4px solid var(--course); background: color-mix(in srgb, var(--course) 10%, var(--surface)); }
.sc-free { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; padding: 4px 0; }
.sc-free > span:last-child { flex: 1; padding: 4px 12px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.sc-now { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: .8rem; font-weight: 600; }
.sc-now span { flex: 0 0 48px; }
.sc-now i { flex: 1; height: 2px; background: var(--accent); border-radius: 2px; }
.sc-untimed { margin-top: 16px; }
.sc-untimed h3 { font-size: .9rem; color: var(--muted); margin: 0 0 8px; }

/* English: AI teacher, lessons, tasks */
.en-brain textarea { width: 100%; min-height: 160px; font: inherit; }
.en-brain .row { flex-wrap: wrap; gap: 8px; }
.en-flow { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.en-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.en-lesson h3 { margin: 6px 0 4px; font-size: 1rem; }
.en-lesson .note-body { white-space: pre-wrap; margin: 0; }
@media (max-width: 520px) { .sc-day { padding: 6px 0; font-size: .85rem; } }

/* Start screen (gate) */
.gate-open .app { visibility: hidden; }
.gate { position: fixed; inset: 0; z-index: 100; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; padding: 48px 16px; background: var(--bg, var(--surface-2)); }
.gate-box { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 16px; }
.gate-head { display: flex; align-items: center; gap: 12px; }
.gate-head .brand-mark { width: 40px; height: 40px; display: inline-flex; }
.gate-head .brand-mark svg { width: 40px; height: 40px; }
.gate-head h1 { margin: 0; }
.gate-label { margin: 0 0 8px; font-weight: 600; }
.gate-pages { margin-bottom: 0; }
.gate-pages .chip { display: inline-flex; align-items: center; gap: 6px; }
.gate-pages .chip svg { width: 16px; height: 16px; }
.gate-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.gate-card h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; }
.gate-card h2 svg { width: 20px; height: 20px; }
.gate-card .row { gap: 8px; }
.gate-pin { flex: 1; min-width: 0; font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.gate-warn { border-color: #c8862a; }
.gate-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.gate-or::before, .gate-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.gate-status { min-height: 1.4em; margin: 0; text-align: center; color: var(--muted); }
.guest-out { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.guest-out svg { width: 16px; height: 16px; }

/* English: teacher folder, overview, mistakes, tests */
.en-teacher { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.en-teacher > svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.en-teacher p { margin: 2px 0 0; }
.en-teacher .sync-dot { background: var(--muted); }
.en-teacher[data-ok] .sync-dot { background: #3aa76d; }
.en-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.en-grid > .card { display: flex; flex-direction: column; gap: 8px; padding: 18px; }
.en-level-row { display: flex; align-items: baseline; gap: 10px; }
.en-level-now { font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--accent); }
.en-level-arrow { color: var(--muted); font-size: 1.3rem; }
.en-level-next { font-size: 1.6rem; font-weight: 700; color: var(--muted); }
.en-ladder { display: flex; gap: 4px; }
.en-ladder span { flex: 1; text-align: center; font-size: .7rem; padding: 3px 0; border-radius: 4px; background: var(--surface-2); color: var(--muted); }
.en-ladder span.past { background: color-mix(in srgb, var(--accent) 30%, var(--surface-2)); color: inherit; }
.en-ladder span.on { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.en-next-text { margin: 0; font-size: 1.05rem; font-weight: 600; }
.en-weak { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.en-review .btn { align-self: flex-start; }
.en-h2 { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 1.1rem; }
.en-md p { margin: 0 0 6px; }
.en-md-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.en-md code, .en-mistake code { font-size: .9em; padding: 0 4px; border-radius: 4px; background: var(--surface-2); }
.en-mistakes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.en-mistake { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.en-mistake p { margin: 0; }
.en-wrong { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, #d9534f 60%, transparent); }
.en-right { font-weight: 600; }
.en-mistake.is-mastered { opacity: .7; }
.en-status { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); }
.en-status.is-new { background: #d9534f; color: #fff; }
.en-status.is-practising { background: #e0a030; color: #1a1a1a; }
.en-status.is-mastered { background: #3aa76d; color: #fff; }
.en-tests { list-style: none; margin: 0; padding: 4px 16px; }
.en-test { display: flex; flex-direction: column; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.en-test:last-child { border-bottom: 0; }
.en-test p { margin: 0; }
.en-test-head { display: flex; justify-content: space-between; gap: 12px; }
.en-test-score { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; }
.en-test-pct { font-weight: 800; font-size: 1.1rem; }

/* English: easy reading (a calm sans-serif even when the site font is mono), one lesson per row, word cards */
.en-read, .en-read .note-title, .en-read .word-text, .en-read input, .en-read textarea { font-family: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif; }
.en-read { line-height: 1.6; }
.en-read .tile-value, .en-level-now, .en-level-next { font-family: var(--font-display); }
.en-lessons { display: flex; flex-direction: column; gap: 12px; }
.en-lesson { display: flex; gap: 16px; padding: 16px 18px; align-items: flex-start; }
.en-date { flex: 0 0 52px; display: flex; flex-direction: column; align-items: center; padding: 8px 0; border-radius: var(--radius-sm); background: var(--surface-2); line-height: 1.1; }
.en-date strong { font-size: 1.4rem; }
.en-date span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.en-lesson.is-speaking .en-date { background: color-mix(in srgb, #3a8fd9 22%, var(--surface-2)); }
.en-lesson.is-test .en-date { background: color-mix(in srgb, #e0a030 25%, var(--surface-2)); }
.en-lesson.is-lesson .en-date { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); }
.en-lesson-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.en-lesson-meta { display: flex; align-items: center; gap: 8px; }
.en-lesson h3 { margin: 0; font-size: 1.1rem; line-height: 1.35; }
.en-lesson-lead { margin: 0; color: var(--text); }
.en-more summary { cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 600; list-style: none; padding: 4px 0; }
.en-more summary::-webkit-details-marker { display: none; }
.en-more summary::before { content: '▸ '; }
.en-more[open] summary::before { content: '▾ '; }
.en-more[open] summary { margin-bottom: 6px; }
.en-md-list { gap: 6px; }
.en-md-list li::marker { color: var(--accent); }
.en-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.en-word { display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.en-word p { margin: 0; }
.en-word-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.en-word-text { font-size: 1.2rem; color: var(--accent); line-height: 1.3; }
.en-word-meaning { color: var(--text); }
.en-word-example { font-style: italic; color: var(--muted); padding-left: 10px; border-left: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.en-word-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.en-word.is-known { opacity: .75; }
.en-word.is-known .en-word-text { color: var(--text); }
@media (max-width: 520px) { .en-lesson { gap: 12px; padding: 14px; } .en-date { flex-basis: 44px; } }

/* English: daily practice */
.en-start { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.en-start h2 { margin: 0 0 4px; font-size: 1.2rem; }
.en-start p { margin: 0; }
.en-start.is-done { border-color: var(--border); background: var(--surface); }
.en-start-btn { font-size: 1.05rem; padding-inline: 22px; }
.pr { display: flex; flex-direction: column; gap: 14px; max-width: 640px; margin: 0 auto; width: 100%; }
.pr-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.pr-card { display: flex; flex-direction: column; gap: 12px; padding: 22px; }
.pr-card p { margin: 0; }
.pr-kind { align-self: flex-start; }
.pr-kind.is-mistake { background: color-mix(in srgb, #d9534f 22%, var(--surface-2)); color: var(--text); }
.pr-label { font-size: .85rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pr-wrong { font-size: 1.25rem; line-height: 1.45; }
.pr-meaning { font-size: 1.25rem; font-weight: 600; }
.pr-example { font-style: italic; color: var(--muted); padding-left: 10px; border-left: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.pr-form { display: flex; flex-direction: column; gap: 10px; }
.pr-input { font-size: 1.1rem; }
.pr-feedback { display: flex; flex-direction: column; gap: 8px; }
.pr-feedback:empty { display: none; }
.pr-ok { color: #3aa76d; font-weight: 700; font-size: 1.1rem; }
.pr-bad { color: #d9534f; font-weight: 700; }
.pr-almost { color: #c8862a; font-weight: 700; }
.pr-answer { font-size: 1.15rem; font-weight: 700; padding: 10px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, #3aa76d 14%, var(--surface-2)); }
.pr-done { align-items: center; text-align: center; padding: 36px 22px; }
.pr-score { font-family: var(--font-display); font-size: 3rem; font-weight: 800; color: var(--accent); line-height: 1; }
@media (max-width: 520px) { .en-start { flex-direction: column; align-items: stretch; } }
