/* ==========================================
   HANGEUL SAYOHATI (한글 여행) - COOL MINIMALIST STYLE
   Inspiration: Modern clean learning interface (No Emojis, 100% SVG)
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&family=Noto+Sans+KR:wght@400;500;700;900&display=swap');

:root {
  --bg-page: #faf9f6;
  --surface: #ffffff;
  --surface-hover: #f4f3ef;
  --border: #e7e5df;
  --border-light: #eeece6;
  --text-main: #18181b;
  --text-muted: #71717a;
  --text-sub: #a1a1aa;
  
  --node-locked-bg: #ece8e1;
  --node-locked-icon: #78716c;
  --node-active-bg: #18181b;
  --node-active-text: #ffffff;
  --node-completed-bg: #059669;
  --node-completed-text: #ffffff;

  --accent-star: #f59e0b;
  --accent-heart: #ef4444;
  --accent-flame: #ea580c;
  --accent-emerald: #10b981;
  --accent-blue: #2563eb;

  --radius-pill: 9999px;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ==========================================
   GLOBAL BEZEL & SCROLLBAR ELIMINATION
   Completely remove native browser scrollbars and side bezel strips
   ========================================== */
html, body, *, *::before, *::after {
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE / Edge */
}

::-webkit-scrollbar,
*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* SVG ICON HELPER */
.svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  flex-shrink: 0;
}
.svg-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* TOP HEADER */
.header-container {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 14px 20px 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 14px;
  border-bottom: 1px solid var(--border-light);
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.brand-badge {
  width: 42px;
  height: 42px;
  background-color: var(--text-main);
  color: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 20px;
  font-weight: 900;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.brand-section:hover .brand-badge {
  transform: scale(1.05);
}

.brand-titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-name {
  font-size: 1.22rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.4px;
  line-height: 1.15;
}

.brand-credit {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

.credit-link {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: #a1a1aa;
  text-underline-offset: 2px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.credit-link:hover {
  color: var(--accent-blue);
  text-decoration-color: var(--accent-blue);
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background-color: #f4f3ef;
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  user-select: none;
  transition: background-color 0.15s;
}
.stat-chip.stars { color: var(--accent-star); }
.stat-chip.stars .svg-icon { color: var(--accent-star); }
.stat-chip.hearts { color: var(--accent-heart); cursor: pointer; }
.stat-chip.hearts:hover { background-color: #fee2e2; }
.stat-chip.hearts .svg-icon { color: var(--accent-heart); }

.star-icon { width: 15px; height: 15px; }
.check-icon { width: 14px; height: 14px; color: #71717a; }
.heart-icon { width: 15px; height: 15px; }

/* SEGMENTED NAVIGATION TABS */
.nav-segment-container {
  padding: 12px 0 10px;
}

.segmented-control {
  display: flex;
  background-color: #eeece6;
  padding: 4px;
  border-radius: var(--radius-pill);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.segmented-control::-webkit-scrollbar {
  display: none;
}

.segment-btn {
  flex: 1;
  min-width: 68px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}

.segment-btn:hover {
  color: var(--text-main);
}

.segment-btn.active {
  background-color: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* MAIN WRAPPER & TAB VIEWS */
.main-wrapper {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 16px 20px 80px;
  flex: 1;
}

.tab-view {
  display: none;
  width: 100%;
  animation: fadeInView 0.2s ease forwards;
}
.tab-view.active {
  display: block;
}

@keyframes fadeInView {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PATH TOOLBAR (FREE MODE TOGGLE + REFILL) */
.path-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  gap: 12px;
}

.mode-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #a1a1aa;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: all 0.15s ease;
}
.toggle-box svg {
  width: 14px;
  height: 14px;
  display: none;
}
.toggle-box.checked {
  background-color: var(--text-main);
  border-color: var(--text-main);
}
.toggle-box.checked svg {
  display: block;
}

.toggle-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.text-pill-btn {
  background: #f4f3ef;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.text-pill-btn:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

/* SECTION BLOCKS (PATH) */
.section-block {
  margin-bottom: 40px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
}

.section-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.section-title-wrap h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}
.section-title-wrap span {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.section-progress-pill {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  background-color: #f4f3ef;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* LEARNING ROAD NODES & BOLD CONNECTING LINE */
.nodes-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding: 10px 0;
}

.node-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
}

/* BOLD CONNECTING LINE */
.path-connector {
  width: 6px;
  height: 38px;
  background-color: #dcd8cf;
  border-radius: var(--radius-pill);
  margin: 8px auto 12px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.path-connector.completed {
  background-color: var(--text-main);
}

/* PERFECTLY ROUND BUTTON (NO BOTTOM ASYMMETRICAL 3D LIP) */
.node-button {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.node-button svg {
  width: 28px;
  height: 28px;
}

/* Optical center for triangle play icon */
.node-button.unlocked svg {
  margin-left: 3px;
}

/* Locked Node: Perfectly round, soft neutral */
.node-button.locked {
  background-color: var(--node-locked-bg);
  color: var(--node-locked-icon);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  cursor: not-allowed;
}

/* Unlocked Node: Perfectly round, deep rich black with clean glow */
.node-button.unlocked {
  background-color: var(--node-active-bg);
  color: var(--node-active-text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
.node-button.unlocked:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.26);
}
.node-button.unlocked:active {
  transform: scale(0.95);
}

/* Completed Node: Perfectly round, emerald green */
.node-button.completed {
  background-color: var(--node-completed-bg);
  color: var(--node-completed-text);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.28);
}
.node-button.completed:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 22px rgba(5, 150, 105, 0.38);
}
.node-button.completed:active {
  transform: scale(0.95);
}

.node-title {
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
  text-align: center;
  max-width: 200px;
  line-height: 1.25;
}
.node-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
}

/* ==========================================
   INLINE VIEW PANELS (SOUNDBOARD, WORDBOOK, SYLLABUS)
   ========================================== */
.view-panel {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.panel-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title-group h2 {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.4px;
}
.panel-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 4px;
}

/* FILTER PILLS ROW */
.filter-pills-row {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.filter-pills-row::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background-color: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.filter-pill:hover {
  background-color: #f4f3ef;
}
.filter-pill.active {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.alphabet-group {
  margin-bottom: 24px;
}
.group-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.group-badge {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-main);
  background-color: #eeece6;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  display: inline-block;
  width: fit-content;
}
.group-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* SOUNDBOARD GRID */
.soundboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
}

.soundboard-card {
  background-color: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.soundboard-card:hover {
  border-color: var(--text-main);
  background-color: #f4f4f5;
  transform: translateY(-2px);
}
.soundboard-card:active {
  transform: scale(0.96);
}

.soundboard-char {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}
.soundboard-rom {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-blue);
  margin-top: 4px;
}
.soundboard-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.2;
}

/* WORDBOOK SEARCH & ROWS */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: #a1a1aa;
  pointer-events: none;
}

.search-field-modern {
  width: 100%;
  padding: 13px 44px 13px 46px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  background-color: #ffffff;
  transition: border-color 0.15s;
}
.search-field-modern:focus {
  border-color: var(--text-main);
}

.search-clear-btn {
  position: absolute;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wordbook-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
}
.meta-count {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-main);
}
.meta-hint {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.wordbook-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.word-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: #ffffff;
  gap: 14px;
  transition: border-color 0.15s;
}
.word-card-row:hover {
  border-color: #a1a1aa;
}

.word-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.word-thumb-img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

.word-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.word-ko-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.word-ko {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.2;
}
.word-rom {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--accent-blue);
}

.word-uz {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}
.word-note {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.word-audio-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f4f3ef;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.word-audio-btn:hover {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}
.word-audio-btn:active {
  transform: scale(0.92);
}
.word-audio-btn svg {
  width: 20px;
  height: 20px;
}

/* ==========================================
   SYLLABUS & CULTURE GUIDE STYLES
   ========================================== */
.syllabus-card {
  background-color: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  margin-bottom: 20px;
}

.syllabus-card h3 {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 12px;
}

.syllabus-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  margin-top: 10px;
  font-size: 0.9rem;
}
.syllabus-table th {
  padding: 10px 12px;
  background: #f4f3ef;
  border-bottom: 1.5px solid var(--border);
  font-weight: 800;
  color: var(--text-main);
}
.syllabus-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  font-weight: 600;
}
.syllabus-table tr:last-child td {
  border-bottom: none;
}

.penalties-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.penalty-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  color: #b91c1c;
}

/* ==========================================
   EXERCISE VIEW (RUNNER OVERLAY - FULLSCREEN MOBILE)
   ========================================== */
.exercise-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100dvh;
  min-height: -webkit-fill-available;
  background-color: #ffffff;
  z-index: 500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exercise-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  gap: 16px;
  flex-shrink: 0;
}

.btn-icon-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.btn-icon-close:hover {
  background-color: var(--surface-hover);
  color: var(--text-main);
}
.btn-icon-close svg {
  width: 22px;
  height: 22px;
}

.progress-track {
  flex: 1;
  height: 12px;
  background-color: #f1efe9;
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent-emerald);
  border-radius: var(--radius-pill);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.exercise-hearts-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  color: var(--accent-heart);
  font-size: 1.05rem;
}

/* EXERCISE CONTENT AREA */
.exercise-scroll-area {
  flex: 1;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px calc(150px + env(safe-area-inset-bottom, 24px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.step-box {
  margin: auto 0;
  width: 100%;
  animation: fadeInStep 0.2s ease forwards;
}

@keyframes fadeInStep {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.exercise-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #52525b;
  background-color: #f4f3ef;
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}

.question-text {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

/* THEORY CARD */
.cool-theory-card {
  background-color: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.03);
  margin-bottom: 16px;
}

.theory-hero-korean {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  gap: 14px;
}

.hero-korean-word {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.1;
}

.audio-btn-pill {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--text-main);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
  flex-shrink: 0;
}
.audio-btn-pill:hover {
  transform: scale(1.06);
}
.audio-btn-pill:active {
  transform: scale(0.94);
}
.audio-btn-pill svg {
  width: 22px;
  height: 22px;
}

.audio-btn-pill.large {
  width: 60px;
  height: 60px;
}
.audio-btn-pill.large svg {
  width: 28px;
  height: 28px;
}
.audio-btn-pill.large.slow {
  background-color: #f4f3ef;
  color: var(--text-main);
  border: 1.5px solid var(--border);
}

.theory-image-view {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
}

.theory-body-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 14px;
  font-weight: 500;
}

.theory-bullet-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
}

/* CHOICE OPTIONS */
.options-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cool-option-btn {
  background-color: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  min-height: 56px;
  line-height: 1.35;
}

.cool-option-btn:hover {
  border-color: #a1a1aa;
  background-color: #fafafa;
}

.cool-option-btn.selected {
  border-color: var(--text-main);
  background-color: #f4f4f5;
}

.option-key-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background-color: #f4f4f5;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
}
.cool-option-btn.selected .option-key-badge {
  background-color: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

/* MATCHING GRID */
.match-grid-modern {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.modern-match-card {
  background-color: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  text-align: center;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modern-match-card:hover {
  border-color: #a1a1aa;
}

.modern-match-card.selected {
  border-color: var(--accent-blue);
  background-color: #eff6ff;
  color: var(--accent-blue);
}

.modern-match-card.matched {
  border-color: #bbf7d0;
  background-color: #f0fdf4;
  color: #15803d;
  cursor: default;
  opacity: 0.45;
}

.modern-match-card.error {
  border-color: #fca5a5;
  background-color: #fef2f2;
  color: #dc2626;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* WORD BUILDER */
.builder-drop-area {
  min-height: 72px;
  border-bottom: 2.5px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  margin-bottom: 24px;
}

.builder-tiles-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.modern-syllable-tile {
  background-color: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border);
  transition: all 0.12s ease;
  min-width: 52px;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modern-syllable-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border);
}

.modern-syllable-tile.used {
  background-color: #f4f4f5;
  border-color: #e4e4e7;
  color: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

/* STROKE TRACING CANVAS */
.stroke-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.canvas-box {
  position: relative;
  width: 240px;
  height: 240px;
  background-color: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.trace-canvas {
  width: 240px;
  height: 240px;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.canvas-watermark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 150px;
  font-weight: 900;
  color: #f1efe9;
  pointer-events: none;
  user-select: none;
}

/* BOTTOM ACTION EVALUATION BAR */
.action-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-top: 1px solid var(--border);
  padding: 14px 20px max(16px, env(safe-area-inset-bottom));
  z-index: 600;
  display: flex;
  justify-content: center;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}

.drawer-content {
  max-width: 620px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.drawer-feedback {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.feedback-status-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-drawer.correct {
  background-color: #f0fdf4;
  border-top-color: #bbf7d0;
}
.action-drawer.correct .feedback-status-icon {
  background-color: var(--accent-emerald);
  color: #ffffff;
}
.action-drawer.correct h4 {
  color: #15803d;
  font-size: 1.15rem;
  font-weight: 800;
}

.action-drawer.wrong {
  background-color: #fef2f2;
  border-top-color: #fecaca;
}
.action-drawer.wrong .feedback-status-icon {
  background-color: var(--accent-heart);
  color: #ffffff;
}
.action-drawer.wrong h4 {
  color: #b91c1c;
  font-size: 1.15rem;
  font-weight: 800;
}
.action-drawer.wrong p {
  color: #dc2626;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 2px;
  line-height: 1.35;
}

/* PRIMARY ACTION BUTTON */
.btn-main {
  background-color: var(--text-main);
  color: #ffffff;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #09090b;
}

.btn-main:hover:not(:disabled) {
  background-color: #27272a;
}
.btn-main:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #09090b;
}

.btn-main:disabled {
  background-color: #e4e4e7;
  color: #a1a1aa;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-main.wrong-action {
  background-color: #dc2626;
  box-shadow: 0 4px 0 #991b1b;
}
.btn-main.wrong-action:hover {
  background-color: #b91c1c;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(24, 24, 27, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background-color: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
  padding: 24px;
  position: relative;
  animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.celebration-dialog {
  text-align: center;
}

.celeb-photo {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}

.celeb-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 20px;
}

.celeb-box {
  background-color: #f4f3ef;
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.celeb-val {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text-main);
}
.celeb-lbl {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.heart-modal-icon-wrap {
  display: inline-flex;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #fee2e2;
  color: #ef4444;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

/* FOOTER ATTRIBUTION */
.app-footer {
  margin-top: 40px;
  padding: 24px 4px 10px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  gap: 12px;
  flex-wrap: wrap;
}

.footer-left b {
  color: var(--text-main);
}

.footer-right b {
  color: var(--text-main);
}

.footer-right a {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: #a1a1aa;
  text-underline-offset: 2px;
  font-weight: 700;
  transition: all 0.15s ease;
}

.footer-right a:hover {
  color: var(--accent-blue);
  text-decoration-color: var(--accent-blue);
}

/* ==========================================
   MOBILE RESPONSIVE ENHANCEMENTS (< 640px)
   ========================================== */
@media (max-width: 640px) {
  .header-container {
    padding: 10px 14px 0;
  }
  .top-bar {
    padding: 4px 0 10px;
  }
  .brand-badge {
    width: 36px;
    height: 36px;
    font-size: 17px;
  }
  .brand-name {
    font-size: 1.08rem;
  }
  .brand-credit {
    font-size: 0.7rem;
  }
  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: 16px;
  }
  .stat-chip {
    padding: 5px 10px;
    font-size: 0.82rem;
  }

  .segmented-control {
    width: 100%;
  }
  .segment-btn {
    padding: 7px 10px;
    font-size: 0.82rem;
  }

  .main-wrapper {
    padding: 14px 14px 80px;
  }

  .node-button {
    width: 66px;
    height: 66px;
  }
  .path-connector {
    width: 6px;
    height: 32px;
    margin: 6px auto 10px;
  }

  .exercise-topbar {
    padding: 10px 16px;
  }
  .question-text {
    font-size: 1.25rem;
    margin-bottom: 16px;
  }
  .hero-korean-word {
    font-size: 1.8rem;
  }

  .cool-option-btn {
    padding: 12px 14px;
    font-size: 0.98rem;
  }

  .match-grid-modern {
    grid-template-columns: 1fr;
  }
  .modern-match-card {
    min-height: 52px;
    font-size: 1.05rem;
  }

  .drawer-content {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .btn-main {
    width: 100%;
    text-align: center;
  }

  .word-card-row {
    padding: 12px;
  }
  .word-thumb-img {
    width: 44px;
    height: 44px;
  }
  .word-ko {
    font-size: 1.15rem;
  }
}
