/* door2.pt — back-office (área do aluno / professora). Flat paper surfaces; glass only over ink. */
*, *::before, *::after { box-sizing: border-box; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
em { font-style: italic; color: var(--cobalt); }
.muted { color: var(--ink-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Login ---------- */
.login { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(280px, 42%) 1fr; }
.login-art { position: relative; background: #f6f3ec; border-right: 1px solid var(--hairline); overflow: hidden; }
.login-art .gx-bloom { position: absolute; inset: 0; }
.login-main { position: relative; display: grid; place-items: center; padding: var(--space-7) var(--space-4); }
.login-main > .d2-ink { position: absolute; inset: 0; }
.login-card { position: relative; width: 100%; max-width: 420px; display: grid; gap: var(--space-5); }
.login-card h1 { font-size: clamp(40px, 6vw, 56px); }
.login-top { display: flex; justify-content: space-between; align-items: center; }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; grid-template-rows: 240px auto; } .login-art { border-right: 0; border-bottom: 1px solid var(--hairline); } .login-art .gx-rods { width: 170px; } }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: var(--space-6); padding: var(--space-6) var(--space-4); background: var(--surface-200); border-right: 1px solid var(--hairline); }
.side-brand { padding: 0 var(--space-3); text-decoration: none; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: var(--space-3); height: 42px; padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--ink-muted); text-decoration: none; font: 500 15px/1 var(--font-sans); }
.side-nav a:hover { color: var(--ink); background: var(--surface-300); }
.side-nav a.is-active { color: var(--on-cobalt); background: var(--cobalt); }
.side-nav .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; font: 500 11px/1 var(--font-mono); background: var(--cobalt-wash); color: var(--cobalt-deep); }
.side-nav .badge[hidden] { display: none; }
.side-nav a.is-active .badge { background: var(--on-cobalt); color: var(--cobalt); }
.side-foot { margin-top: auto; display: grid; gap: var(--space-3); padding: var(--space-4) var(--space-3) 0; border-top: 1px solid var(--hairline); }
.who { display: grid; gap: 2px; }
.who strong { font: 600 14px/1.3 var(--font-sans); }
.side-tools { display: flex; align-items: center; gap: var(--space-2); }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; padding: 0; text-decoration: none; }
.icon-btn:hover { background: var(--surface-300); }
.main { min-width: 0; padding: var(--space-7) var(--space-7) var(--space-9); }
.page { max-width: 1040px; margin: 0 auto; display: grid; gap: var(--space-7); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4); }
.page-head h1 { margin-top: var(--space-3); }
.page-head .d2-kicker { min-width: 240px; }

/* mobile: top bar + bottom tabs */
.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px var(--space-2) calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--hairline); }
  .side-brand, .side-foot { display: none; }
  .side-nav { display: flex; width: 100%; justify-content: space-around; }
  .side-nav a { flex-direction: column; justify-content: center; gap: 4px; height: 52px; padding: 0 6px; font-size: 11px; border-radius: var(--radius-sm); flex: 1; min-width: 0; }
  .side-nav a span.lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .side-nav .badge { position: absolute; margin: -30px 0 0 26px; min-width: 18px; height: 18px; font-size: 10px; }
  .side-nav a { position: relative; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-200); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; z-index: 30; }
  .main { padding: var(--space-6) var(--space-4) 120px; }
}
@media (max-width: 420px) { .side-nav a span.lbl { display: none; } }

/* ---------- Building blocks ---------- */
.panel { background: var(--surface-200); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: var(--space-5); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-5); }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); }
.stat { padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); display: grid; gap: var(--space-2); }
.stat b { font: 400 44px/1 var(--font-display); letter-spacing: -.02em; }
.stat .label { color: var(--ink-muted); }
.empty { padding: var(--space-7) var(--space-5); text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius-md); color: var(--ink-muted); display: grid; gap: var(--space-3); justify-items: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.d2-btn .i { width: 18px; height: 18px; }
.d2-btn--danger { background: transparent; color: var(--neon-ink); border-color: var(--neon-ink); }
.d2-btn--danger:hover { background: var(--surface-300); }

/* Hero card on the dashboard: glass over ink */
.next { border-radius: var(--radius-lg); overflow: hidden; padding: var(--space-6); display: grid; gap: var(--space-6); min-height: 300px; align-content: space-between; border: 1px solid var(--hairline); }
@media (max-width: 560px) { .next { padding: var(--space-5); } }
.next-when { font: 400 clamp(40px, 6vw, 64px)/1 var(--font-display); letter-spacing: -.02em; }
.next .d2-glass { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }

/* Rhythm dots (after the halftone grid) */
.rhythm svg { display: block; width: 100%; height: auto; }
.rhythm circle { fill: var(--cobalt); }
.rhythm-legend { display: flex; justify-content: space-between; margin-top: var(--space-3); }

/* Lessons list */
.list { display: grid; gap: var(--space-3); }
.item { display: grid; grid-template-columns: 72px 1fr auto; gap: var(--space-5); align-items: center; padding: var(--space-4) var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); }
.item.is-past { opacity: .72; }
.item.is-cancelled .item-title { text-decoration: line-through; }
.item-date { display: grid; justify-items: center; gap: 2px; padding: var(--space-2) 0; border-right: 1px solid var(--hairline); padding-right: var(--space-4); }
.item-date b { font: 400 40px/1 var(--font-display); }
.item-date span { color: var(--ink-muted); }
.item-body { display: grid; gap: var(--space-1); min-width: 0; }
.item-meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; color: var(--ink-muted); }
.item-title { font: 600 18px/1.3 var(--font-sans); }
@media (max-width: 680px) { .item { grid-template-columns: 56px 1fr; } .item .row-actions { grid-column: 1 / -1; } .item-date b { font-size: 32px; } }

/* Module cards */
.module { display: grid; gap: var(--space-3); align-content: start; padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); }
.module h3 { font: 600 19px/1.3 var(--font-sans); }
.file { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-300); min-width: 0; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.file a { color: var(--cobalt); }
.file-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file > .i { color: var(--cobalt); }

/* Homework */
.hw { display: grid; gap: var(--space-4); padding: var(--space-5); border-radius: var(--radius-md); background: var(--surface-200); border: 1px solid var(--hairline); }
.hw-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); align-items: flex-start; }
.hw-title { font: 600 18px/1.3 var(--font-sans); }
.hw-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.feedback { padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm); background: var(--cobalt-wash); color: var(--ink); white-space: pre-wrap; }
.feedback .label { display: block; color: var(--cobalt-deep); margin-bottom: var(--space-2); }
.grade { font: 400 36px/1 var(--font-display); color: var(--cobalt); }
.tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-300); }
.tabs button { height: 34px; padding: 0 var(--space-4); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 500 14px/1 var(--font-sans); cursor: pointer; }
.tabs button.is-active { background: var(--surface-200); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }

/* Students table */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font: 500 11px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); padding: 0 var(--space-3) var(--space-3); border-bottom: 1px solid var(--hairline); }
.table td { padding: var(--space-4) var(--space-3); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tr.is-off td { opacity: .55; }
.table-wrap { overflow-x: auto; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: var(--space-4) 0; border-bottom: 1px solid var(--hairline); }
  .table td { border: 0; padding: var(--space-1) 0; }
}

/* Forms */
.form { display: grid; gap: var(--space-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.field { display: grid; gap: var(--space-2); }
.field > .label { color: var(--ink-muted); }
.field input:not([type=checkbox]), .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-100); color: var(--ink); font: var(--text-body); }
.field input[type=file] { padding: 8px; }
.field textarea { resize: vertical; min-height: 96px; }
.field .hint { color: var(--ink-muted); }
.req { color: var(--neon-ink); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--space-2); max-height: 200px; overflow: auto; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-300); }
.checks label { display: flex; gap: var(--space-2); align-items: center; font: var(--text-body-sm); }
.checks input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-2); }
.form-error { color: var(--neon-ink); min-height: 1.3em; }
.secret { font: 500 20px/1.2 var(--font-mono); letter-spacing: .06em; padding: var(--space-4); border-radius: var(--radius-sm); background: var(--cobalt-wash); color: var(--cobalt-deep); text-align: center; user-select: all; }

/* Modal */
.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--surface-200); color: var(--ink); box-shadow: var(--shadow-float); }
.modal::backdrop { background: rgba(12, 15, 26, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-inner { padding: var(--space-6); display: grid; gap: var(--space-5); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); }
.modal-head h2 { font: 400 36px/1.05 var(--font-display); letter-spacing: -.015em; }

/* Toast */
.toast { position: fixed; z-index: 60; left: 50%; bottom: var(--space-6); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill); background: var(--ink); color: var(--surface-100); font: 500 14px/1.3 var(--font-sans); transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { .toast { bottom: 96px; } }

/* ---------- Classroom ---------- */
.room { display: grid; grid-template-columns: 1fr 300px; gap: var(--space-5); align-items: start; }
.room-stage { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #0c0f1a; aspect-ratio: 16 / 10; min-height: 420px; }
.room-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.room-wait { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #efece4; padding: var(--space-6); }
.room-wait .gx-dots circle { fill: #8aa2ff; }
.room-side { display: grid; gap: var(--space-4); }
@media (max-width: 1100px) { .room { grid-template-columns: 1fr; } .room-stage { aspect-ratio: auto; height: 70vh; min-height: 360px; } }
.room-full .main { padding: var(--space-4); }

/* ---------- Ink blooms behind frosted glass ---------- */
body { background: var(--surface-100); }
#app { position: relative; z-index: 1; }
.app-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.app-bg .gx-bloom { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
[data-theme="dark"] .app-bg .gx-bloom { filter: invert(1) hue-rotate(180deg); mix-blend-mode: screen; opacity: .7; }
/* the login has its own art */
#app:has(.login) ~ .app-bg, body:has(.login) .app-bg { display: none; }
.app-bg ~ #app, #app { background: transparent; }

.side, .topbar, .panel, .stat, .item, .module, .hw, .empty, .modal, .table-wrap {
  background: color-mix(in srgb, var(--surface-200) 58%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border-color: var(--glass-stroke);
  box-shadow: inset 1px 1px 0 color-mix(in srgb, var(--glass-specular) 70%, transparent), 0 10px 32px rgba(14,31,102,.07);
}
@media (min-width: 901px) { .side { border-right: 1px solid var(--glass-stroke); } }
.empty { border-style: dashed; border-color: var(--line-strong); }
.file { background: color-mix(in srgb, var(--surface-300) 70%, transparent); }
.modal { background: color-mix(in srgb, var(--surface-200) 86%, transparent); }
.next { border-color: var(--glass-stroke); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .side, .topbar, .panel, .stat, .item, .module, .hw, .empty, .modal, .table-wrap { background: var(--surface-200); }
}

/* phones: the top bar keeps its own height; extra space goes to the page */
@media (max-width: 900px) {
  .shell { grid-template-rows: auto 1fr; align-content: start; }
  .topbar { border-bottom: 1px solid var(--glass-stroke); }
}

/* Light / Dark switch */
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface-300) 80%, transparent); border: 1px solid var(--hairline); }
.theme-switch button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font: 500 13px/1 var(--font-sans); cursor: pointer; }
.theme-switch button .i { width: 16px; height: 16px; }
.theme-switch button.is-active { background: var(--surface-200); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.theme-switch.is-compact button { width: 34px; padding: 0; justify-content: center; }
.side-foot .theme-switch { justify-self: start; }
.login-top .side-tools { display: flex; align-items: center; gap: var(--space-2); }
.switch-row { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.switch-row input:disabled + span { color: var(--ink-muted); }

/* Headings match the public site: Schibsted Grotesk 800, the highlighted word in cobalt (upright) */
.page-head h1.display-title, .login-card h1.display-title, .modal-head h2, .next-when {
  font-family: var(--font-sans); font-weight: 800; letter-spacing: -.04em; line-height: 1.02; }
.page-head h1.display-title { font-size: clamp(34px, 4.4vw, 52px); }
.login-card h1.display-title { font-size: clamp(36px, 5vw, 50px); }
.modal-head h2 { font-size: 28px; }
.next-when { font-size: clamp(34px, 5vw, 54px); }
.page-head h1 em, .login-card h1 em, .modal-head h2 em, .next-when em { font-style: normal; color: var(--cobalt); }
.stat b, .grade, .item-date b { font-family: var(--font-sans); font-weight: 800; letter-spacing: -.04em; }
.stat b { font-size: 40px; }
.grade { font-size: 28px; }
.item-date b { font-size: 34px; }

/* ---------- Menu groups (desktop) and the More button (phones) ---------- */
.side { overflow-y: auto; }
.side-nav a { height: 38px; }
.side-nav .nav-group { padding: var(--space-4) var(--space-3) var(--space-1); letter-spacing: .08em; }
.nav-more { display: none; }
.more-nav { display: grid; gap: 2px; }
.more-nav a { display: flex; align-items: center; gap: var(--space-3); height: 44px; padding: 0 var(--space-3); border-radius: var(--radius-pill); color: var(--ink); text-decoration: none; font: 500 16px/1 var(--font-sans); }
.more-nav a.is-active { color: var(--on-cobalt); background: var(--cobalt); }
.more-nav .nav-group { padding: var(--space-4) var(--space-3) var(--space-1); letter-spacing: .08em; }
.more-nav .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; font: 500 11px/1 var(--font-mono); background: var(--cobalt-wash); color: var(--cobalt-deep); }
.more-nav .badge[hidden] { display: none; }
@media (max-width: 900px) {
  .side-nav .nav-extra, .side-nav .nav-group { display: none; }
  .nav-more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 52px; padding: 0 6px; flex: 1; min-width: 0; position: relative; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-muted); font: 500 11px/1 var(--font-sans); cursor: pointer; }
  .nav-more .badge { position: absolute; margin: -30px 0 0 26px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); display: grid; place-items: center; font: 500 10px/1 var(--font-mono); background: var(--cobalt-wash); color: var(--cobalt-deep); }
  .nav-more .badge[hidden] { display: none; }
}
@media (max-width: 420px) { .nav-more span.lbl { display: none; } }
.lede { max-width: 62ch; margin-top: calc(var(--space-4) * -1); }
.icon-btn .i, .play-btn .i { width: 20px; height: 20px; }
.rec-btn.is-rec { color: var(--neon-ink); border-color: var(--neon-ink); }
.rec-btn.is-rec .i { animation: d2-pulse 1s ease-in-out infinite; }
@keyframes d2-pulse { 50% { opacity: .35; } }
.field.search input { min-width: 200px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Messages ---------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; gap: var(--space-5); align-items: start; }
.chat-threads { display: grid; gap: 2px; padding: var(--space-3); max-height: 72vh; overflow-y: auto; }
.thread { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-2); padding: var(--space-3); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.thread:hover { background: color-mix(in srgb, var(--surface-300) 70%, transparent); }
.thread.is-active { background: var(--cobalt-wash); }
.thread-name { font: 600 15px/1.3 var(--font-sans); }
.thread.is-unread .thread-name { color: var(--cobalt-deep); }
.thread .badge { justify-self: end; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; font: 500 11px/1 var(--font-mono); background: var(--cobalt); color: var(--on-cobalt); }
.thread-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; grid-column: 1; }
.thread-when { grid-column: 2; grid-row: 2; align-self: center; }
.chat-panel { padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--hairline); }
.chat-back { display: none; }
.chat-blank { min-height: 340px; display: grid; place-content: center; justify-items: center; gap: var(--space-3); color: var(--ink-muted); text-align: center; padding: var(--space-6); }
.chat-blank .i { width: 32px; height: 32px; color: var(--cobalt); }
.chat { display: grid; grid-template-rows: 1fr auto; height: min(68vh, 680px); min-height: 380px; }
.chat-log { overflow-y: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.chat-empty { margin: auto; }
.bubble { max-width: min(78%, 520px); align-self: flex-start; display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: 18px 18px 18px 6px; background: color-mix(in srgb, var(--surface-100) 82%, transparent); border: 1px solid var(--hairline); }
.bubble.is-mine { align-self: flex-end; border-radius: 18px 18px 6px 18px; background: var(--cobalt-wash); border-color: transparent; }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; font: var(--text-body); }
.bubble-meta { color: var(--ink-muted); justify-self: end; }
.bubble audio { width: min(280px, 100%); height: 40px; }
.bubble-img img { display: block; max-width: 100%; max-height: 280px; border-radius: 12px; }
.bubble .file { background: color-mix(in srgb, var(--surface-200) 80%, transparent); }
.chat-compose { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--hairline); background: color-mix(in srgb, var(--surface-200) 70%, transparent); }
.chat-compose textarea { width: 100%; min-height: 48px; max-height: 180px; resize: vertical; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-100); color: var(--ink); font: var(--text-body); }
.chat-tools { display: flex; align-items: center; gap: var(--space-2); }
.chat-tools [type=submit] { margin-left: auto; }
.chat-tools label.icon-btn { cursor: pointer; }
.rec-time { font: 500 12px/1 var(--font-mono); }
.chat-att { display: flex; align-items: center; gap: var(--space-2); }
.chat-att .d2-tag .i { width: 14px; height: 14px; vertical-align: -2px; }
@media (max-width: 900px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-layout.has-thread .chat-threads { display: none; }
  .chat-layout:not(.has-thread) .chat-panel { display: none; }
  .chat-back { display: inline-flex; }
  .chat { height: calc(100vh - 290px); min-height: 360px; }
  .bubble { max-width: 88%; }
}

/* ---------- Vocabulary ---------- */
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.word { display: grid; gap: var(--space-2); align-content: start; padding: var(--space-5); border-radius: var(--radius-md); border: 1px solid var(--glass-stroke); background: color-mix(in srgb, var(--surface-200) 58%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); }
.word.is-learned { opacity: .72; }
.word-top { display: flex; justify-content: space-between; gap: var(--space-3); align-items: flex-start; }
.word-pt { font: 800 24px/1.1 var(--font-sans); letter-spacing: -.03em; }
.word-pron { margin-top: 4px; letter-spacing: .02em; }
.word-ex, .flash .word-ex { font: italic 400 19px/1.35 var(--font-display); color: var(--ink-muted); }
.word-foot { margin-top: var(--space-2); }
.word-acts { display: inline-flex; gap: var(--space-1); margin-left: auto; align-items: center; }
.word .d2-tag .i { width: 13px; height: 13px; vertical-align: -2px; }
.flash-wrap { display: grid; gap: var(--space-4); }
.flash { display: grid; justify-items: center; gap: var(--space-3); text-align: center; padding: var(--space-7) var(--space-5); border-radius: var(--radius-lg); background: var(--cobalt-wash); }
.flash-pt { font: 800 clamp(34px, 6vw, 48px)/1.05 var(--font-sans); letter-spacing: -.04em; color: var(--cobalt-deep); }
.flash-back { display: grid; gap: var(--space-2); justify-items: center; }
.flash-end { display: grid; gap: var(--space-4); justify-items: center; text-align: center; padding: var(--space-6) 0; }
.flash-end .i { width: 36px; height: 36px; color: var(--coral); }

/* ---------- Pronunciation ---------- */
.pron-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.pron { display: grid; gap: var(--space-2); align-content: start; padding: var(--space-5); border-radius: var(--radius-md); border: 1px solid var(--glass-stroke); background: color-mix(in srgb, var(--surface-200) 58%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); }
.pron.is-missing { border-style: dashed; border-color: var(--line-strong); }
.pron-word { display: flex; align-items: center; gap: var(--space-3); }
.pron-pt { font: 800 26px/1.1 var(--font-sans); letter-spacing: -.03em; }
.pron-hint { padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--surface-300) 70%, transparent); }
.pron-mine { display: inline-flex; flex-wrap: wrap; gap: var(--space-2); }
.pron-mine[hidden] { display: none; }
.play-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--cobalt); color: var(--on-cobalt); cursor: pointer; }
.play-btn .i { fill: currentColor; stroke: none; }
.play-btn:hover { background: var(--cobalt-deep); }

/* ---------- Weekly challenge ---------- */
.challenge { position: relative; border-radius: var(--radius-lg); overflow: hidden; padding: var(--space-6); display: grid; gap: var(--space-5); border: 1px solid var(--glass-stroke); }
.challenge > * { position: relative; }
.challenge-text { font: 400 clamp(30px, 4.4vw, 48px)/1.08 var(--font-display); letter-spacing: -.015em; max-width: 24ch; }
.challenge-en summary { cursor: pointer; }
.challenge-en p { margin-top: var(--space-2); color: var(--ink-muted); max-width: 52ch; }
.challenge-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.challenge-form .field { flex: 1; min-width: 220px; }
.challenge-form input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-100); color: var(--ink); font: var(--text-body); }
.challenge-done { display: flex; flex-wrap: wrap; gap: var(--space-4); justify-content: space-between; align-items: center; }
.challenge-done .heading-md .i { color: var(--cobalt); vertical-align: -3px; }
.challenge-who { display: grid; gap: var(--space-2); }
.challenge-who ul { display: grid; gap: var(--space-1); padding-left: 1.1em; }
.bank-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--hairline); }
.bank-row:last-child { border-bottom: 0; }
.bank-row > div:first-child { flex: 1; min-width: 240px; }

/* ---------- Conversation club ---------- */
.club-topics { display: grid; gap: var(--space-1); margin-top: var(--space-2); }
.topics { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding: 0; }
.topics li { padding: 4px 12px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--coral) 14%, transparent); font: var(--text-body-sm); }
.item .d2-tag .i { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- Culture library ---------- */
.cu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-5); }
.cu-card { display: grid; grid-template-rows: auto 1fr; border-radius: var(--radius-md); overflow: hidden; text-decoration: none; color: var(--ink); border: 1px solid var(--glass-stroke); background: color-mix(in srgb, var(--surface-200) 58%, transparent); -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6); transition: transform .2s ease; }
.cu-card:hover { transform: translateY(-2px); }
.cu-card img, .cu-card .cu-art { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; }
.cu-card-body { display: grid; gap: var(--space-2); padding: var(--space-4) var(--space-5) var(--space-5); align-content: start; }
.cu-card h3 { font: 700 20px/1.2 var(--font-sans); letter-spacing: -.02em; }
.cu-card .label-sm .i { width: 13px; height: 13px; vertical-align: -2px; }
.cu-read { color: var(--cobalt); }
.cu-draft { color: var(--neon-ink); }
.cu-art { background: color-mix(in srgb, var(--surface-300) 60%, transparent); }
.cu-art svg { display: block; width: 100%; height: 100%; }
.cu-article { display: grid; gap: var(--space-5); max-width: 760px; padding: var(--space-6); }
.cu-title { font: 800 clamp(34px, 5vw, 52px)/1.02 var(--font-sans); letter-spacing: -.04em; }
.cu-hero, .cu-art--hero { width: 100%; border-radius: var(--radius-md); aspect-ratio: 2 / 1; object-fit: cover; overflow: hidden; }
.cu-article audio { width: 100%; }
.cu-body { display: grid; gap: var(--space-4); font: var(--text-body-lg); }
.cu-body p { max-width: 62ch; }
.cu-body ul { display: grid; gap: var(--space-2); padding-left: 1.1em; }
.cu-body ul.cu-words { list-style: none; padding: 0; }
.cu-words li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--surface-300) 60%, transparent); }
.cu-body h3 { margin-top: var(--space-2); }

/* ---------- Home additions ---------- */
.home-life { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .home-life { grid-template-columns: 1fr; } }
.home-card { display: grid; gap: var(--space-3); align-content: start; text-decoration: none; color: var(--ink); transition: transform .2s ease; }
.home-card:hover { transform: translateY(-2px); }
.home-card .panel-head .i { color: var(--cobalt); }
.home-card .d2-tag .i { width: 13px; height: 13px; vertical-align: -2px; }
.home-ch { font: 400 26px/1.15 var(--font-display); }
.home-unread { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); text-decoration: none; color: var(--ink); }
.home-unread .i { color: var(--cobalt); }
.home-unread span:last-child { margin-left: auto; color: var(--cobalt); }
.word, .pron, .cu-card { box-shadow: inset 1px 1px 0 color-mix(in srgb, var(--glass-specular) 70%, transparent), 0 10px 32px rgba(14,31,102,.07); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .word, .pron, .cu-card { background: var(--surface-200); } }
.icon-btn.rec-btn.is-rec { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; }
.learn-btn.is-on { background: var(--cobalt); border-color: var(--cobalt); color: var(--on-cobalt); }
.words > *, .pron-grid > *, .cu-grid > * { min-width: 0; }
.cu-art--hero { aspect-ratio: 3 / 1; }
.d2-tag .i { margin-right: 2px; }
/* phones: the conversation fits between the page title and the bottom menu */
@media (max-width: 900px) {
  .lede { font: var(--text-body); }
  .chat { height: calc(100dvh - 430px); min-height: 330px; }
  .chat-layout.has-thread .chat { height: calc(100dvh - 330px); }
}
.form-actions[hidden], .flash-back[hidden], .chat-att[hidden] { display: none; }
