:root {
  --pitch: #0a7d3b;
  --pitch-dark: #06612c;
  --pitch-light: #12994c;
  --line: rgba(255, 255, 255, 0.25);
  --gold: #ffc224;
  --gold-dark: #e0a400;
  --ink: #1c2733;
  --card: #ffffff;
  --muted: #6b7a8a;
  --bad: #e5484d;
  --good: #18a058;
  --radius: 20px;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Baloo 2", -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -20%, var(--pitch-light), transparent 60%),
    repeating-linear-gradient(180deg, var(--pitch) 0 64px, var(--pitch-dark) 64px 128px);
  background-attachment: fixed;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { margin: 0; line-height: 1.15; }

.screen { display: flex; flex-direction: column; flex: 1; animation: pop-in .25s ease; }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; } }

/* ---------- login ---------- */
.login {
  justify-content: center;
  text-align: center;
  gap: 18px;
  min-height: 80vh;
}
.login .ball { font-size: 84px; animation: bounce 1.6s infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-26px) rotate(20deg); }
  60% { transform: translateY(0); }
}
.login h1 {
  color: #fff;
  font-size: 40px;
  font-weight: 800;
  text-shadow: 0 3px 0 rgba(0,0,0,.25);
}
.login .sub { color: var(--gold); font-weight: 700; font-size: 18px; }

/* ---------- generic card & buttons ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}

.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px 20px;
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  min-height: 54px;
  transition: transform .08s ease, filter .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn-gold { background: linear-gradient(180deg, var(--gold), var(--gold-dark)); color: #3b2b00; box-shadow: 0 4px 0 #a87b00; }
.btn-green { background: linear-gradient(180deg, #23b563, #148a47); color: #fff; box-shadow: 0 4px 0 #0b5e2f; }
.btn-ghost { background: rgba(255,255,255,.15); color: #fff; }
.btn[disabled] { filter: grayscale(.7); opacity: .6; }

input[type="text"], input[type="password"], textarea {
  width: 100%;
  font-family: inherit;
  font-size: 19px;
  padding: 13px 14px;
  border: 3px solid #dbe4ec;
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: #fff;
}
input:focus, textarea:focus { border-color: var(--gold); }
textarea { min-height: 90px; resize: none; }

.shake { animation: shake .4s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-8px); }
  40%,80% { transform: translateX(8px); }
}

/* ---------- calendar ---------- */
.cal-head { text-align: center; color: #fff; margin-bottom: 14px; }
.cal-head h1 { font-size: 30px; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.cal-head .stats {
  display: flex; justify-content: center; gap: 10px; margin-top: 10px; flex-wrap: wrap;
}
.chip {
  background: rgba(0,0,0,.28);
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 15px;
}
.chip b { color: var(--gold); }

.month-label {
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 2px;
  margin: 14px 4px 8px;
  text-shadow: 0 2px 0 rgba(0,0,0,.2);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (min-width: 420px) { .cal-grid { grid-template-columns: repeat(5, 1fr); } }

.tile {
  aspect-ratio: 1;
  border: 0;
  border-radius: 16px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px;
  transition: transform .08s ease;
}
.tile:active { transform: scale(.94); }
.tile .num { font-size: 21px; font-weight: 800; line-height: 1; }
.tile .emo { font-size: 22px; line-height: 1; }
.tile.open { background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.tile.done { background: linear-gradient(180deg, var(--gold), var(--gold-dark)); color: #3b2b00; box-shadow: 0 3px 0 #a87b00; }
.tile.locked { background: rgba(0,0,0,.3); color: rgba(255,255,255,.5); cursor: default; }
.tile.today { outline: 4px solid var(--gold); animation: glow 1.4s infinite; }
@keyframes glow {
  0%,100% { outline-color: var(--gold); }
  50% { outline-color: #fff; }
}

/* ---------- exercise chrome ---------- */
.ex-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.ex-quit {
  background: rgba(0,0,0,.3);
  border: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  width: 42px; height: 42px;
  border-radius: 50%;
  cursor: pointer;
  flex: none;
}
.bar { flex: 1; display: flex; gap: 5px; }
.bar .seg { flex: 1; height: 12px; border-radius: 6px; background: rgba(0,0,0,.3); overflow: hidden; }
.bar .seg i { display: block; height: 100%; background: var(--gold); border-radius: 6px; transition: width .3s ease; }

.phase-label { color: #fff; text-align: center; font-weight: 700; margin-bottom: 10px; opacity: .9; }

.ex-card { text-align: center; }
.ex-card .count { color: var(--muted); font-weight: 700; font-size: 14px; letter-spacing: 1px; }

.word-es {
  font-size: 42px;
  font-weight: 800;
  color: var(--pitch-dark);
  margin: 10px 0 2px;
  cursor: pointer;
  user-select: none;
}
.word-es .spk { font-size: 26px; vertical-align: middle; }
.word-en { font-size: 22px; color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.tap-hint { font-size: 14px; color: #9aa8b5; margin-bottom: 14px; }

.quiz-q { font-size: 26px; font-weight: 800; margin: 12px 0 16px; }
.quiz-q small { display: block; font-size: 15px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }

.sentence {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.7;
  margin: 14px 0 6px;
}
.sentence input {
  display: inline-block;
  width: 110px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  padding: 4px 8px;
  border-width: 0 0 4px 0;
  border-radius: 8px 8px 0 0;
  background: #fff6da;
  border-color: var(--gold);
}
.hint { color: var(--muted); font-weight: 700; font-size: 16px; margin-bottom: 12px; }

.accents { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 10px 0 14px; }
.accents button {
  border: 0;
  background: #eef3f7;
  border-radius: 10px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  color: var(--pitch-dark);
  width: 40px; height: 40px;
  cursor: pointer;
}
.accents button:active { background: var(--gold); }

/* ---------- results ---------- */
.result-big { font-size: 62px; margin: 4px 0; }
.result-title { font-size: 32px; font-weight: 800; }
.result-title.good { color: var(--good); }
.result-title.bad { color: var(--bad); }
.answer-compare { margin: 14px 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.answer-compare .row { border-radius: 12px; padding: 10px 14px; font-size: 19px; font-weight: 700; }
.answer-compare .label { display: block; font-size: 13px; letter-spacing: 1px; opacity: .75; font-weight: 800; }
.answer-compare .yours { background: #ffe9ea; color: #8c2226; }
.answer-compare .correct { background: #e2f7eb; color: #0b5e2f; }

/* ---------- tense intro ---------- */
.tense-card { text-align: left; }
.tense-card h2 { color: var(--pitch-dark); font-size: 26px; }
.tense-card .en { color: var(--muted); font-weight: 700; margin: 2px 0 10px; }
.tense-card p { font-size: 17px; line-height: 1.45; margin: 8px 0 14px; }
table.conj {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  font-size: 17px;
}
table.conj caption {
  text-align: left;
  font-weight: 800;
  color: var(--pitch-dark);
  font-size: 18px;
  padding-bottom: 6px;
}
table.conj td { padding: 7px 10px; border-bottom: 1px solid #eef2f5; }
table.conj td:first-child { color: var(--muted); font-weight: 700; }
table.conj td:last-child { font-weight: 800; }

/* ---------- interstitial / complete ---------- */
.inter { text-align: center; justify-content: center; min-height: 70vh; gap: 16px; color: #fff; }
.inter .big { font-size: 80px; }
.inter h2 { font-size: 30px; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.inter .sub2 { font-size: 18px; opacity: .9; font-weight: 700; }

.scoreline {
  display: flex; justify-content: center; gap: 12px; margin: 8px 0;
}
.scoreline .chip { font-size: 17px; }

.footer-note { text-align: center; color: rgba(255,255,255,.7); font-size: 13px; margin-top: 18px; font-weight: 600; }

.dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: #dbe4ec; }
.dots i.on { background: var(--gold); }

.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
