:root {
  --ink: #14213d;
  --muted: #6f7890;
  --line: #e6eaf2;
  --blue: #3157d5;
  --blue-soft: #edf2ff;
  --red: #dd4256;
  --cream: #fffaf2;
  --green: #2a9d6f;
  --card: #ffffff;
  --shadow: 0 18px 45px rgba(34, 48, 86, 0.09);
}

* { box-sizing: border-box; }
html { background: #f6f7fb; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(49,87,213,.08), transparent 25%),
    radial-gradient(circle at 100% 15%, rgba(221,66,86,.07), transparent 26%),
    #f7f8fc;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1480px; margin: 0 auto; padding: 24px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: rgba(255,255,255,.88); border: 1px solid var(--line);
  border-radius: 24px; padding: 18px 20px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.flag {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  font-size: 30px; background: linear-gradient(135deg, #eef3ff, #fff2f3);
}
.brand h1 { margin: 0; font-size: clamp(20px, 3vw, 30px); letter-spacing: -.03em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.level-switch { display: flex; padding: 5px; gap: 4px; background: #f0f2f7; border-radius: 14px; }
.level-switch button {
  border: 0; padding: 10px 14px; border-radius: 10px; background: transparent; color: var(--muted);
  font-weight: 700;
}
.level-switch button.active { background: white; color: var(--blue); box-shadow: 0 3px 12px rgba(34,48,86,.08); }

.dashboard-row {
  display: grid; grid-template-columns: minmax(240px, 1fr) minmax(260px, 1.3fr) auto;
  gap: 14px; margin: 18px 0;
}
.profile-card, .progress-card, .quick-call {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; min-height: 86px;
}
.profile-card { display: flex; align-items: center; padding: 16px; gap: 12px; }
.profile-avatar {
  width: 50px; height: 50px; border-radius: 15px; background: var(--cream); display: grid; place-items: center; font-size: 27px;
}
.profile-card span, .progress-meta span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.profile-card strong, .progress-meta strong { display: block; margin-top: 4px; }
.progress-card { padding: 17px 18px; display: flex; flex-direction: column; justify-content: center; }
.progress-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.progress-track { height: 10px; border-radius: 10px; background: #eef0f5; overflow: hidden; margin-top: 12px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3157d5, #6f8ff0); border-radius: inherit; transition: width .3s ease; }
.quick-call {
  padding: 0 22px; color: white; border: 0; background: linear-gradient(135deg, var(--blue), #5874df);
  font-weight: 800; box-shadow: 0 14px 28px rgba(49,87,213,.22);
}

.main-grid { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 18px; align-items: start; }
.lesson-sidebar, .lesson-main {
  background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow);
}
.lesson-sidebar { padding: 16px; position: sticky; top: 14px; }
.side-heading { padding: 4px 4px 14px; }
.side-heading span { color: var(--muted); font-size: 11px; letter-spacing: .11em; font-weight: 800; text-transform: uppercase; display: block; }
.side-heading strong { display: block; margin-top: 4px; }
.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-item {
  width: 100%; border: 1px solid transparent; background: transparent; display: grid;
  grid-template-columns: 44px 1fr 28px; gap: 10px; align-items: center; text-align: left;
  padding: 10px; border-radius: 15px; color: var(--ink);
}
.lesson-item:hover { background: #f7f8fc; }
.lesson-item.selected { background: var(--blue-soft); border-color: #dbe4ff; }
.lesson-icon { width: 44px; height: 44px; display: grid; place-items: center; background: white; border: 1px solid var(--line); border-radius: 13px; font-size: 22px; }
.lesson-copy { min-width: 0; }
.lesson-copy small { display: block; color: var(--blue); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.lesson-copy strong { display: block; font-size: 14px; margin-top: 2px; }
.lesson-copy em { display: block; color: var(--muted); font-style: normal; font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-check { width: 24px; height: 24px; border: 1px solid #d7dce7; border-radius: 50%; display: grid; place-items: center; color: white; font-weight: 900; }
.lesson-check.done { background: var(--green); border-color: var(--green); }

.lesson-main { overflow: hidden; min-width: 0; }
.lesson-hero {
  display: grid; grid-template-columns: 94px minmax(0,1fr) auto; gap: 18px; align-items: center;
  padding: 24px; background: linear-gradient(135deg, #f7f9ff 0%, #fff9fa 100%); border-bottom: 1px solid var(--line);
}
.hero-icon {
  width: 88px; height: 88px; border-radius: 25px; display: grid; place-items: center;
  font-size: 48px; background: white; border: 1px solid var(--line); box-shadow: 0 12px 28px rgba(34,48,86,.08);
}
.hero-copy span { color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.hero-copy h2 { margin: 3px 0 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.hero-copy > p { margin: 4px 0 10px; color: var(--muted); }
.goal-chip { display: inline-flex; max-width: 100%; padding: 8px 11px; border-radius: 10px; background: white; border: 1px solid var(--line); font-size: 13px; }
.complete-btn { border: 1px solid var(--line); background: white; border-radius: 12px; padding: 11px 14px; font-weight: 800; color: var(--muted); }
.complete-btn.completed { color: var(--green); border-color: #cdeade; background: #f1fbf6; }

.tabs {
  display: flex; gap: 4px; padding: 10px 18px; border-bottom: 1px solid var(--line); overflow-x: auto; background: white;
}
.tabs button {
  flex: 1 0 auto; min-width: 130px; border: 0; background: transparent; border-radius: 10px; padding: 11px 12px; color: var(--muted); font-weight: 800;
}
.tabs button.active { background: var(--blue-soft); color: var(--blue); }

.content-panel { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.panel-heading span { font-size: 10px; color: var(--blue); letter-spacing: .13em; font-weight: 900; }
.panel-heading h3 { margin: 4px 0 0; font-size: 22px; }
.panel-heading p { margin: 0; max-width: 420px; color: var(--muted); font-size: 13px; }

.vocab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.vocab-card { border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: white; min-width: 0; }
.vocab-picture {
  height: 110px; border-radius: 15px; background: linear-gradient(135deg, #f7f8fc, #fff8f4);
  display: grid; place-items: center; font-size: 58px;
}
.vocab-word { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 12px; }
.vocab-word strong { font-size: 21px; color: var(--blue); }
.vocab-word span { color: var(--muted); font-size: 12px; text-align: right; }
.vocab-card p { margin: 8px 0 12px; color: var(--ink); font-size: 13px; min-height: 34px; }
.sound-btn { width: 100%; border: 0; background: var(--blue-soft); color: var(--blue); font-weight: 800; padding: 9px; border-radius: 10px; }

.record-box {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; border-radius: 18px;
  padding: 16px; background: #f9fafc; border: 1px dashed #ccd3e3; margin-top: 18px;
}
.record-box p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.recorder { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.btn { border: 0; border-radius: 11px; padding: 10px 13px; font-weight: 800; }
.btn.primary { background: var(--blue); color: white; }
.btn.soft { background: #eef1f7; color: var(--ink); }
.btn.danger { background: #fff0f2; color: #c92f45; }
.btn.call { background: var(--blue); color: white; padding: 12px 18px; box-shadow: 0 10px 25px rgba(49,87,213,.25); }
.recording-dot { color: var(--red); font-size: 12px; font-weight: 800; }
.audio-player { max-width: 260px; height: 38px; }
.error-text { color: var(--red); margin: 0; font-size: 12px; width: 100%; text-align: right; }

.grammar-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grammar-line {
  display: grid; grid-template-columns: 34px 1fr 28px; gap: 10px; align-items: center; border: 1px solid var(--line);
  background: white; border-radius: 14px; padding: 13px; text-align: left; color: var(--ink);
}
.grammar-line > span { width: 32px; height: 32px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 900; }
.grammar-line em { font-style: normal; }
.tip-card { margin-top: 16px; border-left: 4px solid #e5b949; background: #fffaf0; border-radius: 12px; padding: 14px 16px; }
.tip-card span { font-weight: 900; }
.tip-card p { margin: 5px 0 0; color: #6e6250; line-height: 1.55; }

.exercise-list { display: flex; flex-direction: column; gap: 13px; }
.exercise-card { display: grid; grid-template-columns: 42px 1fr; gap: 14px; border: 1px solid var(--line); border-radius: 17px; padding: 16px; }
.question-number { width: 40px; height: 40px; border-radius: 12px; background: var(--blue); color: white; display: grid; place-items: center; font-weight: 900; }
.question-body h4 { margin: 2px 0 11px; }
.answer-options { display: flex; flex-wrap: wrap; gap: 8px; }
.answer-options button { border: 1px solid var(--line); background: white; color: var(--ink); padding: 9px 12px; border-radius: 10px; }
.answer-options button.correct { border-color: #8dd0b2; background: #edfaf4; color: #16774f; }
.answer-options button.wrong { border-color: #f0a8b2; background: #fff0f2; color: #b52c40; }
.answer-options button.correct-hint { border-color: #b9d9ca; background: #f5fbf8; }
.feedback { font-size: 12px; font-weight: 800; margin: 9px 0 0; }
.feedback.ok { color: var(--green); }
.feedback.no { color: var(--red); }

.teacher-room { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: #111827; color: white; }
.teacher-stage { position: relative; min-height: 430px; background: radial-gradient(circle at 50% 22%, #28365e, #111827 65%); display: grid; place-items: center; }
.teacher-video { width: 100%; min-height: 430px; max-height: 620px; object-fit: contain; display: none; background: #0e1422; }
.teacher-video.visible { display: block; }
.teacher-placeholder { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px; }
.avatar-orb {
  width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; font-size: 72px;
  background: linear-gradient(145deg, #f0d2bd, #fff7ee); border: 5px solid rgba(255,255,255,.12);
  box-shadow: 0 0 0 12px rgba(255,255,255,.04);
}
.teacher-placeholder h3 { font-size: 26px; margin: 16px 0 4px; }
.teacher-placeholder p { margin: 0 0 18px; color: #c5ccda; max-width: 420px; }
.connecting { color: #dbe4ff; font-weight: 800; animation: pulse 1.2s infinite; }
.live-badge { position: absolute; top: 14px; left: 14px; font-size: 11px; letter-spacing: .06em; background: rgba(16,185,129,.18); border: 1px solid rgba(52,211,153,.3); color: #7ff0c2; padding: 7px 10px; border-radius: 999px; }
.teacher-controls {
  display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 15px 16px;
  border-top: 1px solid rgba(255,255,255,.09); background: #141c2c;
}
.teacher-controls p { margin: 3px 0 0; color: #9ba7bd; font-size: 12px; }
.control-buttons { display: flex; gap: 8px; }
.setup-warning { margin: 14px; background: #2c2230; border: 1px solid #5d3c62; border-radius: 12px; padding: 12px 14px; color: #ead8ee; }
.setup-warning p { margin: 4px 0; color: #cdbad1; font-size: 12px; line-height: 1.5; }
.conversation-goals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.conversation-goals strong { width: 100%; }
.conversation-goals span { font-size: 12px; background: #f2f8f5; color: #297153; border: 1px solid #d7eadf; border-radius: 999px; padding: 7px 10px; }

@keyframes pulse { 50% { opacity: .5; } }
@media (max-width: 1040px) {
  .main-grid { grid-template-columns: 250px minmax(0,1fr); }
  .vocab-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lesson-hero { grid-template-columns: 76px 1fr; }
  .hero-icon { width: 72px; height: 72px; font-size: 38px; }
  .complete-btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 780px) {
  .app-shell { padding: 10px; }
  .topbar { flex-direction: column; align-items: stretch; }
  .level-switch button { flex: 1; }
  .dashboard-row { grid-template-columns: 1fr; }
  .quick-call { min-height: 58px; }
  .main-grid { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; }
  .lesson-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .lesson-item { grid-template-columns: 38px 1fr; }
  .lesson-icon { width: 38px; height: 38px; }
  .lesson-check { display: none; }
  .lesson-hero { padding: 18px; }
  .panel-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .vocab-grid, .grammar-list { grid-template-columns: 1fr; }
  .record-box { align-items: flex-start; flex-direction: column; }
  .recorder { justify-content: flex-start; }
  .teacher-stage, .teacher-video { min-height: 360px; }
  .teacher-controls { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 480px) {
  .brand h1 { font-size: 20px; }
  .flag { width: 46px; height: 46px; font-size: 25px; }
  .lesson-list { grid-template-columns: 1fr; }
  .lesson-hero { grid-template-columns: 64px 1fr; }
  .hero-icon { width: 60px; height: 60px; border-radius: 18px; font-size: 32px; }
  .goal-chip { font-size: 12px; }
  .content-panel { padding: 16px; }
  .vocab-picture { height: 95px; }
  .teacher-stage, .teacher-video { min-height: 300px; }
}
.teacher-flow {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 16px;
  background: #fffdf7;
}
.teacher-flow > strong { display:block; margin-bottom:10px; }
.teacher-flow-list { display:grid; gap:8px; }
.teacher-flow-list p { margin:0; line-height:1.5; font-size:14px; }
