:root {
  --violet: #5b4bff;
  --pink: #ff5fa2;
  --yellow: #ffc94a;
  --yellow-dark: #f5a700;
  --ink: #1f1b3a;
  --muted: #6b6790;
  --card: #ffffff;
  --green: #18b26b;
  --red: #e5484d;
  --home: #ff9f1c;
  --school: #3a86ff;
  --lit: #12a37a;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { background: var(--pink); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--violet) 0, #8d5cff 600px, #c45fd0 1400px, var(--pink) 100%);
  padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom));
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; cursor: pointer; border: 0; }
button:disabled { opacity: .6; }
.screen { max-width: 520px; margin: 0 auto; }

/* ---------- вход ---------- */
#login { display: flex; flex-direction: column; align-items: center; padding-top: 32px; color: #fff; text-align: center; }
.hello .big-star { font-size: 72px; animation: float 3s ease-in-out infinite; }
.hello h1 { font-size: 34px; font-weight: 800; margin-top: 4px; }
.hello p { font-size: 19px; opacity: .92; margin-top: 6px; }
.dots { display: flex; gap: 14px; margin: 26px 0 8px; min-height: 22px; }
.dot { width: 20px; height: 20px; border-radius: 50%; border: 3px solid #fff; transition: background .15s, transform .15s; }
.dot.on { background: var(--yellow); border-color: var(--yellow); transform: scale(1.1); }
.shake { animation: shake .4s; }
.error { min-height: 26px; font-weight: 700; color: #fff3a6; font-size: 17px; }
.keypad { display: grid; grid-template-columns: repeat(3, 84px); gap: 14px; margin-top: 8px; }
.key {
  height: 84px; border-radius: 50%; font-size: 32px; font-weight: 700;
  color: #fff; background: rgba(255, 255, 255, .18); border: 2px solid rgba(255, 255, 255, .35);
  transition: transform .08s, background .15s;
}
.key:active { transform: scale(.92); background: rgba(255, 255, 255, .35); }
.key-ok { background: var(--yellow); color: var(--ink); border-color: var(--yellow); font-size: 24px; }
.key-del { font-size: 28px; }
.parent-link { margin-top: 28px; color: #fff; opacity: .8; font-size: 16px; padding: 12px; min-height: 48px; }

/* ---------- главная ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 14px; color: #fff; }
.top h1 { font-size: 28px; font-weight: 800; }
.ghost { background: rgba(255, 255, 255, .2); color: #fff; padding: 0 16px; min-height: 48px; border-radius: 24px; font-size: 16px; font-weight: 600; }
h2 { color: #fff; font-size: 22px; font-weight: 800; margin: 26px 4px 12px; }
.card { background: var(--card); border-radius: 26px; box-shadow: 0 10px 30px rgba(40, 20, 120, .22); }

.wallet { padding: 20px 20px 16px; }
.wallet-row { display: flex; flex-direction: column; gap: 2px; }
.wallet-label { font-size: 17px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.wallet-value { font-size: 36px; font-weight: 900; }
.progress { height: 16px; background: #eeeafd; border-radius: 10px; margin: 14px 0 6px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 10px; background: linear-gradient(90deg, var(--yellow), var(--yellow-dark)); transition: width .8s cubic-bezier(.2, .9, .3, 1.2); }
.progress-text { font-size: 15px; color: var(--muted); font-weight: 600; }
.savings-row { margin-top: 12px; padding-top: 12px; border-top: 2px dashed #eeeafd; font-size: 18px; }

.tasks { display: flex; flex-direction: column; gap: 14px; }
.task { padding: 16px; border-left: 10px solid var(--violet); }
.task.cat-home { border-left-color: var(--home); }
.task.cat-school { border-left-color: var(--school); }
.task.cat-lithuanian { border-left-color: var(--lit); }
.task-head { display: flex; align-items: flex-start; gap: 12px; }
.task-icon { font-size: 34px; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: #f4f1ff; flex: none; }
.task-text { flex: 1; min-width: 0; }
.task-text h3 { font-size: 20px; font-weight: 800; line-height: 1.2; }
.task-desc { font-size: 16px; color: var(--ink); margin-top: 4px; }
.task-meta { font-size: 14px; color: var(--muted); margin-top: 4px; }
.task-stars { font-size: 22px; font-weight: 900; color: var(--yellow-dark); white-space: nowrap; }
.task-action { margin-top: 14px; }
.btn-yellow {
  width: 100%; min-height: 60px; border-radius: 20px; background: var(--yellow); color: var(--ink);
  font-size: 22px; font-weight: 900; box-shadow: 0 5px 0 var(--yellow-dark); transition: transform .08s, box-shadow .08s;
}
.btn-yellow:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--yellow-dark); }
.state { min-height: 56px; display: grid; place-items: center; border-radius: 20px; font-size: 19px; font-weight: 800; }
.state-pending { background: #fff4d6; color: #9a6500; }
.state-done { background: #dff7ea; color: #0b7a47; }
.task.st-done { opacity: .85; }
.pop { animation: pop .35s ease; }

.history { padding: 6px 16px; }
.h-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f0edfb; }
.h-row:last-child { border-bottom: 0; }
.h-icon { font-size: 24px; flex: none; }
.h-main { flex: 1; min-width: 0; }
.h-title { font-size: 17px; font-weight: 700; }
.h-when { font-size: 14px; color: var(--muted); }
.h-note { font-size: 14px; color: var(--violet); margin-top: 2px; }
.h-right { font-weight: 800; font-size: 17px; white-space: nowrap; }
.h-right.plus { color: var(--green); }
.h-right.minus { color: var(--red); }
.h-right.wait { color: #b07800; font-size: 14px; }
.empty { color: var(--muted); padding: 14px 0; font-size: 17px; text-align: center; }

/* ---------- праздник ---------- */
.celebrate { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(25, 10, 70, .72); padding: 24px; }
.sky { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.fall { position: absolute; top: -50px; animation: fall linear infinite; }
.celebrate-box { position: relative; background: #fff; border-radius: 32px; padding: 28px 22px 22px; width: 100%; max-width: 360px; text-align: center; animation: pop-in .5s cubic-bezier(.2, .9, .3, 1.4); }
.celebrate-star { font-size: 120px; line-height: 1; animation: spin-in 1.1s cubic-bezier(.2, .9, .3, 1.3); filter: drop-shadow(0 8px 20px rgba(245, 167, 0, .6)); }
.celebrate-plus { font-size: 44px; font-weight: 900; color: var(--yellow-dark); margin: 6px 0 10px; }
.celebrate-box p { font-size: 17px; color: var(--muted); }
.celebrate-box ul { list-style: none; padding: 0; margin: 8px 0 14px; font-size: 19px; font-weight: 800; }
.celebrate-box li { padding: 3px 0; }
.celebrate-savings { margin-bottom: 14px; font-weight: 700; color: var(--violet) !important; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; margin: 0 auto; max-width: 480px; background: var(--ink); color: #fff; padding: 16px 18px; border-radius: 18px; font-size: 17px; font-weight: 700; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.toast-error { background: var(--red); }

@keyframes float { 50% { transform: translateY(-8px) rotate(6deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes pop { 50% { transform: scale(1.04); } }
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } }
@keyframes spin-in { from { transform: scale(0) rotate(-540deg); } 70% { transform: scale(1.25) rotate(20deg); } }
@keyframes fall { to { transform: translateY(calc(100vh + 100px)) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .fall { display: none; }
}
@media (max-width: 360px) { .keypad { grid-template-columns: repeat(3, 76px); } .key { height: 76px; } }
