:root {
  color-scheme: light;
  --paper: #f6f5ef;
  --white: #fffefa;
  --ink: #202228;
  --muted: #5f626b;
  --line: #e9e7df;
  --purple: #7355df;
  --purple-dark: #5e43c2;
  --purple-soft: #eee9ff;
  --lime: #d8f36a;
  --green: #2f6b45;
  --green-soft: #e8f4eb;
  --orange: #e58a52;
  --shadow: 0 12px 35px rgba(43, 38, 68, .06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-size: 16px; line-height: 1.5; }
button, a { font: inherit; }
a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid #273fbd; outline-offset: 3px; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 5; padding: 12px 16px; color: white; background: var(--ink); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.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; }
.app-shell { min-height: 100vh; }

.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; flex-direction: column; width: 244px; padding: 29px 17px 18px; background: var(--white); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; background: var(--purple); border-radius: 14px; font-size: 25px; font-weight: 800; letter-spacing: -2px; }
.brand-mark span { color: var(--lime); }
.brand-copy { display: grid; line-height: 1.2; }
.brand-copy strong { font-size: 15px; letter-spacing: -.35px; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.sidebar-label { margin: 45px 9px 13px; color: #5f626b; font-size: 10px; font-weight: 800; letter-spacing: 1.15px; }
.phase-nav { display: grid; gap: 5px; }
.phase-nav-link { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; min-height: 48px; padding: 6px 9px; color: #656771; border-radius: 11px; text-decoration: none; font-size: 12px; font-weight: 650; transition: background .18s ease, color .18s ease; }
.phase-nav-link:hover:not(.is-locked) { background: #f4f1ff; }
.phase-nav-link.is-current { color: var(--purple-dark); background: var(--purple-soft); }
.phase-nav-link.is-locked { color: #5f626b; cursor: not-allowed; }
.nav-number { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #e8e6e1; border-radius: 9px; font-size: 11px; }
.is-current .nav-number { color: white; background: var(--purple); border-color: var(--purple); }
.nav-check { color: #2f6b45; font-size: 14px; }
.nav-lock { font-size: 12px; }
.sidebar-bottom { margin-top: auto; }
.streak-card { display: flex; align-items: center; gap: 11px; margin: 0 3px 12px; padding: 14px 12px; background: #f8f7f2; border: 1px solid #eeece5; border-radius: 13px; }
.streak-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #96751a; background: #fff1bd; border-radius: 11px; font-size: 19px; }
.streak-card div { display: grid; line-height: 1.3; }
.streak-card strong { font-size: 13px; }
.streak-card small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.reset-button { width: 100%; padding: 8px; color: #5f626b; background: transparent; border: 0; cursor: pointer; font-size: 11px; }
.reset-button:hover { color: #a34c4c; text-decoration: underline; }

.main-content { min-height: 100vh; margin-left: 244px; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 66px; padding: 0 clamp(22px, 4vw, 62px); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: #5f626b; font-size: 10px; font-weight: 750; letter-spacing: .85px; }
.breadcrumb strong { color: #464851; font-weight: 700; letter-spacing: 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.level-pill { padding: 7px 10px; color: #59458e; background: #f0edff; border-radius: 20px; font-size: 9px; font-weight: 800; letter-spacing: .7px; }
.level-pill span { padding-right: 4px; color: var(--purple); font-size: 7px; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; color: #4e4575; background: #e6e1f5; border-radius: 50%; font-size: 10px; font-weight: 800; text-decoration: none; }
.page-wrap { max-width: 1190px; margin: 0 auto; padding: 32px clamp(22px, 4vw, 62px) 16px; }

.welcome { position: relative; display: flex; min-height: 250px; overflow: hidden; align-items: center; padding: 33px 42px; color: white; background: #292536; border-radius: 19px; }
.welcome::before { position: absolute; right: 25%; bottom: -105px; width: 320px; height: 230px; background: #39334e; border-radius: 50%; content: ""; }
.welcome-copy { position: relative; z-index: 1; max-width: 510px; }
.eyebrow { margin: 0 0 12px; color: #d7caff; font-size: 9px; font-weight: 800; letter-spacing: 1.45px; }
.eyebrow span { margin-left: 3px; color: var(--lime); font-size: 12px; }
.welcome h1 { margin: 0; font-size: clamp(27px, 3vw, 39px); line-height: 1.14; letter-spacing: -1.65px; }
.welcome h1 em { color: var(--lime); font-style: normal; }
.welcome-subtitle { max-width: 440px; margin: 13px 0 20px; color: #d4d1dc; font-size: 13px; }
.primary-button { display: inline-flex; min-height: 42px; align-items: center; gap: 19px; padding: 0 16px; color: #272533; background: var(--lime); border-radius: 9px; text-decoration: none; font-size: 12px; font-weight: 800; transition: transform .18s ease, background .18s ease; }
.primary-button:hover { transform: translateY(-2px); background: #e2ff83; }
.primary-button span { font-size: 16px; }
.profile-edit-link { display:inline-flex; min-height:44px; align-items:center; margin:0 0 0 12px; padding:10px 4px; color:#e0dced; font-size:11px; font-weight:700; text-decoration:underline; text-decoration-color:#8f899e; text-underline-offset:3px; }
.profile-edit-link:hover { color:var(--lime); }
.welcome-art { position: absolute; top: 0; right: 4%; width: 290px; height: 100%; }
.art-sun { position: absolute; top: 25px; right: 26px; width: 172px; height: 172px; background: #fa9f79; border-radius: 50%; }
.art-card { position: absolute; display: flex; flex-direction: column; justify-content: center; width: 165px; height: 111px; padding: 17px; border-radius: 12px; box-shadow: 0 13px 25px #15131f45; }
.art-card-back { top: 58px; right: 14px; align-items: flex-end; color: #fff; background: #8b74dd; font-size: 14px; font-weight: 900; letter-spacing: 2px; transform: rotate(9deg); }
.art-card-front { top: 88px; right: 74px; z-index: 1; color: #282435; background: #fffdf7; transform: rotate(-7deg); }
.art-word { font-size: 30px; font-weight: 850; letter-spacing: -1.5px; line-height: 1; }
.art-pronunciation { margin-top: 9px; color: #76717c; font-size: 10px; }
.art-spark { position: absolute; top: 11px; right: 13px; color: #8a71dc; font-size: 18px; }
.art-star { position: absolute; color: var(--lime); }
.star-one { top: 37px; left: 18px; font-size: 24px; }
.star-two { right: 8px; bottom: 37px; font-size: 19px; }
.art-caption { position: absolute; right: -20px; bottom: 18px; color: #dad6e4; font-size: 10px; line-height: 1.35; text-align: right; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 17px 0 32px; padding: 15px 20px; background: var(--white); border: 1px solid #efede6; border-radius: 14px; box-shadow: 0 5px 17px #27223606; }
.stat-item { position: relative; display: flex; min-height: 44px; align-items: center; gap: 11px; padding: 0 20px; }
.stat-item + .stat-item { border-left: 1px solid var(--line); }
.stat-item:first-child { padding-left: 1px; }
.stat-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; font-size: 17px; font-weight: 800; }
.stat-icon-purple { color: #7055ca; background: #eee9ff; }
.stat-icon-yellow { color: #9b7613; background: #fff3c7; }
.stat-icon-green { color: #3d815e; background: #e5f3e9; }
.stat-item div:not(.mini-progress) { display: grid; line-height: 1.1; }
.stat-item strong { font-size: 16px; letter-spacing: -.4px; }
.stat-item small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.mini-progress { width: min(85px, 25%); height: 5px; margin-left: auto; overflow: hidden; background: #eeedf0; border-radius: 5px; }
.mini-progress span { display: block; width: 0; height: 100%; background: var(--purple); border-radius: inherit; transition: width .3s; }

.learning-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 330px); gap: 24px; align-items: start; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.eyebrow-dark { margin-bottom: 4px; color: #5c478f; font-size: 9px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.7px; }
.phase-count { margin-bottom: 3px; color: #5f626b; font-size: 11px; }
.phase-list { display: grid; gap: 10px; }
.phase-card { position: relative; overflow: hidden; padding: 15px 16px 14px; background: var(--white); border: 1px solid #eeece6; border-radius: 13px; box-shadow: 0 3px 11px #27223604; transition: border-color .18s, box-shadow .18s; }
.phase-card.is-active { border-color: #c9bdf9; box-shadow: 0 5px 18px #7658df12; }
.phase-card.is-locked { background: #f9f8f4; }
.phase-card-head { display: flex; align-items: center; gap: 12px; }
.phase-emoji { display: grid; flex: 0 0 37px; place-items: center; width: 37px; height: 37px; background: #f0edff; border-radius: 11px; font-size: 17px; }
.phase-card:nth-child(2) .phase-emoji { background: #fff2dc; }
.phase-card:nth-child(3) .phase-emoji { background: #e9f5e9; }
.phase-card:nth-child(4) .phase-emoji { background: #e9f3fb; }
.phase-card:nth-child(5) .phase-emoji { background: #fff0e8; }
.phase-heading-copy { min-width: 0; flex: 1; }
.phase-kicker { margin: 0 0 2px; color: #5f626b; font-size: 9px; font-weight: 750; letter-spacing: .55px; text-transform: uppercase; }
.phase-title { margin: 0; font-size: 14px; font-weight: 780; letter-spacing: -.3px; }
.phase-status { color: #5f626b; font-size: 10px; font-weight: 650; white-space: nowrap; }
.phase-status.done { color: var(--green); }
.phase-desc { margin: 9px 0 10px 49px; color: #5f626b; font-size: 11px; line-height: 1.45; }
.phase-desc a { color: #55439d; font-weight: 750; text-underline-offset: 2px; }
.lesson-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 49px; }
.lesson-chip { min-height: 44px; padding: 8px 10px; color: #625b76; background: #f4f1ff; border: 0; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 650; }
.lesson-chip:hover:not(:disabled) { color: white; background: var(--purple); }
.lesson-chip:disabled { color: #a7a6a4; background: #efeee9; cursor: not-allowed; }
.phase-lock-message { margin: 10px 0 0 49px; color: #555860; font-size: 10px; }

.lesson-column { display: grid; gap: 12px; scroll-margin-top: 18px; }
.lesson-card { min-height: 275px; padding: 19px; background: var(--white); border: 1px solid #eeece6; border-radius: 14px; box-shadow: var(--shadow); }
.lesson-card-top { display: flex; justify-content: space-between; align-items: center; }
.lesson-label { color: #5d4895; font-size: 9px; font-weight: 800; letter-spacing: .85px; }
.lesson-duration { color: #5f626b; font-size: 10px; }
.lesson-card h2 { margin: 11px 0 5px; font-size: 19px; line-height: 1.2; letter-spacing: -.7px; }
.lesson-intro { margin: 0; color: #5f626b; font-size: 11px; }
.learning-steps { display: grid; gap: 8px; margin: 17px 0; padding: 0; list-style: none; }
.learning-steps li { display: flex; align-items: center; gap: 9px; color: #555761; font-size: 11px; }
.learning-steps li span { display: grid; flex: 0 0 23px; width: 23px; height: 23px; place-items: center; color: #5e49a4; background: #eee9ff; border-radius: 8px; font-size: 9px; font-weight: 850; }
.lesson-start { text-decoration: none; }
.lesson-rule { display: flex; gap: 9px; margin: 15px 0; padding: 11px; background: #f5f2ff; border-radius: 9px; }
.rule-spark { color: var(--purple); font-size: 14px; }
.lesson-rule p { margin: 0; color: #59556b; font-size: 10px; line-height: 1.45; }
.lesson-rule strong { color: #40365f; }
.pronunciation-list { display: grid; gap: 6px; margin: -6px 0 14px; }
.pronunciation-example { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 9px; background: #faf9f5; border: 1px solid #efede7; border-radius: 8px; }
.pronunciation-example > div { display: grid; min-width: 0; gap: 2px; }
.pronunciation-example strong { color: #32323a; font-size: 10px; line-height: 1.35; }
.pronunciation-example span[lang="es"] { color: #777982; font-size: 9px; line-height: 1.35; }
.play-phrase { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; padding: 6px 8px; color: #5d47a1; background: #eee9ff; border: 0; border-radius: 7px; cursor: pointer; font-size: 9px; font-weight: 750; }
.play-phrase:hover { color: #fff; background: var(--purple); }
.play-phrase span { font-size: 8px; }
.quiz-progress { display: flex; justify-content: space-between; margin-bottom: 7px; color: #898a91; font-size: 9px; }
.quiz-track { height: 5px; overflow: hidden; background: #efedf2; border-radius: 5px; }
.quiz-track span { display: block; height: 100%; background: var(--purple); border-radius: inherit; transition: width .25s; }
.question-text { margin: 15px 0 10px; font-size: 13px; font-weight: 760; line-height: 1.4; }
.answers { display: grid; gap: 7px; }
.answer-option { display: flex; min-height: 39px; align-items: center; gap: 10px; padding: 7px 10px; color: #44464e; text-align: left; background: #fff; border: 1px solid #e9e7e3; border-radius: 8px; cursor: pointer; font-size: 11px; transition: border-color .15s, background .15s; }
.answer-option:hover:not(:disabled) { border-color: #a99ae5; background: #faf9ff; }
.answer-option:disabled { cursor: default; }
.answer-letter { display: grid; flex: 0 0 22px; place-items: center; width: 22px; height: 22px; color: #777780; background: #f1f0ed; border-radius: 6px; font-size: 9px; font-weight: 800; }
.answer-option.is-correct { color: #286442; background: #eff8f0; border-color: #9dccaa; }
.answer-option.is-correct .answer-letter { color: #fff; background: #4b9566; }
.answer-option.is-wrong { color: #934e47; background: #fff2ef; border-color: #e9b0a7; }
.answer-option.is-wrong .answer-letter { color: white; background: #c76b5e; }
.feedback { margin-top: 10px; padding: 9px 10px; border-radius: 8px; font-size: 10px; line-height: 1.45; }
.feedback.correct { color: #286442; background: #eff8f0; }
.feedback.incorrect { color: #7a5545; background: #fff5e8; }
.next-button { display: flex; width: 100%; min-height: 39px; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; color: #fff; background: var(--purple); border: 0; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 750; }
.next-button:hover { background: var(--purple-dark); }
.lesson-start { min-height: 48px; text-decoration: none; }
.lesson-resume-note { margin: 12px 0 0; padding: 10px; color: #3f5f48; background: #edf7ef; border-radius: 9px; font-size: 10px; line-height: 1.5; }
.lesson-empty { display: grid; min-height: 240px; align-content: center; text-align: center; }
.lesson-empty-icon { font-size: 34px; }
.lesson-empty h2 { margin: 9px 0 4px; font-size: 17px; }
.lesson-empty p { margin: 0; color: var(--muted); font-size: 11px; }
.tip-card { display: flex; gap: 10px; padding: 13px; background: #fff8e7; border: 1px solid #f3ebd2; border-radius: 12px; }
.tip-icon { display: grid; flex: 0 0 28px; place-items: center; height: 28px; color: #8b6b0d; background: #ffefbd; border-radius: 9px; font-size: 16px; }
.tip-card strong { font-size: 10px; }
.tip-card p { margin: 3px 0 0; color: #77716a; font-size: 10px; line-height: 1.5; }
.saved-note { color: #555860; font-size: 9px; line-height: 1.45; }
.saved-dot { display: inline-block; width: 6px; height: 6px; margin: 0 5px 1px 2px; background: #70a881; border-radius: 50%; }
.footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; padding: 13px 0; color: #555860; border-top: 1px solid var(--line); font-size: 9px; }
.footer a { color: #555860; text-decoration: none; }
.footer a:hover { color: var(--purple-dark); text-decoration: underline; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 5; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px; color: white; background: #292536; border-radius: 10px; box-shadow: var(--shadow); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1400px) { .welcome { min-height: 270px; } }
@media (max-width: 1050px) {
  .sidebar { width: 210px; }
  .main-content { margin-left: 210px; }
  .learning-layout { grid-template-columns: minmax(0, 1fr) minmax(245px, 290px); gap: 16px; }
  .welcome-art { right: 0; transform: scale(.88); transform-origin: center right; }
  .welcome-copy { max-width: 60%; }
}
@media (max-width: 780px) {
  .sidebar { position: static; width: auto; height: auto; padding: 12px 18px 9px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-mark { width: 36px; height: 36px; border-radius: 11px; font-size: 22px; }
  .sidebar-label, .sidebar-bottom { display: none; }
  .phase-nav { display: flex; gap: 6px; margin-top: 11px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
  .phase-nav-link { display: flex; flex: 0 0 auto; min-height: 44px; gap: 6px; padding: 4px 8px; background: #f7f6f2; font-size: 10px; }
  .nav-number { width: 24px; height: 24px; border-radius: 7px; }
  .nav-lock, .nav-check { display: none; }
  .main-content { margin-left: 0; }
  .topbar { height: 50px; padding-inline: 19px; }
  .page-wrap { padding: 18px 18px 12px; }
  .welcome { min-height: 245px; padding: 25px 24px; }
  .welcome-copy { max-width: 70%; }
  .welcome h1 { font-size: clamp(25px, 5vw, 33px); }
  .welcome-subtitle { max-width: 370px; font-size: 12px; }
  .welcome-art { right: -45px; opacity: .7; transform: scale(.7); }
  .stats { margin-bottom: 23px; padding: 12px 13px; }
  .stat-item { gap: 7px; padding: 0 10px; }
  .stat-icon { width: 30px; height: 30px; }
  .stat-item strong { font-size: 14px; }
  .mini-progress { display: none; }
  .learning-layout { grid-template-columns: 1fr; gap: 22px; }
  .lesson-column { grid-row: 1; }
  .lesson-card { min-height: 0; }
  .phase-list { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .topbar-right { gap: 8px; }
  .level-pill { padding: 6px 8px; font-size: 8px; }
  .page-wrap { padding-inline: 13px; }
  .welcome { min-height: 266px; align-items: flex-start; padding: 23px 19px; }
  .welcome-copy { max-width: 100%; }
  .welcome h1 { max-width: 340px; font-size: 29px; }
  .welcome-subtitle { max-width: 315px; margin-top: 10px; font-size: 11px; }
  .welcome-art { top: 75px; right: -109px; opacity: .22; transform: scale(.78); }
  .primary-button { min-height: 44px; font-size: 11px; }
  .profile-edit-link { margin-left:6px; font-size:10px; }
  .stats { grid-template-columns: repeat(3, 1fr); padding: 10px 7px; }
  .stat-item { justify-content: center; gap: 6px; padding: 0 5px; }
  .stat-item:first-child { padding-left: 0; }
  .stat-icon { width: 27px; height: 27px; border-radius: 8px; font-size: 14px; }
  .stat-item strong { font-size: 12px; }
  .stat-item small { font-size: 9px; }
  .phase-list { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
