/* =========================================================
   MeQuiz — premium dark / glass UI
   ========================================================= */

:root {
  --bg: #08080c;
  --glass: rgba(16, 16, 23, .62);
  --glass-solid: #101017;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --stroke: rgba(255, 255, 255, .10);
  --stroke-2: rgba(255, 255, 255, .17);
  --text: #f4f4f7;
  --muted: rgba(235, 235, 245, .56);
  --muted-2: rgba(235, 235, 245, .36);
  --accent: #6e7bff;
  --accent-2: #aa6bff;
  --cyan: #4fd1ff;
  --green: #30d158;
  --red: #ff453a;
  --amber: #ffd60a;
  --r-xs: 12px;
  --r-sm: 16px;
  --r-md: 22px;
  --r-lg: 28px;
  --sh-1: 0 8px 30px rgba(0, 0, 0, .34);
  --sh-2: 0 20px 60px rgba(0, 0, 0, .55);
  --nav-h: 78px;
  --ease: cubic-bezier(.22, .85, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -.01em;
  overflow: hidden;
  overscroll-behavior: none;
}

button, input, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
svg.ic { display: block; flex: none; }

/* ---------- ambient background ---------- */
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .34; }
.blob-1 { width: 320px; height: 320px; top: -110px; left: -90px; background: #4a53ff; }
.blob-2 { width: 300px; height: 300px; top: 32%; right: -140px; background: #8b3bff; opacity: .24; }
.blob-3 { width: 340px; height: 340px; bottom: -150px; left: 20%; background: #0b6f8f; opacity: .22; }

/* ---------- shell ---------- */
.app {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  height: 100dvh;
  margin: 0 auto;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--stroke);
}

.topbar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(100%, 480px);
  height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0 0 22px 22px;
  border-width: 0 0 1px 0;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
body.immersed .topbar { opacity: 0; pointer-events: none; transform: translate(-50%, -100%); }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(110, 123, 255, .42);
}
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: -.045em; }
.brand-name span { color: var(--accent); }

.xp-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--stroke);
  font-size: 12px; font-weight: 700; color: var(--amber);
}
.xp-chip .ic { color: var(--amber); }

/* ---------- screens ---------- */
.screens { position: relative; width: 100%; height: 100dvh; }
.screen {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.995);
  transition: opacity .3s var(--ease), transform .3s var(--ease), visibility .3s;
}
.screen.is-active { opacity: 1; visibility: visible; transform: none; }
.scroll {
  height: 100%; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(78px + env(safe-area-inset-top)) 18px calc(var(--nav-h) + 34px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar { display: none; }

/* ---------- bottom capsule nav ---------- */
.tabbar {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  z-index: 60;
  width: min(calc(100% - 28px), 452px);
  height: 66px;
  padding: 7px;
  border-radius: 999px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  box-shadow: var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
body.immersed .tabbar,
body.immersed .fab { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(24px); }
body.immersed .fab { transform: translateY(24px); }

.tab {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  border-radius: 999px; color: var(--muted);
  transition: background .25s var(--ease), color .25s var(--ease), transform .2s var(--ease);
}
.tab:active { transform: scale(.94); }
.tab .tab-ico {
  width: 30px; height: 26px; border-radius: 999px;
  display: grid; place-items: center; transition: box-shadow .25s var(--ease);
}
.tab .tab-label { font-size: 9.5px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.tab.active {
  color: #fff;
  background: rgba(0, 0, 0, .46);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .055), 0 6px 16px rgba(0, 0, 0, .35);
}
.tab.active .tab-ico {
  background: transparent;
  box-shadow: none;
}
.tab.active .tab-ico .ic {
  color: var(--accent);
  fill: var(--accent);
  stroke: var(--accent);
  filter: none;
}
.tab.active .tab-ico .ic.no-fill { fill: none; stroke: var(--accent); }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: max(calc(50% - 226px), 18px);
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 59;
  width: 58px; height: 58px; border-radius: 20px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, rgba(110, 123, 255, .9), rgba(170, 107, 255, .85));
  box-shadow: 0 14px 34px rgba(110, 123, 255, .4), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .22s var(--ease), opacity .25s var(--ease), box-shadow .22s;
}
.fab:active { transform: scale(.9); }
body:not([data-screen="quizzes"]) .fab { opacity: 0; pointer-events: none; transform: translateY(18px); }

/* ---------- generic blocks ---------- */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .058), rgba(255, 255, 255, .028));
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.small { font-size: 12.5px; }
.bold { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted-2);
}
.section-title { margin: 26px 2px 12px; font-size: 17px; font-weight: 700; letter-spacing: -.03em; }
.screen-heading { margin: 4px 2px 20px; }
.screen-heading h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.05em; }
.screen-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.divider { height: 1px; background: var(--stroke); margin: 18px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-sm);
  font-weight: 650; font-size: 14px;
  transition: transform .2s var(--ease), opacity .2s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.965); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(110, 123, 255, .34), inset 0 1px 0 rgba(255, 255, 255, .26);
}
.btn-ghost { background: var(--surface); border: 1px solid var(--stroke); color: var(--text); }
.btn-danger { background: rgba(255, 69, 58, .14); border: 1px solid rgba(255, 69, 58, .32); color: #ff8a80; }
.btn-block { width: 100%; }
.btn-lg { min-height: 62px; border-radius: var(--r-md); font-size: 16px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 13px;
  display: grid; place-items: center; color: var(--muted);
  background: var(--surface); border: 1px solid var(--stroke);
  transition: transform .2s var(--ease), color .2s, background .2s;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn:hover { color: #fff; background: var(--surface-2); }
.icon-btn.danger:hover { color: #ff8a80; background: rgba(255, 69, 58, .14); }

/* ---------- avatars & badges ---------- */
.avatar {
  width: 44px; height: 44px; border-radius: 15px; flex: none;
  display: grid; place-items: center; font-weight: 750; font-size: 14px; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3);
}
.avatar.lg { width: 84px; height: 84px; border-radius: 28px; font-size: 26px; }
.avatar.sm { width: 34px; height: 34px; border-radius: 12px; font-size: 11px; }
.avatar.stack-ava { box-shadow: 0 0 0 2px var(--glass-solid); margin-left: -12px; }
.avatar.stack-ava:first-child { margin-left: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 9px; border-radius: 999px; font-size: 10.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--stroke); color: var(--muted);
}
.badge.green { background: rgba(48, 209, 88, .13); border-color: rgba(48, 209, 88, .3); color: #6ee897; }
.badge.red { background: rgba(255, 69, 58, .13); border-color: rgba(255, 69, 58, .3); color: #ff9188; }
.badge.amber { background: rgba(255, 214, 10, .12); border-color: rgba(255, 214, 10, .28); color: #ffe27a; }
.badge.violet { background: rgba(110, 123, 255, .15); border-color: rgba(110, 123, 255, .34); color: #b3bcff; }

/* ---------- home hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 26px 22px 22px;
  border-radius: 32px;
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(170, 107, 255, .5), transparent 60%),
    linear-gradient(150deg, rgba(60, 70, 190, .65), rgba(18, 18, 28, .85));
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 24px 60px rgba(40, 40, 130, .38), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.hero::after {
  content: ""; position: absolute; width: 260px; height: 260px; right: -110px; top: -120px;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, .025), 0 0 0 80px rgba(255, 255, 255, .018);
  pointer-events: none;
}
.hero .hero-tag { display: inline-flex; align-items: center; gap: 7px; color: rgba(255,255,255,.72); font-size: 11px; font-weight: 650; }
.hero h1 { position: relative; margin: 12px 0 6px; font-size: 29px; line-height: 1.12; font-weight: 800; letter-spacing: -.055em; max-width: 85%; }
.hero p { position: relative; margin: 0 0 20px; color: rgba(255, 255, 255, .68); font-size: 13px; }
.hero .btn { position: relative; width: 100%; background: #fff; color: #15151f; box-shadow: 0 14px 34px rgba(0,0,0,.3); }
.hero .btn .ic { color: var(--accent); }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-strip .card { padding: 14px 12px; text-align: center; }
.stat-strip b { display: block; font-size: 19px; letter-spacing: -.04em; }
.stat-strip span { font-size: 10.5px; color: var(--muted); }

/* ---------- list items ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--stroke);
  transition: transform .2s var(--ease), background .2s;
}
.item:active { transform: scale(.985); }
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--surface-2); }
.item-title { font-size: 14px; font-weight: 650; }
.item-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.quiz-card { padding: 16px; border-radius: var(--r-lg); }
.quiz-ico {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: grid; place-items: center;
  color: var(--muted); background: transparent;
}
.quiz-card .quiz-ico {
  color: #fff; background: linear-gradient(145deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.quiz-ico .ic { display: block; margin: auto; transform: none; fill: none; }
.row > .quiz-ico, .between > .quiz-ico { margin: 0; }
.quiz-card .actions { display: flex; gap: 6px; }
.quiz-card .actions .icon-btn { width: 34px; height: 34px; border-radius: 11px; }

.empty {
  padding: 46px 24px; text-align: center; border-radius: var(--r-lg);
  border: 1px dashed var(--stroke-2); background: rgba(255,255,255,.02);
}
.empty .empty-ico {
  width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 20px;
  display: grid; place-items: center; color: var(--accent); background: rgba(110,123,255,.12);
}
.empty h3 { margin: 0 0 6px; font-size: 16px; }
.empty p { margin: 0 auto 18px; max-width: 240px; color: var(--muted); font-size: 12.5px; }

/* ---------- friends leaderboard ---------- */
.lb-card { padding: 18px; }
.rank-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--stroke);
}
.rank-row:first-of-type { border-top: 0; padding-top: 2px; }
.rank-num {
  width: 22px; flex: none; text-align: center;
  font-size: 12px; font-weight: 750; color: var(--muted-2);
}
.rank-num.top1 { color: var(--amber); }
.rank-num.top2 { color: #d7dbe8; }
.rank-num.top3 { color: #d99b6a; }
.rank-num .ic { margin: 0 auto; }
.rank-xp { font-size: 13px; font-weight: 750; color: #c3cbff; white-space: nowrap; }
.rank-xp small { font-size: 9px; color: var(--muted); font-weight: 650; }
.rank-bar { height: 4px; border-radius: 99px; background: rgba(255,255,255,.075); overflow: hidden; margin-top: 6px; }
.rank-bar i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s var(--ease);
}
.rank-meta { margin-top: 4px; font-size: 10px; color: var(--muted-2); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(3, 3, 7, .62);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .22s var(--ease);
}
.overlay[hidden] { display: none; }
.overlay.centered { align-items: center; padding: 20px; }

.sheet {
  position: relative;
  width: min(100%, 480px);
  max-height: calc(100dvh - 16px);
  height: auto;
  display: flex; flex-direction: column;
  background: rgba(16, 16, 23, .94);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--stroke);
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
  box-shadow: var(--sh-2);
  animation: slideUp .34s var(--ease);
  overflow: hidden;
}
.overlay.centered .sheet { border-radius: 28px; border-bottom: 1px solid var(--stroke); max-height: 90dvh; }
.sheet.full { height: calc(100dvh - 8px); }
.grabber { width: 38px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.2); margin: 10px auto 2px; flex: none; }

.sheet-head {
  flex: none; padding: 10px 20px 14px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--stroke);
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.035em; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px; scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }
.sheet-foot {
  flex: none; padding: 14px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stroke); background: rgba(10,10,16,.55);
}
.sheet-foot .between > span {
  display: inline-flex; align-items: center; gap: 6px;
  vertical-align: middle; white-space: nowrap;
}
.sheet-foot .between > span .ic { display: block; margin: 0; transform: none; }
.rank-row .rank-status { flex: none; }
.rank-row .rank-status .badge { white-space: nowrap; }

/* ---------- history ownership colors ---------- */
.history-card.own {
  border-color: rgba(110, 123, 255, .38);
  background: linear-gradient(145deg, rgba(110,123,255,.12), rgba(22,22,31,.85));
}
.history-card.other {
  border-color: rgba(255, 149, 10, .4);
  background: linear-gradient(145deg, rgba(255,69,58,.14), rgba(255,214,10,.08));
}
.history-card .owner-tag { flex: none; white-space: nowrap; }
.history-card.own .owner-tag { color: #b3bcff; }
.history-card.other .owner-tag { color: #ffc46b; }

/* ---------- inputs ---------- */
.field-label { display: block; margin: 0 0 8px 2px; font-size: 12px; font-weight: 650; color: var(--muted); }
.input, .textarea {
  width: 100%; padding: 15px 16px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--stroke);
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus, .textarea:focus {
  border-color: rgba(110, 123, 255, .6); background: rgba(110, 123, 255, .06);
  box-shadow: 0 0 0 4px rgba(110, 123, 255, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--accent); }
.input-icon .input { padding-left: 44px; }
.field + .field { margin-top: 18px; }

/* ---------- wizard ---------- */
.wiz-progress-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.progress { height: 6px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; flex: 1; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s var(--ease); }
.wiz-step { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }

.segment {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: rgba(255,255,255,.045); border: 1px solid var(--stroke); border-radius: 15px;
}
.segment button {
  padding: 10px; border-radius: 11px; font-size: 12.5px; font-weight: 650; color: var(--muted);
  transition: .2s var(--ease);
}
.segment button.active { background: rgba(110,123,255,.2); color: #fff; box-shadow: inset 0 0 0 1px rgba(110,123,255,.35); }

.tpl-grid { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; padding-right: 2px; }
.tpl {
  padding: 13px 14px; border-radius: 15px; text-align: left;
  background: var(--surface); border: 1px solid var(--stroke);
  font-size: 13px; transition: .2s var(--ease);
}
.tpl:active { transform: scale(.985); }
.tpl.active { border-color: rgba(110,123,255,.55); background: rgba(110,123,255,.12); }
.tpl small { display: block; color: var(--muted-2); font-size: 10.5px; margin-top: 3px; }

.opt-edit { display: flex; align-items: center; gap: 12px; }
.opt-edit + .opt-edit { margin-top: 9px; }
.opt-edit .input { padding: 14px 15px; }
.radio {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: 1.6px solid rgba(255,255,255,.32); display: grid; place-items: center;
  color: #fff; transition: .2s var(--ease);
}
.radio.on {
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  border-color: transparent; box-shadow: 0 0 0 4px rgba(110,123,255,.17);
}
.hint-field .input { padding-left: 44px; }
.hint-note { margin: 8px 2px 0; font-size: 11px; color: var(--muted-2); }

/* ---------- play session ---------- */
.play-top { display: flex; align-items: center; gap: 12px; padding: 4px 2px 18px; }
.play-dots { display: flex; gap: 5px; flex: 1; }
.play-dots i { height: 5px; flex: 1; border-radius: 99px; background: rgba(255,255,255,.12); transition: background .3s; }
.play-dots i.done { background: rgba(110,123,255,.75); }
.play-dots i.now { background: #fff; }

.q-card { padding: 24px 20px; border-radius: 28px; }
.q-card h2 { margin: 0 0 22px; font-size: 21px; line-height: 1.35; font-weight: 750; letter-spacing: -.035em; }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opt {
  width: 100%; min-height: 58px; padding: 14px 17px; border-radius: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left; font-size: 14px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--stroke);
  transition: transform .2s var(--ease), background .2s, border-color .2s, color .2s;
}
.opt:active { transform: scale(.98); }
.opt-check-wrap {
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
}
.opt-check-wrap .ic { display: block; margin: auto; transform: none; }
.opt .opt-check { opacity: 0; transition: opacity .2s; }
.opt.correct { background: rgba(48,209,88,.17); border-color: rgba(48,209,88,.55); color: #d9ffe4; }
.opt.correct .opt-check { opacity: 1; color: var(--green); }
.opt.wrong { background: rgba(255,69,58,.16); border-color: rgba(255,69,58,.5); color: #ffd5d2; }
.opt.wrong .opt-check { opacity: 1; color: var(--red); }
.opt.dim { opacity: .5; }

.hint-btn {
  margin-top: 14px; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px; font-size: 12px; font-weight: 650;
  color: #ffe27a; background: rgba(255,214,10,.1); border: 1px solid rgba(255,214,10,.24);
}
.hint-pop {
  margin-top: 12px; padding: 14px 16px; border-radius: 16px; font-size: 13px; line-height: 1.5;
  background: rgba(255,214,10,.09); border: 1px solid rgba(255,214,10,.22); color: #ffeab0;
  animation: fadeIn .25s var(--ease);
}
.feedback { margin-top: 16px; text-align: center; font-size: 13px; font-weight: 650; animation: fadeIn .25s var(--ease); }
.feedback.good { color: var(--green); }
.feedback.bad { color: #ff8a80; }

.xp-fly {
  position: fixed; z-index: 150; pointer-events: none;
  font-size: 18px; font-weight: 800; color: var(--green);
  text-shadow: 0 0 18px rgba(48,209,88,.65);
  animation: xpFly 1s var(--ease) forwards;
}

/* ---------- result ---------- */
.result-ring { width: 190px; height: 190px; margin: 6px auto 14px; position: relative; }
.result-ring svg { transform: rotate(-90deg); }
.result-ring .ring-bg { stroke: rgba(255,255,255,.08); }
.result-ring .ring-fg { stroke: url(#grad); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.result-ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.result-ring .ring-label b { font-size: 46px; font-weight: 800; letter-spacing: -.07em; line-height: 1; }
.result-ring .ring-label span { font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.result-title { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: -.045em; margin: 0 0 6px; }
.result-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.miss-row { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--stroke); }
.miss-row + .miss-row { margin-top: 8px; }
.miss-row b { font-size: 12.5px; font-weight: 650; }
.miss-row p { margin: 4px 0 0; font-size: 11.5px; color: var(--green); }

/* ---------- profile ---------- */
.profile-center {
  min-height: calc(100dvh - 190px);
  display: flex; flex-direction: column; justify-content: center;
}
.profile-hero { padding: 24px 20px; text-align: center; }
.profile-hero .avatar { margin: 0 auto 14px; }
.profile-hero h2 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.04em; }
.profile-hero p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.level-bar { margin-top: 18px; }
.level-bar .between { margin-bottom: 7px; font-size: 11px; font-weight: 650; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-row {
  display: flex; align-items: center; gap: 13px; padding: 15px 16px;
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--stroke);
}
a.menu-row { text-decoration: none; color: inherit; }
.menu-row .menu-ico { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,.06); color: var(--accent); }
.menu-row span { flex: 1; font-size: 13.5px; font-weight: 600; }

.switch { width: 44px; height: 26px; border-radius: 99px; padding: 3px; background: rgba(255,255,255,.14); transition: background .2s; }
.switch i { display: block; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .22s var(--ease); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.switch.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch.on i { transform: translateX(18px); }

/* ---------- share field ---------- */
.link-box {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 15px; background: var(--surface); border: 1px solid var(--stroke);
}
.link-box .ic { color: var(--accent); }
.link-box code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--muted); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; z-index: 200; left: 50%; transform: translateX(-50%);
  bottom: calc(100px + env(safe-area-inset-bottom));
  width: min(calc(100% - 40px), 400px);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 16px; border-radius: 999px; max-width: 100%;
  background: rgba(26,26,34,.92); backdrop-filter: blur(20px);
  border: 1px solid var(--stroke-2); box-shadow: var(--sh-2);
  font-size: 12.5px; font-weight: 600; animation: toastIn .3s var(--ease);
}
.toast.out { animation: toastOut .3s var(--ease) forwards; }
.toast .ic { color: var(--accent); }

/* ---------- animations ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes xpFly { 0% { opacity: 0; transform: translateY(10px) scale(.8); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-90px) scale(1.2); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (min-width: 520px) {
  body { background: #050508; }
  .app { box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 30px 100px rgba(0,0,0,.6); }
}

/* Telegram initData gate */
body.is-gated { overflow: hidden; }
body.is-gated .app { display: none !important; }
.telegram-gate {
  position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(110,123,255,.16), transparent 70%), #08080c;
}
.gate-card {
  width: min(100%, 420px); text-align: center; border-radius: 26px; padding: 34px 24px;
  background: rgba(20,20,28,.78); border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(26px) saturate(160%); -webkit-backdrop-filter: blur(26px) saturate(160%);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.gate-icon {
  width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(110,123,255,.35);
}
.gate-card h1 { margin: 0 0 10px; font-size: 22px; letter-spacing: -.04em; }
.gate-card p { margin: 0 0 22px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.gate-card .btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; }
