*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0c0e11;
  --bg-soft: #11151a;
  --panel: #171b20;
  --panel-2: #1d221f;
  --panel-3: #201d18;
  --text: #f3f0e8;
  --muted: #a9adad;
  --soft: #747c7a;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --mint: #7ee0b2;
  --mint-ink: #0b1b14;
  --amber: #f1c56b;
  --red: #ff817a;
  --cyan: #78c7e8;
  --violet: #c7a8ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
  --radius: 8px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, #101316 0%, #0c0e11 46%, #0b0d0f 100%);
  color: var(--text);
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: var(--soft) !important;
  border-color: var(--line) !important;
  background: #12161a !important;
  transform: none !important;
}

a {
  color: inherit;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 14px;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 19, 22, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand-block,
.desktop-nav,
.top-stats,
.view-head,
.mission-card-head,
.keyword-row,
.action-row,
.lesson-actions,
.chart-toolbar,
.coach-top,
.wallet-card,
.range-label,
.trade-readout,
.check-row,
.choice-top,
.resource-meta {
  display: flex;
  gap: 10px;
}

.brand-block {
  align-items: center;
  min-width: 0;
}

.brand-mark,
.mission-symbol,
.popup-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: var(--mint);
  background: #101a15;
  border: 1px solid rgba(126, 224, 178, 0.26);
}

.brand-mark .icon,
.mission-symbol .icon,
.popup-icon .icon {
  width: 24px;
  height: 24px;
}

.eyebrow,
.micro-label,
.stat-pill span,
.compact-meter span,
.wallet-card span,
.range-label span,
.readout-item span,
.resource-meta span {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--soft);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", "Manrope", sans-serif;
  letter-spacing: 0;
}

h1 {
  font-size: 1.1rem;
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2.15rem);
}

h3 {
  font-size: 1.15rem;
}

p {
  margin: 0;
}

.desktop-nav {
  justify-content: center;
  flex-wrap: wrap;
}

.nav-btn,
.soft-btn,
.primary-btn,
.icon-button,
.ghost-link,
.save-btn,
.choice-btn,
.term-chip,
.term-focus,
.track-step,
.direction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #15191e;
  color: var(--text);
  text-decoration: none;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.nav-btn,
.soft-btn,
.primary-btn,
.ghost-link,
.save-btn {
  min-height: 40px;
  padding: 9px 12px;
  font-weight: 800;
  font-size: 0.88rem;
}

.nav-btn:hover,
.soft-btn:hover,
.primary-btn:hover,
.icon-button:hover,
.ghost-link:hover,
.save-btn:hover,
.choice-btn:hover,
.track-step:hover,
.direction-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.nav-btn.is-active,
.direction-btn.is-active {
  color: var(--mint);
  border-color: rgba(126, 224, 178, 0.38);
  background: #112019;
}

.utility-btn {
  border-color: rgba(120, 199, 232, 0.32);
}

.danger-btn {
  border-color: rgba(255, 129, 122, 0.32);
  color: #ffb6b2;
}

.danger-btn:hover {
  border-color: rgba(255, 129, 122, 0.52);
  background: #221514;
}

.primary-btn {
  border-color: rgba(126, 224, 178, 0.46);
  background: var(--mint);
  color: var(--mint-ink);
}

.primary-btn:hover {
  background: #91ecc2;
}

.nav-btn:disabled,
.soft-btn:disabled,
.primary-btn:disabled,
.icon-button:disabled,
.ghost-link:disabled,
.save-btn:disabled,
.choice-btn:disabled,
.track-step:disabled,
.direction-btn:disabled {
  color: var(--soft) !important;
  border-color: var(--line) !important;
  background: #12161a !important;
  box-shadow: none;
}

.ghost-link {
  background: #201b13;
  border-color: rgba(241, 197, 107, 0.34);
  color: var(--amber);
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
}

.burger-btn {
  display: none;
}

.top-stats {
  align-items: stretch;
}

.stat-pill {
  min-width: 88px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #13171b;
}

.stat-pill.wide {
  min-width: 120px;
}

.stat-pill strong {
  display: block;
  margin-top: 2px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.98rem;
  white-space: nowrap;
}

.mini-progress {
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--amber));
  transition: width 180ms ease;
}

.mobile-menu {
  position: sticky;
  top: 78px;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 19, 22, 0.96);
  box-shadow: var(--shadow);
}

.app-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.side-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 27, 32, 0.92);
  box-shadow: var(--shadow);
}

.rail-panel {
  padding: 12px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.compact-meter {
  margin-bottom: 12px;
}

.rail-track {
  display: grid;
  gap: 8px;
}

.track-step {
  justify-content: flex-start;
  width: 100%;
  padding: 9px;
  text-align: left;
}

.track-step .step-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.track-step strong {
  display: block;
  font-size: 0.82rem;
}

.track-step small {
  display: block;
  margin-top: 2px;
  color: var(--soft);
  font-size: 0.72rem;
}

.track-step.is-current {
  border-color: rgba(126, 224, 178, 0.42);
  background: #102019;
}

.track-step.is-done .step-icon {
  color: var(--mint);
}

.track-step.is-locked {
  opacity: 0.52;
}

.term-focus {
  width: 100%;
  justify-content: flex-start;
  padding: 12px;
  text-align: left;
  background: #12171a;
}

.term-focus span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: rgba(120, 199, 232, 0.12);
  color: var(--cyan);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.term-focus span .icon {
  width: 20px;
  height: 20px;
}

.term-focus strong,
.term-focus small {
  display: block;
}

.term-focus small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.lesson-word-card {
  margin-top: 14px;
  padding: 14px;
}

.lesson-word-card .panel-title {
  margin-bottom: 10px;
}

.lesson-term-focus {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  column-gap: 10px;
  min-height: 72px;
}

.lesson-term-focus span {
  width: 58px;
  grid-row: 1 / span 2;
}

.lesson-term-focus strong,
.lesson-term-focus small {
  grid-column: 2;
}

.save-btn {
  width: 100%;
}

.content-shell {
  min-width: 0;
}

.view-pane {
  display: none;
}

.view-pane.is-active {
  display: block;
}

.view-head {
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(29, 34, 31, 0.94), rgba(32, 29, 24, 0.92));
}

.view-head p {
  max-width: 58ch;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.mission-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: stretch;
}

.mission-card,
.coach-card {
  padding: 16px;
  min-height: 100%;
}

.mission-card-head {
  align-items: center;
}

.mission-card-head p {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.mission-chart-wrap {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1216;
}

.chart-toolbar {
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.chart-toolbar strong {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

.mission-chart {
  min-height: 280px;
  padding: 12px;
}

.mission-chart svg {
  width: 100%;
  height: 260px;
}

.mission-brief {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.mission-brief p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.keyword-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.term-chip {
  padding: 6px 8px;
  color: var(--text);
  background: #11161a;
  font-size: 0.78rem;
  font-weight: 800;
}

.term-chip svg {
  width: 15px;
  height: 15px;
  color: var(--cyan);
}

.mission-controls {
  margin-top: 16px;
}

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

.choice-btn {
  display: grid;
  justify-items: start;
  gap: 9px;
  width: 100%;
  min-height: 132px;
  padding: 12px;
  text-align: left;
  background: #12171c;
  border: 2px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.12);
  position: relative;
}

.choice-btn:nth-child(1) {
  background: linear-gradient(180deg, #142020, #101719);
}

.choice-btn:nth-child(2) {
  background: linear-gradient(180deg, #211d13, #171512);
}

.choice-btn:nth-child(3) {
  background: linear-gradient(180deg, #1f1721, #171318);
}

.choice-btn:hover {
  background: #1b2228;
  border-color: rgba(126, 224, 178, 0.52);
}

.answer-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.choice-btn.is-selected,
.choice-btn.is-good {
  border-color: rgba(126, 224, 178, 0.48);
  background: #102019;
}

.choice-btn.is-bad {
  border-color: rgba(255, 129, 122, 0.4);
  background: #231716;
}

.choice-btn.is-selected:disabled,
.choice-btn.is-good:disabled {
  color: var(--text) !important;
  border-color: rgba(126, 224, 178, 0.48) !important;
  background: #102019 !important;
}

.choice-btn.is-bad:disabled {
  color: var(--text) !important;
  border-color: rgba(255, 129, 122, 0.4) !important;
  background: #231716 !important;
}

.choice-top {
  align-items: center;
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: var(--amber);
  background: rgba(241, 197, 107, 0.11);
}

.choice-btn strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
}

.choice-btn small {
  color: var(--muted);
  line-height: 1.45;
}

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

.direction-btn {
  min-height: 74px;
  padding: 12px;
  font-weight: 900;
}

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

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

.range-card {
  min-width: 0;
}

.range-label {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.range-label strong {
  font-family: "Space Grotesk", sans-serif;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--mint);
}

.trade-readout {
  align-items: stretch;
  flex-wrap: wrap;
  padding-top: 4px;
}

.readout-item {
  flex: 1 1 120px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.readout-item strong {
  display: block;
  margin-top: 4px;
  font-family: "Space Grotesk", sans-serif;
}

.feedback-area {
  min-height: 0;
  margin-top: 14px;
}

.feedback-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11161a;
}

.feedback-box.good {
  border-color: rgba(126, 224, 178, 0.38);
}

.feedback-box.bad {
  border-color: rgba(255, 129, 122, 0.34);
}

.feedback-box strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
}

.feedback-box p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.feedback-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.feedback-stats span {
  padding: 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
  font-weight: 800;
}

.feedback-box .primary-btn {
  width: fit-content;
  margin-top: 10px;
}

.action-row {
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 16px;
}

.coach-card {
  position: sticky;
  top: 98px;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.coach-top {
  align-items: center;
  justify-content: space-between;
}

.coach-top h3 {
  margin-top: 3px;
}

.coach-emoji {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: rgba(126, 224, 178, 0.1);
  font-size: 1.3rem;
}

.checklist {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  align-content: start;
  flex: 1;
}

.check-row {
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.check-row:last-child {
  border-bottom: 0;
}

.check-dot {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.06);
}

.check-row.good .check-dot {
  color: var(--mint);
  background: rgba(126, 224, 178, 0.12);
}

.check-row.warn .check-dot {
  color: var(--amber);
  background: rgba(241, 197, 107, 0.12);
}

.check-row.bad .check-dot {
  color: var(--red);
  background: rgba(255, 129, 122, 0.12);
}

.check-row span:last-child {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.wallet-card {
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.wallet-card strong {
  display: block;
  margin-top: 3px;
  font-family: "Space Grotesk", sans-serif;
}

.lesson-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 14px;
}

.lesson-image-card,
.lesson-copy-card {
  padding: 14px;
}

.lesson-image-card {
  display: grid;
  place-items: center;
  background: #101316;
}

.lesson-image-card.is-theory {
  align-content: stretch;
}

#slideImage {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.theory-card {
  width: 100%;
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(126, 224, 178, 0.1), rgba(120, 199, 232, 0.08));
}

.theory-card .icon {
  width: 34px;
  height: 34px;
  color: var(--mint);
}

.theory-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
}

.theory-card p {
  color: var(--text);
  line-height: 1.65;
}

.lesson-copy-card h3 {
  margin-top: 8px;
}

.lesson-copy-card p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.lesson-copy-card .keyword-row {
  justify-content: flex-start;
  margin-top: 14px;
}

.glossary-grid,
.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.glossary-card,
.resource-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 27, 32, 0.92);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
}

.glossary-card {
  cursor: pointer;
}

.glossary-card:hover,
.resource-card:hover {
  border-color: var(--line-strong);
}

.glossary-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.glossary-card .popup-icon {
  width: 36px;
  height: 36px;
}

.glossary-card strong,
.resource-card strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
}

.glossary-card p,
.resource-card p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.resource-card[href] {
  display: block;
  text-decoration: none;
}

.resource-card .resource-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--mint);
  font-size: 0.84rem;
  font-weight: 900;
}

.resource-meta {
  flex-wrap: wrap;
  margin-top: 12px;
}

.resource-meta span {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 27, 32, 0.92);
}

.summary-card span {
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.summary-check {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #11161a;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.check-loading-head,
.check-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-loading-head strong,
.check-result-head strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}

.check-percent {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border-radius: var(--radius);
  background: rgba(126, 224, 178, 0.1);
  color: var(--mint);
  font-weight: 900;
}

.check-progress {
  height: 10px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.check-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--cyan), var(--amber));
  transition: width 340ms ease;
}

.check-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.check-result-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.grade-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: #07100c;
  font-weight: 1000;
}

.summary-check.grade-red {
  border-color: rgba(255, 99, 92, 0.48);
  background: #241314;
}

.summary-check.grade-purple {
  border-color: rgba(193, 111, 255, 0.46);
  background: #211526;
}

.summary-check.grade-emerald {
  border-color: rgba(42, 192, 138, 0.5);
  background: #102119;
}

.summary-check.grade-sand {
  border-color: rgba(226, 197, 137, 0.5);
  background: #211d14;
}

.summary-check.grade-lime {
  border-color: rgba(177, 245, 128, 0.55);
  background: #142113;
}

.grade-red .grade-pill {
  background: #ff635c;
}

.grade-purple .grade-pill {
  background: #c16fff;
}

.grade-emerald .grade-pill {
  background: #2ac08a;
}

.grade-sand .grade-pill {
  background: #e2c589;
}

.grade-lime .grade-pill {
  background: #b1f580;
}

.check-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.check-mini-card {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.check-mini-card span {
  color: var(--soft);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.check-mini-card strong {
  display: block;
  margin-top: 5px;
  font-family: "Space Grotesk", sans-serif;
}

.check-notes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.check-note {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.check-note .icon {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--amber);
}

.check-note span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.summary-text {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1317;
  color: var(--text);
  line-height: 1.6;
  outline: none;
}

.summary-text:focus {
  border-color: rgba(126, 224, 178, 0.45);
}

.study-chat {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 65;
  display: grid;
  justify-items: end;
  gap: 10px;
  width: min(390px, calc(100vw - 28px));
  pointer-events: none;
}

.chat-toggle,
.chat-panel {
  pointer-events: auto;
}

.chat-toggle {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid rgba(126, 224, 178, 0.46);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), transparent 32%),
    linear-gradient(135deg, #123121, #163b4d);
  color: var(--mint);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.chat-toggle:hover {
  transform: translateY(-2px);
  border-color: rgba(126, 224, 178, 0.72);
}

.chat-toggle .icon {
  width: 24px;
  height: 24px;
}

.study-chat:not(.is-closed) .chat-toggle {
  background: #161b20;
  color: var(--text);
}

.chat-panel {
  width: 100%;
  height: min(530px, calc(100vh - 104px));
  min-height: 360px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(24, 29, 34, 0.98), rgba(14, 17, 20, 0.98)),
    #11161a;
  box-shadow: var(--shadow);
}

.chat-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 34px;
}

.chat-messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
}

.chat-message {
  width: fit-content;
  max-width: 86%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.chat-message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.045);
}

.chat-message.user {
  align-self: flex-end;
  border-color: rgba(120, 199, 232, 0.35);
  background: rgba(120, 199, 232, 0.13);
}

.chat-message.is-typing::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 1em;
  margin-left: 3px;
  border-radius: 2px;
  background: currentColor;
  vertical-align: -0.15em;
  animation: typing-cursor 0.8s steps(2, start) infinite;
}

.chat-message mark {
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(126, 224, 178, 0.18);
  color: var(--mint);
  font-weight: 900;
}

@keyframes typing-cursor {
  50% {
    opacity: 0;
  }
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.chat-form input {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f1317;
  color: var(--text);
  outline: none;
}

.chat-form input:focus {
  border-color: rgba(126, 224, 178, 0.45);
}

.chat-send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--mint);
  color: var(--mint-ink);
  transition: transform 160ms ease, filter 160ms ease;
}

.chat-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.glossary-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 9, 0.72);
  backdrop-filter: blur(10px);
}

.answer-overlay {
  position: fixed;
  inset: 0;
  z-index: 72;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(5, 7, 9, 0.62);
  backdrop-filter: blur(8px);
}

.answer-modal {
  width: min(440px, 100%);
  padding: 18px;
  border: 1px solid rgba(241, 197, 107, 0.36);
  border-radius: var(--radius);
  background: #151a1f;
  box-shadow: var(--shadow);
  text-align: center;
}

.answer-modal.good {
  border-color: rgba(126, 224, 178, 0.44);
}

.answer-modal.bad {
  border-color: rgba(255, 129, 122, 0.44);
}

.answer-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  color: var(--amber);
  background: rgba(241, 197, 107, 0.12);
}

.answer-modal.bad .answer-icon {
  color: var(--red);
  background: rgba(255, 129, 122, 0.12);
}

.answer-icon .icon {
  width: 28px;
  height: 28px;
}

.answer-modal p {
  margin: 8px 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.answer-modal.bad .primary-btn {
  border-color: rgba(255, 129, 122, 0.42);
  background: var(--red);
  color: #220f0d;
}

.glossary-panel {
  position: relative;
  width: min(480px, 100%);
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #15191e;
  box-shadow: var(--shadow);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

.glossary-panel .popup-icon {
  margin-bottom: 12px;
}

.glossary-panel h3 {
  margin-top: 4px;
  font-size: 1.5rem;
}

.glossary-panel > p:not(.eyebrow) {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.popup-example {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.popup-example span {
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.popup-example p {
  margin-top: 6px;
  color: var(--text);
  line-height: 1.5;
}

.save-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(126, 224, 178, 0.42);
  border-radius: var(--radius);
  background: #102019;
  color: var(--mint);
  font-weight: 900;
  box-shadow: var(--shadow);
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .desktop-nav,
  .top-stats {
    display: none;
  }

  .burger-btn {
    display: inline-grid;
    justify-self: end;
  }

  .app-grid,
  .mission-layout,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: none;
  }

  .coach-card {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 8px;
  }

  .topbar {
    top: 6px;
    gap: 8px;
    padding: 8px;
  }

  .brand-block {
    min-width: 0;
  }

  .brand-block > div:last-child {
    min-width: 0;
  }

  .brand-block h1,
  .brand-block .eyebrow {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view-head,
  .mission-brief,
  .wallet-card,
  .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .view-head {
    padding: 14px;
  }

  .mobile-menu {
    top: 72px;
    grid-template-columns: 1fr;
  }

  .keyword-row {
    justify-content: flex-start;
  }

  .choice-grid,
  .direction-grid,
  .range-grid,
  .feedback-stats,
  .glossary-grid,
  .resource-grid,
  .summary-grid,
  .check-result-grid {
    grid-template-columns: 1fr;
  }

  .summary-actions,
  .check-loading-head,
  .check-result-head {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .summary-actions .primary-btn,
  .summary-actions .soft-btn,
  .action-row .soft-btn,
  .action-row .primary-btn,
  .feedback-box .primary-btn {
    width: 100%;
  }

  .summary-text {
    min-height: 340px;
    font-size: 0.86rem;
  }

  .mission-chart {
    min-height: 240px;
  }

  .mission-chart svg {
    height: 220px;
  }

  .study-chat {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }

  .chat-panel {
    height: min(560px, calc(100vh - 96px));
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 520px) {
  .brand-block {
    gap: 8px;
  }

  .brand-mark,
  .mission-symbol,
  .popup-icon {
    width: 40px;
    height: 40px;
  }

  h2 {
    font-size: 1.45rem;
  }

  h1 {
    font-size: 1rem;
  }

  .mission-card,
  .coach-card,
  .view-head {
    padding: 12px;
  }

  .mission-chart {
    min-height: 230px;
  }

  .mission-chart svg {
    height: 220px;
  }

  .nav-btn,
  .soft-btn,
  .primary-btn,
  .ghost-link,
  .save-btn {
    min-height: 44px;
  }

  .choice-btn {
    min-height: 112px;
  }

  .check-note {
    grid-template-columns: 24px minmax(0, 1fr);
    padding: 9px;
  }

  .check-mini-card,
  .summary-card {
    padding: 11px;
  }
}
