:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f7);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #5b4cf0);
  --accent: #5b4cf0;          /* indigo */
  --accent-text: #ffffff;
  --mint: #2fd3a3;
  --mint-ink: #0b6b52;
  --bad: #ff5a5f;
  --card: var(--tg-theme-section-bg-color, var(--bg2));
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }
h1 { font-size: 26px; line-height: 1.15; margin: 8px 0 6px; letter-spacing: -0.3px; }
h2 { font-size: 20px; margin: 22px 0 10px; }
p { margin: 6px 0; }
.hint { color: var(--hint); font-size: 14px; }
.center { text-align: center; }
.hero { text-align: center; padding: 18px 0 6px; }
.hero .emoji { font-size: 56px; line-height: 1; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px 16px; margin: 10px 0 0;
  font-size: 17px; font-weight: 600; cursor: pointer; text-align: center;
  background: var(--accent); color: var(--accent-text);
  transition: transform .06s ease, opacity .15s;
}
.btn:active { transform: scale(0.985); }
.btn.secondary { background: var(--bg2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--link); padding: 10px; font-weight: 500; }
.btn.mint { background: var(--mint); color: #062e23; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }
.progress { height: 6px; background: var(--bg2); border-radius: 6px; overflow: hidden; margin: 6px 0 16px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .25s; }
.q { font-size: 21px; font-weight: 650; line-height: 1.25; margin: 4px 0 16px; min-height: 54px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 2px solid transparent; border-radius: 14px; padding: 14px 14px; margin: 9px 0; text-align: start;
  background: var(--bg2); color: var(--text); font-size: 17px; cursor: pointer;
}
.opt .dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--bg); color: var(--hint); }
.opt.sel { border-color: var(--accent); }
.opt.sel .dot { background: var(--accent); color: #fff; }
.opt.right { border-color: var(--mint); }
.opt.right .dot { background: var(--mint); color: #062e23; }
.opt.wrong { border-color: var(--bad); }
.opt.wrong .dot { background: var(--bad); color: #fff; }
.score { font-size: 64px; font-weight: 800; letter-spacing: -1px; margin: 4px 0; }
.level { font-size: 20px; font-weight: 650; }
.lb { list-style: none; padding: 0; margin: 0; }
.lb li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--hint) 20%, transparent); }
.lb li:last-child { border-bottom: 0; }
.lb .pos { width: 26px; text-align: center; font-weight: 700; color: var(--hint); }
.lb .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .val { font-weight: 700; }
.lb .me .name { font-weight: 700; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.av.big { width: 72px; height: 72px; font-size: 28px; margin: 0 auto 8px; }
.review .item { padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, var(--hint) 20%, transparent); }
.review .item:last-child { border-bottom: 0; }
.review .rq { font-weight: 600; margin-bottom: 4px; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: var(--bg); color: var(--hint); margin-left: 6px; }
.ok { color: var(--mint-ink); }
html.dark .ok, .dark .ok { color: var(--mint); }
.ko { color: var(--bad); }
.tabs { display: flex; gap: 6px; background: var(--bg2); padding: 4px; border-radius: 14px; margin: 4px 0 10px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--text); padding: 9px 6px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.tabs button.on { background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.bar { height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--mint); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--bg2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(0,0,0,.82); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 9; }
.foot { text-align: center; margin-top: 26px; font-size: 13px; color: var(--hint); }
.foot a { color: var(--hint); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; padding: 10px; border-radius: 12px; border: 2px solid var(--bg2); background: var(--bg); color: var(--text); font-weight: 600; cursor: pointer; }
.seg button.on { border-color: var(--accent); }
.logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 8px 24px rgba(91,60,240,.28); display: block; margin: 4px auto 10px; }
