:root {
  color-scheme: dark;
  --ink: #f8fbff;
  --muted: #9aa7c7;
  --line: rgba(116, 247, 255, 0.24);
  --paper: #10162a;
  --panel: rgba(16, 22, 42, 0.78);
  --deep: #070914;
  --coral: #ff3df2;
  --teal: #18f0ff;
  --gold: #ffe66d;
  --green: #61ff9c;
  --red: #ff4f6d;
  --violet: #8b5cff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.46), 0 0 34px rgba(24, 240, 255, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 104px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 61, 242, 0.24), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(24, 240, 255, 0.20), transparent 30%),
    linear-gradient(160deg, #070914 0%, #10162a 48%, #160a2e 100%);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

.phone-status {
  display: flex;
  justify-content: space-between;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 104px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
  padding: 18px 0 24px;
}

.feed-panel,
.coach-panel {
  min-width: 0;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(24, 240, 255, 0.48);
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.95;
  text-shadow: 0 0 22px rgba(255, 61, 242, 0.22);
}

.session-pill {
  min-width: 94px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(16, 22, 42, 0.84);
  color: var(--gold);
  font-weight: 900;
  box-shadow: 0 0 24px rgba(24, 240, 255, 0.18);
}

.diagnostic-panel,
.book-bridge,
.operator-strip,
.coach-card,
.score-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.diagnostic-panel {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  margin-bottom: 14px;
}

.diagnostic-panel p:last-child {
  margin: 0;
  color: #dbe7ff;
  font-weight: 800;
  line-height: 1.35;
}

.diagnostic-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.topic-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.topic-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 22, 42, 0.78);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.topic-tab.active {
  background: linear-gradient(135deg, rgba(255, 61, 242, 0.34), rgba(24, 240, 255, 0.20));
  border-color: var(--teal);
  color: var(--ink);
  box-shadow: 0 0 22px rgba(24, 240, 255, 0.18);
}

.card {
  position: relative;
  min-height: 570px;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(24, 240, 255, 0.30);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23, 31, 56, 0.96), rgba(9, 13, 26, 0.97));
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
  overflow: hidden;
  scroll-margin-bottom: 108px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 8px;
  background: linear-gradient(90deg, var(--coral), var(--teal), var(--gold), var(--violet));
  box-shadow: 0 0 28px rgba(255, 61, 242, 0.50);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-weight: 900;
  font-size: 0.88rem;
}

.voice-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
}

.voice-button,
.voice-toggle,
.voice-select-label {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 900;
}

.voice-button {
  border: 0;
  background: linear-gradient(135deg, var(--teal), var(--violet));
  color: #050712;
  padding: 0 16px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(24, 240, 255, 0.25);
}

.voice-toggle,
.voice-select-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(16, 22, 42, 0.78);
  color: var(--ink);
  padding: 0 12px;
}

.voice-select-label {
  padding-right: 10px;
}

.voice-select-label select {
  min-height: 30px;
  max-width: 170px;
  border: 0;
  border-radius: 6px;
  background: var(--deep);
  color: var(--ink);
  font-weight: 800;
}

.voice-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.hook {
  max-width: 100%;
  margin: 20px 0 10px;
  color: var(--coral);
  font-weight: 900;
  font-size: 1rem;
}

.eli5 {
  margin: 0 0 18px;
  color: #dbe7ff;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: 750;
}

.visual {
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 22px;
  background:
    linear-gradient(rgba(24, 240, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 240, 255, 0.08) 1px, transparent 1px),
    rgba(7, 9, 20, 0.74);
  background-size: 22px 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px;
}

.visual span {
  min-height: 32px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--teal), #00a3ff);
  box-shadow: 0 0 16px rgba(24, 240, 255, 0.34);
}

.visual span.alt {
  background: linear-gradient(135deg, var(--coral), var(--gold));
  box-shadow: 0 0 16px rgba(255, 61, 242, 0.35);
}

.card h2 {
  margin: 0 0 20px;
  font-size: clamp(1.55rem, 4vw, 2.45rem);
  line-height: 1.08;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.answer-button {
  min-height: 58px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 22, 42, 0.86);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.answer-button:hover,
.answer-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--teal);
  box-shadow: 0 0 20px rgba(24, 240, 255, 0.20);
  outline: none;
}

.answer-button.correct {
  background: rgba(97, 255, 156, 0.14);
  border-color: var(--green);
}

.answer-button.wrong {
  background: rgba(255, 79, 109, 0.14);
  border-color: var(--red);
}

.feedback {
  min-height: 52px;
  margin-top: 16px;
  color: var(--muted);
  font-weight: 800;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.ghost-button,
.primary-button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
}

.ghost-button {
  border: 1px solid var(--line);
  background: rgba(16, 22, 42, 0.78);
  color: var(--ink);
}

.primary-button {
  flex: 1;
  border: 0;
  background: linear-gradient(135deg, var(--coral), var(--violet));
  color: var(--ink);
  box-shadow: 0 0 22px rgba(255, 61, 242, 0.24);
}

.book-bridge {
  margin-top: 14px;
  padding: 16px;
}

.book-bridge p:last-child {
  margin: 0;
  font-weight: 900;
}

.operator-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  scroll-margin-bottom: 108px;
}

.operator-strip span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  background: rgba(7, 9, 20, 0.72);
  color: var(--ink);
  font-weight: 900;
}

.operator-strip strong {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--coral));
  color: #050712;
}

.coach-panel {
  display: grid;
  gap: 14px;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.score-strip strong {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font-size: 1.8rem;
}

.coach-card {
  padding: 18px;
  scroll-margin-bottom: 108px;
}

.coach-card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(154, 167, 199, 0.22);
  overflow: hidden;
}

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

.coach-card p,
.notes,
.ladder {
  color: var(--muted);
  line-height: 1.45;
}

.ladder {
  margin: 0;
  padding-left: 20px;
}

.ladder li {
  margin: 9px 0;
}

.ladder .done {
  color: var(--green);
  font-weight: 900;
}

.ladder .active {
  color: var(--ink);
  font-weight: 900;
}

.notes {
  margin: 0;
  padding-left: 18px;
}

.notes li {
  margin: 9px 0;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 20;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  min-height: 68px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(24, 240, 255, 0.28);
  border-radius: 18px;
  background: rgba(7, 9, 20, 0.88);
  box-shadow: 0 0 34px rgba(24, 240, 255, 0.18), 0 20px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
}

.bottom-nav-button {
  min-width: 0;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}

.bottom-nav-button span {
  font-size: 1.18rem;
  line-height: 1;
}

.bottom-nav-button.active {
  background: linear-gradient(135deg, rgba(24, 240, 255, 0.22), rgba(255, 61, 242, 0.22));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(24, 240, 255, 0.28), 0 0 18px rgba(255, 61, 242, 0.18);
}

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

  .coach-panel {
    grid-row: 2;
  }
}

@media (max-width: 620px) {
  body {
    padding-bottom: 96px;
  }

  .phone-status,
  .app-shell {
    width: min(100% - 20px, 1180px);
  }

  .app-shell {
    padding: 10px 0 18px;
  }

  .top-bar {
    align-items: flex-start;
  }

  .diagnostic-panel {
    align-items: stretch;
    flex-direction: column;
  }

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

  .topic-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card {
    min-height: 570px;
  }

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

  .score-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .score-strip strong {
    font-size: 1.35rem;
  }

  .operator-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-height: 760px) {
  .card {
    min-height: auto;
  }

  .visual {
    min-height: 82px;
    margin-bottom: 16px;
  }

  .hook {
    margin-top: 14px;
  }

  .eli5 {
    margin-bottom: 14px;
    font-size: 1rem;
  }
}
