/* Completeaza Versetul — mobile-first, portrait phone. Adapted from web/assets/app.css. */
:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent2: #7c3aed;
  --ok: #16a34a;
  --bad: #dc2626;
  --gold: #f59e0b;
  --radius: 16px;
  --tap: 48px;
  --pad: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* author display rules must not defeat the hidden attribute */
html, body { margin: 0; height: 100%; }
body {
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: #e2e8f0;
  font: 16px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior: none;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 0 var(--pad);
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 72px);
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 2px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(160deg, var(--bg), transparent);
}
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .me-wrap { display: flex; align-items: center; gap: 8px; }
.topbar .me { font-size: 13px; color: var(--muted); }
.topbar .me b { color: var(--gold); }
.topbar .logout-btn {
  width: 34px; height: 34px; margin: 0; padding: 0; border-radius: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: #e2e8f0; font-size: 16px; line-height: 1; cursor: pointer;
}
.topbar .logout-btn:active { transform: scale(.95); }

main { flex: 1; padding-bottom: 8px; }

/* cards / inputs */
.card {
  background: var(--card); color: var(--ink);
  border-radius: var(--radius); padding: 22px 18px; margin: 8px 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 12px 0 6px; }
input, select {
  width: 100%; height: var(--tap); border: 2px solid #e2e8f0; border-radius: 12px;
  padding: 0 14px; font-size: 16px; background: #f8fafc; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

button {
  width: 100%; height: var(--tap); border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 16px;
}
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
button.ghost { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
button.small { height: 38px; font-size: 13px; margin-top: 10px; border-radius: 10px; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; }

h1 { margin: 0 0 8px; font-size: 24px; }
h2 { margin: 8px 0; font-size: 18px; }
h3.sec-h { margin: 18px 0 8px; font-size: 14px; color: var(--ink); }
.muted { color: var(--muted); font-size: 13px; }
.hint-info { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; }

.auth .switch { text-align: center; margin-top: 14px; font-size: 14px; color: var(--muted); }
.auth .switch a { color: var(--accent); font-weight: 700; text-decoration: none; }
.auth .links { text-align: center; margin-top: 8px; font-size: 13px; }
.auth .links a { color: var(--accent); text-decoration: none; }
.err { color: var(--bad); text-align: center; margin-top: 8px; font-size: 14px; }
.ok-box { background: #dcfce7; color: #166534; border-radius: 12px; padding: 12px; margin-top: 12px; font-size: 14px; word-break: break-all; }
.ok-box a { color: var(--accent); font-weight: 700; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 6px; }
.stat { background: #f1f5f9; border-radius: 12px; padding: 12px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.stat .v { font-size: 20px; font-weight: 800; color: var(--ink); }
.stat .v.gold { color: var(--gold); }

/* tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9;
  max-width: 480px; margin: 0 auto; display: flex;
  background: rgba(15,23,42,.96); padding: 6px 6px calc(6px + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,.08);
}
.tabbar button {
  flex: 1; height: 44px; margin: 0 4px; background: transparent;
  color: #94a3b8; font-weight: 700; font-size: 12px; border-radius: 10px;
}
.tabbar button.active { background: var(--accent); color: #fff; }

/* daily card */
.daily-card .d-ref { font-weight: 800; color: var(--ink); }
.daily-card .d-streak { color: var(--gold); font-weight: 700; }
.daily-card .d-solved { color: var(--ok); font-weight: 700; font-size: 13px; margin-top: 6px; }

/* game */
.game { background: var(--card); color: var(--ink); border-radius: var(--radius); padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
/* Daily challenge: full-bleed white slab (not a small card on the dark page) */
.game.daily-screen {
  background: #ffffff; color: var(--ink);
  margin: 0 calc(-1 * var(--pad)); border-radius: 0; box-shadow: none;
  padding: 14px var(--pad) 24px; min-height: 62vh;
}
.game.daily-screen .d-back-top { width: auto; margin: 0 0 12px; }
.game.daily-screen .blank.filled-ans {
  background: #dcfce7; color: var(--ok); border-radius: 4px; padding: 0 4px; letter-spacing: 0;
}
.hud { display: flex; justify-content: space-between; align-items: center; }
.lives { font-size: 18px; letter-spacing: 2px; }
.progress { font-size: 13px; font-weight: 700; color: var(--accent); }
.streak-line { font-size: 13px; color: var(--muted); margin: 2px 0 8px; min-height: 16px; }
.score { font-weight: 800; font-size: 20px; color: var(--gold); }
.timer { height: 8px; background: #e2e8f0; border-radius: 8px; overflow: hidden; margin: 12px 0 6px; }
.timer-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--ok), var(--gold), var(--bad)); transition: width .1s linear; }
.qmeta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.pts { font-weight: 700; color: var(--accent); }
.question { font-size: 18px; line-height: 1.5; margin: 6px 0 14px; }
.question .blank { color: var(--accent); font-weight: 800; letter-spacing: 1px; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 12px 14px;
  background: #f1f5f9; border: 2px solid #e2e8f0; border-radius: 12px;
  font-size: 15px; text-align: left; color: var(--ink); font-weight: 600; margin: 0; width: 100%;
}
.option .key { font-weight: 800; color: var(--accent); flex: 0 0 22px; }
.option:active { transform: scale(.99); }
.option.correct { background: #dcfce7; border-color: var(--ok); }
.option.wrong  { background: #fee2e2; border-color: var(--bad); }
.option.disabled { opacity: .6; }
.option.faded { opacity: .35; }

/* type mode */
.type-box { display: flex; gap: 8px; }
.type-box input { flex: 1; margin: 0; }
.type-box button { width: auto; margin: 0; padding: 0 18px; }

/* twoblank mode */
.slots { display: flex; gap: 10px; margin-bottom: 12px; }
.slot {
  flex: 1; min-height: var(--tap); border: 2px dashed #cbd5e1; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; padding: 8px;
  font-weight: 700; color: var(--muted); background: #f8fafc;
}
.slot.active { border-color: var(--accent); background: #eef2ff; color: var(--accent); }
.slot.filled { border-style: solid; border-color: var(--accent); color: var(--ink); background: #eef2ff; }
.wordbank { display: flex; flex-wrap: wrap; gap: 8px; }
.wordbank button {
  width: auto; margin: 0; height: 40px; padding: 0 14px; border-radius: 10px;
  background: #f1f5f9; border: 2px solid #e2e8f0; color: var(--ink); font-size: 14px; font-weight: 600;
}
.wordbank button:active { transform: scale(.96); }
.wordbank button.placed { opacity: .35; }

/* hint row */
.hint-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hint-row button {
  width: auto; flex: 1; min-width: 0; margin: 0; height: 40px; padding: 0 10px;
  font-size: 13px; border-radius: 10px; background: #fef3c7; color: #92400e;
  border: 1px solid #fcd34d; font-weight: 700;
}
.hint-row button:disabled { background: #f1f5f9; color: var(--muted); border-color: #e2e8f0; }
.hint-letter { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }

/* feedback */
.feedback { margin-top: 14px; padding: 12px; border-radius: 12px; font-size: 14px; }
.feedback.good { background: #dcfce7; color: #166534; }
.feedback.bad  { background: #fee2e2; color: #991b1b; }
.feedback .ans { font-weight: 800; display: block; margin-top: 4px; }
.feedback .ref { display: block; font-style: italic; margin-top: 4px; }
.feedback .gain { float: right; font-weight: 800; }
.feedback .next-btn { margin-top: 14px; }

/* result */
.result { text-align: center; }
.result-score { font-size: 44px; font-weight: 900; color: var(--gold); margin: 4px 0; }
.result-stats { color: var(--muted); margin-bottom: 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.badge { background: #f1f5f9; border-radius: 12px; padding: 8px 12px; font-size: 12px; font-weight: 700; color: var(--ink); }
.badge.new { background: var(--gold); color: #1e1b0f; }

/* leaderboard */
.myrank { background: var(--accent); color: #fff; border-radius: 12px; padding: 12px; margin-bottom: 12px; text-align: center; font-weight: 700; }
.board { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.board li { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: #f1f5f9; margin-bottom: 8px; counter-increment: r; font-weight: 600; }
.board li::before { content: counter(r) "."; color: var(--muted); width: 28px; font-weight: 800; }
.board li.me { background: #ddd6fe; }
.board li .pts { color: var(--gold); }

/* achievements grid */
.badges-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ach { background: #f1f5f9; border-radius: 14px; padding: 14px; text-align: center; }
.ach .emoji { font-size: 30px; display: block; filter: grayscale(1); opacity: .4; }
.ach.earned { background: #ecfccb; }
.ach.earned .emoji { filter: none; opacity: 1; }
.ach .name { font-weight: 800; font-size: 13px; margin-top: 4px; }
.ach .desc { font-size: 11px; color: var(--muted); }

/* review list */
.review-list { display: grid; gap: 8px; }
.review-item { background: #f1f5f9; border-radius: 10px; padding: 10px 12px; }
.review-item .ri-ref { font-weight: 800; font-size: 13px; color: var(--ink); }
.review-item .ri-text { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.review-item .ri-meta { font-size: 11px; color: var(--accent); font-weight: 700; margin-top: 3px; }
.review-item .ri-meta.due { color: var(--gold); }

/* progress bars */
.book-bars { display: grid; gap: 8px; }
.book-bar { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; }
.book-bar .bb-name { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-bar .bb-track { height: 10px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.book-bar .bb-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.book-bar .bb-pct { color: var(--muted); font-weight: 700; text-align: right; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + var(--safe-bottom)); transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: 14px; z-index: 50; max-width: 90%; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

@media (min-width: 600px) { #app { box-shadow: 0 0 60px rgba(0,0,0,.4); min-height: 100vh; border-radius: 0; } }