:root {
  --purple: #3B175C; --violet: #6440BF; --lilac: #CFC4EB; --beige: #F4F2F0;
  --coral: #DE7A63; --yellow: #FDDD8D; --turq: #A3E6EF; --steel: #5780BF;
  --muted: #7A6E8C; --white: #FFFFFF; --ok: #2E8B57;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Arial, "Liberation Sans", Helvetica, sans-serif; color: var(--purple); background: var(--white);
       -webkit-text-size-adjust: 100%; }
button { font: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- телефон ---------------- */
.m-wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; min-height: 100vh; display: flex; flex-direction: column; }
.m-top { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); padding: 4px 0 14px; }
.m-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lilac); display: inline-block; margin-right: 6px; vertical-align: 0; }
.m-dot.on { background: var(--ok); }
.m-title { font-size: 22px; line-height: 1.25; font-weight: 700; margin: 6px 0 6px; }
.m-sub { font-size: 15px; color: var(--muted); margin: 0 0 16px; line-height: 1.35; }
.m-wait { margin: auto 0; text-align: center; padding: 40px 10px; }
.m-wait h1 { font-size: 26px; margin: 0 0 10px; }
.m-wait p { color: var(--muted); font-size: 16px; line-height: 1.4; margin: 0; }
.m-pulse { width: 54px; height: 54px; border-radius: 50%; background: var(--lilac); margin: 0 auto 22px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.85); opacity: .6 } 50% { transform: scale(1); opacity: 1 } }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 15px 14px; margin: 0 0 10px;
       border: 2px solid var(--beige); background: var(--beige); border-radius: 14px; color: var(--purple); font-size: 17px; line-height: 1.25; }
.opt .mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--lilac); background: #fff;
             display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; font-weight: 700; }
.opt.multi .mark { border-radius: 7px; }
.opt.sel { border-color: var(--violet); background: #fff; }
.opt.sel .mark { background: var(--violet); border-color: var(--violet); }
.scale { display: flex; gap: 8px; margin: 8px 0 6px; }
.scale button { flex: 1; aspect-ratio: 1; max-height: 74px; border-radius: 50%; border: 2px solid var(--lilac); background: #fff;
                font-size: 22px; font-weight: 700; color: var(--purple); }
.scale button.sel { background: var(--violet); border-color: var(--violet); color: #fff; }
.scale-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
textarea, select { width: 100%; font: inherit; font-size: 17px; color: var(--purple); border: 2px solid var(--lilac); border-radius: 12px;
           padding: 12px; background: #fff; }
textarea { min-height: 130px; resize: vertical; line-height: 1.35; }
.m-counter { font-size: 13px; color: var(--muted); text-align: right; margin: 6px 0 14px; }
.m-counter.warn { color: var(--coral); }
.groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 16px; }
.groups button { padding: 12px 0; border-radius: 12px; border: 2px solid var(--lilac); background: #fff; font-size: 18px; font-weight: 700; color: var(--purple); }
.groups button.sel { background: var(--purple); border-color: var(--purple); color: #fff; }
.label { font-size: 13px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--violet); margin: 4px 0 6px; }
.btn { display: block; width: 100%; padding: 16px; border: 0; border-radius: 14px; background: var(--purple); color: #fff; font-size: 18px; font-weight: 700; margin-top: 6px; }
.btn:disabled { background: var(--lilac); color: #fff; cursor: default; }
.btn.light { background: var(--beige); color: var(--purple); }
.m-done { background: #EEF8F2; border-radius: 14px; padding: 16px; margin-top: 14px; font-size: 16px; line-height: 1.4; }
.m-done b { color: var(--ok); }
.m-err { color: var(--coral); font-size: 15px; margin-top: 10px; min-height: 18px; }
.m-foot { margin-top: auto; padding-top: 24px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.4; }

/* ---------------- экран ---------------- */
.s-body { background: var(--white); overflow: hidden; height: 100vh; }
.s-wrap { position: relative; height: 100vh; padding: 4.2vh 4vw 3vh; display: flex; flex-direction: column; }
.s-qr-corner { position: absolute; top: 3vh; right: 2.5vw; background: #fff; padding: .6vw; border-radius: .8vw; box-shadow: 0 .3vw 1.2vw rgba(59,23,92,.15); text-align: center; }
.s-qr-corner canvas { display: block; width: 9vw; height: 9vw; image-rendering: pixelated; }
.s-qr-corner div { font-size: .8vw; color: var(--muted); margin-top: .3vw; }
.s-block { font-size: 1.25vw; font-weight: 700; letter-spacing: .1vw; text-transform: uppercase; color: var(--violet); margin-right: 14vw; }
.s-title { font-size: 3.1vw; line-height: 1.18; font-weight: 700; margin: 1vh 14vw 3vh 0; }
.s-sub { font-size: 1.6vw; color: var(--muted); margin: -1.5vh 14vw 3vh 0; }
.s-main { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.s-opts { display: grid; gap: 1.6vh 2vw; grid-template-columns: 1fr 1fr; }
.s-opts.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.s-opt { background: var(--beige); border-radius: 1vw; padding: 2vh 1.4vw; font-size: 1.9vw; display: flex; gap: 1vw; align-items: center; }
.s-opt b { color: var(--violet); }
.s-count { margin-top: 4vh; font-size: 2vw; color: var(--muted); }
.s-count b { font-size: 3.2vw; color: var(--purple); }
.bars { display: flex; flex-direction: column; gap: 1.5vh; }
.bar { display: grid; grid-template-columns: 28vw 1fr 9vw; align-items: center; gap: 1.2vw; font-size: 1.7vw; }
.bar .track { height: 4.6vh; background: var(--beige); border-radius: .6vw; overflow: hidden; }
.bar .fill { height: 100%; background: var(--violet); border-radius: .6vw; width: 0; transition: width .8s ease; }
.bar .val { font-weight: 700; font-size: 1.9vw; }
.bar .val small { font-weight: 400; color: var(--muted); font-size: 1.2vw; }
.bar.correct .name { font-weight: 700; }
.bar.correct .fill { background: var(--purple); }
.bar.dim .fill { background: var(--lilac); }
.verdict { margin-top: 3.5vh; background: var(--purple); color: #fff; border-radius: 1vw; padding: 2.4vh 2vw; font-size: 2vw; }
.verdict span { color: var(--turq); font-weight: 700; }
.scale-wrap { display: flex; gap: 4vw; }
.scale-panel { flex: 1; }
.scale-panel h3 { font-size: 1.7vw; margin: 0 0 2vh; }
.avg { font-size: 6vw; font-weight: 700; line-height: 1; color: var(--violet); }
.avg small { font-size: 1.6vw; color: var(--muted); font-weight: 400; margin-left: .6vw; }
.cols { display: flex; align-items: flex-end; gap: 1.2vw; height: 28vh; margin-top: 3vh; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.cols .c .colfill { width: 100%; background: var(--violet); border-radius: .5vw .5vw 0 0; min-height: 2px; transition: height .8s ease; }
.cols .c .n { font-size: 1.4vw; color: var(--muted); margin-bottom: .6vh; }
.cols .c .k { font-size: 1.8vw; font-weight: 700; margin-top: 1vh; }
.texts { display: grid; grid-template-columns: repeat(auto-fill, minmax(26vw, 1fr)); gap: 1.6vh 1.6vw; overflow: hidden; align-content: start; }
.tcard { background: var(--beige); border-radius: 1vw; padding: 2vh 1.4vw; font-size: 1.6vw; line-height: 1.3; white-space: pre-wrap; }
.tcard .g { display: block; font-size: 1.1vw; font-weight: 700; color: var(--violet); margin-bottom: .8vh; text-transform: uppercase; }
.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 1.2vh 2.2vw; padding: 0 4vw; }
.cloud span { font-weight: 700; line-height: 1.1; }
.lobby { flex: 1; display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: 5vw; }
.lobby h1 { font-size: 4.6vw; line-height: 1.08; margin: 0 0 3vh; }
.lobby p { font-size: 2vw; color: var(--muted); margin: 0 0 2vh; line-height: 1.35; }
.lobby .url { font-size: 2.6vw; font-weight: 700; color: var(--violet); word-break: break-all; }
.lobby .qrbox { background: #fff; padding: 2vw; border-radius: 2vw; box-shadow: 0 .4vw 2vw rgba(59,23,92,.18); justify-self: center; text-align: center; }
.lobby canvas { width: 30vw; height: 30vw; display: block; image-rendering: pixelated; }
.featured { position: fixed; inset: 0; background: var(--purple); color: #fff; display: flex; align-items: center; justify-content: center; padding: 8vh 9vw; z-index: 10; }
.featured .ft { font-size: 4vw; line-height: 1.3; font-weight: 700; white-space: pre-wrap; text-align: left; }
.featured .timer { position: absolute; top: 4vh; right: 4vw; font-size: 5vw; font-weight: 700; color: var(--turq); }
.s-logo { position: absolute; bottom: 2.4vh; left: 4vw; font-size: 1vw; color: var(--muted); }

/* ---------------- пульт ---------------- */
.a-body { background: var(--beige); }
.a-top { position: sticky; top: 0; z-index: 5; background: var(--purple); color: #fff; padding: 10px 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.a-top .url { font-weight: 700; font-size: 15px; margin-right: auto; word-break: break-all; }
.a-top a, .a-top button { background: rgba(255,255,255,.14); color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; text-decoration: none; font-size: 14px; }
.a-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; padding: 16px; align-items: start; }
.a-card { background: #fff; border-radius: 14px; padding: 14px 16px; margin-bottom: 16px; }
.a-card h2 { font-size: 16px; margin: 0 0 10px; }
.a-q { display: flex; gap: 8px; align-items: center; padding: 8px 6px; border-radius: 10px; font-size: 14px; line-height: 1.3; }
.a-q + .a-q { border-top: 1px solid var(--beige); }
.a-q.cur { background: #EFEAFB; }
.a-q .t { flex: 1; }
.a-q .t small { color: var(--muted); display: block; }
.a-q .cnt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.a-q button { border: 0; background: var(--purple); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.a-q.cur button { background: var(--violet); }
.a-block { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--violet); margin: 14px 0 4px; }
.tag { font-size: 11px; background: var(--yellow); color: var(--purple); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.a-now h1 { font-size: 22px; margin: 4px 0 6px; line-height: 1.25; }
.a-ctrl { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.a-ctrl button { border: 2px solid var(--purple); background: #fff; color: var(--purple); border-radius: 10px; padding: 10px 14px; font-size: 15px; font-weight: 700; }
.a-ctrl button.on { background: var(--purple); color: #fff; }
.a-ctrl button.warn { border-color: var(--coral); color: var(--coral); }
.a-note { font-size: 13px; color: var(--muted); background: var(--beige); border-radius: 8px; padding: 8px 10px; margin-top: 8px; }
.a-big { font-size: 34px; font-weight: 700; }
.a-res .row { display: grid; grid-template-columns: 1fr 60px 60px; gap: 8px; font-size: 14px; padding: 4px 0; border-bottom: 1px solid var(--beige); }
.a-res .row.ok { font-weight: 700; }
.a-txt { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--beige); font-size: 14px; }
.a-txt .x { white-space: pre-wrap; line-height: 1.35; }
.a-txt .x small { display: block; color: var(--violet); font-weight: 700; font-size: 11px; text-transform: uppercase; margin-bottom: 3px; }
.a-txt.ap .x { color: var(--purple); }
.a-txt:not(.ap) .x { color: var(--muted); }
.a-txt .b { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.a-txt .b button { border: 0; border-radius: 8px; padding: 6px 10px; font-size: 12px; background: var(--beige); color: var(--purple); white-space: nowrap; }
.a-txt .b button.on { background: var(--ok); color: #fff; }
.a-txt .b button.pk.on { background: var(--violet); }
.a-login { max-width: 360px; margin: 18vh auto; background: #fff; border-radius: 16px; padding: 24px; }
.a-login input { width: 100%; font: inherit; font-size: 18px; padding: 12px; border: 2px solid var(--lilac); border-radius: 10px; margin: 10px 0; }
.a-qr canvas { width: 140px; height: 140px; image-rendering: pixelated; display: block; }
@media (max-width: 860px) { .a-grid { grid-template-columns: 1fr; } }
