:root {
  --bg: #0f1220;
  --bg-2: #161a2e;
  --panel: #1c2140;
  --panel-2: #232a52;
  --text: #eef1ff;
  --muted: #9aa3c7;
  --brand: #6c5ce7;
  --brand-2: #8f7bff;
  --accent: #00d2a8;
  --danger: #ff6b81;
  --warn: #ffb454;
  --ok: #38d39f;
  --border: #2a3160;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: radial-gradient(1200px 700px at 80% -10%, #1a1f3d 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Tajawal", system-ui, -apple-system, Segoe UI, sans-serif;
}

body {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--bg-2), #12162a);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 20px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: var(--shadow);
}
.brand-text strong { display: block; font-size: 18px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: transparent; color: var(--muted);
  border: 1px solid transparent; border-radius: 12px;
  padding: 11px 12px; font-size: 15px; cursor: pointer;
  text-align: left; transition: .18s;
}
.nav-item .ico { font-size: 18px; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-badge {
  margin-left: auto; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 700; min-width: 20px; text-align: center;
  padding: 1px 7px; border-radius: 999px;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(108,92,231,.25), rgba(0,210,168,.15));
  color: #fff; border-color: var(--border);
}

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.settings-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; cursor: pointer; font-size: 14px;
}
.settings-btn:hover { background: var(--panel-2); }
.streak {
  background: rgba(255,180,84,.12); color: var(--warn);
  border: 1px solid rgba(255,180,84,.25); border-radius: 12px;
  padding: 8px 12px; font-size: 13px; text-align: center;
}

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
  background: rgba(15,18,32,.75); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.menu-toggle {
  display: none; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  width: 40px; height: 40px; font-size: 18px; cursor: pointer;
}
.topbar-title { font-size: 20px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.level-pill, .xp-pill {
  background: var(--panel); border: 1px solid var(--border);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
}
.level-pill strong, .xp-pill span { color: var(--text); }

.content { padding: 24px; max-width: 1100px; width: 100%; }

/* Cards & generic */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

h1.view-title { font-size: 26px; margin: 0 0 4px; }
p.view-sub { color: var(--muted); margin: 0 0 20px; }

.btn {
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); border-radius: 12px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; }
.btn.accent { background: linear-gradient(135deg, var(--accent), #16d0b0); border-color: transparent; color: #04231d; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: rgba(255,107,129,.4); color: var(--danger); }
.btn.big { padding: 14px 22px; font-size: 16px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

textarea, input[type="text"], select, input[type="password"] {
  width: 100%; background: #12152a; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: 15px; font-family: inherit; resize: vertical;
}
textarea:focus, input:focus, select:focus { outline: 2px solid rgba(108,92,231,.5); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted);
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.active { background: rgba(108,92,231,.25); color: #fff; }

.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.badge.ok { background: rgba(56,211,159,.15); color: var(--ok); }
.badge.warn { background: rgba(255,180,84,.15); color: var(--warn); }
.badge.err { background: rgba(255,107,129,.15); color: var(--danger); }

.muted { color: var(--muted); }
.center { text-align: center; }

/* Home hero */
.hero {
  background:
    radial-gradient(700px 300px at 90% -30%, rgba(0,210,168,.25), transparent),
    linear-gradient(135deg, rgba(108,92,231,.35), rgba(28,33,64,.6));
  border: 1px solid var(--border); border-radius: 20px;
  padding: 30px; margin-bottom: 20px;
}
.hero h1 { font-size: 30px; margin: 0 0 8px; }
.hero p { color: #d7dcf5; max-width: 620px; margin: 0 0 18px; }

.skill-card { cursor: pointer; transition: .18s; }
.skill-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.skill-ico { font-size: 30px; }
.skill-card h3 { margin: 10px 0 6px; }
.skill-card p { color: var(--muted); font-size: 14px; margin: 0; }

/* Progress bar */
.progress { height: 10px; background: #12152a; border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); width: 0; transition: width .4s; }

/* Mic */
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 10px 0; }
.mic-btn {
  width: 96px; height: 96px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-size: 38px; box-shadow: 0 12px 30px rgba(108,92,231,.45); transition: .2s;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.recording { background: linear-gradient(135deg, var(--danger), #ff8a9b); animation: pulse 1.3s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(255,107,129,.5)} 70%{box-shadow:0 0 0 22px rgba(255,107,129,0)} 100%{box-shadow:0 0 0 0 rgba(255,107,129,0)} }

.transcript { min-height: 60px; background: #12152a; border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: 16px; }
.word-ok { color: var(--ok); }
.word-bad { color: var(--danger); text-decoration: underline wavy var(--danger); }

/* Score ring */
.score-ring { display: grid; place-items: center; width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--accent) var(--pct,0%), #202544 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg-2); }
.score-ring span { position: relative; font-size: 26px; font-weight: 800; }

/* Conversation */
.chat { display: flex; flex-direction: column; gap: 12px; max-height: 52vh; overflow-y: auto; padding: 4px; }
.msg { max-width: 78%; padding: 12px 14px; border-radius: 14px; line-height: 1.5; }
.msg.bot { background: var(--panel-2); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.user { background: linear-gradient(135deg, var(--brand), var(--brand-2)); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .correction { margin-top: 8px; font-size: 13px; background: rgba(255,180,84,.12); border-left: 3px solid var(--warn); padding: 8px 10px; border-radius: 8px; color: #ffe6c2; }
.msg .correction b { color: var(--warn); }
/* Voice-only conversation: hide message text, tap a bubble to reveal it. */
.voice-only-opt { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; }
.chat.voice-only .msg { color: transparent; cursor: pointer; -webkit-user-select: none; user-select: none; }
.chat.voice-only .msg.revealed { color: inherit; -webkit-user-select: text; user-select: text; }
.chat.voice-only .msg .correction { display: none; }
.chat.voice-only .msg.revealed .correction { display: block; }

/* Diff / corrections */
.ins { color: var(--ok); background: rgba(56,211,159,.12); border-radius: 4px; padding: 0 2px; }
.del { color: var(--danger); background: rgba(255,107,129,.12); text-decoration: line-through; border-radius: 4px; padding: 0 2px; }

.issue { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #12152a; margin-top: 8px; }
.issue .tag { flex: none; }

/* Reading */
.reader { font-size: 19px; line-height: 1.9; }
.reader .tok { cursor: pointer; border-radius: 4px; padding: 0 1px; }
.reader .tok:hover { background: rgba(108,92,231,.3); }
.reader .tok.speaking { background: var(--accent); color: #04231d; }

/* Speaking text lengths */
.speaking-length {
  max-width: 520px;
  margin-top: 14px;
}
.speaking-length > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.speaking-length .auth-tabs { width: 100%; }
.speaking-target h2 {
  margin: 0 0 10px;
  color: #f3c969;
  font-size: 15px;
  font-weight: 700;
}
.speaking-target #target {
  max-height: 34vh;
  overflow-y: auto;
  padding-right: 8px;
  white-space: pre-line;
  scrollbar-color: var(--border) transparent;
}
.speaking-target.long #target {
  max-height: 52vh;
  padding: 22px;
  border: 1px solid #394163;
  border-radius: 8px;
  background: #f5f3ec;
  color: #25282c;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.85;
}

/* Flashcard */
.flash { perspective: 1200px; }
.flash-inner { position: relative; height: 220px; transition: transform .5s; transform-style: preserve-3d; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center; text-align: center; padding: 20px;
  border-radius: 16px; border: 1px solid var(--border); background: linear-gradient(180deg, var(--panel), var(--bg-2)); }
.flash-face.back { transform: rotateY(180deg); }
.flash-face h2 { font-size: 30px; margin: 0 0 8px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,6,16,.65); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; }
.modal { width: min(520px, 92vw); background: var(--bg-2); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.modal-head, .modal-foot { display: flex; align-items: center; padding: 16px 20px; }
.modal-head { border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-foot { border-top: 1px solid var(--border); gap: 10px; justify-content: flex-end; }
.modal-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; max-height: 60vh; overflow-y: auto; }
.icon-btn { margin-left: auto; background: transparent; border: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.field > span { color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }
.row-check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.sep { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* Toast */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 60; font-size: 14px; }

/* Stats */
.stat { background: #12152a; border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.stat b { font-size: 24px; display: block; }
.stat span { color: var(--muted); font-size: 13px; }

/* Account box */
.account { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; }
.account-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--accent)); flex: none; }
.account-text { min-width: 0; }
.account-text strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#logoutBtn { font-size: 16px; }

/* Auth screen */
.auth-screen { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(900px 500px at 70% -10%, #1a1f3d, var(--bg)); }
.auth-card { width: min(420px, 94vw); background: var(--bg-2); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-tabs { display: flex; gap: 8px; background: #12152a; border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.auth-tab { flex: 1; background: transparent; color: var(--muted); border: none; border-radius: 9px; padding: 9px; cursor: pointer; font-weight: 600; }
.auth-tab.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.auth-error { background: rgba(255,107,129,.12); color: var(--danger); border: 1px solid rgba(255,107,129,.3);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0; }

/* Lesson explain */
.explain { white-space: pre-line; line-height: 1.7; color: #d7dcf5; }

/* Mic enable chip + test meter */
.mic-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border);
  color: var(--text); border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.mic-chip:hover { background: var(--panel-2); }
.mic-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 3px rgba(255,107,129,.18); }
.mic-dot.granted { background: var(--ok); box-shadow: 0 0 0 3px rgba(56,211,159,.18); }
.mic-dot.denied { background: var(--warn); box-shadow: 0 0 0 3px rgba(255,180,84,.18); }
.meter { height: 14px; background: #12152a; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--warn), var(--danger)); transition: width .06s linear; }

/* Persistent media player */
.media-player {
  position: fixed;
  z-index: 45;
  left: 260px;
  right: 0;
  bottom: 0;
  min-height: 92px;
  display: grid;
  grid-template-columns: 58px minmax(150px, 1fr) auto minmax(210px, .8fr) 36px;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(12, 15, 27, .96);
  border-top: 1px solid #3a426d;
  box-shadow: 0 -14px 34px rgba(0, 0, 0, .38);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.player-open .content { padding-bottom: 132px; }
.player-open .toast { bottom: 112px; }
.media-art {
  width: 58px;
  aspect-ratio: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #071c18;
  font-weight: 800;
  background: linear-gradient(145deg, #4ee1bd, #f3c969);
}
.media-art img { width: 100%; height: 100%; object-fit: cover; }
.media-details { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.media-details strong, .media-details small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-details strong { font-size: 15px; }
.media-details small { color: var(--muted); font-size: 12px; }
.media-transport { display: flex; align-items: center; justify-content: center; gap: 5px; }
.media-icon {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.media-icon:hover { background: var(--panel-2); }
.media-icon:disabled { opacity: .3; cursor: default; }
.media-toggle { width: 44px; height: 44px; border: none; color: #06251f; background: var(--accent); font-size: 17px; }
.media-toggle:hover { background: #32e3c0; }
.media-close { color: var(--muted); border-color: transparent; }
.media-timeline { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-width: 0; }
.media-timeline input { width: 100%; accent-color: var(--accent); cursor: pointer; }
.media-timeline span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.media-timeline b { color: var(--text); font-weight: 500; }

/* Books */
.library-view, .book-reader-view, .broadcast-view { width: 100%; }
.library-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--border);
}
.library-heading h1 { margin: 5px 0 7px; font-size: 30px; }
.library-heading p { max-width: 680px; margin: 0; color: var(--muted); line-height: 1.6; }
.library-kicker { color: #f3c969; font-size: 12px; font-weight: 800; letter-spacing: 0; }
.library-count { flex: none; width: 92px; height: 92px; display: grid; place-items: center; align-content: center; border: 1px solid #4a5279; border-radius: 8px; background: #181d33; }
.library-count b { font-size: 27px; line-height: 1; }
.library-count span { color: var(--muted); font-size: 12px; margin-top: 4px; }
.library-toolbar, .broadcast-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; }
.library-search { width: min(390px, 100%); display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #12152a; }
.library-search > span { color: var(--muted); font-size: 22px; }
.library-search input { border: 0; background: transparent; padding-left: 0; }
.library-search input:focus { outline: 0; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 18px; align-items: start; }
.book-card {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  text-align: left;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171b30;
  cursor: pointer;
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.book-card:hover { transform: translateY(-3px); border-color: #6974ab; box-shadow: 0 12px 28px rgba(0, 0, 0, .28); }
.book-cover { position: relative; width: 100%; aspect-ratio: 2 / 3; display: grid; place-items: center; overflow: hidden; background: linear-gradient(145deg, #273251, #1c7e72); }
.book-cover img { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.book-cover-fallback { font-size: 25px; font-weight: 800; color: rgba(255, 255, 255, .72); }
.book-card-copy { min-height: 112px; display: flex; flex-direction: column; padding: 12px; }
.book-card-copy strong { display: -webkit-box; min-height: 42px; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
.book-card-copy small { display: -webkit-box; margin-top: 5px; overflow: hidden; color: var(--muted); -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.book-card-copy > span { margin-top: auto; padding-top: 8px; color: #77d9c1; font-size: 11px; }
.library-loading, .library-empty { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; align-content: center; gap: 12px; color: var(--muted); text-align: center; border: 1px dashed var(--border); border-radius: 8px; }
.reader-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.book-reader-view { max-width: 820px; margin: 0 auto; }
.book-reader-head { display: flex; align-items: center; gap: 18px; padding-bottom: 18px; }
.book-reader-head img { width: 72px; height: 104px; flex: none; object-fit: cover; border-radius: 6px; box-shadow: 0 8px 18px rgba(0, 0, 0, .3); }
.book-reader-head h1 { margin: 4px 0; font-size: 27px; }
.book-reader-head p { margin: 0; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.book-page { min-height: 60vh; padding: clamp(24px, 6vw, 58px); border-radius: 8px; background: #f5f3ec; color: #25282c; box-shadow: 0 18px 38px rgba(0, 0, 0, .28); white-space: pre-wrap; line-height: 1.85; font-family: Georgia, "Times New Roman", serif; }
.reader-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 18px 0 6px; }
.reader-pagination .btn:last-child { justify-self: end; }
.reader-pagination > span { color: var(--muted); font-size: 13px; }

/* Broadcasts */
.broadcast-heading { align-items: center; }
.broadcast-signal { width: 110px; height: 82px; flex: none; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #44506e; border-radius: 8px; background: #171c2d; }
.broadcast-signal i { display: block; width: 7px; border-radius: 4px; background: #f3c969; animation: signal 1.1s ease-in-out infinite alternate; }
.broadcast-signal i:nth-child(1) { height: 20px; }
.broadcast-signal i:nth-child(2) { height: 42px; animation-delay: -.3s; }
.broadcast-signal i:nth-child(3) { height: 58px; animation-delay: -.6s; }
.broadcast-signal i:nth-child(4) { height: 30px; animation-delay: -.9s; }
@keyframes signal { to { transform: scaleY(.55); opacity: .6; } }
.broadcast-channels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 18px 0; }
.broadcast-channel { min-width: 0; display: grid; grid-template-columns: 45px 1fr; grid-template-rows: auto auto; column-gap: 11px; padding: 13px; text-align: left; color: var(--text); border: 1px solid var(--border); border-radius: 8px; background: #171b30; cursor: pointer; }
.broadcast-channel > span { grid-row: 1 / 3; width: 45px; height: 45px; display: grid; place-items: center; align-self: center; border-radius: 6px; background: #c72b36; color: #fff; font-size: 12px; font-weight: 800; }
.broadcast-channel:nth-child(n+2) > span { background: #247f78; }
.broadcast-channel strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.broadcast-channel small { color: var(--muted); }
.broadcast-channel:hover, .broadcast-channel.active { border-color: #7580af; background: #222944; }
.broadcast-channel.active { box-shadow: inset 0 -3px #f3c969; }
.broadcast-toolbar { border-top: 1px solid var(--border); }
.broadcast-toolbar h2 { margin: 3px 0 1px; font-size: 22px; }
.broadcast-toolbar p { margin: 0; }
.episode-list { border-top: 1px solid var(--border); }
.episode-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--border); }
.episode-row:hover { background: rgba(255, 255, 255, .02); }
.episode-play { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #4a557d; border-radius: 50%; color: #05251f; background: var(--accent); cursor: pointer; font-size: 16px; }
.episode-play:hover { transform: scale(1.05); }
.episode-copy { min-width: 0; }
.episode-copy strong { font-size: 16px; }
.episode-copy p { display: -webkit-box; margin: 4px 0; overflow: hidden; color: var(--muted); font-size: 13px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.episode-copy span { color: #77d9c1; font-size: 11px; }

/* Responsive */
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 260px; transform: translateX(-105%); transition: .25s; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: block; }
  .grid.cols-3 { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .media-player { left: 0; grid-template-columns: 48px minmax(0, 1fr) 36px; grid-template-areas: "art details close" "transport transport transport" "timeline timeline timeline"; gap: 8px 12px; padding: 10px 14px; }
  .media-art { grid-area: art; width: 48px; }
  .media-details { grid-area: details; }
  .media-transport { grid-area: transport; }
  .media-timeline { grid-area: timeline; }
  .media-close { grid-area: close; }
  .player-open .content { padding-bottom: 182px; }
  .player-open .toast { bottom: 162px; }
  .broadcast-channels { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .content { padding: 16px; }
  .library-heading { align-items: flex-start; }
  .library-heading h1 { font-size: 25px; }
  .library-count, .broadcast-signal { display: none; }
  .library-toolbar, .broadcast-toolbar { align-items: stretch; flex-direction: column; }
  .library-search { width: 100%; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .book-card-copy { min-height: 122px; padding: 10px; }
  .book-reader-head h1 { font-size: 23px; }
  .book-page { padding: 24px 20px; }
  .reader-pagination { grid-template-columns: 1fr 1fr; }
  .reader-pagination > span { grid-column: 1 / -1; grid-row: 1; text-align: center; }
  .topbar-right .level-pill { display: none; }
  .speaking-length .auth-tabs { flex-direction: column; }
  .speaking-target.long #target { max-height: 56vh; padding: 18px; font-size: 17px; }
}

/* Admin — content visibility */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}
.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.admin-row:hover { border-color: var(--brand-2); }
.admin-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.admin-row-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.admin-row-copy strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-copy small { color: var(--muted); font-size: 12px; }
.admin-row-state { flex: none; }

/* Group Conversation Room */
.cast-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cast-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--pc, var(--accent)); font-size: 13px; }
.cast-chip small { color: var(--muted); }
.msg.persona { border-left: 3px solid var(--pc, var(--accent)); }
.msg.persona .persona-tag { display: block; font-size: 12px; font-weight: 700; color: var(--pc, var(--accent)); margin-bottom: 4px; }
.msg.room-host .persona-tag { color: #a7b0c4; }

/* Grammar Journey path */
.journey { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
.journey-node { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; }
.journey-marker { display: flex; flex-direction: column; align-items: center; align-self: stretch; }
.journey-dot { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  border: 2px solid var(--border); background: var(--panel-2); color: var(--muted); transition: all .2s; }
.journey-line { width: 2px; flex: 1; min-height: 20px; background: var(--border); margin: 2px 0; }
.journey-node.done .journey-dot { background: var(--accent); color: #04231d; border-color: transparent; }
.journey-node.done .journey-line { background: var(--accent); }
.journey-node.current .journey-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px rgba(0,210,168,.15); }
.journey-info { padding: 4px 0 18px; min-width: 0; }
.journey-info h4 { margin: 2px 0 2px; }
.journey-info .muted { font-size: 13px; }
.journey-node:hover .journey-title { color: var(--brand-2); }

