:root {
  --font-sans: "Pretendard Variable", Pretendard, sans-serif;
  --color-bg: #f7f8fb;
  --color-surface: #ffffff;
  --color-surface-subtle: #f0f3f8;
  --color-text: #172033;
  --color-text-muted: #667085;
  --color-border: #d8dee9;
  --color-border-strong: #aeb8c8;
  --color-accent: #2357d9;
  --color-accent-hover: #1948bf;
  --color-accent-soft: #eaf0ff;
  --color-on-accent: #fff;
  --color-success: #137a4b;
  --color-success-soft: #eaf7f0;
  --color-error: #b42335;
  --color-error-soft: #fff0f1;
  --color-warning: #9a6700;
  --shadow-dialog: 0 24px 64px rgba(19, 31, 53, 0.18);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --duration: 160ms;
}

[data-theme="dark"] {
  --color-bg: #0f141d;
  --color-surface: #171e2a;
  --color-surface-subtle: #202938;
  --color-text: #edf1f7;
  --color-text-muted: #a8b3c5;
  --color-border: #344054;
  --color-border-strong: #667085;
  --color-accent: #7aa2ff;
  --color-accent-hover: #9ab9ff;
  --color-accent-soft: #1d315e;
  --color-on-accent: #0f141d;
  --color-success: #67d39b;
  --color-success-soft: #153b2d;
  --color-error: #ff8994;
  --color-error-soft: #4a2028;
  --color-warning: #f4c464;
}

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

html {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  word-break: keep-all;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden,
.screen:not(.active) {
  display: none !important;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--color-bg) 94%, transparent);
  backdrop-filter: blur(12px);
}

.app-header__inner {
  width: min(100% - 32px, 960px);
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand-button,
.nav-button,
.text-button,
.quiz-type-card,
.term-tag,
.sort-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.nav-button {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
}

.nav-button:hover {
  background: var(--color-surface-subtle);
  color: var(--color-text);
}

.nav-button span {
  margin-left: 3px;
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
}

.app-shell {
  width: min(100% - 32px, 960px);
  min-width: 0;
  margin: 0 auto;
  padding: var(--space-10) 0 var(--space-16);
}

.eyebrow {
  margin: 0 0 var(--space-3);
  color: var(--color-accent);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.home-intro,
.section-heading,
.result-heading {
  max-width: 680px;
  margin-bottom: var(--space-10);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: var(--space-10);
  margin-bottom: var(--space-10);
}

.home-hero .home-intro {
  margin-bottom: 0;
}

.home-visual {
  min-width: 0;
  margin: 0;
  justify-self: end;
}

.home-visual img {
  display: block;
  width: min(100%, 260px);
  height: auto;
}

.home-intro h1,
.section-heading h1,
.result-heading h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.home-intro > p:last-child,
.section-heading > p:last-child {
  margin: var(--space-4) 0 0;
  color: var(--color-text-muted);
  font-size: 18px;
}

.quiz-menu {
  border-top: 1px solid var(--color-border-strong);
}

.quiz-type-card {
  width: 100%;
  min-height: 104px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-2);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  text-align: left;
  transition: background var(--duration) ease, color var(--duration) ease;
}

.quiz-type-card:hover {
  background: var(--color-surface);
}

.quiz-type-card__index {
  color: var(--color-text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.quiz-type-card__body {
  display: grid;
  gap: var(--space-1);
}

.quiz-type-card__body strong {
  font-size: 21px;
  letter-spacing: -0.025em;
}

.quiz-type-card__body span,
.quiz-type-card__meta {
  color: var(--color-text-muted);
  font-size: 15px;
}

.quiz-type-card__meta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quiz-type-card__arrow {
  color: var(--color-accent);
  font-size: 20px;
  transition: transform var(--duration) ease;
}

.quiz-type-card:hover .quiz-type-card__arrow {
  transform: translateX(3px);
}

.home-footer {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-8);
  color: var(--color-text-muted);
  font-size: 14px;
}

.home-footer p {
  margin: 0;
}

.text-button {
  padding: 0;
  color: var(--color-accent);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.text-button:hover {
  color: var(--color-accent-hover);
}

.quiz-container {
  width: 100%;
  min-width: 0;
  max-width: 820px;
  margin: 0 auto;
}

.quiz-container.has-docked-actions {
  padding-bottom: 88px;
}

.quiz-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.progress-bar {
  height: 3px;
  overflow: hidden;
  background: var(--color-border);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--color-accent);
  transition: width 220ms ease;
}

.progress-text {
  color: var(--color-text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.question-header {
  margin-bottom: var(--space-5);
}

.question-header .eyebrow {
  margin-bottom: var(--space-1);
}

.question-header > p:last-child {
  margin: 0;
  color: var(--color-text-muted);
}

.question-content {
  margin-bottom: var(--space-5);
}

.question-text,
.definition-box,
.term-definition-pair,
.scenario-box {
  margin: 0;
}

.definition-text {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 24px);
  font-weight: 580;
  line-height: 1.48;
  letter-spacing: -0.025em;
}

.category-hint {
  display: inline-block;
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 650;
}

.term-definition-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

.term-label,
.definition-label {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: var(--space-4);
  margin: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.term-label strong,
.definition-label strong {
  color: var(--color-text-muted);
  font-size: 14px;
}

.term-label {
  font-size: 23px;
  font-weight: 650;
}

.definition-label {
  font-size: 19px;
}

.question-text .question-header {
  margin: 0;
}

.question-text .question-icon {
  display: none;
}

.question-text .question-title {
  margin: 0 0 var(--space-3);
  font-size: 14px;
  color: var(--color-text-muted);
}

.scenario-text {
  margin: 0;
  font-size: 22px;
  line-height: 1.6;
}

.answer-options {
  display: grid;
  gap: 10px;
  margin-top: var(--space-6);
}

.quiz-dictionary-button {
  width: fit-content;
  margin-top: var(--space-3);
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--color-accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.quiz-dictionary-dialog {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
}

.quiz-dictionary-dialog[open] {
  display: grid;
  justify-items: end;
}

.quiz-dictionary-dialog::backdrop {
  background: rgba(4, 8, 15, 0.64);
}

.quiz-dictionary-panel {
  width: min(100%, 480px);
  height: 100dvh;
  padding: var(--space-8);
  overflow-y: auto;
  border-inline-start: 1px solid var(--color-border);
  background: var(--color-bg);
}

.quiz-dictionary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.quiz-dictionary-header h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.dialog-close {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.quiz-dictionary-guide {
  margin: var(--space-5) 0;
  color: var(--color-text-muted);
}

.quiz-dictionary-status {
  min-height: 24px;
  margin: var(--space-3) 0 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.quiz-dictionary-results {
  margin-top: var(--space-2);
}

.quiz-dictionary-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  border-top: 1px solid var(--color-border);
}

.quiz-dictionary-result h3 {
  margin: 0 0 var(--space-2);
  font-size: 17px;
}

.quiz-dictionary-result p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.quiz-dictionary-use {
  white-space: nowrap;
}

.option,
.tf-button {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  font-size: 16px;
  font-weight: 560;
  text-align: left;
  transition: border-color var(--duration) ease, background var(--duration) ease;
}

.option:hover,
.tf-button:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.option.selected,
.tf-button.selected {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.option.correct,
.tf-button.correct {
  border-color: var(--color-success);
  background: var(--color-success-soft);
  color: var(--color-success);
}

.option.incorrect,
.tf-button.incorrect {
  border-color: var(--color-error);
  background: var(--color-error-soft);
  color: var(--color-error);
}

.option.disabled,
.tf-button:disabled {
  cursor: default;
}

.tf-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.tf-button {
  text-align: center;
}

.text-input,
.search-input {
  width: 100%;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
}

.text-input {
  min-height: 60px;
  padding: 14px 16px;
  font-size: 18px;
}

.text-input.correct {
  border-color: var(--color-success);
  background: var(--color-success-soft);
}

.text-input.incorrect {
  border-color: var(--color-error);
  background: var(--color-error-soft);
}

.feedback {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-strong);
  scroll-margin-bottom: 92px;
}

.feedback__heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: 20px;
}

.feedback.correct .feedback__heading {
  color: var(--color-success);
}

.feedback.incorrect .feedback__heading {
  color: var(--color-error);
}

.feedback__summary {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}

.feedback-comparison {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--color-border);
}

.feedback-comparison > * {
  min-width: 0;
}

.feedback-comparison:first-of-type {
  border-top: 0;
}

.feedback-comparison__label,
.review-label {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feedback-comparison strong {
  font-size: 18px;
}

.feedback-comparison p {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.question-actions {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-4) 0 0;
  border-top: 1px solid var(--color-border);
}

.question-actions.is-docked {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(calc(100% - 32px), 820px);
  min-height: 64px;
  margin-top: 0;
  padding: 9px 12px;
  transform: translateX(-50%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-bg) 94%, transparent);
  backdrop-filter: blur(14px);
}

.question-action-hint {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
}

.question-action-buttons {
  display: flex;
  justify-content: flex-end;
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 700;
  transition: background var(--duration) ease, border-color var(--duration) ease;
}

.button--primary {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.button--primary:hover {
  background: var(--color-accent-hover);
}

.button--secondary {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.button--secondary:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-subtle);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.search-section {
  position: relative;
  max-width: 720px;
  margin-bottom: var(--space-8);
}

.search-section > label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 14px;
  font-weight: 700;
}

.search-input-wrapper {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2);
}

.search-input {
  min-height: 48px;
  padding: 11px 14px;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 80px;
  display: none;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-dialog);
  z-index: 10;
}

.search-suggestions.show {
  display: block;
}

.suggestion-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover {
  background: var(--color-surface-subtle);
}

.suggestion-icon {
  display: none;
}

.suggestion-term {
  font-weight: 700;
}

.suggestion-definition {
  color: var(--color-text-muted);
  font-size: 13px;
}

.welcome-message {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--color-border);
}

.welcome-message > p {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 650;
}

.term-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.dictionary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.term-tag,
.sort-btn {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 14px;
}

.term-tag:hover,
.sort-btn:hover,
.sort-btn.active {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.results-header,
.terms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-border-strong);
}

.results-count {
  font-weight: 700;
}

.terms-header h2 {
  margin: 0;
  font-size: 20px;
}

.segmented-control {
  display: flex;
  gap: var(--space-2);
}

.term-item {
  display: grid;
  grid-template-columns: minmax(190px, 0.35fr) minmax(0, 1fr);
  gap: var(--space-8);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--color-border);
}

.term-header {
  display: block;
}

.term-icon {
  display: none;
}

.term-name {
  margin: 0 0 var(--space-2);
  font-size: 18px;
  line-height: 1.35;
}

.term-category {
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 700;
}

.term-definition {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.no-results {
  padding: var(--space-12) 0;
}

.no-results-icon {
  display: none;
}

.no-results h3 {
  margin: 0 0 var(--space-2);
  font-size: 20px;
  overflow-wrap: anywhere;
}

.no-results p {
  margin: 0;
  color: var(--color-text-muted);
}

.learning-map-screen {
  width: min(calc(100vw - 48px), 1440px);
  min-width: 0;
  margin-left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 280px minmax(620px, 1fr) 340px;
  align-items: start;
  gap: var(--space-6);
}

.learning-sidebar,
.learning-stage,
.learning-detail {
  min-width: 0;
}

.learning-sidebar,
.learning-detail {
  display: grid;
  gap: var(--space-5);
}

.learning-sidebar {
  padding-right: var(--space-6);
  border-right: 1px solid var(--color-border);
}

.learning-sidebar__heading h2,
.learning-detail h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.025em;
}

.learning-sidebar__heading p,
.learning-stage__header > p:last-child,
.learning-detail__placeholder {
  margin: var(--space-2) 0 0;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

.learning-stage {
  display: grid;
  gap: var(--space-6);
}

.learning-stage__header {
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border-strong);
}

.learning-stage__header h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.learning-path-flow,
.learning-mobile-path {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learning-path-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

.learning-topic-choice {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.learning-topic-button,
.learning-path-choice {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}

.learning-topic-button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2);
  font-weight: 700;
}

.learning-topic-button span {
  color: var(--color-text-muted);
  font-size: 13px;
}

.learning-topic-button.active {
  color: var(--color-accent);
}

.learning-path-choices {
  display: grid;
  gap: var(--space-1);
  padding-inline-start: var(--space-3);
}

.learning-path-choice {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

.learning-path-choice strong {
  font-size: 14px;
}

.learning-path-choice span {
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.learning-path-choice:hover,
.learning-path-choice.active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.learning-active-path {
  grid-column: 1 / -1;
  display: grid;
  gap: var(--space-2);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--color-border-strong);
}

.learning-active-path .eyebrow,
.learning-active-path h2,
.learning-active-path p:last-child {
  margin: 0;
}

.learning-active-path h2 {
  font-size: clamp(20px, 2vw, 28px);
  letter-spacing: -0.03em;
}

.learning-active-path p:last-child {
  color: var(--color-text-muted);
}

.learning-path-flow__step,
.learning-supporting-terms {
  display: grid;
  gap: var(--space-2);
}

.learning-path-flow__step,
.learning-mobile-path__step {
  min-width: 0;
}

.learning-term-button {
  max-width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  /* 색을 지정하지 않으면 브라우저 기본 버튼 배경(밝은 회색)에 상속된 밝은 글자가
     겹쳐 다크 모드에서 글씨가 보이지 않는다. 두 테마 모두 토큰으로 고정한다. */
  padding: var(--space-3);
  text-align: left;
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  cursor: pointer;
}

.learning-term-button:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-subtle);
}

.learning-term-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.learning-term-button.active {
  color: var(--color-text);
  background: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.learning-relation-button {
  padding: var(--space-2) var(--space-3);
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  cursor: pointer;
}

.learning-relation-button:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.learning-relation-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.learning-path-flow__step > .learning-term-button,
.learning-mobile-path__step > .learning-term-button {
  width: 100%;
}

.learning-supporting-terms {
  grid-column: 1 / -1;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.learning-supporting-terms > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.learning-fit-assessment {
  padding-block: var(--space-3);
  border-block: 1px solid var(--color-border);
}

.learning-fit-assessment h3,
.learning-fit-assessment p {
  margin: 0;
}

.learning-fit-assessment p {
  margin-top: var(--space-1);
  color: var(--color-text-muted);
}

.learning-mobile-path {
  display: none;
}

.learning-detail {
  min-height: 200px;
  padding-left: var(--space-6);
  border-inline-start: 1px solid var(--color-border);
}

.learning-detail__placeholder {
  margin-top: 0;
  line-height: 1.7;
}

.learning-detail .button {
  justify-self: start;
}

.result-content {
  max-width: 820px;
  margin: 0 auto;
}

.result-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border-strong);
  border-bottom: 1px solid var(--color-border-strong);
}

.result-summary > div {
  display: grid;
  gap: var(--space-2);
}

.result-summary__label {
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 700;
}

.result-summary strong {
  font-size: clamp(38px, 7vw, 64px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.result-summary small {
  color: var(--color-text-muted);
  font-size: 0.38em;
  font-weight: 600;
}

.result-summary > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--color-text-muted);
}

.result-actions {
  display: flex;
  gap: var(--space-3);
  margin: var(--space-6) 0 var(--space-12);
}

.review-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-strong);
}

.review-heading h2 {
  margin: 0;
  font-size: 24px;
}

.review-heading p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.review-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-6) 0;
  border-bottom: 1px solid var(--color-border);
}

.review-item__index {
  color: var(--color-error);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.review-question {
  margin: 0 0 var(--space-3);
  font-weight: 650;
}

.review-answers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  color: var(--color-text-muted);
  font-size: 14px;
}

.review-answers strong {
  color: var(--color-text);
}

.review-summary {
  margin: var(--space-4) 0;
  color: var(--color-text-muted);
}

.review-explanation {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--color-border);
}

.review-explanation strong {
  align-self: start;
}

.review-explanation p {
  grid-column: 2;
  margin: -22px 0 0;
  color: var(--color-text-muted);
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: var(--space-6);
  }

  .home-visual img {
    width: min(100%, 190px);
  }

  .feedback-comparison {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

/* 학습 지도만 앱 쉘의 일반 960px 폭을 벗어나되, 스크롤바를 포함하는 100vw에는 의존하지 않습니다. */
@media (min-width: 721px) {
  .app-shell:has(.learning-map-screen.active) {
    width: min(calc(100% - 48px), 1440px);
  }

  .learning-map-screen {
    width: 100%;
    margin-left: 0;
    transform: none;
  }
}

/* 3열 최소폭: 280 + 620 + 340 + (24 × 2) + 바깥 여백 48 = 1336px */
@media (min-width: 721px) and (max-width: 1335px) {
  .learning-map-screen {
    grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
    grid-template-areas:
      "sidebar stage"
      "sidebar detail";
  }

  .learning-sidebar {
    grid-area: sidebar;
    min-width: 0;
    max-height: calc(100dvh - 96px);
    overflow-y: auto;
    position: sticky;
    top: calc(64px + var(--space-4));
    align-self: start;
    padding-right: var(--space-5);
  }

  .learning-stage {
    grid-area: stage;
    min-width: 0;
  }

  .learning-detail {
    grid-area: detail;
    width: 100%;
    min-width: 0;
    padding: var(--space-5) 0 0;
    border-top: 1px solid var(--color-border);
    border-inline-start: 0;
  }
}

@media (max-width: 720px) {
  .app-header__inner,
  .app-shell {
    width: min(100% - 24px, 960px);
  }

  .app-header__inner {
    min-height: 56px;
  }

  .app-shell {
    padding: var(--space-8) 0 var(--space-12);
  }

  .nav-button {
    padding: 7px 6px;
    font-size: 13px;
  }

  .home-intro,
  .section-heading,
  .result-heading {
    margin-bottom: var(--space-8);
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-8);
  }

  .home-hero .home-intro {
    margin-bottom: 0;
  }

  .home-visual {
    justify-self: start;
  }

  .home-visual img {
    width: 144px;
  }

  .quiz-dictionary-dialog[open] {
    align-items: end;
  }

  .quiz-dictionary-panel {
    width: 100%;
    height: min(78dvh, 680px);
    padding: var(--space-6) var(--space-4) max(var(--space-6), env(safe-area-inset-bottom));
    border-top: 1px solid var(--color-border);
    border-inline-start: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .quiz-dictionary-result {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .quiz-dictionary-use {
    justify-self: start;
  }

  .home-intro h1,
  .section-heading h1,
  .result-heading h1 {
    font-size: 32px;
  }

  .home-intro > p:last-child,
  .section-heading > p:last-child {
    font-size: 16px;
  }

  .quiz-type-card {
    grid-template-columns: 32px minmax(0, 1fr) 20px;
    gap: var(--space-3);
    padding: var(--space-4) 0;
  }

  .quiz-type-card__meta {
    display: none;
  }

  .quiz-type-card__body strong {
    font-size: 18px;
  }

  .quiz-type-card__body span {
    font-size: 14px;
  }

  .home-footer,
  .review-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .quiz-progress {
    margin-bottom: var(--space-8);
  }

  .definition-text {
    font-size: 21px;
  }

  .term-label,
  .definition-label {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .term-label {
    font-size: 20px;
  }

  .definition-label,
  .scenario-text {
    font-size: 17px;
  }

  .tf-buttons,
  .feedback-comparison,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .result-summary > p {
    grid-column: 1;
  }

  .result-actions .button {
    width: 100%;
  }

  .question-actions {
    min-height: 64px;
    gap: var(--space-3);
    padding: 9px 12px;
  }

  .question-action-hint {
    font-size: 12px;
  }

  .question-actions .button {
    width: auto;
    white-space: nowrap;
  }

  .result-actions {
    flex-direction: column;
  }

  .search-input-wrapper {
    grid-template-columns: 1fr;
  }

  .search-suggestions {
    right: 0;
  }

  .term-item {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .terms-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .review-explanation {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .review-explanation p {
    grid-column: 1;
    margin: 0;
  }

  /* learning-map-mobile:start */
  .learning-map-screen {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
    margin-left: 0;
    transform: none;
  }

  .learning-sidebar {
    gap: var(--space-4);
    padding-right: 0;
    border-right: 0;
  }

  #learning-topic-list {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .learning-stage__header {
    padding-bottom: var(--space-5);
  }

  .learning-stage__header h1,
  .learning-stage__header > p:last-child,
  .learning-detail__placeholder,
  .learning-path-flow,
  .learning-mobile-path {
    overflow-wrap: anywhere;
  }

  .learning-path-flow {
    display: none;
  }

  .learning-mobile-path {
    display: block;
  }

  .learning-detail {
    min-height: auto;
    padding: var(--space-5) 0 0;
    border-top: 1px solid var(--color-border);
    border-inline-start: 0;
  }

  .learning-detail .button {
    width: 100%;
  }
  /* learning-map-mobile:end */

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* 전체 연결 지도 */

.learning-view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: var(--space-4);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.learning-view-switch__button {
  padding: var(--space-2) var(--space-4);
  font: inherit;
  color: var(--color-text-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.learning-view-switch__button.active {
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-weight: 600;
}

.learning-view-switch__button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.learning-graph {
  display: grid;
  gap: var(--space-3);
  min-width: 0;
}

.learning-graph__summary {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.learning-graph__canvas {
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.learning-graph__svg {
  display: block;
  width: 100%;
  height: auto;
}

.learning-graph__edge {
  stroke: var(--color-border-strong);
  stroke-width: 1.4;
  opacity: 0.75;
}

.learning-graph__edge.is-dim {
  opacity: 0.08;
}

.learning-graph__node {
  stroke: var(--color-surface);
  stroke-width: 1.5;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.learning-graph__node.is-isolated {
  opacity: 0.4;
}

.learning-graph__node.is-dim {
  opacity: 0.1;
}

.learning-graph__node.is-selected {
  stroke: var(--color-text);
  stroke-width: 2.5;
}

.learning-graph__node:hover,
.learning-graph__node:focus-visible {
  stroke: var(--color-text);
  stroke-width: 2.5;
  outline: none;
}

.learning-graph__label {
  fill: var(--color-text);
  font-size: 11px;
  font-weight: 600;
  paint-order: stroke;
  stroke: var(--color-surface);
  stroke-width: 3px;
  pointer-events: none;
}

.learning-graph__label.is-dim {
  opacity: 0.12;
}

.learning-graph__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.learning-graph__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.learning-graph__legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.learning-graph__legend-item b {
  color: var(--color-text);
  font-weight: 600;
}

.learning-graph__note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* 그래프 진단 — 무엇이 비었는지에서 무엇을 할지로 */

.graph-insights {
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.graph-insights__head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.graph-insights__head p {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.graph-insights__list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.graph-insights__item {
  padding: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.graph-insights__meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.graph-insights__code {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

.graph-insights__impact {
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.graph-insights__item h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.graph-insights__detail,
.graph-insights__why {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.graph-insights__action {
  margin: var(--space-2) 0 0;
  color: var(--color-text);
  font-size: 0.86rem;
  font-weight: 600;
}

.graph-insights__jump {
  margin-top: var(--space-2);
  padding: 6px 12px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--color-accent);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}

.graph-insights__jump:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.graph-insights__jump:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.graph-insights__empty {
  padding: var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.88rem;
}
