/* Galego Agora! — Stylesheet | GPL-3.0 */

.ai-warning {
  background: #fff8e1;
  border-bottom: 1px solid #ffe082;
  color: #5d4037;
  font-size: 0.78rem;
  padding: 6px 16px;
  text-align: center;
}

:root {
  --green: #58CC02;
  --green-dk: #46A302;
  --green-bg: #E5F8CD;
  --blue: #1CB0F6;
  --blue-dk: #0A91D1;
  --blue-bg: #DDF4FF;
  --red: #FF4B4B;
  --red-dk: #EA2B2B;
  --red-bg: #FFE0E0;
  --gold: #FF9600;
  --gold-dk: #CC7A00;
  --gold-bg: #FFF3D4;
  --g50: #F7F7F7;
  --g100: #EBEBEB;
  --g200: #CDCDCD;
  --g400: #AFAFAF;
  --g600: #777;
  --g900: #3C3C3C;
  --white: #FFF;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --font: 'Nunito', sans-serif;
  --header-h: 64px;
  --action-h: 80px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font); background: var(--g50); color: var(--g900); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ── Welcome ─────────────────────────────────────────────── */
#welcome-screen {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #f0fde4 0%, #e8f5ff 100%);
  padding: 24px;
}
.welcome-inner { width: 100%; max-width: 480px; text-align: center; }
.app-brand { margin-bottom: 28px; }
.brand-icon { font-size: 64px; display: block; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.brand-title { font-size: 2.5rem; font-weight: 900; color: var(--green-dk); letter-spacing: -0.5px; }
.brand-sub { font-size: 1rem; color: var(--g600); margin-top: 4px; font-weight: 600; }

.welcome-banner {
  background: var(--green); border-radius: var(--r-xl); padding: 20px;
  margin: 0 0 28px; color: white;
}
.welcome-word { font-size: 3rem; font-weight: 900; letter-spacing: -1px; }

.welcome-heading { font-size: 1.4rem; font-weight: 800; color: var(--g900); margin-bottom: 18px; }

.lang-choice-btns { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.lang-choice-btn {
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border: 2px solid var(--g200);
  border-radius: var(--r-lg); padding: 16px 18px;
  font-size: 1rem; font-weight: 700; color: var(--g900);
  transition: all .15s; text-align: left; box-shadow: 0 2px 0 var(--g200);
}
.lang-choice-btn:hover { border-color: var(--green); background: var(--green-bg); transform: translateY(-2px); box-shadow: 0 4px 0 var(--green-dk); }
.lang-flag { font-size: 2rem; flex-shrink: 0; }
.lang-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.lang-info strong { font-size: 1.1rem; }
.lang-info span { font-size: .875rem; color: var(--g600); font-weight: 600; }
.lang-arrow { font-size: 1.5rem; color: var(--g400); font-weight: 300; }
.license-note { font-size: .75rem; color: var(--g400); line-height: 1.5; }

/* ── App Header ──────────────────────────────────────────── */
#app-screen { display: flex; flex-direction: column; background: var(--white); }
.top-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: var(--white); border-bottom: 2px solid var(--g100);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
}
.header-brand { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; font-weight: 900; color: var(--green-dk); }
.header-brand span:first-child { font-size: 1.5rem; }
.header-stats { display: flex; align-items: center; gap: 20px; }
.hstat { display: flex; align-items: center; gap: 5px; font-size: 1rem; font-weight: 800; }
.hstat-icon { font-size: 1.2rem; }
.lang-toggle-btn { font-size: 1.3rem; padding: 6px; border-radius: var(--r-sm); transition: background .15s; }
.lang-toggle-btn:hover { background: var(--g100); }

/* ── Course Map ──────────────────────────────────────────── */
.course-map-wrap { flex: 1; overflow-y: auto; padding-bottom: 48px; }
.course-map { max-width: 640px; margin: 0 auto; padding: 32px 16px; }

.unit-block { margin-bottom: 48px; }

.unit-header {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 24px; border-radius: var(--r-xl); color: white;
  margin-bottom: 28px; position: relative; overflow: hidden;
}
.unit-header::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,.15);
}
.unit-icon { font-size: 2.2rem; flex-shrink: 0; }
.unit-info { flex: 1; min-width: 0; }
.unit-level-badge {
  font-size: .7rem; font-weight: 800; background: rgba(255,255,255,.25);
  padding: 2px 8px; border-radius: 100px; display: inline-block; margin-bottom: 4px; letter-spacing: .5px;
}
.unit-title { font-size: 1.2rem; font-weight: 900; }
.unit-desc { font-size: .85rem; opacity: .9; margin-top: 2px; }
.unit-progress-label { font-size: .8rem; opacity: .8; margin-top: 6px; font-weight: 700; }

.lessons-path { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.lesson-row { display: flex; justify-content: center; gap: 20px; width: 100%; }

.lesson-bubble { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bubble-btn {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; transition: all .15s; position: relative;
}
.bubble-label { font-size: .75rem; font-weight: 700; color: var(--g600); text-align: center; max-width: 82px; line-height: 1.2; }

.lesson-bubble.state-unlocked .bubble-btn { background: var(--green); box-shadow: 0 4px 0 var(--green-dk); cursor: pointer; }
.lesson-bubble.state-unlocked .bubble-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green-dk); }
.lesson-bubble.state-unlocked .bubble-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--green-dk); }

.lesson-bubble.state-complete .bubble-btn { background: var(--gold); box-shadow: 0 4px 0 var(--gold-dk); cursor: pointer; }
.lesson-bubble.state-complete .bubble-btn:hover { transform: translateY(-2px); }

.lesson-bubble.state-locked .bubble-btn { background: var(--g200); box-shadow: 0 4px 0 var(--g400); cursor: not-allowed; filter: grayscale(.4); }
.lesson-bubble.state-locked .bubble-label { color: var(--g400); }

/* ── Lesson Page ─────────────────────────────────────────── */
.lesson-body { background: var(--white); display: flex; flex-direction: column; min-height: 100vh; }

.lesson-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; height: 64px; border-bottom: 2px solid var(--g100);
  position: sticky; top: 0; background: var(--white); z-index: 50;
}
.quit-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm); display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem; font-weight: 900;
  color: var(--g400); flex-shrink: 0; transition: all .15s;
}
.quit-btn:hover { background: var(--g100); color: var(--g900); }
.lesson-progress-track { flex: 1; height: 16px; background: var(--g100); border-radius: 100px; overflow: hidden; }
.lesson-progress-bar { height: 100%; background: var(--green); border-radius: 100px; transition: width .4s ease; width: 0%; }
.lesson-lives { font-size: 1rem; flex-shrink: 0; letter-spacing: -2px; }

/* Exercise Wrap */
.exercise-wrap {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px calc(var(--action-h) + 40px);
  max-width: 640px; margin: 0 auto; width: 100%;
}

.exercise-instruction { font-size: 1rem; font-weight: 700; color: var(--g600); margin-bottom: 12px; width: 100%; }
.gl-tag {
  display: inline-block; background: var(--green-bg); color: var(--green-dk);
  border: 2px solid var(--green); border-radius: var(--r-sm); padding: 2px 8px;
  font-size: .7rem; font-weight: 800; letter-spacing: .5px; margin-bottom: 8px;
}
.exercise-prompt { font-size: 2rem; font-weight: 900; color: var(--g900); margin-bottom: 32px; width: 100%; line-height: 1.3; }
.exercise-prompt.sm { font-size: 1.4rem; }

/* Multiple Choice */
.mc-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
.mc-option {
  background: var(--white); border: 2px solid var(--g200); border-radius: var(--r-md);
  padding: 16px 12px; font-size: .95rem; font-weight: 700; color: var(--g900);
  text-align: center; transition: all .12s; box-shadow: 0 2px 0 var(--g200); line-height: 1.3;
}
.mc-option:hover:not(.selected):not(.disabled) { border-color: var(--blue); background: var(--blue-bg); box-shadow: 0 2px 0 var(--blue-dk); }
.mc-option.selected { border-color: var(--blue); background: var(--blue-bg); box-shadow: 0 2px 0 var(--blue-dk); }
.mc-option.correct { border-color: var(--green); background: var(--green-bg); box-shadow: 0 2px 0 var(--green-dk); color: var(--green-dk); }
.mc-option.incorrect { border-color: var(--red); background: var(--red-bg); box-shadow: 0 2px 0 var(--red-dk); color: var(--red-dk); }
.mc-option.disabled { cursor: not-allowed; }

/* Fill in the Blank */
.fib-sentence { font-size: 1.4rem; font-weight: 700; color: var(--g900); margin-bottom: 8px; width: 100%; line-height: 1.9; }
.fib-blank {
  display: inline-block; min-width: 80px; border-bottom: 3px solid var(--g900);
  padding: 0 8px 2px; vertical-align: bottom; text-align: center; color: var(--green-dk); font-weight: 900;
}
.fib-blank.empty { color: transparent; border-bottom-color: var(--g400); }
.fib-context { font-size: .875rem; color: var(--g600); font-weight: 600; margin-bottom: 24px; font-style: italic; width: 100%; }
.fib-word-bank { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; margin-top: 8px; }
.fib-word {
  background: var(--white); border: 2px solid var(--g200); border-radius: var(--r-sm);
  padding: 10px 16px; font-size: 1rem; font-weight: 700; color: var(--g900);
  box-shadow: 0 2px 0 var(--g200); transition: all .12s;
}
.fib-word:hover:not(.used) { border-color: var(--blue); background: var(--blue-bg); transform: translateY(-1px); }
.fib-word.used { opacity: .3; cursor: not-allowed; }

/* Match Pairs */
.match-instruction { font-size: 1rem; font-weight: 700; color: var(--g600); margin-bottom: 20px; width: 100%; }
.match-container { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.match-col-label { font-size: .75rem; font-weight: 800; color: var(--g400); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; text-align: center; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-item {
  background: var(--white); border: 2px solid var(--g200); border-radius: var(--r-md);
  padding: 14px 10px; font-size: .9rem; font-weight: 700; text-align: center;
  transition: all .12s; box-shadow: 0 2px 0 var(--g200); cursor: pointer; line-height: 1.3;
}
.match-item:hover:not(.matched):not(.disabled) { border-color: var(--blue); background: var(--blue-bg); }
.match-item.selected { border-color: var(--gold); background: var(--gold-bg); box-shadow: 0 2px 0 var(--gold-dk); }
.match-item.matched { border-color: var(--green); background: var(--green-bg); box-shadow: 0 2px 0 var(--green-dk); color: var(--green-dk); cursor: default; }
.match-item.shake { animation: shake .4s ease; border-color: var(--red); background: var(--red-bg); }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

/* Info Card */
.info-card { background: var(--gold-bg); border: 2px solid var(--gold); border-radius: var(--r-lg); padding: 24px; width: 100%; }
.info-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.info-card-emoji { font-size: 2rem; }
.info-card-title { font-size: .9rem; font-weight: 800; color: var(--gold-dk); text-transform: uppercase; letter-spacing: .5px; }
.info-card-body { font-size: 1rem; color: var(--g900); line-height: 1.6; font-weight: 600; }
.info-card-example {
  margin-top: 16px; padding: 12px 16px; background: white; border-radius: var(--r-sm);
  border-left: 4px solid var(--green); font-style: italic; font-weight: 700; color: var(--green-dk); font-size: .95rem;
}

/* ── Action Bar ──────────────────────────────────────────── */
.action-bar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--action-h);
  background: var(--white); border-top: 2px solid var(--g100);
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px; z-index: 40;
}
.check-btn {
  width: 100%; max-width: 400px; height: 50px; border-radius: var(--r-lg);
  font-size: 1rem; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  background: var(--g200); color: var(--g400); transition: all .15s; box-shadow: 0 4px 0 var(--g400);
}
.check-btn:not([disabled]) { background: var(--green); color: white; box-shadow: 0 4px 0 var(--green-dk); }
.check-btn:not([disabled]):hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green-dk); }
.check-btn:not([disabled]):active { transform: translateY(2px); box-shadow: 0 2px 0 var(--green-dk); }

/* Feedback Banner */
.feedback-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.feedback-banner.correct { background: var(--green-bg); border-top: 3px solid var(--green); }
.feedback-banner.incorrect { background: var(--red-bg); border-top: 3px solid var(--red); }
.feedback-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.feedback-left { display: flex; align-items: flex-start; gap: 12px; flex: 1; }
.feedback-icon { font-size: 2rem; flex-shrink: 0; }
.feedback-title { font-size: 1rem; font-weight: 900; }
.feedback-banner.correct .feedback-title { color: var(--green-dk); }
.feedback-banner.incorrect .feedback-title { color: var(--red-dk); }
.feedback-detail { font-size: .875rem; color: var(--g600); margin-top: 2px; font-weight: 600; }
.feedback-continue-btn {
  background: var(--green); color: white; border-radius: var(--r-lg);
  padding: 12px 28px; font-size: 1rem; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; box-shadow: 0 4px 0 var(--green-dk); flex-shrink: 0; transition: all .15s;
}
.feedback-banner.incorrect .feedback-continue-btn { background: var(--red); box-shadow: 0 4px 0 var(--red-dk); }
.feedback-continue-btn:hover { transform: translateY(-2px); }
.feedback-continue-btn:active { transform: translateY(2px); }

/* Completion Screen */
.completion-screen {
  position: fixed; inset: 0; background: var(--white); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.completion-inner { text-align: center; max-width: 480px; width: 100%; }
.completion-trophy { font-size: 5rem; margin-bottom: 16px; animation: pop .6s ease; }
@keyframes pop { 0%{transform:scale(.5);opacity:0} 70%{transform:scale(1.1)} 100%{transform:scale(1);opacity:1} }
.completion-title { font-size: 2rem; font-weight: 900; color: var(--gold); margin-bottom: 32px; }
.completion-stats-row { display: flex; gap: 12px; margin-bottom: 32px; justify-content: center; }
.comp-stat-card {
  flex: 1; max-width: 130px; background: var(--g50); border: 2px solid var(--g100);
  border-radius: var(--r-lg); padding: 16px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.comp-stat-icon { font-size: 1.5rem; }
.comp-stat-val { font-size: 1.5rem; font-weight: 900; color: var(--g900); }
.comp-stat-label { font-size: .7rem; font-weight: 800; color: var(--g600); text-transform: uppercase; letter-spacing: .5px; }
.completion-continue-btn {
  width: 100%; height: 56px; border-radius: var(--r-lg); background: var(--green); color: white;
  font-size: 1rem; font-weight: 900; letter-spacing: .5px; text-transform: uppercase;
  box-shadow: 0 4px 0 var(--green-dk); transition: all .15s;
}
.completion-continue-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--green-dk); }

/* Dialog */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.dialog-box { background: var(--white); border-radius: var(--r-xl); padding: 32px 24px; width: 100%; max-width: 400px; text-align: center; }
.dialog-box h3 { font-size: 1.5rem; font-weight: 900; color: var(--g900); margin-bottom: 12px; }
.dialog-box p { font-size: 1rem; color: var(--g600); margin-bottom: 24px; font-weight: 600; line-height: 1.5; }
.dialog-actions { display: flex; gap: 12px; }
.btn-outline {
  flex: 1; height: 50px; border-radius: var(--r-lg); background: white; border: 2px solid var(--g200);
  font-size: .95rem; font-weight: 800; color: var(--g600); text-transform: uppercase; letter-spacing: .5px; transition: all .15s;
}
.btn-outline:hover { border-color: var(--g400); }
.btn-danger {
  flex: 1; height: 50px; border-radius: var(--r-lg); background: var(--red); color: white;
  font-size: .95rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  box-shadow: 0 4px 0 var(--red-dk); transition: all .15s;
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--red-dk); }

/* Responsive */
@media (max-width: 480px) {
  .brand-title { font-size: 2rem; }
  .welcome-word { font-size: 2.2rem; }
  .mc-options { grid-template-columns: 1fr; }
  .exercise-prompt { font-size: 1.6rem; }
  .top-header { padding: 0 12px; }
  .header-brand-name { display: none; }
  .feedback-inner { flex-direction: column; align-items: stretch; }
  .feedback-continue-btn { text-align: center; }
}
@media (max-width: 360px) {
  .hstat { gap: 3px; font-size: .875rem; }
  .header-stats { gap: 12px; }
}
