:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #1f2733;
  --muted: #7b8794;
  --line: #eef2f7;
  --running: #34d399;   /* cercul, cat merge planul */
  --warning: #f59e0b;   /* ultimele 10% */
  --gold: #fcd34d;      /* timp extra */
  --primary: #2563eb;
  --ok: #22c55e;
  --star: #fff5cc;
  --star-border: #ffd84d;
  --star-ink: #b58a00;
  --line-strong: #cbd5e1;
  --highlight-bg: #e8f1ff;
  --highlight-border: #3b82f6;
  --radius: 16px;
}

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* pe iPhone, sub bara de sus si deasupra celei de jos */
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.screen { padding: 16px 14px 24px; max-width: 480px; margin: 0 auto; }
.screen--center { min-height: 80vh; display: flex; flex-direction: column;
                  align-items: center; justify-content: center; gap: 14px; text-align: center; }

.koala--big { font-size: 88px; line-height: 96px; text-align: center; }
.lead { font-size: 19px; font-weight: 800; margin: 0; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }

.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-size: 16px;
       font-weight: 800; font-family: inherit; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--quiet { background: transparent; color: var(--muted); font-size: 13px; }

.field { width: 100%; padding: 13px; margin-bottom: 9px; border: 2px solid var(--line);
         border-radius: 12px; font-size: 16px; font-family: inherit; }
.error { color: #b91c1c; font-size: 13px; margin: 4px 0 10px; }

.sheet-backdrop { position: fixed; inset: 0; background: rgba(31, 39, 51, .45);
                  display: flex; align-items: flex-end; }
.sheet { background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 18px 28px;
         width: 100%; max-width: 480px; margin: 0 auto; }

/* Ecranul zilei obisnuite */

.header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.koala--avatar { width: 36px; height: 36px; border-radius: 50%; background: #dbeafe;
                  display: flex; align-items: center; justify-content: center;
                  font-size: 20px; line-height: 1; flex: 0 0 auto; }
.header__day { font-weight: 800; font-size: 19px; line-height: 1.1; }
.header__date { font-size: 11px; color: var(--muted); }
.points { margin-left: auto; background: var(--star); border: 1.5px solid var(--star-border);
          border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: 13px;
          white-space: nowrap; }

/* Zi libera: un cadou, nu o lista goala -- acelasi limbaj vizual ca la
   ecranele de pornire (koala mare, centrata), nu lista zilei stinsa. */
.rest { min-height: 70vh; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 10px; text-align: center; }

.goal { background: #f3f6fb; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.goal__bar { height: 9px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.goal__bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #6ee7b7, var(--running));
               transition: width .3s ease; }

/* Fara tinta aleasa: invitatie apasabila, nu o eticheta pasiva. */
.goal__invite { display: block; width: 100%; border: 0; background: transparent; padding: 3px 0;
                 text-align: left; font-family: inherit; font-weight: 800; font-size: 14.5px;
                 color: var(--primary); }
.goal__invite::before { content: "🎁 "; }

/* Tinta aleasa, dar inca nu ajung punctele. */
.goal__progress { display: block; width: 100%; border: 0; background: transparent; padding: 0;
                    text-align: left; font-family: inherit; }
.goal__label { font-size: 12.5px; font-weight: 700; color: var(--ink); margin: 0 0 6px; }

/* Tinta aleasa si ajung punctele: butonul de cumparare inlocuieste bara. */
.goal__ready { display: flex; align-items: center; gap: 8px; }
.goal__label--tap { flex: 1 1 auto; border: 0; background: transparent; padding: 4px 0;
                     text-align: left; font-family: inherit; margin: 0; }
.goal__buy { flex: 0 0 auto; background: var(--gold); color: #7c4a03; padding: 11px 16px;
             font-size: 14px; border-radius: 12px; white-space: nowrap; }
/* O cumparare deja plecata spre coada, inca netrimisa -- nu stricat, doar in asteptare. */
.goal__buy:disabled { background: var(--line); color: var(--muted); }

/* Fisa de alegere a tintei (reward sheet). */
.reward-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.reward { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%;
          border: 2px solid var(--line); border-radius: 14px; padding: 11px 12px;
          background: var(--bg); text-align: left; font-family: inherit; min-height: 44px; }
.reward--chosen { border-color: var(--primary); background: var(--highlight-bg); }
.reward__icon { font-size: 22px; flex: 0 0 auto; }
.reward__name { font-weight: 800; font-size: 14px; color: var(--ink); flex: 1 1 auto; }
.reward__cost { font-size: 12px; font-weight: 800; color: var(--star-ink); background: var(--star);
                 border: 1.5px solid var(--star-border); border-radius: 999px; padding: 3px 8px; flex: 0 0 auto; }
.reward__hint { flex-basis: 100%; font-size: 11px; color: var(--muted); }

/* Munca netrimisa inca. Calma, nu rosie: copilul n-a gresit nimic, iar
   munca ei nu e pierduta. */
.offline-strip { background: #eef2f7; color: var(--muted); font-size: 12px; font-weight: 700;
                  text-align: center; border-radius: 10px; padding: 7px 10px; margin-bottom: 8px; }

/* Mesaje de la parinti: stele primite sau luate, cu motivul lor. Cardul
   "luate" are alta culoare decat cel "primite" -- altfel semnul e singura
   diferenta, si se pierde exact in cazul care conteaza (vezi notes.js). Nu
   dispar singure: ea poate fi la scoala cand deschide aplicatia. */
.note-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
             border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.note-card--given { background: var(--star); border: 2px solid var(--star-border); }
.note-card--taken { background: #fde8e8; border: 2px solid #f3b4b4; }
.note-card__star { font-size: 26px; flex: 0 0 auto; }
.note-card__text { flex: 1 1 160px; font-weight: 700; font-size: 14px; line-height: 1.3; color: var(--ink); }
.note-card__ok { flex: 0 0 auto; background: #fff; color: var(--ink); padding: 9px 14px; font-size: 13px; }

.card { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; border-radius: 14px;
        padding: 9px 10px; margin-bottom: 7px; background: var(--bg); border: 1.5px solid var(--line); }
.card--next { background: var(--highlight-bg); border: 2.5px solid var(--highlight-border);
              padding: 11px; }
.card--done { opacity: .5; }
.card--done .card__name { text-decoration: line-through; }

.card__icon { font-size: 19px; width: 26px; text-align: center; flex: 0 0 auto; }
.card__text { flex: 1 1 auto; min-width: 0; }
.card__name { font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.card__time { font-size: 11px; color: var(--muted); margin-top: 1px; }

.stars { font-size: 11px; font-weight: 800; color: var(--star-ink); background: var(--star);
         border-radius: 999px; padding: 2px 7px; flex: 0 0 auto; }

/* Buton fara timer: bifa. 44px, deget de copil pe tableta. */
.check { width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--line-strong);
         background: #fff; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
         font-size: 18px; font-weight: 900; color: #fff; padding: 0; }
.check--on { background: var(--ok); border-color: var(--ok); }

/* Butonul de pornire al sarcinii urmatoare: pe randul lui, sub icoana si
   text, ca sa nu se inghesuie -- singurul raspuns mare la "ce fac acum?". */
.card__go { flex: 1 1 100%; margin-top: 9px; min-height: 44px; }

/* Butonul de pornire al celorlalte sarcini cu timer: raman pornibile
   oricand (Leya poate vrea Klavier inaintea temelor), dar discret -- contur
   in loc de fundal plin, pe randul cardului, nu pe rand propriu. Tot 44px,
   ca bifa, ca degetul unui copil sa-l nimereasca sigur. */
.card__go--quiet { flex: 0 0 auto; width: 44px; height: 44px; min-height: 44px;
                    padding: 0; border-radius: 10px;
                    background: transparent; border: 2px solid var(--primary);
                    color: var(--primary); font-size: 16px; display: flex;
                    align-items: center; justify-content: center; }

/* Ecranul de timer */

.timer { background: var(--card); border-radius: 26px; padding: 18px 16px 20px;
         box-shadow: 0 8px 30px rgba(31, 39, 51, .14); max-width: 320px; margin: 8px auto 0; }
.timer__head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.timer__name { font-weight: 800; font-size: 15px; }

.ring { position: relative; width: 210px; height: 210px; margin: 18px auto;
        border-radius: 50%; background: conic-gradient(var(--tone) 0 var(--progress), #e8edf3 var(--progress) 100%); }
.ring--running { --tone: var(--running); }
.ring--warning { --tone: var(--warning); }
.ring--gold    { --tone: var(--gold); }
.ring::after { content: ""; position: absolute; inset: 16px; background: var(--card); border-radius: 50%; }
.ring__orbit { position: absolute; inset: 0; }
.ring__koala { position: absolute; left: 50%; top: -14px; width: 34px; font-size: 30px;
               line-height: 1; transform: translateX(-50%); }
.ring__flag { position: absolute; left: 50%; top: -13px; font-size: 22px; line-height: 1;
              transform: translateX(-50%); }
.ring__center { position: absolute; inset: 0; display: flex; flex-direction: column;
                 align-items: center; justify-content: center; text-align: center; padding: 0 28px;
                 /* `.ring::after` (gaura alba) e pseudo-element si se picteaza dupa toti
                    copiii reali ai lui `.ring`. Fara stratul de aici, discul alb acopera
                    exact cifrele pentru care exista ecranul asta. */
                 z-index: 1; }
.ring__clock { font-size: 42px; font-weight: 900; letter-spacing: -.04em;
               font-variant-numeric: tabular-nums; }
.ring__label { font-size: 10.5px; color: var(--muted); font-weight: 700; margin-top: 5px; }
/* Ultimele 10%: aceeasi urgenta si in cifre, nu doar in cerc. */
.ring--warning .ring__clock { color: #b45309; }

.timer .btn--wide { display: block; width: 100%; margin-bottom: 8px; }
.timer .btn--ghost { background: #fff; color: var(--primary); border: 2.5px solid #bfdbfe; }
.timer .btn--locked { background: var(--line); color: #a5b0bd; }
.timer .btn--ok { background: var(--ok); color: #fff; }
.timer .muted { text-align: center; margin-top: 2px; }

/* Banda de puncte: cat un rezultat inca nu e confirmat de server, un numar
   optimist s-ar putea dovedi gresit (plafonul zilnic de bonus) -- in locul
   lui sta "wird gleich gezählt", pana se limpezeste. Cand soldul real
   soseste, cifra intra cu un mic puls, nu doar sare pe loc. */
@keyframes points-pop { 0% { transform: scale(1); } 45% { transform: scale(1.16); } 100% { transform: scale(1); } }
.points--pop { animation: points-pop .4s ease; }

/* Dialogurile de la capatul timerului. Aceleasi proportii si culori ca in
   03-dialoguri-final.html -- fundal intunecat, foaie alba centrata, cel mult
   doua butoane. */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(31, 39, 51, .45);
                    display: flex; align-items: center; justify-content: center;
                    padding: 20px 16px; z-index: 30; }
.dialog-card { background: var(--card); border-radius: 19px; padding: 22px 18px 20px;
               width: 100%; max-width: 300px; text-align: center;
               box-shadow: 0 8px 30px rgba(31, 39, 51, .22); }
.dialog-icon { font-size: 42px; line-height: 1; }
.dialog-q { font-weight: 900; font-size: 18px; margin: 7px 0 0; line-height: 1.25; }
.dialog-sub { font-size: 13px; color: var(--muted); margin: 5px 0 0; line-height: 1.4; }
.dialog-chip { display: inline-block; background: var(--star); border: 1.5px solid var(--star-border);
               color: var(--star-ink); border-radius: 999px; padding: 5px 13px;
               font-weight: 800; font-size: 15px; margin-top: 10px; }
.dialog-hint { font-size: 12px; color: var(--muted); margin-top: 10px; line-height: 1.4; }

.dialog-btn { display: block; width: 100%; border: 0; border-radius: 13px; padding: 14px;
              font-weight: 800; font-size: 15.5px; font-family: inherit; margin-top: 10px; }
.dialog-btn--go { background: var(--ok); color: #fff; }
.dialog-btn--soft { background: #fff; color: var(--primary); border: 2.5px solid #bfdbfe; }
.dialog-btn--gold { background: #fff8e1; color: #a16207; border: 2.5px solid #fcd34d; }
.dialog-btn--quiet { background: transparent; color: var(--muted); font-size: 13.5px; padding: 10px; }

/* Mesaj scurt, peste orice ecran -- se stinge singur, calm, nu rosu. */
.toast { position: fixed; left: 14px; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom));
         max-width: 452px; margin: 0 auto; background: var(--ink); color: #fff;
         border-radius: 14px; padding: 13px 16px; font-size: 14px; font-weight: 700;
         text-align: center; box-shadow: 0 8px 24px rgba(31, 39, 51, .28); z-index: 20; }
