:root {
  --sea: #0b1a2b;
  --sea-2: #11263c;
  --sea-3: #183551;
  --line: rgba(233, 222, 198, 0.14);
  --ink: #f4eee2;
  --muted: #9fb2c1;
  --gold: #c9a45c;
  --gold-2: #e8cd8f;
  --ok: #5fb38a;
  --bad: #d0675a;
  --a: #c9a45c;
  --b: #3f93b5;
  --c: #c0665a;
  --d: #6fa274;
  --radius: 18px;
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 80% at 50% -10%, #1d4262 0%, var(--sea-2) 45%, var(--sea) 100%) fixed;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }

.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.gold { color: var(--gold-2); }
.center { text-align: center; }
.hidden { display: none !important; }

/* волна-орнамент под заголовками */
.wave {
  height: 10px;
  width: 120px;
  margin: 14px auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='10' viewBox='0 0 40 10'%3E%3Cpath d='M0 5 Q10 0 20 5 T40 5' fill='none' stroke='%23c9a45c' stroke-width='1.6'/%3E%3C/svg%3E") repeat-x center;
  opacity: 0.9;
}

.btn {
  border: 0;
  border-radius: 14px;
  padding: 15px 20px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1b1408;
  width: 100%;
  font-size: 17px;
  transition: transform 0.08s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 10px; }

.field { display: block; margin: 0 0 14px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 17px;
  outline: none;
}
.input:focus { border-color: var(--gold); }

.card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.letter {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-weight: 800;
  color: #10161d;
  flex: none;
}
.c0 { --opt: var(--a); } .c1 { --opt: var(--b); } .c2 { --opt: var(--c); } .c3 { --opt: var(--d); }
.letter { background: var(--opt); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #2a1614;
  border: 1px solid var(--bad);
  color: #ffd9d3;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 50;
  max-width: calc(100% - 32px);
}

/* ================= телефон игрока ================= */
.player main { max-width: 520px; margin: 0 auto; padding: 22px 16px calc(28px + env(safe-area-inset-bottom)); }
.brand { text-align: center; padding: 8px 0 4px; }
.brand .eyebrow { font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.brand h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.05; margin: 8px 0 0; }
.p-hero { text-align: center; padding: 26px 0 8px; }
.p-hero .big { font-family: var(--serif); font-size: 30px; line-height: 1.1; margin: 0 0 8px; }
.p-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-bottom: 18px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); width: 100%; transition: width 0.25s linear; }
.p-q { font-size: 20px; font-weight: 700; line-height: 1.3; margin: 0 0 16px; }
.p-img { border-radius: 14px; overflow: hidden; background: #fff; margin-bottom: 16px; }
.p-img img { width: 100%; max-height: 42vh; object-fit: contain; }
.opts { display: grid; gap: 10px; }
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 17px;
  font-weight: 600;
  min-height: 62px;
  transition: transform 0.08s, background 0.2s, opacity 0.2s;
}
.opt:active { transform: scale(0.98); }
.opt.picked { background: color-mix(in srgb, var(--opt) 32%, transparent); border-color: var(--opt); }
.opt.dim { opacity: 0.4; }
.opt.right { border-color: var(--ok); background: rgba(95, 179, 138, 0.2); }
.opt:disabled { cursor: default; }
.status { text-align: center; margin-top: 16px; color: var(--muted); font-size: 15px; }
.verdict { text-align: center; padding: 22px 0 10px; }
.verdict .icon { font-size: 54px; line-height: 1; }
.verdict h2 { font-family: var(--serif); font-size: 34px; margin: 10px 0 6px; }
.promo-card { text-align: center; margin-top: 18px; border-color: rgba(201, 164, 92, 0.5); }
.promo-card h3 { font-family: var(--serif); font-size: 26px; margin: 0 0 8px; }
.code {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 14px;
  border: 2px dashed var(--gold);
  border-radius: 14px;
  margin: 14px 0 12px;
  color: var(--gold-2);
  word-break: break-all;
}
.p-actions { display: grid; gap: 10px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 14px; margin-top: 18px; }
.net { position: fixed; top: 0; left: 0; right: 0; background: #5a2a23; color: #ffe3dc; font-size: 13px; text-align: center; padding: 6px; z-index: 40; }

/* ================= большой экран ================= */
.screen { overflow: hidden; height: 100vh; }
.screen #app { height: 100vh; display: flex; flex-direction: column; padding: 3.2vh 4vw; }
.s-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 1.5vw; letter-spacing: 0.08em; }
.s-head b { color: var(--gold-2); font-weight: 700; }
.s-body { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.s-title { font-family: var(--serif); font-weight: 600; font-size: 5.4vw; line-height: 1; margin: 0; }
.s-sub { font-size: 1.6vw; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; }

.lobby { display: grid; grid-template-columns: 1.2fr 1fr; gap: 5vw; align-items: center; }
.qr { background: #fff; padding: 1.6vw; border-radius: 2vw; width: min(30vw, 58vh); aspect-ratio: 1; margin-left: auto; }
.qr svg { width: 100%; height: 100%; display: block; }
.lobby .count { font-size: 2.2vw; margin-top: 3vh; }
.lobby .count b { font-family: var(--serif); font-size: 5vw; color: var(--gold-2); margin-right: 0.6vw; }
.lobby .url { font-size: 1.7vw; margin-top: 2vh; color: var(--ink); }
.lobby .rule { font-size: 1.25vw; color: var(--muted); margin-top: 3vh; max-width: 40vw; line-height: 1.4; }

.s-q { display: grid; grid-template-columns: 1fr auto; gap: 3vw; align-items: start; }
.s-q h2 { font-size: 3.1vw; line-height: 1.2; margin: 0; font-weight: 700; }
.s-q.hard h2 { color: var(--gold-2); }
.ring { width: 9vw; height: 9vw; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.4vw; font-weight: 800; }
.s-main { display: grid; gap: 3vw; margin-top: 4vh; align-items: center; }
.s-main.with-img { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.s-img { background: #fff; border-radius: 1.4vw; overflow: hidden; height: 58vh; display: grid; place-items: center; }
.s-img img { max-height: 100%; width: 100%; object-fit: contain; }
.s-img.pair { background: transparent; grid-template-columns: 1fr 1fr; gap: 1vw; }
.s-img.pair > div { background: #fff; border-radius: 1.4vw; overflow: hidden; aspect-ratio: 4 / 3; max-height: 58vh; display: grid; place-items: center; }
.s-main.pair-layout { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); }
.s-img.pair { height: auto; align-items: center; }
.s-img.pair img { height: 100%; width: 100%; object-fit: contain; }
.s-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4vw; }
.with-img .s-opts { grid-template-columns: 1fr; }
.s-opt {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 1.2vw;
  padding: 2.2vh 1.4vw;
  border-radius: 1.2vw;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  font-size: 2vw;
  font-weight: 700;
  min-height: 11vh;
}
.s-opt .letter { width: 3.4vw; height: 3.4vw; font-size: 1.8vw; border-radius: 0.8vw; }
.s-opt .fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--opt) 26%, transparent); width: 0; transition: width 0.9s cubic-bezier(.2,.8,.2,1); z-index: 0; }
.s-opt > *:not(.fill) { position: relative; z-index: 1; }
.s-opt .pct { margin-left: auto; font-size: 1.8vw; color: var(--muted); }
.s-opt.right { border-color: var(--ok); box-shadow: 0 0 0 0.3vw rgba(95, 179, 138, 0.35); }
.s-opt.wrong { opacity: 0.45; }
.s-foot { display: flex; justify-content: space-between; align-items: center; font-size: 1.6vw; color: var(--muted); margin-top: 3vh; min-height: 5vh; }
.s-foot b { color: var(--ink); }
.fast { display: flex; gap: 1.4vw; align-items: center; }
.fast .chip { background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); border-radius: 99px; padding: 0.8vh 1.2vw; color: var(--ink); font-size: 1.4vw; }
.fast .chip:first-of-type { border-color: var(--gold); color: var(--gold-2); }

.stat { text-align: center; }
.stat .num { font-family: var(--serif); font-size: 16vw; line-height: 0.9; color: var(--gold-2); }
.stat .of { font-size: 2.6vw; margin-top: 2vh; }
.stat .q { font-size: 1.6vw; color: var(--muted); max-width: 60vw; margin: 3vh auto 0; line-height: 1.4; }

.promo { display: grid; grid-template-columns: 1.3fr 1fr; gap: 5vw; align-items: center; }
.promo .code { font-size: 4.4vw; padding: 2.4vh 2vw; border-width: 0.25vw; border-radius: 1.4vw; display: inline-block; margin: 4vh 0 2vh; }
.promo p { font-size: 2vw; line-height: 1.4; color: var(--ink); margin: 3vh 0 0; max-width: 44vw; }

.board { max-width: 70vw; margin: 0 auto; width: 100%; }
.board h2 { font-family: var(--serif); font-size: 4.2vw; text-align: center; margin: 0 0 3vh; font-weight: 600; }
.b-row {
  display: grid;
  grid-template-columns: 5vw 1fr auto;
  align-items: center;
  gap: 1.5vw;
  padding: 1.1vh 1.6vw;
  border-radius: 1vw;
  font-size: 1.7vw;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 0.9vh;
  animation: rise 0.6s cubic-bezier(.2,.8,.2,1) both;
}
.b-row .pl { font-family: var(--serif); font-size: 2.4vw; font-weight: 700; color: var(--muted); }
.b-row .nm small { color: var(--muted); margin-left: 0.8vw; font-size: 1.3vw; }
.b-row .sc { font-weight: 800; }
.b-row .sc small { color: var(--muted); font-weight: 500; margin-left: 0.8vw; font-size: 1.2vw; }
.b-row.hidden-row { opacity: 0.35; animation: none; }
.b-row.hidden-row .nm { letter-spacing: 0.3em; color: var(--muted); }
.b-row.first { border-color: var(--gold); background: rgba(201, 164, 92, 0.16); font-size: 2.5vw; padding: 2vh 1.6vw; }
.b-row.first .pl { color: var(--gold-2); font-size: 3.4vw; }
@keyframes rise { from { opacity: 0; transform: translateY(2vh) scale(0.98); } to { opacity: 1; transform: none; } }
.winner { text-align: center; }
.winner .crown { font-size: 7vw; }
.winner .who { font-family: var(--serif); font-size: 8vw; line-height: 1; margin: 2vh 0; color: var(--gold-2); animation: rise 0.9s both; }
.winner .how { font-size: 2vw; color: var(--muted); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.fs-hint { position: fixed; right: 1vw; bottom: 1vh; font-size: 12px; color: var(--muted); opacity: 0.5; }

/* ================= пульт ведущего ================= */
.admin main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.a-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.a-head h1 { font-family: var(--serif); font-size: 28px; margin: 0; }
.tabs { display: flex; gap: 6px; background: rgba(255, 255, 255, 0.05); padding: 4px; border-radius: 12px; }
.tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.tabs button.on { background: var(--gold); color: #1b1408; }
.a-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 800px) { .a-grid { grid-template-columns: 1fr; } }
.phase { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 5px 10px; border-radius: 99px; background: rgba(201, 164, 92, 0.2); color: var(--gold-2); }
.kpis { display: flex; gap: 22px; margin: 14px 0; }
.kpis div { font-size: 13px; color: var(--muted); }
.kpis b { display: block; font-size: 28px; color: var(--ink); font-family: var(--serif); }
.next { font-size: 20px; padding: 20px; margin-top: 8px; }
.a-q { margin-top: 14px; }
.a-q .t { font-weight: 700; margin-bottom: 10px; }
.a-q ol { margin: 0; padding-left: 22px; }
.a-q li.ok { color: var(--ok); font-weight: 700; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.qlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-height: 60vh; overflow: auto; }
.qitem { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); font-size: 14px; }
.qitem.cur { border-color: var(--gold); background: rgba(201, 164, 92, 0.1); }
.qitem .n { color: var(--muted); width: 22px; flex: none; }
.qitem .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); flex: none; }
.tag.warn { background: rgba(208, 103, 90, 0.25); color: #ffc6bd; }
.tag.hard { background: rgba(201, 164, 92, 0.25); color: var(--gold-2); }
.tag.draw { background: rgba(63, 147, 181, 0.25); color: #b9e2f2; }
.links { display: grid; gap: 8px; font-size: 14px; }
.links a { color: var(--gold-2); word-break: break-all; }
.mini-qr { background: #fff; width: 140px; padding: 8px; border-radius: 10px; }

.ed { display: grid; gap: 12px; }
.ed-q { padding: 16px; }
.ed-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.ed-top .n { font-family: var(--serif); font-size: 22px; font-weight: 700; margin-right: 4px; }
.ed-top select, .ed-top input[type=number] { padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--sea-2); }
.ed-top input[type=number] { width: 70px; }
.ed-top label { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.ed-top .sp { flex: 1; }
.ed textarea { width: 100%; min-height: 64px; resize: vertical; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); }
.ed-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
@media (max-width: 700px) { .ed-opts { grid-template-columns: 1fr; } }
.ed-opt { display: flex; gap: 8px; align-items: center; }
.ed-opt input[type=text] { flex: 1; min-width: 0; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); }
.ed-opt input[type=radio] { width: 20px; height: 20px; accent-color: var(--ok); }
.ed-imgs { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.ed-img { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.ed-img .th { width: 74px; height: 56px; border-radius: 8px; background: #fff center/contain no-repeat; border: 1px solid var(--line); flex: none; }
.ed-img .th.empty { background: rgba(255, 255, 255, 0.05); }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--sea) 30%); display: flex; gap: 10px; align-items: center; }
.saved { color: var(--ok); font-size: 14px; }
