:root {
  --bg: #fdf7ff; --card: #ffffff; --ink: #2b2350; --muted: #6b6490; --track: #ece8f8;
  --brand: #7c3aed; --brand2: #ec4899; --good: #16a34a; --soft: #f59e0b; --bad: #ef4444;
  --radius: 22px;
  font-family: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(160deg, #e0f2fe 0%, #fdf2f8 55%, #ede9fe 100%); color: var(--ink); display: flex; flex-direction: column; align-items: center; padding: 24px 14px; }
.bg-dots { position: fixed; inset: 0; background-image: radial-gradient(#c4b5fd55 1.5px, transparent 1.5px); background-size: 26px 26px; pointer-events: none; z-index: 0; }
.card { position: relative; z-index: 1; width: 100%; max-width: 720px; background: var(--card); border-radius: var(--radius); box-shadow: 0 20px 60px -20px #6d28d955, 0 2px 0 #fff inset; padding: 32px clamp(18px, 4vw, 44px); }
.hidden { display: none !important; }
h1 { font-size: clamp(28px, 5vw, 40px); margin: 6px 0 8px; text-align: center; background: linear-gradient(90deg, var(--brand), var(--brand2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: clamp(20px, 3.4vw, 26px); text-align: center; margin: 14px 0 10px; line-height: 1.35; }
h3 { margin: 26px 0 10px; font-size: 19px; }
.hero { font-size: 72px; text-align: center; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.lead { text-align: center; color: var(--muted); font-size: 17px; margin: 0 auto 18px; max-width: 520px; }
.field { display: block; margin: 18px 0; }
.field > span { display: block; font-weight: 700; margin-bottom: 8px; }
.field em { font-weight: 400; color: var(--muted); }
input { width: 100%; font: inherit; font-size: 18px; padding: 12px 16px; border: 2px solid var(--track); border-radius: 14px; outline: none; }
input:focus { border-color: var(--brand); }
.ages { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.age { font: inherit; font-size: 20px; font-weight: 800; padding: 12px 0; border-radius: 14px; border: 2px solid var(--track); background: #faf8ff; color: var(--ink); cursor: pointer; transition: .15s; }
.age:hover { border-color: #c4b5fd; transform: translateY(-2px); }
.age.on { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; border-color: transparent; }
button.primary { display: block; margin: 22px auto 6px; font: inherit; font-size: 20px; font-weight: 800; color: #fff; border: 0; border-radius: 999px; padding: 14px 36px; background: linear-gradient(135deg, var(--brand), var(--brand2)); box-shadow: 0 10px 24px -10px var(--brand); cursor: pointer; transition: .15s; }
button.primary:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { font: inherit; font-size: 17px; font-weight: 700; padding: 12px 26px; border-radius: 999px; border: 2px solid var(--track); background: #fff; color: var(--ink); cursor: pointer; }
.note { font-size: 13.5px; color: var(--muted); background: #faf8ff; border-radius: 14px; padding: 12px 14px; margin-top: 22px; line-height: 1.5; }

.topbar { display: flex; justify-content: space-between; font-weight: 700; color: var(--muted); }
.stars { letter-spacing: 1px; }
.progress { height: 12px; background: var(--track); border-radius: 99px; overflow: hidden; margin: 10px 0 16px; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #38bdf8, var(--brand), var(--brand2)); transition: width .4s; }
.chip { display: table; margin: 0 auto; background: #f3e8ff; color: var(--brand); font-weight: 800; padding: 6px 14px; border-radius: 999px; font-size: 15px; }
.display { text-align: center; font-size: clamp(24px, 4.6vw, 34px); font-weight: 800; letter-spacing: 1px; margin: 8px 0 6px; min-height: 10px; word-spacing: 4px; }
.display.big { font-size: clamp(30px, 6vw, 46px); letter-spacing: 4px; }
.countdown { text-align: center; font-size: 22px; font-weight: 800; color: var(--brand); min-height: 28px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.options.big .opt { font-size: clamp(24px, 4.6vw, 34px); }
.opt { font: inherit; font-size: 19px; font-weight: 700; padding: 18px 12px; border-radius: 18px; border: 3px solid var(--track); background: #fff; color: var(--ink); cursor: pointer; transition: .12s; min-height: 68px; }
.opt:hover:not(:disabled) { border-color: #c4b5fd; background: #faf5ff; transform: translateY(-2px); }
.opt.right { border-color: var(--good); background: #dcfce7; }
.opt.wrong { border-color: var(--bad); background: #fee2e2; }
.opt:disabled { cursor: default; }
.feedback { text-align: center; font-size: 22px; font-weight: 800; min-height: 34px; margin-top: 14px; }
.feedback.good { color: var(--good); animation: pop .35s; }
.feedback.soft { color: var(--soft); }
@keyframes pop { 0% { transform: scale(.6); } 70% { transform: scale(1.15); } }

.r-name { text-align: center; color: var(--muted); font-weight: 700; margin: 0; }
.medal { text-align: center; font-size: 64px; }
.gauge { position: relative; width: 260px; max-width: 80%; margin: 8px auto 0; }
.gauge svg { width: 100%; display: block; }
.needle { position: absolute; left: 50%; bottom: 8%; width: 4px; height: 44%; background: var(--ink); border-radius: 4px; transform-origin: bottom center; transform: rotate(-90deg); transition: transform 1.4s cubic-bezier(.2, 1.4, .4, 1); margin-left: -2px; }
.gauge-num { position: absolute; left: 0; right: 0; bottom: -46px; text-align: center; }
.gauge-num span { display: block; font-size: 44px; font-weight: 900; color: var(--brand); line-height: 1; }
.gauge-num small { color: var(--muted); font-weight: 700; }
.range { text-align: center; color: var(--muted); margin: 56px 0 2px; }
.acc { text-align: center; color: var(--muted); font-size: 14px; margin: 0; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 44px; align-items: center; gap: 10px; font-weight: 700; }
.bar { height: 14px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, var(--brand)); border-radius: 99px; }
.bar-val { text-align: right; color: var(--muted); }
.list { padding-left: 20px; line-height: 1.7; }
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tip { background: #faf8ff; border-radius: 16px; padding: 12px 16px; }
.tip h4 { margin: 4px 0 6px; }
.tip ul { margin: 0; padding-left: 18px; line-height: 1.55; font-size: 15px; }
.actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; align-items: center; }
.actions .primary { margin: 22px 0 0; }
.actions .ghost { margin-top: 22px; }
.history { margin-top: 18px; font-size: 14px; color: var(--muted); }
.history h3 { font-size: 15px; margin: 8px 0 4px; }
.history ul { padding-left: 18px; margin: 0; line-height: 1.6; }
footer { position: relative; z-index: 1; margin-top: 18px; color: var(--muted); font-size: 13px; }

@media (max-width: 520px) {
  .options { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr 40px; font-size: 14px; }
}
@media print {
  body { background: #fff; padding: 0; } .bg-dots, footer, .actions { display: none; }
  .card { box-shadow: none; }
}
