:root {
  color-scheme: dark;
  --bg: #0e1117;
  --bg-2: #0a0d13;
  --panel: #151b25;
  --panel-2: #101722;
  --panel-3: #0d131d;
  --text: #f7fbff;
  --muted: #9ba8bd;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --purple: #6c5ce7;
  --purple-soft: rgba(108, 92, 231, 0.22);
  --cyan: #00cec9;
  --cyan-soft: rgba(0, 206, 201, 0.18);
  --green: #55efc4;
  --amber: #fdcb6e;
  --danger: #ff7675;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% -8%, rgba(108, 92, 231, 0.26), transparent 30rem),
    radial-gradient(circle at 88% 4%, rgba(0, 206, 201, 0.18), transparent 28rem),
    linear-gradient(180deg, var(--bg), #080b10);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 1.25rem;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    rgba(7, 10, 16, 0.88);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.35rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(0, 206, 201, 0.42);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.98), rgba(0, 206, 201, 0.82));
  color: white;
  font-weight: 900;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.eyebrow {
  margin: 0 0 0.12rem;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.brand-lockup h1 {
  margin: 0;
  color: #fff;
  font-size: 1.05rem;
  line-height: 1.1;
}

.main {
  min-width: 0;
  padding: clamp(1rem, 2vw, 1.5rem);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1rem;
  padding: clamp(1rem, 2.2vw, 1.55rem);
  border: 1px solid rgba(108, 92, 231, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(108, 92, 231, 0.22), rgba(0, 206, 201, 0.08)),
    rgba(16, 23, 34, 0.92);
  box-shadow: var(--shadow);
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.35rem 0.65rem;
  margin-bottom: 0.65rem;
  border: 1px solid rgba(0, 206, 201, 0.36);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #eff7ff;
  font-size: 0.82rem;
  font-weight: 800;
}

.hero h2 {
  margin-bottom: 0.5rem;
  color: #fff;
  font-size: clamp(1.75rem, 3.4vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: #bfd0ea;
  font-size: 1rem;
  line-height: 1.55;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 0.75rem;
  min-width: min(410px, 100%);
}

.hero-metrics article,
.stat-card,
.lesson-block,
.context-box,
.chat-wrap,
.day-card,
.phase-card,
.progress-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.064), rgba(255, 255, 255, 0.03));
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.22);
}

.hero-metrics article {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 92px;
  padding: 1rem;
}

.hero-metrics span,
.metric-label,
.meta,
.block-time {
  color: var(--muted);
  font-size: 0.82rem;
}

.hero-metrics strong {
  color: #fff;
  font-size: 1.65rem;
  line-height: 1.1;
}

.tabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.tab {
  min-height: 42px;
  padding: 0 0.9rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #c9d6eb;
  font-weight: 800;
}

.tab.is-active {
  border-color: rgba(0, 206, 201, 0.34);
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.74), rgba(0, 206, 201, 0.46));
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.control-group {
  margin-bottom: 1rem;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

label {
  display: block;
  margin-bottom: 0.42rem;
  color: #dce7f7;
  font-size: 0.9rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  background: #0b111a;
  color: var(--text);
  padding: 0.72rem 0.78rem;
}

textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(0, 206, 201, 0.72);
  box-shadow: 0 0 0 3px rgba(0, 206, 201, 0.12);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--cyan);
}

.range-meta,
.card-top,
.check-row,
.chat-top,
.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.range-meta {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.82rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.toggle-row input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--cyan);
}

.progress-panel {
  padding: 0.95rem;
  margin-bottom: 1rem;
}

.audio-panel,
.db-panel {
  margin-bottom: 1rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(0, 206, 201, 0.08), rgba(108, 92, 231, 0.055)),
    rgba(255, 255, 255, 0.025);
}

.audio-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.audio-title span {
  color: #fff;
  font-weight: 850;
}

.audio-panel .control-group:last-child {
  margin-bottom: 0;
}

.audio-panel label strong {
  color: var(--cyan);
  font-weight: 850;
}

.db-panel {
  background:
    linear-gradient(180deg, rgba(108, 92, 231, 0.1), rgba(0, 206, 201, 0.045)),
    rgba(255, 255, 255, 0.025);
}

.db-panel .button {
  width: 100%;
}

.panel-note {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.progress-panel > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.progress-panel strong {
  color: #fff;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--cyan), var(--green));
  transition: width 220ms ease;
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 0.95rem;
  border: 1px solid rgba(0, 206, 201, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.98), rgba(0, 206, 201, 0.78));
  color: #fff;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
}

.button:hover {
  border-color: rgba(255, 255, 255, 0.42);
  transform: translateY(-1px);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
  color: #eaf1ff;
  box-shadow: none;
}

.button.danger {
  background: rgba(255, 118, 117, 0.14);
  border-color: rgba(255, 118, 117, 0.34);
}

.button.small {
  min-height: 34px;
  padding: 0 0.65rem;
  font-size: 0.84rem;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.grid-3,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 0.85rem;
}

.stat-card,
.phase-card,
.lesson-block,
.context-box,
.chat-wrap {
  padding: 1rem;
}

.stat-card span,
.phase-card span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.stat-card strong {
  color: #fff;
  font-size: 1.7rem;
  line-height: 1.1;
}

.stat-card p,
.phase-card p,
.lesson-block p,
.context-box p {
  margin: 0.55rem 0 0;
  color: #b8c6dc;
  line-height: 1.55;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 0.75rem;
}

.section-title h3 {
  margin: 0;
  color: #fff;
  font-size: 1.1rem;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.lesson-header {
  margin-bottom: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.lesson-header h3 {
  margin: 0.25rem 0 0.35rem;
  color: #fff;
  font-size: 1.35rem;
}

.lesson-header p {
  margin-bottom: 0;
  color: #b8c6dc;
}

.lesson-block {
  min-height: 132px;
}

.block-kicker {
  margin-bottom: 0.35rem;
  color: var(--cyan);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.lesson-block h4 {
  margin: 0 0 0.35rem;
  color: #fff;
  font-size: 1rem;
}

.vocab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.vocab-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.82rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.vocab-item strong {
  color: #fff;
  font-size: 0.98rem;
}

.vocab-item em {
  display: block;
  color: var(--cyan);
  font-style: normal;
  font-size: 0.82rem;
  margin-top: 0.12rem;
}

.vocab-item p {
  margin: 0.42rem 0 0;
  color: #b9c7dc;
  font-size: 0.88rem;
  line-height: 1.45;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(0, 206, 201, 0.32);
  border-radius: 8px;
  background: rgba(0, 206, 201, 0.1);
  color: #fff;
  font-weight: 900;
}

.context-box {
  white-space: pre-wrap;
  color: #eaf1ff;
  line-height: 1.62;
}

.practice-actions,
.chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.feedback-box {
  margin-top: 0.8rem;
  padding: 0.95rem;
  border: 1px solid rgba(0, 206, 201, 0.24);
  border-radius: 8px;
  background: rgba(0, 206, 201, 0.055);
  color: #eaf1ff;
  white-space: pre-wrap;
  line-height: 1.55;
}

.checklist {
  display: grid;
  gap: 0.58rem;
}

.check-row {
  padding: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 0.68rem;
  margin: 0;
}

.check-row input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--green);
}

.check-row span {
  color: #dfe8f8;
}

.chat-wrap {
  min-height: 620px;
}

.chat-top {
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.85rem;
}

.chat-top h3 {
  margin: 0;
  color: #fff;
}

.chat-top p {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.chat-log {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  min-height: 330px;
  max-height: 460px;
  overflow: auto;
  padding-right: 0.25rem;
}

.message {
  max-width: min(760px, 92%);
  padding: 0.82rem 0.92rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  color: #eaf1ff;
  line-height: 1.52;
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  border-color: rgba(108, 92, 231, 0.4);
  background: rgba(108, 92, 231, 0.2);
}

.message.assistant {
  justify-self: start;
  border-color: rgba(0, 206, 201, 0.22);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}

.day-card {
  min-height: 122px;
  padding: 0.75rem;
}

.day-card.is-complete {
  border-color: rgba(85, 239, 196, 0.52);
  background: rgba(85, 239, 196, 0.08);
}

.day-card.is-current {
  border-color: rgba(0, 206, 201, 0.72);
  box-shadow: 0 0 0 3px rgba(0, 206, 201, 0.1);
}

.card-top strong {
  color: #fff;
}

.card-top span {
  color: var(--muted);
  font-size: 0.84rem;
}

.day-card p {
  margin: 0.5rem 0 0.7rem;
  color: #b8c6dc;
  font-size: 0.86rem;
  line-height: 1.36;
}

.phase-section {
  margin-bottom: 1.1rem;
}

.phase-card {
  margin-bottom: 0.65rem;
}

.phase-card strong {
  color: #fff;
  font-size: 1.1rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.78rem 0.9rem;
  border: 1px solid rgba(0, 206, 201, 0.35);
  border-radius: 8px;
  background: rgba(13, 19, 29, 0.94);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.muted {
  color: var(--muted);
}

.success {
  color: var(--green);
}

.warning {
  color: var(--amber);
}

.danger-text {
  color: var(--danger);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-metrics {
    min-width: 0;
  }

  .grid-2,
  .grid-3,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .main,
  .sidebar {
    padding: 0.9rem;
  }

  .hero h2 {
    font-size: 1.85rem;
  }

  .hero-metrics,
  .vocab-list,
  .starter-grid,
  .schedule-grid {
    grid-template-columns: 1fr;
  }

  .control-grid,
  .sidebar-actions,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .section-title {
    align-items: start;
    flex-direction: column;
  }

  .tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .tab {
    width: 100%;
  }
}
