/* Pedra brand (from the Pedra invoice): coral · orange · violet · cyan on ink and cream */
:root {
  --ink: #161a23;
  --ink-2: #1e2330;
  --ink-3: #2a3040;
  --cream: #fbf8f3;
  --paper: #ffffff;
  --line: #ece7df;
  --line-2: #ddd6ca;
  --muted: #6b7080;
  --text: #161a23;
  --coral: #ff5a5f;
  --coral-dark: #e8434a;
  --orange: #ffb23f;
  --pink: #d58fb4;
  --violet: #9b7bf7;
  --blue: #4f8dfb;
  --cyan: #2fd3e6;
  --ok: #12a37a;
  --ok-tint: #e3f6ef;
  --bad: #ff5a5f;
  --bad-tint: #ffe9e9;
  --part: #f0a020;
  --part-tint: #fff3df;
  --grad: linear-gradient(90deg, #ff5a5f 0%, #ff9a3c 28%, #d58fb4 50%, #8f8af7 72%, #3cc8ea 100%);
  --ka: "Noto Sans Georgian", "Manrope", system-ui, sans-serif;
  --lat: "Manrope", "Noto Sans Georgian", system-ui, sans-serif;
  --stage: var(--cream);
  --card: var(--paper);
}
@media (prefers-color-scheme: dark) {
  :root {
    --stage: #12151d;
    --card: var(--ink-2);
    --text: #f3efe8;
    --muted: #a3a8b6;
    --line: #2c3242;
    --line-2: #39405290;
    --ok-tint: #0f3a30;
    --bad-tint: #43202a;
    --part-tint: #3d2f14;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--ka); font-size: 17px; line-height: 1.6; font-weight: 500;
  color: var(--text); background: var(--stage);
  -webkit-font-smoothing: antialiased;
}
body.dark { background: var(--ink); color: #f3efe8; }
button { font: inherit; color: inherit; }
a { color: inherit; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .85em; background: rgba(127,127,127,.14); padding: 1px 6px; border-radius: 6px; word-break: break-word; }
.lat { font-family: var(--lat); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }

/* ================= HOME ================= */
.home { position: relative; overflow: hidden; background: var(--ink); color: #f3efe8; min-height: 100vh; }
.blobs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; }
.b1 { width: 520px; height: 420px; left: -180px; top: -160px; background: #ff5a5f; animation: drift1 22s ease-in-out infinite alternate; }
.b2 { width: 460px; height: 380px; right: -160px; top: -120px; background: #3cc8ea; opacity: .45; animation: drift2 26s ease-in-out infinite alternate; }
.b3 { width: 380px; height: 320px; right: 10%; top: 120px; background: #9b7bf7; opacity: .42; animation: drift1 30s ease-in-out infinite alternate-reverse; }
.b4 { width: 360px; height: 300px; left: 30%; top: -200px; background: #ffb23f; opacity: .38; animation: drift2 24s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(90px, 60px) scale(1.12); } }
@keyframes drift2 { to { transform: translate(-80px, 70px) scale(1.08); } }
.grain { position: absolute; inset: 0; pointer-events: none; opacity: .08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.fade { position: absolute; left: 0; right: 0; top: 380px; height: 360px; background: linear-gradient(to bottom, rgba(22,26,35,0), var(--ink) 75%); pointer-events: none; }

.wrap { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.nav { display: flex; align-items: center; justify-content: space-between; padding: max(18px, env(safe-area-inset-top)) 0 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.brand span { font-family: var(--lat); font-weight: 800; font-size: 21px; letter-spacing: -.4px; color: #fff; }
.nav-tag { font-family: var(--lat); font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: rgba(255,255,255,.62); }

.hero { padding: 44px 0 34px; max-width: 760px; }
.hero-mark { width: 64px; height: 64px; margin-bottom: 22px; filter: drop-shadow(0 10px 30px rgba(255,90,95,.35)); }
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; padding: 6px 14px 6px 10px; border-radius: 99px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #fff; backdrop-filter: blur(8px); }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); }
.hero h1 { font-weight: 900; font-size: clamp(32px, 7.4vw, 62px); line-height: 1.08; letter-spacing: -.5px; margin: 18px 0 16px; color: #fff; }
.hero h1 .lat { font-weight: 800; letter-spacing: -1.5px; }
.hero p { margin: 0; font-size: 17px; color: rgba(255,255,255,.72); max-width: 32em; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 26px; }

.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat { min-width: 92px; padding: 10px 14px; border-radius: 16px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.stat b { display: block; font-family: var(--lat); font-weight: 800; font-size: 24px; line-height: 1.1; color: #fff; }
.stat small { font-size: 13px; color: rgba(255,255,255,.62); }
.stat.star b { color: var(--orange); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; padding: 0 26px; border-radius: 16px; border: 0; cursor: pointer;
  font-family: var(--ka); font-weight: 800; font-size: 18px; text-decoration: none;
  background: var(--coral); color: #fff; box-shadow: 0 4px 0 var(--coral-dark);
  transition: transform .12s, box-shadow .12s, background .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: #ff6b70; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-dark); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn:disabled { background: var(--line-2); box-shadow: 0 4px 0 rgba(0,0,0,.08); color: var(--muted); cursor: not-allowed; transform: none; }
.btn.dark { background: var(--ink); box-shadow: 0 4px 0 #000; }
@media (prefers-color-scheme: dark) { .btn.dark { background: #f3efe8; color: var(--ink); box-shadow: 0 4px 0 #9a958c; } }
.btn.light { background: #fff; color: var(--ink); box-shadow: 0 4px 0 rgba(255,255,255,.35); }
.btn.ghost { background: transparent; color: #fff; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.btn.ghost:hover { box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.btn .arr { font-family: var(--lat); }

.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 14px; }
.sec-h h2 { margin: 0; font-size: 22px; font-weight: 800; color: #fff; }
.sec-h span { font-size: 14px; color: rgba(255,255,255,.55); }

.tiles { list-style: none; margin: 0; padding: 0 0 40px; display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  --c: var(--coral);
  position: relative; display: flex; flex-direction: column; height: 100%; min-height: 168px;
  padding: 18px 18px 16px; border-radius: 22px; text-decoration: none; overflow: hidden;
  background: var(--ink-2); border: 1px solid rgba(255,255,255,.08);
  transition: transform .18s, border-color .18s, background .18s;
  -webkit-tap-highlight-color: transparent;
}
.tile::before { content: ""; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: var(--c); opacity: .16; filter: blur(30px); transition: opacity .2s; }
.tile:hover { transform: translateY(-3px); border-color: var(--c); }
.tile:hover::before { opacity: .32; }
.tile:active { transform: scale(.98); }
.tile:focus-visible { outline: 3px solid var(--c); outline-offset: 3px; }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; }
.tile-n { font-family: var(--lat); font-weight: 800; font-size: 54px; line-height: .9; letter-spacing: -2px; color: var(--c); }
.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 18px; height: 18px; }
.stars .on { fill: var(--orange); }
.stars .off { fill: rgba(255,255,255,.14); }
.tile-t { margin: 14px 0 4px; font-weight: 800; font-size: 18px; line-height: 1.3; color: #fff; }
.tile-m { margin-top: auto; padding-top: 10px; font-size: 14px; color: rgba(255,255,255,.6); display: flex; justify-content: space-between; gap: 8px; }
.tile-m b { color: #fff; font-family: var(--lat); font-weight: 700; }
.tile-bar { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--c); border-radius: 0 4px 4px 0; }
.tile.c1 { --c: #ff5a5f; } .tile.c2 { --c: #ff9a3c; } .tile.c3 { --c: #ffb23f; } .tile.c4 { --c: #d58fb4; }
.tile.c5 { --c: #9b7bf7; } .tile.c6 { --c: #8f8af7; } .tile.c7 { --c: #4f8dfb; } .tile.c8 { --c: #2fd3e6; }

.foot { position: relative; z-index: 1; border-top: 1px solid rgba(255,255,255,.08); }
.foot .wrap { display: flex; align-items: center; gap: 12px; padding-top: 20px; padding-bottom: max(26px, env(safe-area-inset-bottom)); font-size: 13px; color: rgba(255,255,255,.55); line-height: 1.45; }
.foot img { width: 26px; height: 26px; flex: none; }
.foot b { color: #fff; font-family: var(--lat); font-weight: 800; }

/* ================= QUESTION ================= */
.play { max-width: 760px; margin: 0 auto; padding: 0 16px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.qbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 0 12px; background: var(--stage); }
.x { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; text-decoration: none; color: var(--muted); }
.x:hover { background: rgba(127,127,127,.12); color: var(--text); }
.x svg { width: 22px; height: 22px; }
.segs { flex: 1; display: flex; gap: 4px; }
.segs i { flex: 1; height: 8px; border-radius: 99px; background: var(--line); transition: background .25s; }
.segs i.now { background: var(--ink); }
@media (prefers-color-scheme: dark) { .segs i.now { background: #f3efe8; } }
.segs i.ok { background: var(--ok); }
.segs i.bad { background: var(--coral); }
.streak { display: inline-flex; align-items: center; gap: 4px; min-width: 48px; justify-content: flex-end; font-family: var(--lat); font-weight: 800; font-size: 17px; color: var(--orange); }
.streak svg { width: 20px; height: 20px; }
.streak.zero { color: var(--line-2); }
.streak.bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.35); } }

.qmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 12px; }
.qnum { font-family: var(--lat); font-weight: 800; font-size: 14px; color: var(--muted); margin-right: 4px; }
.chip { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: rgba(127,127,127,.12); color: var(--muted); }
.qt { font-weight: 900; font-size: clamp(24px, 5.6vw, 32px); line-height: 1.2; letter-spacing: -.2px; margin: 0 0 12px; }
.qx p { margin: 0 0 12px; font-size: 17px; }
.hint { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; color: var(--violet); margin: 2px 0 10px; }
.hint::before { content: ""; width: 16px; height: 16px; border-radius: 5px; border: 2.5px solid currentColor; }

.opts { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 10px; }
.opt {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: start;
  padding: 14px 14px 15px; min-height: 60px; line-height: 1.5; font-size: 17px; font-weight: 600;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  box-shadow: 0 3px 0 var(--line);
  transition: border-color .15s, background .15s, transform .12s, box-shadow .12s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover:not(:disabled) { border-color: var(--line-2); }
.opt:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.opt:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; }
.opt:disabled { cursor: default; }
.key { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-family: var(--lat); font-weight: 800; font-size: 16px; color: var(--muted); border: 2px solid var(--line); background: var(--stage); transition: all .15s; }
.opt-b { padding-top: 5px; }
.opt.sel { border-color: var(--violet); box-shadow: 0 3px 0 var(--violet); }
.opt.sel .key { background: var(--violet); border-color: var(--violet); color: #fff; }
.why { display: none; margin-top: 8px; font-size: 15px; font-weight: 500; line-height: 1.55; color: var(--muted); }
.done .why { display: block; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.tag { font-weight: 800; margin-right: 4px; }
.opt.ok { border-color: var(--ok); background: var(--ok-tint); box-shadow: 0 3px 0 var(--ok); }
.opt.ok .key { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.ok .tag, .opt.miss .tag { color: var(--ok); }
.opt.bad { border-color: var(--coral); background: var(--bad-tint); box-shadow: 0 3px 0 var(--coral); animation: shake .4s ease; }
.opt.bad .key { background: var(--coral); border-color: var(--coral); color: #fff; }
.opt.bad .tag { color: var(--coral); }
.opt.miss { border-color: var(--ok); border-style: dashed; box-shadow: none; }
.opt.miss .key { border-color: var(--ok); color: var(--ok); }
.opt.pop { animation: pop .35s ease; }
.opt.dim { opacity: .72; }
@keyframes pop { 45% { transform: scale(1.025); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.sheet {
  position: sticky; bottom: 0; z-index: 5; margin: auto -16px 0; padding: 14px 16px max(14px, env(safe-area-inset-bottom));
  background: var(--stage); border-top: 2px solid transparent;
  display: flex; align-items: center; gap: 14px;
}
.spacer { height: 18px; flex: 1; }
.sheet { border-top: 0 !important; box-shadow: 0 0 0 100vmax var(--sheet-bg, var(--stage)), 0 -2px 0 100vmax var(--sheet-line, transparent); clip-path: inset(-2px -100vmax 0 -100vmax); }
.sheet.ok { --sheet-bg: var(--ok-tint); background: var(--ok-tint); --sheet-line: var(--ok); }
.sheet.bad { --sheet-bg: var(--bad-tint); background: var(--bad-tint); --sheet-line: var(--coral); }
.sheet.part { --sheet-bg: var(--part-tint); background: var(--part-tint); --sheet-line: var(--part); }
.sheet.show { animation: up .28s ease both; }
@keyframes up { from { transform: translateY(100%); } }
.verdict { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 19px; }
.verdict .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.ok .verdict { color: var(--ok); } .ok .ic { background: var(--ok); }
.bad .verdict { color: var(--coral); } .bad .ic { background: var(--coral); }
.part .verdict { color: var(--part); } .part .ic { background: var(--part); }
.ic svg { width: 20px; height: 20px; }
.plus { font-family: var(--lat); font-weight: 800; font-size: 15px; color: var(--ok); animation: plus .8s ease both; }
@keyframes plus { from { opacity: 0; transform: translateY(8px); } 30% { opacity: 1; transform: none; } }
.sheet .btn { min-width: 160px; }
.sheet.ok .btn { background: var(--ok); box-shadow: 0 4px 0 #0b7a5a; }
.sheet.part .btn { background: var(--part); box-shadow: 0 4px 0 #c07d10; }
@media (max-width: 560px) {
  .sheet { flex-wrap: wrap; gap: 10px; }
  .sheet .btn { width: 100%; }
  .sheet .verdict:empty { display: none; }
}
.kbd { display: none; font-size: 12px; color: var(--muted); text-align: center; margin: 0 0 6px; }
@media (hover: hover) and (min-width: 900px) { .kbd { display: block; } }

/* ================= RESULT ================= */
.result { min-height: 100vh; min-height: 100dvh; position: relative; overflow: hidden; background: var(--ink); color: #fff; display: flex; flex-direction: column; }
.result .wrap { max-width: 560px; flex: 1; display: flex; flex-direction: column; text-align: center; }
.res-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 20px 0 32px; }
.res-ch { font-size: 15px; font-weight: 700; color: rgba(255,255,255,.6); }
.big { font-family: var(--lat); font-weight: 800; font-size: clamp(88px, 26vw, 132px); line-height: 1; letter-spacing: -5px; margin: 10px 0 4px; }
.big small { font-size: .36em; letter-spacing: -1px; color: rgba(255,255,255,.5); -webkit-text-fill-color: rgba(255,255,255,.5); }
.res-stars { display: flex; justify-content: center; gap: 10px; margin: 14px 0 18px; }
.res-stars svg { width: 52px; height: 52px; fill: rgba(255,255,255,.12); }
.res-stars svg.on { fill: var(--orange); animation: star .5s cubic-bezier(.3,1.6,.5,1) both; filter: drop-shadow(0 6px 18px rgba(255,178,63,.45)); }
@keyframes star { from { transform: scale(0) rotate(-40deg); } }
.res-stars svg:nth-child(2) { width: 64px; height: 64px; margin-top: -8px; }
.res-t { font-size: 26px; font-weight: 900; margin: 0 0 8px; }
.res-p { color: rgba(255,255,255,.7); margin: 0 auto 26px; max-width: 26em; }
.best { display: inline-block; margin: 0 auto 6px; padding: 4px 12px; border-radius: 99px; background: var(--grad); color: var(--ink); font-weight: 800; font-size: 14px; }
.res-act { display: grid; gap: 10px; }
@media (min-width: 560px) { .res-act { grid-template-columns: 1fr 1fr; } .res-act .btn:first-child { grid-column: span 2; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 619px) { .tile { min-height: 0; padding: 16px 16px 14px; } .tile-n { font-size: 46px; } .tile-t { margin-top: 10px; } }
