/* Kvíz Brány Skeldalu */
:root {
  --bg: #0f0a1c;
  --bg-2: #171029;
  --panel: #1e1535;
  --panel-2: #281c46;
  --line: #3a2b60;
  --text: #f1e9da;
  --muted: #b3a8cc;
  --gold: #f2a93b;
  --gold-2: #ffd98a;
  --gold-ink: #2a1a05;
  --violet: #8f6be0;
  --ok: #58d08c;
  --bad: #ff6f6f;
  --radius: 14px;
  --display: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg) radial-gradient(1200px 600px at 50% -100px, #2a1b52 0%, transparent 70%) no-repeat;
  color: var(--text);
  font: 16px/1.6 var(--body);
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-2); }
h1, h2 { font-family: var(--display); line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.3rem); color: var(--gold-2); }
h2 { font-size: clamp(1.2rem, 3.2vw, 1.5rem); }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  background: #1a1030 url(img/hero.jpg) center 40% / cover no-repeat;
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,10,28,.35) 0%, rgba(15,10,28,.15) 45%, var(--bg) 100%);
}
.hero__inner {
  position: relative; z-index: 1;
  max-width: 860px; margin: 0 auto; padding: 28px 16px 36px;
  text-align: center;
}
.hero__logo { width: min(440px, 82vw); margin: 0 auto; filter: drop-shadow(0 8px 24px rgba(0,0,0,.7)); }
.hero__tag {
  margin: 6px 0 0; font-family: var(--display); font-size: clamp(1rem, 3vw, 1.3rem);
  letter-spacing: .08em; text-transform: uppercase; color: var(--gold-2);
  text-shadow: 0 2px 10px #000;
}
body.in-quiz .hero__inner { padding: 12px 16px 16px; }
body.in-quiz .hero__logo { width: min(200px, 50vw); }
body.in-quiz .hero__tag { display: none; }

/* ---------- layout ---------- */
.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 40px; }
.view { display: none; }
.view.is-active { display: block; animation: fade .25s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(18px, 4vw, 30px);
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.card--error { border-color: var(--bad); color: #ffd6d6; }
.eyebrow { margin: 0 0 .4em; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 1rem var(--body); text-decoration: none; cursor: pointer;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .option:focus-visible, .pager__btn:focus-visible, .link:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold-2); outline-offset: 2px;
}
.btn--primary, .btn--gold {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--gold-ink); border-color: #b8731a;
  box-shadow: 0 4px 0 #8a520f, 0 10px 20px rgba(242,169,59,.25);
}
.btn--primary:hover, .btn--gold:hover { filter: brightness(1.08); }
.btn--big { font-size: 1.2rem; padding: 16px 40px; font-family: var(--display); letter-spacing: .04em; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: rgba(255,255,255,.06); }
.link { background: none; border: 0; padding: 0; color: var(--gold-2); font: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- intro ---------- */
.intro { text-align: center; }
.intro p { color: var(--muted); max-width: 62ch; margin-inline: auto; }
.rules { list-style: none; padding: 0; margin: 1.2em auto 1.6em; max-width: 52ch; text-align: left; }
.rules li { position: relative; padding: 6px 0 6px 30px; }
.rules li::before { content: "✦"; position: absolute; left: 4px; color: var(--gold); }
.resume { margin: 1.2em 0 0; }

/* ---------- campaign ---------- */
.campaign {
  display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(120deg, rgba(242,169,59,.16), rgba(143,107,224,.12)), var(--panel);
  border-color: #6b4a1c;
}
.campaign__text { flex: 1 1 320px; }
.campaign__text p:last-child { margin-bottom: 0; color: var(--muted); }
.campaign h2 { color: var(--gold-2); }
.campaign--ended { border-color: var(--line); }

/* ---------- board ---------- */
.board__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.board__count { color: var(--muted); font-size: .9rem; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid rgba(58,43,96,.6); }
.table .num { text-align: right; white-space: nowrap; }
.table th.num:first-child, .table td.num:first-child { text-align: left; width: 3.2em; color: var(--muted); }
.table .nick { font-weight: 600; word-break: break-word; }
.table .strong { font-weight: 800; color: var(--gold-2); }
.table .empty { text-align: center; color: var(--muted); padding: 24px 10px; }
.table tr.top1 td:first-child { color: #ffd700; font-weight: 800; }
.table tr.top2 td:first-child { color: #d5dbe6; font-weight: 800; }
.table tr.top3 td:first-child { color: #e0935a; font-weight: 800; }
.table tr.is-me td { background: rgba(242,169,59,.12); }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 16px; }
.pager:empty { display: none; }
.pager__btn { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 1.3rem; cursor: pointer; }
.pager__btn:disabled { opacity: .35; cursor: default; }
.pager__info { color: var(--muted); font-variant-numeric: tabular-nums; }

.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.shots img { border-radius: 10px; border: 1px solid var(--line); }

/* ---------- quiz ---------- */
.quiz__top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .92rem; color: var(--muted); }
.quiz__top b { color: var(--text); }
.quiz__level { padding: 2px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.quiz__level[data-level="1"] { color: var(--ok); border-color: rgba(88,208,140,.5); }
.quiz__level[data-level="2"] { color: var(--gold-2); border-color: rgba(242,169,59,.5); }
.quiz__level[data-level="3"] { color: var(--bad); border-color: rgba(255,111,111,.5); }
.progress { height: 6px; background: rgba(255,255,255,.08); border-radius: 999px; margin: 12px 0 10px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--violet); border-radius: inherit; transition: width .3s; }
.timer { position: relative; height: 22px; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.timer__bar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .1s linear; }
.timer__bar.is-low { background: linear-gradient(90deg, #d93b3b, var(--bad)); }
.timer__num { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.quiz__image { margin: 18px 0 0; }
.quiz__image img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.quiz__text { margin: 22px 0 18px; font-size: clamp(1.15rem, 3.4vw, 1.5rem); min-height: 2.4em; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); color: var(--text); font: 1rem/1.4 var(--body); cursor: pointer;
  transition: background .12s, border-color .12s, transform .08s;
}
.option:hover:not(:disabled) { background: rgba(242,169,59,.12); border-color: var(--gold); }
.option:active:not(:disabled) { transform: scale(.995); }
.option:disabled { cursor: default; opacity: .6; }
.option__key { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); font-weight: 800; color: var(--gold-2); font-family: var(--display); }
.option.is-picked { opacity: 1; border-color: var(--gold); background: rgba(242,169,59,.14); }
.option.is-ok { border-color: var(--ok); background: rgba(88,208,140,.16); }
.option.is-bad { border-color: var(--bad); background: rgba(255,111,111,.14); }
.quiz__feedback { margin: 16px 0 0; text-align: center; font: 700 1.15rem var(--display); }
.quiz__feedback.is-ok { color: var(--ok); }
.quiz__feedback.is-bad { color: var(--bad); }

/* ---------- result ---------- */
.result { text-align: center; background: linear-gradient(180deg, rgba(30,21,53,.88), rgba(30,21,53,.96)), url(img/cave.jpg) center / cover; }
.result__score { font-family: var(--display); line-height: 1; margin: 8px 0 10px; }
.result__score b { font-size: clamp(4rem, 16vw, 6.5rem); color: var(--gold-2); text-shadow: 0 4px 24px rgba(242,169,59,.4); }
.result__score span { font-size: 1.6rem; color: var(--muted); margin-left: 6px; }
.result__title { color: var(--text); }
.result__meta { color: var(--muted); }
.result__meta b { color: var(--text); }
.nickform { max-width: 420px; margin: 22px auto 0; text-align: left; }
.nickform label { display: block; font-weight: 700; margin-bottom: 8px; }
.nickform__row { display: flex; gap: 10px; }
.nickform input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: 1.05rem var(--body); }
.nickform__error { color: var(--bad); margin: 8px 0 0; }
.result__saved { margin: 20px 0 0; font-weight: 700; color: var(--ok); }
.result__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

/* ---------- misc ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); max-width: calc(100vw - 32px); margin: 0; padding: 12px 18px; border-radius: 10px; background: #3b1320; border: 1px solid var(--bad); color: #ffe1e1; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 10; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 32px; }
.footer p { margin: 0 0 .4em; }

@media (max-width: 560px) {
  .shots { grid-template-columns: 1fr; }
  .shots img:nth-child(n+2) { display: none; }
  .nickform__row { flex-direction: column; }
  .campaign .btn { width: 100%; }
  .table td, .table th { padding: 9px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- language switch ---------- */
.langs {
  position: absolute; z-index: 2; top: 12px; right: 12px;
  display: flex; gap: 4px; padding: 4px;
  background: rgba(15,10,28,.72); border: 1px solid var(--line); border-radius: 999px;
  backdrop-filter: blur(4px);
}
.langs__item {
  padding: 5px 14px; border-radius: 999px;
  font-size: .85rem; font-weight: 700; text-decoration: none; color: var(--muted);
}
.langs__item:hover { color: var(--text); }
.langs__item:focus-visible { outline: 3px solid var(--gold-2); outline-offset: 2px; }
.langs__item.is-current { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--gold-ink); }
body.in-quiz .langs { display: none; }
