/* ============================================================
   LEARN YOUR WAY — style.css
   Monochrome · Dark/Light · Mobile-first
   ============================================================ */

/* --- Tokens ------------------------------------------------- */
:root {
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Dark (default) */
  --bg:           #0a0a0a;
  --surface:      #141414;
  --surface-2:    #1e1e1e;
  --border:       #2a2a2a;
  --text-primary: #f0f0f0;
  --text-secondary: #888888;
  --text-tertiary: #555555;
  --btn-primary-bg: #f0f0f0;
  --btn-primary-text: #0a0a0a;
  --btn-secondary-bg: transparent;
  --btn-secondary-text: #f0f0f0;
  --btn-secondary-border: #3a3a3a;
  --tag-bg: #252525;
  --tag-text: #aaaaaa;
  --shadow: 0 1px 3px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg:           #f5f5f5;
  --surface:      #ffffff;
  --surface-2:    #f0f0f0;
  --border:       #e0e0e0;
  --text-primary: #111111;
  --text-secondary: #666666;
  --text-tertiary: #aaaaaa;
  --btn-primary-bg: #111111;
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: transparent;
  --btn-secondary-text: #111111;
  --btn-secondary-border: #cccccc;
  --tag-bg: #ebebeb;
  --tag-text: #555555;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* --- Reset -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.2s, color 0.2s;
  -webkit-font-smoothing: antialiased;
}

/* --- Container --------------------------------------------- */
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Nav --------------------------------------------------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.theme-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
}

.btn:active { transform: scale(0.98); }

.btn:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
}

.btn-large {
  padding: 16px 40px;
  font-size: 1.05rem;
}

/* --- Hero -------------------------------------------------- */
.hero {
  padding: 80px 24px 72px;
  text-align: center;
}

.hero-inner {
  max-width: 600px;
  margin: 0 auto;
}

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

.hero-heading {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.hero-heading em {
  font-style: italic;
  color: var(--text-secondary);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- Problem strip ----------------------------------------- */
.problem {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 40px 0;
  background: var(--surface);
}

.problem-text {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}

.problem-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* --- Section labels ---------------------------------------- */
.section-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.section-sub {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

/* --- Demo section ------------------------------------------ */
.demo {
  padding: 72px 0;
}

.concept-source {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.concept-tag {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.concept-original {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
}

/* --- Mode cards -------------------------------------------- */
.modes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 40px;
}

@media (min-width: 600px) {
  .modes-grid { grid-template-columns: 1fr 1fr; }
}

.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.2s;
}

.mode-card:hover {
  border-color: var(--text-tertiary);
}

.mode-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-icon {
  font-size: 1rem;
  color: var(--text-tertiary);
}

.mode-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.mode-text {
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.7;
}

.mode-text em {
  font-style: italic;
  color: var(--text-secondary);
}

/* Visual demo */
.visual-demo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.vd-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.vd-val {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-left: auto;
}

.vd-addr { border-style: dashed; }
.vd-ptr { border-color: var(--text-tertiary); }

.vd-arrow {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  padding-left: 14px;
}

/* Step list */
.steps-list {
  list-style: none;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.steps-list li {
  counter-increment: step-counter;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.steps-list li::before {
  content: counter(step-counter);
  min-width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  flex-shrink: 0;
  margin-top: 1px;
}

/* Demo CTA */
.demo-cta {
  text-align: center;
  padding-top: 8px;
}

.demo-cta-text {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* --- How it works ------------------------------------------ */
.how {
  padding: 72px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.steps-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flow-step {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.flow-num {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.flow-content h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  padding-top: 8px;
}

.flow-content p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.flow-divider {
  color: var(--text-tertiary);
  padding: 10px 0 10px 19px;
  font-size: 1rem;
}

/* --- Final CTA --------------------------------------------- */
.final-cta {
  padding: 80px 24px;
  text-align: center;
  border-top: 1px solid var(--border);
}

.final-heading {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 28px;
}

/* --- Footer ------------------------------------------------ */
.footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.footer-brand {
  color: var(--text-secondary);
}

/* --- Utility ----------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Fix level + language button independence */
.difficulty-selector .lang-btn { opacity: 0.5; }
.difficulty-selector .lang-btn.active { opacity: 1; font-weight: 600; }
.lang-selector .lang-btn { opacity: 0.5; }
.lang-selector .lang-btn.active { opacity: 1; font-weight: 600; }

/* Symmetric mode buttons */
.mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.mode-btn { width: 100%; }

/* Button active state fix */
.lang-btn { border: 1px solid rgba(255,255,255,0.2); border-radius: 99px; padding: 6px 16px; background: transparent; color: var(--text-secondary); cursor: pointer; font-size: 14px; transition: all 0.2s; }
.lang-btn.active { background: var(--text-primary); color: var(--bg-primary); border-color: var(--text-primary); font-weight: 600; }

/* Textarea inline toolbar */
.textarea-wrapper { position: relative; }
.textarea-wrapper .material-input { padding-bottom: 52px; }
.textarea-toolbar { position: absolute; bottom: 12px; left: 12px; display: flex; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.icon-btn:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }
.icon-btn.listening { color: #f87171; border-color: #f87171; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Prevent text overlap with toolbar icons */
.textarea-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: linear-gradient(to top, var(--surface) 40%, transparent);
  pointer-events: none;
  border-radius: 0 0 12px 12px;
}
.textarea-toolbar { z-index: 2; }

/* Continue button alignment */
.input-actions { display: flex; justify-content: flex-end; margin-top: 16px; }

/* Symmetric level/language button rows */


/* Side drawer */
.nav { display: flex; align-items: center; gap: 12px; }
.hamburger-btn { background: none; border: none; color: var(--text-primary); cursor: pointer; padding: 4px; display: flex; align-items: center; }
.side-drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; }
.side-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 260px; background: var(--surface); z-index: 101; padding: 20px; display: flex; flex-direction: column; gap: 8px; transform: translateX(0); transition: transform 0.25s ease; box-shadow: 4px 0 20px rgba(0,0,0,0.3); }
.side-drawer.hidden { transform: translateX(-100%); display: flex !important; visibility: hidden; }
.drawer-close-btn { align-self: flex-end; background: none; border: none; color: var(--text-secondary); cursor: pointer; margin-bottom: 12px; }
.side-drawer .menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px; border-radius: 8px; background: none; border: none; color: var(--text-primary); font-size: 15px; cursor: pointer; } .side-drawer .drawer-close-btn { color: var(--text-primary); }
.side-drawer .menu-item:hover { background: rgba(255,255,255,0.05); }

/* Perfect level/language grid alignment */
.difficulty-selector, .lang-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.difficulty-selector .lang-btn, .lang-selector .lang-btn { width: 100%; }
.lang-selector { margin-bottom: 20px; }

/* Fix LEVEL/LANGUAGE label width for perfect column alignment */
.difficulty-selector, .lang-selector { display: flex; align-items: center; gap: 12px; }
.difficulty-selector > span, .lang-selector > span { display: inline-block; width: 90px; flex-shrink: 0; }
.difficulty-selector .lang-btn, .lang-selector .lang-btn { flex: 1; }

/* Key term chips - clickable */
.key-term-chip.clickable { cursor: pointer; text-decoration: underline dotted; }
.key-term-chip.clickable:hover { background: var(--tag-bg); }

/* Definition modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--surface); border-radius: 12px; padding: 24px; max-width: 400px; width: 100%; position: relative; box-shadow: 0 8px 30px rgba(0,0,0,0.3); }
.modal-close-btn { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-secondary); cursor: pointer; }
#definitionTerm { font-size: 20px; font-weight: 700; margin-bottom: 12px; text-transform: capitalize; color: var(--text-primary); }
#definitionBody { color: var(--text-secondary); line-height: 1.6; }
.def-pos { font-style: italic; color: var(--text-tertiary); margin-bottom: 6px; }

/* Definition loading spinner */
.def-spinner { width: 24px; height: 24px; border: 3px solid var(--tag-bg); border-top-color: var(--text-primary); border-radius: 50%; animation: spin 0.7s linear infinite; margin: 8px 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* YouTube search modal */
.yt-search-row { display: flex; gap: 8px; margin: 16px 0; }
.yt-search-input { flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); font-size: 14px; }
.yt-result-card { display: flex; gap: 12px; padding: 10px; border-radius: 8px; margin-bottom: 10px; cursor: pointer; transition: background 0.2s; }
.yt-result-card:hover { background: var(--surface-2); }
.yt-result-thumb { width: 100px; height: 60px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.yt-result-info { flex: 1; min-width: 0; }
.yt-result-title { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.yt-result-channel { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }

/* Drawer brand header */
.drawer-brand { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
