/* Визуальный стиль по мотивам wibes.ru: чёрный фон, Inter + Unbounded,
   фиолетовый акцент #8B6AFB и фирменный градиент red → pink → purple → orange. */
:root {
  --bg: #000;
  --surface: #16161b;
  --surface-2: #242429;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f6f6f9;
  --muted: #9b9bb0;
  --accent: #8b6afb;
  --accent-hover: #9d80ff;
  --ok: #2fd47a;
  --bad: #ff4d6d;
  --grad: linear-gradient(112deg, #fc1717 11%, #f622ad 38%, #c356f0 65%, #ffb00d 92%);
  --radius: 20px;
  --radius-sm: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: -20vh -10vw auto auto;
  width: 70vw;
  height: 70vh;
  background: radial-gradient(closest-side, rgba(195, 86, 240, 0.35), rgba(246, 34, 173, 0.12) 55%, transparent);
  filter: blur(40px);
  pointer-events: none;
  z-index: -1;
}

h1, h2, .grade, .prompt { font-family: Unbounded, Inter, sans-serif; }
h1 { font-size: clamp(30px, 6vw, 48px); line-height: 1.1; letter-spacing: -1px; margin: 16px 0; font-weight: 700; }
h2 { font-size: 20px; margin: 0 0 16px; font-weight: 500; }
a { color: inherit; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
.topbar { padding: 20px 16px; max-width: 760px; margin: 0 auto; }
.badge.logo { text-decoration: none; color: var(--text); font-family: Inter, sans-serif; font-size: 14px; padding: 8px 16px; }
.container { max-width: 760px; margin: 0 auto; padding: 0 16px 64px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card + .card, .card + div { margin-top: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border: 0; border-radius: var(--radius-sm);
  font: 500 15px/1 Inter, sans-serif; color: var(--text); cursor: pointer; text-decoration: none;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); }
.btn-secondary:hover { background: #2f2f36; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); }
.btn-lg { height: 56px; font-size: 16px; width: 100%; }
.btn:focus-visible, .option:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- start ---------- */
.hero { padding-top: 24px; text-align: center; }
.badge {
  display: inline-block; padding: 6px 14px; border-radius: 999px; background: var(--grad);
  font-size: 13px; font-weight: 600;
}
.lead { color: var(--muted); font-size: 18px; max-width: 520px; margin: 0 auto 32px; text-wrap: balance; }
.start-form { display: flex; flex-direction: column; gap: 14px; text-align: left; max-width: 460px; margin: 0 auto 16px; }
.start-form label { font-weight: 600; }
.start-form input[type=password] {
  height: 52px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 16px Inter, sans-serif;
}
.login-error { color: var(--bad); font-size: 14px; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 52px !important; }
.start-form .password-field input[type=text] {
  height: 52px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 16px Inter, sans-serif;
}
.toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  border: 0; border-radius: 12px; background: transparent; font-size: 18px; cursor: pointer; opacity: .5;
}
.toggle-password:hover, .toggle-password.is-on { opacity: 1; background: rgba(139, 106, 251, .18); }
.btn:disabled { opacity: .6; cursor: default; }
.start-form input[type=text], .start-form input:not([type]) {
  height: 52px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 16px Inter, sans-serif;
}

/* ---------- quiz ---------- */
.quiz-head {
  position: sticky; top: 0; z-index: 5; margin: 0 -16px 20px; padding: 10px 16px 0;
  background: linear-gradient(var(--bg) 75%, transparent);
}
.quiz-head .progress { margin-bottom: 10px; }
.progress-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 8px; }
.timer {
  min-width: 72px; text-align: center; padding: 4px 12px; border-radius: 999px; background: var(--surface-2);
  font-weight: 700; font-variant-numeric: tabular-nums; transition: background .2s, color .2s;
}
.timer:empty { visibility: hidden; }
.timer.is-urgent { background: rgba(255, 77, 109, .2); color: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.progress-row b { color: var(--text); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: 20px; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 99px; transition: width .4s ease; }

.author { display: grid; grid-template-columns: auto 1fr; gap: 16px 20px; align-items: center; }
.avatar {
  width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center;
  font: 700 32px Unbounded, sans-serif; background: var(--grad);
}
.author-name { font-size: 22px; font-weight: 700; word-break: break-all; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; color: #d6d6e3; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 16px; }
.stats span { font-size: 12px; color: var(--muted); }
.open-btn { grid-column: 1 / -1; width: 100%; }
.avatar.has-img { background: var(--surface-2); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-handle { font-size: 14px; margin-top: -2px; }
.author-bio { font-size: 14px; white-space: pre-line; margin-top: 6px; color: #d6d6e3; }

/* сетка роликов, как в профиле Wibes */
.clips { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
@media (max-width: 720px) { .clips { grid-template-columns: repeat(4, 1fr); } }
.clip {
  position: relative; aspect-ratio: 9 / 16; border: 0; padding: 0; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); cursor: pointer;
}
.clip img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.clip:hover img { transform: scale(1.04); }
.clip-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 8px;
  background: rgba(0, 0, 0, .6); font: 600 11px Inter, sans-serif; color: #fff;
}
.clip.skeleton, .clip.is-loading { cursor: default; animation: shimmer 1.2s ease-in-out infinite alternate; }
@keyframes shimmer { from { opacity: .45; } to { opacity: .9; } }
.clips-empty, .clips-more { grid-column: 1 / -1; font-size: 13px; text-align: center; padding: 8px 0; }
.clips-empty { padding: 24px 0; }

/* плеер */
.no-scroll { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .92);
  display: flex; align-items: center; justify-content: center; gap: 16px; animation: pop .15s ease;
}
.viewer-stage { height: min(88vh, 860px); aspect-ratio: 9 / 16; max-width: calc(100vw - 140px); display: grid; place-items: center; }
.viewer-stage video, .viewer-stage img { width: 100%; height: 100%; object-fit: contain; border-radius: 16px; background: #000; }
.viewer-nav, .viewer-close {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--text);
  font-size: 28px; line-height: 1; cursor: pointer; flex: none;
}
.viewer-nav:disabled { opacity: .25; cursor: default; }
.viewer-close { position: absolute; top: 16px; right: 16px; font-size: 18px; }
.viewer-counter { position: absolute; top: 28px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 14px; }

.prompt { text-align: center; font-size: clamp(20px, 4vw, 26px); margin: 32px 0 16px; }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.option {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 8px; border-radius: var(--radius); border: 2px solid transparent;
  background: var(--surface); color: var(--text); font: 600 16px Inter, sans-serif; cursor: pointer;
  transition: transform .1s, border-color .15s, background .15s, opacity .2s;
}
.option:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.option .emoji { font-size: 34px; line-height: 1; }
.option kbd {
  position: absolute; top: 8px; right: 10px; font: 500 11px Inter, sans-serif; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px;
}
.option:disabled { cursor: default; }
.option.is-correct { border-color: var(--ok); background: rgba(47, 212, 122, .12); }
.option.is-wrong { border-color: var(--bad); background: rgba(255, 77, 109, .12); }
.option.is-dim { opacity: .4; }

.feedback { margin-top: 20px; animation: pop .25s ease; }
.feedback.ok { border-color: rgba(47, 212, 122, .4); }
.feedback.bad { border-color: rgba(255, 77, 109, .4); }
.feedback-title { font: 700 22px Unbounded, sans-serif; margin-bottom: 6px; }
.feedback.ok .feedback-title { color: var(--ok); }
.feedback.bad .feedback-title { color: var(--bad); }
.feedback p { margin: 10px 0 16px; }
.ai-hint {
  position: relative; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box;
  border: 1px solid transparent;
}
.ai-hint-title { font-weight: 700; margin-bottom: 4px; }
.ai-hint-text p { margin: 0 0 10px; }
.signals { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.signals li { display: flex; gap: 8px; align-items: flex-start; }
.signal-icon {
  flex: none; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; margin-top: 1px;
}
.signals li.plus .signal-icon { background: rgba(47, 212, 122, .18); color: var(--ok); }
.signals li.minus .signal-icon { background: rgba(255, 77, 109, .18); color: var(--bad); }
.scout-tip { font-size: 14px; color: #d6d6e3; margin-bottom: 0 !important; }
.ai-hint.is-stub .ai-hint-title::after {
  content: 'скоро'; margin-left: 8px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600;
  background: var(--grad); vertical-align: 2px;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

/* ---------- result ---------- */
.result-card { text-align: center; }
.ring {
  --p: 0; width: 168px; height: 168px; margin: 0 auto 16px; border-radius: 50%;
  background: conic-gradient(#f622ad calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center;
}
.ring span {
  width: 136px; height: 136px; border-radius: 50%; background: var(--surface); display: grid; place-items: center;
  font: 700 38px Unbounded, sans-serif;
}
.grade { font-size: clamp(24px, 5vw, 34px); margin: 8px 0; }
.result-count { font-size: 18px; margin-bottom: 20px; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.save-status { margin-top: 14px; font-size: 13px; }

.recs { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.lifehacks { gap: 14px; padding-left: 24px; }
.lifehacks li::marker { color: var(--accent); font-weight: 700; }
.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.review li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.review-ai { flex-basis: 100%; margin: 0 0 0 36px; font-size: 13px; }
.review-n { width: 24px; color: var(--muted); font-size: 13px; }
.review a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.review-ans { font-size: 14px; color: var(--muted); white-space: nowrap; }
.review-ans b { color: var(--ok); }
.review-ans s { color: var(--bad); }

/* ---------- leaderboard ---------- */
.back { margin-bottom: 8px; padding: 0; }
.table-wrap { overflow-x: auto; margin: 0 -8px; }
.leaders { width: 100%; border-collapse: collapse; font-size: 15px; }
.leaders th { text-align: left; font-weight: 500; font-size: 13px; color: var(--muted); padding: 8px; }
.leaders td { padding: 12px 8px; border-top: 1px solid var(--border); }
.leaders .place { width: 40px; font-weight: 700; }
.leaders .lname { font-weight: 600; word-break: break-word; }
.leaders tr.is-me td { background: rgba(139, 106, 251, .18); }
.leaders tr.is-me td:first-child { border-radius: 12px 0 0 12px; }
.leaders tr.is-me td:last-child { border-radius: 0 12px 12px 0; }

/* ---------- misc ---------- */
.loading { text-align: center; padding: 80px 0; color: var(--muted); }
.error { border-color: rgba(255, 77, 109, .4); }

@media (max-width: 560px) {
  .card { padding: 18px; }
  .author { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .chips, .stats { justify-content: center; }
  .clips { grid-template-columns: repeat(3, 1fr); }
  .viewer { gap: 0; }
  .viewer-stage { max-width: 100vw; height: 100vh; }
  .viewer-stage video, .viewer-stage img { border-radius: 0; }
  .viewer-nav { position: absolute; top: 50%; z-index: 1; background: rgba(36, 36, 41, .7); }
  .viewer-nav.prev { left: 8px; }
  .viewer-nav.next { right: 8px; }
  .option { padding: 16px 4px; font-size: 14px; }
  .option kbd { display: none; }
  .leaders th:nth-child(4), .leaders td:nth-child(4) { display: none; }
}
