/* ---------- Fun & game layer (HUD, hero, toasts, confetti, Quiz Arena) ---------- */
.icon-btn { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 999px; width: 32px; height: 28px; font-size: 14px; display: grid; place-items: center; padding: 0; }
.hud { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 999px; padding: 3px 8px 3px 10px; font-size: 12.5px; font-weight: 700; }
.hud-streak { opacity: .65; filter: grayscale(.6); }
.hud-streak.lit { opacity: 1; filter: none; animation: flame 1.6s ease-in-out infinite; display: inline-block; }
@keyframes flame { 50% { transform: scale(1.12) rotate(-4deg); } }
.hud-lvl { position: relative; display: inline-grid; place-items: center; }
.hud-lvl span { position: relative; z-index: 1; padding: 1px 7px; border-radius: 999px; background: rgba(0,0,0,.18); }
.hud-lvl i { position: absolute; left: 0; bottom: -4px; height: 3px; width: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--gold) var(--p), rgba(255,255,255,.25) var(--p)); }

.msg { animation: msgIn .35s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.chip { transition: transform .12s, border-color .12s; }
.chip:active, .hero-btn:active, .aopt:active, .mode:active { transform: scale(.96); }
.chip.hot { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; font-weight: 600; }

.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--panel)), var(--gold-soft)); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 4px; }
.hero-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.hero-hi { margin: 0 !important; color: var(--muted); font-size: 13px; }
.hero h2 { margin: 2px 0 0; font-size: 19px; }
.ring { --p: 0%; flex: 0 0 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--brand) var(--p), color-mix(in srgb, var(--brand) 15%, transparent) 0); }
.ring span { width: 50px; height: 50px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-size: 11px; line-height: 1.1; text-align: center; }
.ring b { display: block; font-size: 13px; }
.hero-acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 8px; }
.hero-btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 14px; padding: 10px 4px; font-size: 12px; font-weight: 600; display: grid; gap: 2px; justify-items: center; transition: transform .12s, box-shadow .12s; }
.hero-btn span { font-size: 22px; }
.hero-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.hero-btn.arena-btn { background: linear-gradient(135deg, #0b6b3a, #13994f); color: #fff; border-color: transparent; animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 45%, transparent); } }
.hero-sub { font-size: 13px; color: var(--muted); margin: 0 !important; }

.ai-nudge { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: 12px; padding: 8px 10px; font-size: 13.5px; margin-bottom: 8px; }
.sec.best .best-text { white-space: pre-line; margin: 0; }
details.srcs > summary { cursor: pointer; list-style: none; margin: 0; }
details.srcs > summary::-webkit-details-marker { display: none; }
details.srcs[open] > summary { margin-bottom: 6px; }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 7px; vertical-align: middle; }
.ai-acts { display: grid; gap: 4px; justify-items: end; }
.linkish { border: 0 !important; background: none !important; color: var(--brand) !important; padding: 2px 0 !important; font-size: 12.5px; text-decoration: underline; }

.toasts { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 30; display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--panel); padding: 7px 14px; border-radius: 999px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: toastIn .35s cubic-bezier(.2,.9,.3,1.4); text-align: center; }
.toast.xp { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; }
.toast.big { background: linear-gradient(90deg, #b8860b, var(--gold)); color: #1d2a22; font-size: 14px; padding: 9px 16px; border-radius: 14px; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .4s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.9); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

.prof .prof-lvl { display: flex; gap: 12px; align-items: center; margin: 6px 0 10px; }
.prof-icon { font-size: 40px; width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; background: var(--gold-soft); flex: 0 0 auto; }
.xpbar { height: 9px; border-radius: 9px; background: var(--sec); overflow: hidden; margin-top: 6px; width: 200px; max-width: 100%; }
.xpbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--gold)); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; margin: 6px 0 12px; }
.badge-tile { border: 1px solid var(--line); border-radius: 12px; padding: 8px 4px; text-align: center; opacity: .55; }
.badge-tile.got { opacity: 1; background: var(--gold-soft); border-color: var(--gold); }
.badge-tile span { font-size: 22px; display: block; }
.badge-tile small { font-size: 10.5px; line-height: 1.2; display: block; }
.arena-go.big, .arena-next { width: 100%; border: 0; border-radius: 12px; padding: 12px; font-weight: 700; color: #fff; background: linear-gradient(90deg, var(--brand), var(--brand-2)); font-size: 15px; }

.arena { position: fixed; inset: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.arena[hidden] { display: none; }
.arena-card { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 16px; width: min(560px, 100%); box-shadow: 0 16px 50px rgba(0,0,0,.25); animation: msgIn .3s both; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 10px; }
.mode { border: 1.5px solid var(--line); background: var(--sec); color: var(--ink); border-radius: 14px; padding: 14px 8px; font-weight: 700; display: grid; gap: 4px; justify-items: center; }
.mode span { font-size: 26px; }
.mode:hover { border-color: var(--brand); }
.arena-prog { display: flex; gap: 4px; flex: 1; margin-right: 10px; }
.arena-prog i { flex: 1; height: 6px; border-radius: 6px; background: var(--sec); border: 1px solid var(--line); }
.arena-prog i.cur { background: var(--gold); }
.arena-prog i.ok { background: var(--right); }
.arena-prog i.no { background: var(--wrong); }
.arena-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-weight: 700; margin: 4px 0; }
.timer { height: 6px; background: var(--sec); border-radius: 6px; overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--brand); transition: width .1s linear; }
.timer i.hurry { background: var(--wrong); }
.arena-q { margin: 12px 0; font-size: 16px; }
.arena-q .quote { font-size: 14px; font-style: italic; background: var(--sec); border-left: 3px solid var(--gold); padding: 8px 10px; border-radius: 0 10px 10px 0; margin: 8px 0 0; max-height: 34vh; overflow-y: auto; }
.arena-opts { display: grid; gap: 8px; }
.aopt { text-align: left; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 12px; padding: 11px 12px; font-size: 14px; transition: transform .1s, border-color .1s; }
.aopt:hover:not(:disabled) { border-color: var(--brand); transform: translateX(3px); }
.aopt.right { border-color: var(--right); background: color-mix(in srgb, var(--right) 18%, var(--panel)); animation: pop .3s; }
.aopt.wrong { border-color: var(--wrong); background: color-mix(in srgb, var(--wrong) 14%, var(--panel)); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.arena-fb { margin-top: 10px; font-weight: 700; font-size: 15px; animation: pop .3s; }
.arena-fb small { display: block; font-weight: 400; color: var(--muted); margin: 4px 0 10px; font-size: 12.5px; max-height: 22vh; overflow-y: auto; }
.arena-card.done { text-align: center; }
.arena-card.done h2 { font-size: 36px; margin: 4px 0; }
.stars { font-size: 40px; letter-spacing: 6px; }
.stars span { color: var(--line); display: inline-block; }
.stars span.on { color: var(--gold); animation: starPop .5s cubic-bezier(.2,.9,.3,1.6) both; }
.stars span.on:nth-child(2) { animation-delay: .15s; }
.stars span.on:nth-child(3) { animation-delay: .3s; }
@keyframes starPop { from { transform: scale(0) rotate(-90deg); } }

@media (max-width: 560px) {
  .hero-acts { grid-template-columns: repeat(2, 1fr); }
  .top { padding-left: 10px; padding-right: 10px; }
  .logo { width: 36px; height: 36px; font-size: 22px; }
  .brand h1 { font-size: 17px; }
  .top-r { gap: 5px; }
}
/* In-app reader (replaces the bulky original HTML pages) */
.reader { place-items: start center; }
.reader-card { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; width: min(760px, 100%); margin: 8px 0 40px; box-shadow: 0 16px 50px rgba(0,0,0,.25); }
.reader-body { font-family: Georgia, "Times New Roman", serif; font-size: 15.5px; line-height: 1.75; }
.reader-body h3 { font-family: system-ui, sans-serif; font-size: 14px; color: var(--brand); margin: 18px 0 6px; }
.reader-body p { margin: 0 0 12px; }
.reader-body p.hit { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 8px 10px; border-radius: 0 10px 10px 0; }
.read-doc { border: 0; background: none; color: var(--brand); font-weight: 600; padding: 0; font-size: 13px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.web-note { font-size: 12.5px; color: #2b7de9; background: color-mix(in srgb, #2b7de9 10%, transparent); border-radius: 10px; padding: 6px 10px; margin: 8px 0 0 !important; }
