/* Факторинг-Квиз — игривый стиль в тонах Альфы (красный #EF3124 + Styrene A). */
@font-face { font-family: 'Styrene A'; src: url('/fonts/styrenea-regular.woff2') format('woff2'), url('/fonts/styrenea-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Styrene A'; src: url('/fonts/styrenea-medium.woff2') format('woff2'), url('/fonts/styrenea-medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Styrene A'; src: url('/fonts/styrenea-bold.woff2') format('woff2'), url('/fonts/styrenea-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --red: #EF3124;         /* Альфа-красный */
  --red-press: #d5271b;
  --red-soft: #fdf0ee;
  --red-soft-2: #f7d4cd;
  --ink: #0b0b0b;
  --ink-2: #3a3a3a;
  --ink-3: #7a7a7a;
  --line: #ececec;
  --line-2: #dcdcdc;
  --bg: #f4f2f0;
  --surface: #ffffff;
  --ok: #12a05a;
  --ok-soft: #e6f6ee;
  --sun: #ffc94d;         /* игривый жёлтый акцент */
  --grape: #7b61ff;       /* фиолетовый акцент */
  --sky: #24a7ff;
  /* акценты раундов */
  --c-films: #EF3124; --c-books: #7b61ff; --c-travel: #24a7ff; --c-hobby: #ff8a3d; --c-lifehacks: #f4b400; --c-factoring: #12a05a;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 2px 4px rgba(11,11,11,.04), 0 12px 34px rgba(239,49,36,.08);
  --shadow-pop: 0 10px 0 rgba(11,11,11,.06);
  --font: 'Styrene A', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg);
  background-image: radial-gradient(var(--line-2) 1.1px, transparent 1.1px);
  background-size: 22px 22px;
}
.wrap { max-width: 900px; margin: 0 auto; padding: 22px 18px 70px; }
.wrap-wide { max-width: 1140px; }

/* Шапка бренда — тёмная, с красным «пятном» и игривым лого */
.brandbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 13px; padding: 13px 20px;
  background: var(--ink); color: #fff; box-shadow: 0 6px 24px rgba(11,11,11,.14); }
.brandbar .logo { width: 34px; height: 34px; border-radius: 11px; background: var(--red); display: grid; place-items: center; font-size: 19px; flex: none;
  box-shadow: 0 4px 0 var(--red-press); transform: rotate(-6deg); }
.brandbar h1 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.brandbar h1 span { color: var(--red); }
.brandbar .role { margin-left: auto; font-size: 11px; color: #c9c9c9; text-transform: uppercase; letter-spacing: .14em; font-weight: 500; }
.brandbar .conn { width: 10px; height: 10px; border-radius: 50%; background: #888; flex: none; transition: .2s; }
.brandbar .conn.on { background: #37d67a; box-shadow: 0 0 0 4px rgba(55,214,122,.2); }
.brandbar .conn.off { background: #ff5a5a; box-shadow: 0 0 0 4px rgba(255,90,90,.2); }

h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.015em; font-weight: 700; }
.display { font-weight: 700; letter-spacing: -.03em; line-height: 1.02; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* Карточки — крупные, скруглённые, с «pop-in» */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-top: 18px; animation: pop .32s cubic-bezier(.2,.9,.25,1.1) both; }
.card > h2:first-child { margin-top: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin: 0 0 12px; font-weight: 500; }

/* Кнопки — чанки, «резиновый» отклик */
.btn { font-family: var(--font); font-size: 15px; font-weight: 500; border: 2px solid var(--line-2); background: var(--surface); color: var(--ink);
  padding: 12px 20px; border-radius: 999px; cursor: pointer; transition: transform .1s, background .12s, border-color .12s, box-shadow .12s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--ink); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 5px 0 var(--red-press); }
.btn.primary:hover { background: var(--red); box-shadow: 0 7px 0 var(--red-press); transform: translateY(-2px); }
.btn.primary:active { box-shadow: 0 2px 0 var(--red-press); transform: translateY(2px); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; box-shadow: 0 5px 0 #000; }
.btn.dark:active { box-shadow: 0 2px 0 #000; transform: translateY(2px); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 8px 14px; font-size: 13px; border-width: 1.5px; }
.btn.block { width: 100%; justify-content: center; }
.btn.xl { font-size: 18px; padding: 16px 28px; font-weight: 700; }
.btnrow { display: flex; flex-wrap: wrap; gap: 10px; }

/* Инпуты */
input[type=text], input[type=number], input[type=password], select {
  font-family: var(--font); font-size: 15px; padding: 12px 15px; border: 2px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.code-input { font-size: 28px; font-weight: 700; text-align: center; letter-spacing: .28em; text-transform: uppercase; padding: 16px; }
label.field { display: block; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; font-weight: 500; }

/* Пилюли / бейджи */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 5px 12px; border-radius: 999px; background: var(--bg); border: 1.5px solid var(--line); color: var(--ink-2); }
.pill.red { background: var(--red-soft); border-color: var(--red-soft-2); color: var(--red-press); }
.pill.ok { background: var(--ok-soft); border-color: #bfe6cf; color: var(--ok); }
.pill.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.sun { background: #fff6de; border-color: #ffe6a8; color: #8a6300; }
.badge-vabank { background: linear-gradient(100deg, var(--red), #ff6a3d); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; padding: 4px 12px; box-shadow: 0 3px 0 var(--red-press); }

/* Таймер */
.timer { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.03em; }
.timer.big { font-size: clamp(56px, 14vw, 150px); line-height: .95; }
.timer.warn { color: var(--red); animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* Круг-прогресс таймера */
.ring { transform: rotate(-90deg); }
.ring .bg { stroke: var(--line); }
.ring .fg { stroke: var(--red); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }

/* Варианты ответа — чанки, «резиновый» hover */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 560px) { .opts { grid-template-columns: 1fr; } }
.opt { text-align: left; font-family: var(--font); font-size: 15.5px; padding: 15px 17px; border: 2px solid var(--line-2); border-radius: 16px; background: var(--surface); cursor: pointer; transition: transform .1s, border-color .12s, background .12s; display: flex; gap: 12px; align-items: center; }
.opt .k { width: 28px; height: 28px; border-radius: 9px; background: var(--bg); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; color: var(--ink-3); transition: .12s; }
.opt:hover { border-color: var(--ink); transform: translateY(-2px); }
.opt.sel { border-color: var(--ink); background: var(--surface-2); box-shadow: 0 4px 0 var(--line-2); }
.opt.sel .k { background: var(--ink); color: #fff; }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt.wrong .k { background: var(--red); color: #fff; }

/* Лидерборд */
.lb { display: flex; flex-direction: column; gap: 9px; }
.lb-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 12px 15px; border: 2px solid var(--line); border-radius: 15px; background: var(--surface); transition: .2s; }
.lb-row .rk { font-weight: 700; color: var(--ink-3); text-align: center; font-size: 17px; }
.lb-row .nm { font-weight: 500; }
.lb-row .pt { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }
.lb-row.gold { border-color: var(--red); background: var(--red-soft); }
.lb-row.gold .rk, .lb-row.gold .pt { color: var(--red-press); }
.lb-row.me { outline: 3px solid var(--ink); outline-offset: 1px; }

/* Таблица команд (админ) */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.code { font-family: ui-monospace, Menlo, monospace; font-weight: 700; letter-spacing: .16em; background: var(--ink); color: #fff; padding: 4px 11px; border-radius: 8px; font-size: 14px; }

.q-block { padding: 18px 0; border-top: 1px dashed var(--line-2); }
.q-block:first-child { border-top: none; }
.q-type { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--red-press); background: var(--red-soft); padding: 4px 10px; border-radius: 7px; }
.q-type.open { color: #5a45cc; background: #efeaff; }
.q-type.num { color: #8a6300; background: #fff6de; }
.q-text { font-size: 17px; font-weight: 500; margin: 9px 0 0; line-height: 1.35; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hint { font-size: 13px; color: var(--ink-3); }
.saved { font-size: 12.5px; color: var(--ok); font-weight: 500; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* Крупный эмодзи-герой (команда/экран) */
.hero-emoji { font-size: clamp(52px, 12vw, 104px); line-height: 1; filter: drop-shadow(0 8px 12px rgba(11,11,11,.12)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }

/* Конфетти */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  .card, .timer.warn, .hero-emoji { animation: none !important; }
  .btn, .opt { transition: none; }
}
