/* Aflex Quiz Live — shared styles */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg1: #0b1733;
  --bg2: #183a7a;
  --panel: #ffffff;
  --ink: #14213d;
  --muted: #6b7690;
  --line: #e3e7f0;
  --accent: #ffcc33;
  --good: #22b07d;
  --bad: #e5484d;
  --a: #e5484d;  /* red    / triangle */
  --b: #2f6fde;  /* blue   / diamond  */
  --c: #e9a23b;  /* amber  / circle   */
  --d: #22a06b;  /* green  / square   */
  --radius: 14px;
  --head: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  color: #fff;
  background: radial-gradient(1200px 700px at 80% -10%, #2b5bb8 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #3a2a8a 0%, transparent 55%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .head { font-family: var(--head); font-weight: 600; letter-spacing: .2px; margin: 0; }
button { font-family: var(--body); cursor: pointer; }
input, select, textarea { font-family: var(--body); font-size: 16px; }
a { color: inherit; }
.hidden { display: none !important; }

/* floating bubbles background */
.bubbles { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bubbles span {
  position: absolute; bottom: -80px; border-radius: 50%;
  background: rgba(255,255,255,.06); animation: rise linear infinite;
}
@keyframes rise { to { transform: translateY(-120vh) translateX(40px); } }

.wrap { position: relative; z-index: 1; min-height: 100%; display: flex; flex-direction: column; }

/* brand */
.brand { font-family: var(--head); font-weight: 700; font-size: 22px; display: inline-flex; align-items: baseline; gap: 6px; }
.brand b { color: var(--accent); }
.logo-big { font-family: var(--head); font-weight: 700; font-size: clamp(40px, 9vw, 72px); line-height: 1; text-shadow: 0 4px 0 rgba(0,0,0,.25); }
.logo-big b { color: var(--accent); }

/* card + inputs */
.card { background: var(--panel); color: var(--ink); border-radius: var(--radius); padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.field { width: 100%; padding: 14px 14px; border: 2px solid var(--line); border-radius: 10px; font-size: 18px; text-align: center; font-weight: 600; color: var(--ink); outline: none; }
.field:focus { border-color: var(--b); }
.btn { border: 0; border-radius: 10px; padding: 14px 18px; font-size: 17px; font-weight: 700; color: #fff; background: #14213d; box-shadow: 0 4px 0 rgba(0,0,0,.25); transition: transform .06s; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn.big { padding: 16px 28px; font-size: 20px; }
.btn.yellow { background: var(--accent); color: #14213d; }
.btn.green { background: var(--good); }
.btn.ghost { background: rgba(255,255,255,.14); box-shadow: none; }
.btn.light { background: #eef1f7; color: var(--ink); box-shadow: none; }
.btn.danger { background: var(--bad); }
.btn.sm { padding: 8px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.err { color: var(--bad); font-weight: 600; font-size: 14px; min-height: 18px; }

/* shapes */
.shape { width: 34px; height: 34px; flex: 0 0 auto; background: #fff; }
.shape.s0 { clip-path: polygon(50% 6%, 96% 90%, 4% 90%); }
.shape.s1 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); transform: scale(.92); }
.shape.s2 { border-radius: 50%; transform: scale(.88); }
.shape.s3 { border-radius: 4px; transform: scale(.8); }
.c0 { background: var(--a) !important; } .c1 { background: var(--b) !important; }
.c2 { background: var(--c) !important; } .c3 { background: var(--d) !important; }

/* answer grid */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ans {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left;
  border: 0; border-radius: 12px; padding: 18px 18px; color: #fff; font-size: 20px; font-weight: 700;
  box-shadow: 0 5px 0 rgba(0,0,0,.25); min-height: 84px; transition: transform .08s, opacity .2s, filter .2s;
}
.ans:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.ans.picked { outline: 4px solid #fff; outline-offset: -4px; }
.ans.dim { opacity: .28; filter: grayscale(.4); }
.ans .tick { margin-left: auto; font-size: 26px; }
.ans .count { margin-left: auto; font-family: var(--head); font-size: 26px; }

/* timer ring */
.timer { position: relative; width: 92px; height: 92px; }
.timer svg { transform: rotate(-90deg); }
.timer .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--head); font-size: 34px; font-weight: 700; }
.timer.urgent .num { color: #ff6b6b; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }

/* progress bar (phone) */
.bar { height: 8px; background: rgba(255,255,255,.18); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s linear; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.14); padding: 8px 14px; border-radius: 99px; font-weight: 600; font-size: 15px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: 0 0 auto; }
.pop { animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* leaderboard */
.lb { display: flex; flex-direction: column; gap: 10px; }
.lb .row { display: flex; align-items: center; gap: 14px; background: #fff; color: var(--ink); border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 20px; transition: transform .5s; }
.lb .row .rank { font-family: var(--head); width: 32px; color: var(--muted); }
.lb .row .pts { margin-left: auto; font-family: var(--head); }
.lb .row .move { font-size: 13px; font-weight: 700; color: var(--good); margin-left: 6px; }
.lb .row.first { background: var(--accent); }
.slide-in { animation: slidein .45s ease both; }
@keyframes slidein { from { transform: translateX(-40px); opacity: 0; } }

/* result splash (phone) */
.splash { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 24px; }
.splash.good { background: linear-gradient(160deg, #1fae7a, #11815a); }
.splash.bad  { background: linear-gradient(160deg, #e5484d, #a92f33); }
.splash.wait { background: transparent; }
.splash .big { font-family: var(--head); font-size: 44px; font-weight: 700; }
.splash .pts { background: rgba(0,0,0,.22); padding: 10px 22px; border-radius: 99px; font-family: var(--head); font-size: 28px; }
.icon-circle { width: 96px; height: 96px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 54px; font-weight: 700; }

/* podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.podium .step { width: 200px; text-align: center; }
.podium .step .name { font-family: var(--head); font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.podium .step .block { border-radius: 12px 12px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 16px; font-family: var(--head); font-weight: 700; color: #14213d; transform-origin: bottom; animation: grow .9s cubic-bezier(.2,1.2,.4,1) both; }
.podium .p1 .block { height: 260px; background: linear-gradient(#ffd84d, #f2b705); font-size: 64px; animation-delay: 2.2s; }
.podium .p2 .block { height: 190px; background: linear-gradient(#e9eef7, #b8c2d6); font-size: 52px; animation-delay: 1.2s; }
.podium .p3 .block { height: 140px; background: linear-gradient(#f2b48a, #cf8150); font-size: 44px; animation-delay: .3s; }
.podium .step .score { font-size: 18px; margin-top: 4px; }
.podium .p1 .name { animation-delay: 2.2s; } .podium .p2 .name { animation-delay: 1.2s; } .podium .p3 .name { animation-delay: .3s; }
.podium .name { animation: fadein .5s both; }
@keyframes grow { from { transform: scaleY(0); } }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } }

/* distribution bars (host) */
.dist { display: flex; align-items: flex-end; justify-content: center; gap: 28px; height: 220px; }
.dist .col { width: 110px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dist .col .v { font-family: var(--head); font-size: 28px; font-weight: 700; }
.dist .col .b { width: 100%; border-radius: 8px 8px 0 0; min-height: 8px; transition: height .8s cubic-bezier(.2,1.2,.4,1); }
.dist .col .lbl { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.dist .col.wrong { opacity: .35; }

/* utility */
.row-flex { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.center { text-align: center; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #14213d; color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 99; box-shadow: 0 8px 20px rgba(0,0,0,.3); }
canvas.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
