/* Yohana tu profe — design system */
:root {
  /* Brand palette (Yohana's house style): blue, purple, yellow, sky blue, green */
  --brand: #2581c4;
  --brand-dark: #1a629b;
  --brand-soft: #e2f0fb;
  --accent: #f2c54b;
  --accent-soft: #fdf3d3;
  --purple: #5f539b;
  --purple-dark: #48407a;
  --purple-soft: #e9e6f4;
  --sky: #8cbbe9;
  --sky-soft: #eaf3fc;
  --teal: #4fa564;
  --teal-soft: #e3f3e6;
  --ink: #172338;
  --muted: #5d6b80;
  --bg: #f3f7fc;
  --bg-2: #e6eef8;
  --card: #ffffff;
  --border: #d6e2ef;
  --shadow: 0 1px 2px rgba(23, 55, 100, .06), 0 8px 24px -12px rgba(23, 55, 100, .22);
  --m: #1f5fc2; --m-soft: #e0eafb;
  --f: #d94a7a; --f-soft: #fbe4ec;
  --mf: #7b5cc9; --mf-soft: #ece6fa;
  --n: #5d6b80; --n-soft: #e9eef5;
  --good: #4fa564; --good-soft: #e3f3e6;
  --bad: #d64545; --bad-soft: #fbe3e3;
  --warn: #c98a00;
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 240px;
  --font: 'Nunito', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f1a2b; --bg-2: #162539; --card: #1a2b44; --border: #29405e;
  --ink: #eef3fa; --muted: #a9b8cc;
  --brand-soft: #14304b; --accent-soft: #3a3012; --teal-soft: #14301c; --purple-soft: #2a2547; --sky-soft: #16304a;
  --m-soft: #14263c; --f-soft: #3a1826; --mf-soft: #261a44; --n-soft: #1f2a3a; --good-soft: #14301c; --bad-soft: #3b1a1a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px -14px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55;
  background: var(--bg); color: var(--ink);
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
h1 { font-size: 2rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.bold { font-weight: 800; }
.center { text-align: center; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt-2 { margin-top: 2rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.hidden { display: none !important; }
.es { font-family: var(--font); }
.nowrap { white-space: nowrap; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--card); border-right: 1px solid var(--border);
  padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: .25rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 900; font-size: 1.25rem; padding: .25rem .5rem 1rem; color: var(--ink); }
.brand .logo { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--purple)); display: grid; place-items: center; color: #fff; font-size: 1.1rem; box-shadow: var(--shadow); }
.brand small { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem; border-radius: 12px; color: var(--ink); font-weight: 700; font-size: .95rem; position: relative; }
.nav a:hover { background: var(--bg-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); }
.nav a .ico { width: 1.5rem; text-align: center; font-size: 1.1rem; }
.nav .badge { margin-left: auto; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; padding: 1rem .75rem .25rem; }
.sidebar .user-card { margin-top: auto; padding: .75rem; border-radius: 12px; background: var(--bg-2); display: flex; gap: .6rem; align-items: center; }
.sidebar .user-card .avatar { font-size: 1.5rem; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.5rem; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.topbar .title { font-weight: 900; font-size: 1.15rem; }
.topbar .stats { margin-left: auto; display: flex; gap: .6rem; align-items: center; }
.stat-pill { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; background: var(--bg-2); font-weight: 800; font-size: .85rem; white-space: nowrap; }
.stat-pill.streak { background: var(--accent-soft); color: #8a5a00; }
.stat-pill.xp { background: var(--brand-soft); color: var(--brand-dark); }
.stat-pill.level { background: var(--teal-soft); color: #2a6b3a; }
.content { padding: 1.5rem; max-width: 1100px; }
.content.narrow { max-width: 760px; }
.bottombar { display: none; }
.icon-btn { background: transparent; border: 0; font-size: 1.2rem; cursor: pointer; padding: .35rem .5rem; border-radius: 10px; color: var(--ink); line-height: 1; }
.icon-btn:hover { background: var(--bg-2); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 1rem; padding-bottom: 5.5rem; }
  .topbar { padding: .7rem 1rem; }
  .topbar .title { font-size: 1rem; }
  .bottombar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); z-index: 30; padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); }
  .bottombar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; font-size: .65rem; font-weight: 800; color: var(--muted); padding: .3rem 0; border-radius: 10px; position: relative; }
  .bottombar a .ico { font-size: 1.3rem; }
  .bottombar a.active { color: var(--brand-dark); }
  .bottombar .badge { position: absolute; top: 0; right: 18%; }
}

/* ---------- Cards, buttons, forms ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; animation: rise .35s ease both; }
.card.flat { box-shadow: none; }
.card.tight { padding: .9rem 1rem; }
.card.accent { background: linear-gradient(135deg, var(--brand), var(--purple)); color: #fff; border: 0; }
.card.accent .muted { color: rgba(255,255,255,.85); }
.card.accent a { color: #fff; }
.card.teal { background: linear-gradient(135deg, var(--teal), #6fbe7f); color: #fff; border: 0; }
.card.sun { background: linear-gradient(135deg, #f2c54b, #f0b323); color: #3a2a00; border: 0; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.btn, button.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--brand); color: #fff; border: 0; padding: .7rem 1.2rem; border-radius: 999px; font-size: 1rem; font-weight: 800; cursor: pointer; font-family: inherit; transition: transform .08s ease, background .15s ease, box-shadow .15s ease; box-shadow: 0 6px 14px -8px rgba(224, 90, 51, .7); line-height: 1.2; text-decoration: none; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--bg-2); color: var(--ink); box-shadow: none; }
.btn.secondary:hover { background: var(--border); }
.btn.ghost { background: transparent; color: var(--brand-dark); box-shadow: none; border: 2px solid var(--brand-soft); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.teal { background: var(--teal); box-shadow: 0 6px 14px -8px rgba(79,165,100,.7); }
.btn.teal:hover { background: #3e8a51; }
.btn.small { padding: .4rem .8rem; font-size: .85rem; }
.btn.big { padding: .9rem 1.6rem; font-size: 1.1rem; }
.btn.block { width: 100%; }
.btn.white { background: #fff; color: var(--brand-dark); box-shadow: none; }
.btn.white:hover { background: #eaf3fc; }
.card.accent a.btn.white, .card.teal a.btn.white, .card.sun a.btn.white { color: var(--brand-dark); }

label { display: block; font-weight: 700; font-size: .875rem; margin-bottom: .3rem; }
input, select, textarea { font-family: inherit; font-size: 1rem; padding: .7rem .9rem; border: 2px solid var(--border); border-radius: 12px; width: 100%; background: var(--card); color: var(--ink); transition: border-color .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
textarea { min-height: 100px; resize: vertical; }
.field { margin-bottom: 1rem; }
.error { color: var(--bad); font-weight: 700; }
.success { color: var(--good); font-weight: 700; }
.input-lg { font-size: 1.25rem; padding: .9rem 1rem; text-align: center; }
.input-lg.correct { border-color: var(--good); background: var(--good-soft); }
.input-lg.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .3s; }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-6px);} 75% { transform: translateX(6px);} }

.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .4rem; border-radius: 999px; background: var(--brand); color: #fff; font-size: .7rem; font-weight: 900; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 999px; background: var(--bg-2); font-size: .8rem; font-weight: 800; color: var(--muted); }
.chip.level { background: var(--teal-soft); color: #2a6b3a; }
.chip.brand { background: var(--brand-soft); color: var(--brand-dark); }
.chip.good { background: var(--good-soft); color: #2a6b3a; }
.chip.bad { background: var(--bad-soft); color: #9b2c2c; }
.chip.warn { background: var(--accent-soft); color: #8a5a00; }
.chip.m { background: var(--m-soft); color: var(--m); }
.chip.f { background: var(--f-soft); color: var(--f); }
.chip.mf { background: var(--mf-soft); color: var(--mf); }
.chip.n { background: var(--n-soft); color: var(--n); }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button, .tabs a { background: var(--bg-2); border: 0; padding: .5rem .9rem; border-radius: 999px; font-weight: 800; cursor: pointer; font-family: inherit; color: var(--muted); font-size: .9rem; }
.tabs button.active, .tabs a.active { background: var(--ink); color: var(--bg); }
[data-theme="dark"] .tabs button.active, [data-theme="dark"] .tabs a.active { background: var(--brand); color: #fff; }

/* ---------- Progress ---------- */
.bar { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--sky)); border-radius: 999px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bar.teal > i { background: linear-gradient(90deg, var(--teal), #8fd39c); }
.bar.thin { height: 6px; }
.ring { position: relative; width: 96px; height: 96px; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring .track { stroke: var(--bg-2); }
.ring .fill { stroke: var(--brand); transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.ring .label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 1.1rem; text-align: center; line-height: 1.1; }
.ring .label small { display: block; font-size: .65rem; color: var(--muted); font-weight: 700; }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.calendar .day { aspect-ratio: 1; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; font-size: .7rem; font-weight: 800; color: var(--muted); }
.calendar .day.active { background: var(--brand); color: #fff; }
.calendar .day.hot { background: var(--brand-dark); color: #fff; }
.calendar .day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.week-strip { display: flex; gap: .4rem; }
.week-strip .d { flex: 1; text-align: center; font-size: .7rem; font-weight: 800; color: var(--muted); }
.week-strip .d .dot { width: 30px; height: 30px; margin: 0 auto .2rem; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: .9rem; }
.week-strip .d.active .dot { background: var(--accent); }
.week-strip .d.today .dot { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Word cards ---------- */
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; }
.word-card { position: relative; border: 2px solid var(--border); border-radius: 14px; padding: .8rem .9rem; background: var(--card); cursor: pointer; transition: transform .1s, border-color .15s, box-shadow .15s; }
.word-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.word-card.m { border-color: color-mix(in srgb, var(--m) 45%, var(--border)); background: linear-gradient(180deg, var(--m-soft), var(--card) 60%); }
.word-card.f { border-color: color-mix(in srgb, var(--f) 45%, var(--border)); background: linear-gradient(180deg, var(--f-soft), var(--card) 60%); }
.word-card.mf { border-color: color-mix(in srgb, var(--mf) 45%, var(--border)); background: linear-gradient(180deg, var(--mf-soft), var(--card) 60%); }
.word-card .article { font-weight: 900; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.word-card.m .article { color: var(--m); } .word-card.f .article { color: var(--f); } .word-card.mf .article { color: var(--mf); }
.word-card .spanish { font-weight: 900; font-size: 1.2rem; display: block; }
.word-card .translation { color: var(--muted); font-size: .9rem; display: block; }
.word-card .speaker { position: absolute; top: .5rem; right: .6rem; font-size: 1rem; opacity: .7; }
.word-card .mastery { position: absolute; bottom: .5rem; right: .6rem; display: flex; gap: 2px; }
.word-card .mastery i { width: 6px; height: 6px; border-radius: 50%; background: var(--border); display: block; }
.word-card .mastery i.on { background: var(--teal); }
.art-m { color: var(--m); font-weight: 900; } .art-f { color: var(--f); font-weight: 900; } .art-mf { color: var(--mf); font-weight: 900; }
.speak { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; border: 0; background: var(--bg-2); cursor: pointer; font-size: .95rem; vertical-align: middle; margin-left: .3rem; transition: background .15s, transform .1s; }
.speak:hover { background: var(--accent-soft); }
.speak:active { transform: scale(.9); }
.speak.speaking { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }

/* ---------- Practice ---------- */
.practice-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.practice-head .bar { flex: 1; }
.exercise { text-align: center; padding: 1.5rem 1rem; }
.exercise .prompt { font-size: 1.8rem; font-weight: 900; margin: .5rem 0 1rem; }
.exercise .kind { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; }
.options { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); max-width: 620px; margin: 0 auto; }
.options button { background: var(--card); border: 2px solid var(--border); border-radius: 14px; padding: .9rem 1rem; font-size: 1.05rem; font-weight: 800; cursor: pointer; font-family: inherit; color: var(--ink); transition: transform .08s, border-color .15s, background .15s; }
.options button:hover { border-color: var(--brand); transform: translateY(-1px); }
.options button.selected { border-color: var(--brand); background: var(--brand-soft); }
.options button.correct { border-color: var(--good); background: var(--good-soft); }
.options button.wrong { border-color: var(--bad); background: var(--bad-soft); }
.options button.el { border-color: var(--m); color: var(--m); } .options button.la { border-color: var(--f); color: var(--f); }
.feedback { margin: 1rem auto 0; max-width: 620px; padding: .9rem 1rem; border-radius: 14px; font-weight: 800; text-align: left; animation: rise .25s ease; }
.feedback.good { background: var(--good-soft); color: #2a6b3a; }
.feedback.bad { background: var(--bad-soft); color: #9b2c2c; }
.feedback.almost { background: var(--accent-soft); color: #8a5a00; }
.feedback .expected { font-size: 1.15rem; margin-top: .25rem; }
.feedback .expl { font-weight: 600; margin-top: .35rem; color: var(--ink); }
.gap-sentence { font-size: 1.35rem; font-weight: 700; line-height: 1.7; }
.gap-sentence input { display: inline-block; width: auto; min-width: 8ch; max-width: 16ch; padding: .2rem .5rem; text-align: center; font-size: 1.2rem; font-weight: 800; border-radius: 8px; vertical-align: baseline; }
.result-hero { text-align: center; padding: 2rem 1rem; }
.result-hero .big { font-size: 3.5rem; line-height: 1; }
.result-hero .score { font-size: 2.2rem; font-weight: 900; }
.xp-gain { display: inline-block; background: var(--accent-soft); color: #8a5a00; padding: .4rem .9rem; border-radius: 999px; font-weight: 900; margin: .5rem .25rem; }

/* ---------- Path ---------- */
.path { position: relative; padding-left: 1.75rem; }
.path::before { content: ''; position: absolute; left: .55rem; top: .5rem; bottom: .5rem; width: 3px; background: var(--border); border-radius: 3px; }
.path-item { position: relative; margin-bottom: .6rem; }
.path-item::before { content: ''; position: absolute; left: -1.62rem; top: 1.1rem; width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--border); }
.path-item.done::before { background: var(--teal); border-color: var(--teal); }
.path-item.started::before { background: var(--accent); border-color: var(--accent); }
.path-item.next::before { background: var(--brand); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.path-item .card { margin: 0; display: flex; gap: .9rem; align-items: center; }
.path-item .ico { font-size: 1.6rem; width: 2.2rem; text-align: center; }
.path-item.next .card { border-color: var(--brand); }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.conj-table td:first-child { color: var(--muted); font-weight: 700; white-space: nowrap; width: 1%; padding-right: 2rem; }
.conj-table td.form { font-weight: 800; }
.irregular { color: var(--brand-dark); }

/* ---------- Grammar prose ---------- */
.prose p { margin: 0 0 .8rem; }
.prose ul { margin: 0 0 .8rem 1.2rem; padding: 0; }
.prose li { margin-bottom: .25rem; }
.prose code { background: var(--bg-2); padding: .1rem .35rem; border-radius: 6px; font-family: inherit; font-weight: 800; color: var(--brand-dark); }
.prose strong { font-weight: 900; }
.example { display: flex; gap: .6rem; align-items: baseline; padding: .5rem .75rem; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 10px 10px 0; margin-bottom: .5rem; }
.example .es { font-weight: 800; }
.example .tr { color: var(--muted); font-size: .9rem; }
.tip-box { background: var(--accent-soft); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .6rem; display: flex; gap: .6rem; }
.tip-box .ico { font-size: 1.2rem; }

/* ---------- Achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.ach { text-align: center; padding: 1rem .5rem; border-radius: 14px; background: var(--card); border: 1px solid var(--border); }
.ach .ico { font-size: 2.2rem; }
.ach .name { font-weight: 800; font-size: .9rem; margin-top: .3rem; }
.ach.locked { opacity: .45; filter: grayscale(1); }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 420px; }
.chat .messages { flex: 1; overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .5rem; }
.msg { max-width: 78%; padding: .6rem .9rem; border-radius: 16px; background: var(--bg-2); animation: rise .2s ease; }
.msg.mine { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.msg .meta { font-size: .68rem; opacity: .7; margin-top: .2rem; }
.chat form { display: flex; gap: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.chat form textarea { min-height: 44px; max-height: 120px; }

/* ---------- Toasts, modals, confetti ---------- */
.toast-wrap { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: .7rem 1rem; border-radius: 12px; font-weight: 800; box-shadow: var(--shadow); animation: toastIn .3s ease; pointer-events: auto; max-width: 320px; }
.toast.xp { background: linear-gradient(135deg, var(--brand), var(--purple)); color: #fff; }
.toast.good { background: var(--teal); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-bg { position: fixed; inset: 0; background: rgba(20, 12, 6, .55); display: grid; place-items: center; z-index: 90; padding: 1rem; animation: fade .2s ease; }
.modal { background: var(--card); border-radius: 20px; padding: 1.75rem; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2,.9,.3,1.3); }
.modal .big { font-size: 4rem; line-height: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; }

/* ---------- Landing ---------- */
.landing-nav { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; max-width: 1100px; margin: 0 auto; }
.landing-nav .spacer { flex: 1; }
.hero { max-width: 1100px; margin: 0 auto; padding: 3rem 1.5rem 2rem; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 900; line-height: 1.05; }
.hero h1 span { color: var(--brand); }
.hero p.lead { font-size: 1.2rem; color: var(--muted); }
.hero-card { background: var(--card); border-radius: 24px; padding: 1.5rem; box-shadow: var(--shadow); border: 1px solid var(--border); transform: rotate(-1.5deg); }
.section { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }
.feature { padding: 1.25rem; border-radius: 18px; background: var(--card); border: 1px solid var(--border); }
.feature .ico { font-size: 2rem; }
.levels-strip { display: flex; gap: .5rem; flex-wrap: wrap; }
.levels-strip span { padding: .5rem .9rem; border-radius: 12px; background: var(--card); border: 1px solid var(--border); font-weight: 800; }
footer.landing { text-align: center; color: var(--muted); padding: 2rem; font-size: .85rem; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; padding-top: 1.5rem; } .hero-card { transform: none; } }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }

/* ---------- Flashcards ---------- */
.flashcard { perspective: 1200px; height: 260px; cursor: pointer; }
.flashcard .inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flipped .inner { transform: rotateY(180deg); }
.flashcard .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 20px; background: var(--card); border: 2px solid var(--border); display: grid; place-items: center; text-align: center; padding: 1.5rem; font-size: 1.6rem; font-weight: 900; box-shadow: var(--shadow); }
.flashcard .face.back { transform: rotateY(180deg); background: var(--brand-soft); }

/* ---------- Misc ---------- */
.kpi { text-align: center; padding: 1rem; }
.kpi .v { font-size: 2rem; font-weight: 900; line-height: 1; }
.kpi .l { color: var(--muted); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-top: .3rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .ico { font-size: 1.4rem; width: 2rem; text-align: center; }
.avatar-lg { font-size: 2.6rem; width: 64px; height: 64px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; }
.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--border), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; min-height: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.spark i { flex: 1; background: var(--brand); border-radius: 3px 3px 0 0; min-height: 3px; opacity: .85; }
.spark i.today { background: var(--accent); }
.mini-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.mini-chart i { flex: 1; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.mini-chart i:hover::after { content: attr(data-v); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: .7rem; padding: .1rem .4rem; border-radius: 6px; white-space: nowrap; }
.pill-select { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill-select label { display: inline-flex; align-items: center; gap: .3rem; background: var(--bg-2); padding: .4rem .7rem; border-radius: 999px; cursor: pointer; font-size: .85rem; margin: 0; }
.pill-select label:has(input:checked) { background: var(--brand-soft); color: var(--brand-dark); }
.pill-select input { width: auto; margin: 0; }
kbd { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 0 .35rem; font-family: inherit; font-size: .8rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Teacher photo + socials ---------- */
.avatar-lg.photo, img.avatar-photo { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; display: block; background: var(--brand); }
.avatar-lg.photo.sm { width: 44px; height: 44px; }
.sidebar .user-card .avatar img { width: 34px; height: 34px; border-radius: 50%; display: block; object-fit: cover; }
.socials { display: flex; flex-wrap: wrap; gap: .4rem; }
.socials .chip { background: rgba(255,255,255,.18); color: #fff; font-weight: 800; }
.socials .chip:hover { background: rgba(255,255,255,.3); text-decoration: none; }
footer.landing .socials { justify-content: center; margin-top: .6rem; }
footer.landing .socials .chip { background: var(--bg-2); color: var(--ink); }

/* ---------- Live classroom ---------- */
.cls-body { background: #0f1a2b; color: #eef3fa; }
.cls { display: flex; flex-direction: column; height: 100vh; }
.cls-top { display: flex; align-items: center; gap: .8rem; padding: .5rem .9rem; background: #16253a; border-bottom: 1px solid #29405e; }
.cls-top .chip { background: #29405e; color: #eef3fa; }
.cls-top .chip.good { background: var(--teal); color: #fff; } .cls-top .chip.warn { background: var(--accent); color: #3a2a00; }
.cls-main { display: flex; flex: 1; min-height: 0; }
.cls-stage { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: .6rem; gap: .6rem; }
.cls-videos { position: relative; flex: 1; min-height: 0; background: #000; border-radius: 16px; overflow: hidden; }
.cls-remote { position: absolute; inset: 0; }
.cls-remote video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.cls-local { position: absolute; right: .8rem; bottom: .8rem; width: 22%; min-width: 140px; max-width: 280px; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; border: 2px solid #29405e; background: #16253a; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.cls-local video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cls-name { position: absolute; left: .5rem; bottom: .4rem; background: rgba(0,0,0,.55); color: #fff; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; }
.cls-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: #a9b8cc; font-weight: 700; pointer-events: none; text-align: center; padding: 1rem; }
.cls-overlay.sharing { inset: auto .8rem .8rem auto; place-items: end; background: var(--purple); color: #fff; border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; }
.cls-tools { display: flex; justify-content: center; gap: .6rem; }
.cls-tools .tool { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #29405e; color: #fff; font-size: 1.3rem; cursor: pointer; transition: background .15s, transform .1s; }
.cls-tools .tool:hover { background: #3a5680; } .cls-tools .tool:active { transform: scale(.94); }
.cls-tools .tool.off { background: var(--bad); } .cls-tools .tool.on { background: var(--teal); } .cls-tools .tool:disabled { opacity: .35; cursor: not-allowed; }
.cls-side { width: 400px; max-width: 45vw; display: flex; flex-direction: column; background: var(--card); color: var(--ink); border-left: 1px solid var(--border); }
.cls-side .tabs { display: flex; flex-wrap: wrap; gap: .2rem; padding: .4rem; border-bottom: 1px solid var(--border); }
.cls-side .tabs button { flex: 1; border: 0; background: transparent; padding: .45rem .3rem; border-radius: 10px; font: inherit; font-weight: 800; font-size: .8rem; cursor: pointer; color: var(--muted); white-space: nowrap; }
.cls-side .tabs button.active { background: var(--brand-soft); color: var(--brand-dark); }
.cls-panel { flex: 1; min-height: 0; overflow: auto; padding: .7rem; display: flex; flex-direction: column; }
.cls-chat { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: .4rem; }
.cls-chat .msg { max-width: 92%; padding: .4rem .7rem; border-radius: 14px; background: var(--bg-2); }
.cls-chat .msg.mine { align-self: flex-end; background: var(--brand-soft); }
.cls-notes { flex: 1; width: 100%; min-height: 240px; resize: vertical; font: inherit; font-size: .95rem; line-height: 1.5; padding: .7rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); }
.cls-main.ex-focus .cls-stage { flex: 0 0 340px; }
.cls-main.ex-focus .cls-side { flex: 1; width: auto; max-width: none; }
.cls-panel .practice-head { flex-wrap: wrap; }
@media (max-width: 900px) {
  .cls-main { flex-direction: column; }
  .cls-stage { flex: 0 0 42vh; }
  .cls-side { width: auto; max-width: none; flex: 1; border-left: 0; border-top: 1px solid var(--border); }
  .cls-main.ex-focus .cls-stage { flex: 0 0 160px; }
  .cls-local { width: 30%; min-width: 100px; }
}

/* ---- whiteboard (classroom tab + pop-out board.html) ---- */
.bd-host { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: .4rem; }
.bd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; padding: .3rem; background: var(--bg-2); border-radius: 12px; }
.bd-btn { width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; font: inherit; font-size: 1.15rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); touch-action: manipulation; }
.bd-btn:hover { background: var(--card); } .bd-btn.active { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }
.bd-btn i { display: block; border-radius: 50%; background: currentColor; }
.bd-color { width: 26px; height: 26px; border-radius: 50%; margin: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.bd-color.active { box-shadow: 0 0 0 3px var(--brand); }
.bd-pick { width: 30px; height: 30px; border: 0; padding: 0; background: transparent; cursor: pointer; }
.bd-sep { width: 1px; height: 26px; background: var(--border); margin: 0 .2rem; }
.bd-wrap { position: relative; flex: 1; min-height: 240px; background: #cfd8e3; border-radius: 12px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.bd-wrap canvas { position: absolute; background: transparent; touch-action: none; }
.bd-wrap canvas:first-child { background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
.bd-lock { position: absolute; left: 50%; top: .6rem; transform: translateX(-50%); background: var(--bad); color: #fff; padding: .25rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 800; pointer-events: none; }
.cls-main.board-focus .cls-stage { flex: 0 0 340px; }
.cls-main.board-focus .cls-side { flex: 1; width: auto; max-width: none; }
@media (max-width: 900px) { .cls-main.board-focus .cls-stage { flex: 0 0 160px; } }
