:root {
  --bg: #1a1033;
  --card: #241545;
  --ink: #f6f1ff;
  --muted: #c5b8e6;
  --red: #e21b3c;
  --blue: #1368ce;
  --yellow: #d89e00;
  --green: #26890c;
  --line: rgba(255, 255, 255, 0.14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  min-height: 100dvh;
}

button, input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#app {
  min-height: 100dvh;
  padding: 16px;
}

.screen {
  max-width: 980px;
  margin: 0 auto;
}

.narrow { max-width: 460px; }

h1, h2, p { margin: 0; }

.lead {
  color: var(--muted);
  margin: 8px 0 18px;
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  margin-top: 12px;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #140c2b;
  color: var(--ink);
  border-radius: 12px;
  padding: 14px 12px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border-radius: 12px;
  padding: 14px 16px;
  background: #6d4aff;
  color: white;
  font-weight: 700;
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn.small {
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

.pin {
  font-size: 42px;
  letter-spacing: 8px;
  font-weight: 800;
  margin: 8px 0;
}

.qr {
  width: 180px;
  height: 180px;
  background: white;
  border-radius: 12px;
  padding: 8px;
}

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.person {
  background: #311c66;
  border-radius: 999px;
  padding: 8px 12px;
}

.question {
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  margin: 18px 0;
}

.meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  gap: 12px;
}

.bar {
  height: 8px;
  background: #3a2768;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
}

.bar > span {
  display: block;
  height: 100%;
  background: #ffd166;
  width: 0;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.shape {
  min-height: 92px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  font-weight: 800;
  font-size: 22px;
  text-align: center;
  padding: 12px;
}

.shape.red { background: var(--red); }
.shape.blue { background: var(--blue); }
.shape.yellow { background: var(--yellow); color: #2a2100; }
.shape.green { background: var(--green); }

.shape.big {
  min-height: 38dvh;
  font-size: 54px;
}

.shape:disabled { opacity: 0.55; }

.mark { font-size: 34px; line-height: 1; }

.board {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.score {
  display: flex;
  justify-content: space-between;
  background: #311c66;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
}

.score.me { outline: 2px solid #ffd166; }

.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 10px;
  align-items: end;
  margin-top: 18px;
}

.pod {
  background: #311c66;
  border-radius: 16px 16px 8px 8px;
  text-align: center;
  padding: 12px 8px;
}

.pod b { display: block; font-size: 28px; }
.pod.first { min-height: 180px; background: #6d4aff; }
.pod.second { min-height: 140px; }
.pod.third { min-height: 110px; }

.wait {
  text-align: center;
  color: var(--muted);
  margin-top: 24px;
  font-size: 20px;
}

.error {
  color: #ffb4b4;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .answers.phone { grid-template-columns: 1fr 1fr; }
  .shape.big { min-height: 28dvh; font-size: 64px; }
}

.topic {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.topic-name { flex: 1; }

.topic-count {
  width: 76px;
  text-align: center;
}

.photo-wrap {
  margin: 16px auto 0;
  width: min(100%, 640px);
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  overflow: hidden;
  background: #100826;
}

.photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(30px);
  transform: scale(1.08);
}

.dial-board, .dial-phone { margin-top: 16px; }

.dial-range {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  margin-top: 8px;
}

.dial-readout {
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 800;
  text-align: center;
}

.dial-window { position: relative; margin-top: 12px; }

.dial-mark {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 3px;
  margin-left: -1px;
  background: #ffd166;
  z-index: 1;
  pointer-events: none;
}

.dial-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px calc(50% - 42px);
  touch-action: pan-x;
}

.dial-cell {
  flex: 0 0 84px;
  background: #311c66;
  color: var(--ink);
  border-radius: 12px;
  min-height: 64px;
  font-weight: 800;
}

.dial-cell.on { background: #6d4aff; }

.center { text-align: center; }

.settings input,
.settings select { width: 100%; }

select {
  border: 1px solid var(--line);
  background: #140c2b;
  color: var(--ink);
  border-radius: 12px;
  padding: 14px 12px;
  font: inherit;
}

.answer-key {
  margin: 0 0 8px;
  text-align: center;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 800;
  color: #ffd166;
}

#close { margin-top: 14px; width: 100%; }

@media (max-width: 720px) {
  #app { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }
  .pin { font-size: 34px; letter-spacing: 4px; }
  .qr { width: min(180px, 62vw); height: auto; }
  .question { font-size: clamp(22px, 7vw, 34px); }
  .shape { min-height: 74px; font-size: 18px; }
  .shape.big { min-height: 24dvh; font-size: 48px; }
  .btn, .dial-cell, select, input { min-height: 48px; }
}

.own-card {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.own-head, .own-option {
  display: flex;
  gap: 8px;
  align-items: center;
}

.own-head { margin-bottom: 8px; }
.own-head select { flex: 1; }
.own-card input { width: 100%; margin-top: 8px; }
.own-option { margin-top: 8px; }
.own-option input[type="radio"] { width: 22px; margin: 0; flex: 0 0 auto; }
.own-option .own-variant { margin-top: 0; }

.own-file { margin-top: 8px; display: inline-flex; }
.own-file input { display: none; }
.own-note { display: block; color: var(--muted); margin-top: 6px; }

/* Friendly light theme for children and family play. */
:root {
  --bg: #f7fbff;
  --card: #ffffff;
  --ink: #17324d;
  --muted: #58718a;
  --red: #ef476f;
  --blue: #3a86ff;
  --yellow: #f4b942;
  --green: #35b779;
  --line: #d8e8f5;
}

html, body {
  background:
    radial-gradient(circle at 8% 4%, rgba(255, 209, 102, .28), transparent 26rem),
    radial-gradient(circle at 94% 8%, rgba(58, 134, 255, .18), transparent 28rem),
    var(--bg);
  color: var(--ink);
}

#app { padding: 20px; }
.card {
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(155, 193, 220, .42);
  box-shadow: 0 12px 30px rgba(49, 104, 145, .10);
}
.lead, label, .meta, .wait { color: var(--muted); }
input, select {
  background: #f8fcff;
  color: var(--ink);
  border-color: #bfd8eb;
}
input:focus, select:focus {
  outline: 3px solid rgba(58, 134, 255, .22);
  border-color: var(--blue);
}
.btn {
  background: linear-gradient(135deg, #3a86ff, #6c63ff);
  box-shadow: 0 7px 16px rgba(58, 134, 255, .22);
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn.ghost { background: #edf6ff; color: #245477; border-color: #c7e0f2; box-shadow: none; }
.pin { color: #3657c8; text-shadow: 0 3px 0 rgba(58, 134, 255, .10); }
.people .person, .score { background: #edf6ff; color: var(--ink); border: 1px solid #d2e7f5; }
.score.me { outline-color: #f4b942; background: #fff7dd; }
.bar { background: #e6f0f7; }
.bar > span { background: linear-gradient(90deg, #ffd166, #ef476f); }
.answer-key { color: #d27a00; }
.error { color: #c52853; }
.dial-cell { background: #eaf4ff; color: var(--ink); border: 1px solid #c7e0f2; }
.dial-cell.on { background: linear-gradient(135deg, #3a86ff, #6c63ff); color: #fff; }
.dial-mark { background: #ef476f; }
.photo-wrap { background: #eaf4ff; border: 1px solid #c7e0f2; }
.own-card { border-color: #cfe4f2; }
.own-note { color: var(--muted); }
.podium .pod { background: #edf6ff; color: var(--ink); border: 1px solid #d2e7f5; }
.podium .pod.first { background: linear-gradient(135deg, #ffd166, #ff9f1c); color: #573400; }
.podium .pod.second { background: #eaf4ff; }
.podium .pod.third { background: #eef9f4; }

@media (max-width: 640px) {
  #app { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }
  .card { border-radius: 16px; padding: 14px; }
  h1 { color: #3657c8; }
}


/* Quiz usability: status, preview and fullscreen controls. */
.preview-overlay { position: fixed; inset: 0; z-index: 20; padding: 16px; overflow: auto; background: rgba(23,50,77,.35); backdrop-filter: blur(6px); }
.preview-modal { max-width: 760px; margin: 3vh auto; padding: 18px; border-radius: 20px; background: #fff; color: #17324d; box-shadow: 0 24px 60px rgba(23,50,77,.25); }
.preview-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.preview-head h2 { margin:0; }
.preview-list { display:grid; gap:9px; }
.preview-item { padding:11px 12px; border:1px solid #d8e8f5; border-radius:12px; background:#f8fcff; }
.preview-item p { margin:5px 0; }
.preview-item small { color:#58718a; }
.preview-options { display:flex; flex-wrap:wrap; gap:5px; margin:6px 0; }
.preview-options span { padding:4px 7px; border-radius:8px; background:#eaf4ff; font-size:13px; }
.preview-options span.correct { background:#d8f5e7; color:#176b45; font-weight:700; }
@media (max-width:640px) { .preview-head { align-items:flex-start; } .preview-head h2 { font-size:20px; } .preview-modal { margin:0; } }

.person { display:inline-flex; align-items:center; gap:6px; }
.person-dot { width:8px; height:8px; border-radius:50%; background:#35b779; box-shadow:0 0 0 3px rgba(53,183,121,.15); }
.person small { color:#58718a; font-size:11px; font-weight:600; }
.person.offline { opacity:.62; }
.person.offline .person-dot { background:#9bb0c2; box-shadow:none; }

/* Azure single-palette wallpaper theme. */
:root {
  --bg: #e9f8ff;
  --card: rgba(255,255,255,.90);
  --ink: #123b5d;
  --muted: #4d7795;
  --line: #bfe5f5;
  --red: #168aad;
  --blue: #1d9bd1;
  --yellow: #42b8d9;
  --green: #146c94;
}

html, body { min-height:100%; }
body {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 12%, rgba(255,255,255,.95) 0 3px, transparent 4px),
    radial-gradient(circle at 82% 19%, rgba(255,255,255,.75) 0 5px, transparent 6px),
    radial-gradient(circle at 28% 82%, rgba(255,255,255,.68) 0 4px, transparent 5px),
    linear-gradient(145deg, #e8f9ff 0%, #d2f1fc 47%, #b9e7f7 100%);
}
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(2px);
}
body::before {
  width: 360px;
  height: 360px;
  top: -135px;
  right: -90px;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.76), rgba(79,190,222,.28) 55%, transparent 70%);
}
body::after {
  width: 520px;
  height: 220px;
  left: -170px;
  bottom: -75px;
  transform: rotate(-12deg);
  background: radial-gradient(ellipse, rgba(255,255,255,.62), rgba(65,174,211,.20) 60%, transparent 72%);
}

#app { position: relative; z-index: 1; }
.screen { position: relative; }
.screen::before {
  content: "✦  ·  ○  ·  ✦";
  position: fixed;
  top: 26px;
  left: 5vw;
  color: rgba(21,139,181,.18);
  font-size: 28px;
  letter-spacing: 18px;
  pointer-events: none;
}
.card {
  border: 1px solid rgba(96,183,216,.38);
  background: var(--card);
  box-shadow: 0 16px 34px rgba(23,112,153,.13), 0 2px 0 rgba(255,255,255,.85) inset;
  backdrop-filter: blur(10px);
}
h1, h2 { color: #12618c; letter-spacing: -.02em; }
.lead, label, .meta, .wait { color: var(--muted); }
.btn {
  color: #fff;
  border: 1px solid rgba(14,108,150,.16);
  background: linear-gradient(135deg, #169bc8, #176ea5);
  box-shadow: 0 8px 16px rgba(22,139,181,.22);
}
.btn:hover { background: linear-gradient(135deg, #22afd8, #2182b8); }
.btn.ghost {
  color: #12618c;
  background: rgba(232,249,255,.9);
  border-color: #9ed5e9;
  box-shadow: none;
}
.pin { color: #147ba7; text-shadow: 0 3px 0 rgba(20,123,167,.12); }
.people .person, .score {
  background: linear-gradient(135deg, #e5f8ff, #cceefa);
  border: 1px solid #a9dceb;
  color: #164f70;
}
.score.me { outline-color: #168aad; background: #d4f3fc; }
.bar { background: #c8eaf5; }
.bar > span { background: linear-gradient(90deg, #63d5e8, #167eae); }
.answer-key { color: #1379a2; }
.error { color: #b62959; }
.dial-cell { background: #dff5fc; color: #145879; border-color: #a9dceb; }
.dial-cell.on { background: linear-gradient(135deg, #19afd0, #176ea5); color: white; }
.dial-mark { background: #168aad; }
.photo-wrap { background: #d9f3fb; border-color: #a9dceb; }
.own-card { border-color: #b9e0ee; }
.podium .pod { background: linear-gradient(135deg, #e5f8ff, #c8edf8); color: #164f70; border: 1px solid #a9dceb; }
.podium .pod.first { background: linear-gradient(135deg, #61d5e5, #168aad); color: white; }
.podium .pod.second { background: linear-gradient(135deg, #dff7fd, #8ed7ea); }
.podium .pod.third { background: linear-gradient(135deg, #e9fbff, #bce8f4); }
.person-dot { background: #1599bd; box-shadow: 0 0 0 3px rgba(21,153,189,.16); }
.person small { color: #4d7795; }
.person.offline .person-dot { background: #91b7c8; box-shadow: none; }

/* Same hue, different depth: answer buttons stay distinct without a rainbow. */
.shape.red { background: #168aad; color: #fff; }
.shape.blue { background: #1d9bd1; color: #fff; }
.shape.yellow { background: #42b8d9; color: #073b50; }
.shape.green { background: #146c94; color: #fff; }
.shape.red:hover, .shape.blue:hover, .shape.yellow:hover, .shape.green:hover { filter: brightness(1.08); transform: translateY(-2px); }

.preview-overlay { background: rgba(11,73,103,.34); }
.preview-modal { border: 1px solid #a9dceb; box-shadow: 0 24px 60px rgba(13,99,137,.25); }
.preview-item { background: #effbff; border-color: #b9e0ee; }
.preview-options span { background: #dff5fc; color: #145879; }
.preview-options span.correct { background: #bdeaf4; color: #12618c; }

@media (max-width: 640px) {
  .screen::before { top: 12px; left: 8px; font-size: 19px; letter-spacing: 9px; }
  .card { box-shadow: 0 10px 24px rgba(23,112,153,.12), 0 2px 0 rgba(255,255,255,.9) inset; }
}


/* Own question editor controls. */
.own-help { margin: 5px 0 8px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.own-head { flex-wrap: wrap; }
.own-head .own-kind { min-width: 170px; }
.own-head button { min-height: 34px; padding: 6px 8px; font-size: 12px; }
@media (max-width: 640px) {
  .own-head { display: grid; grid-template-columns: minmax(0,1fr) auto auto; }
  .own-head .own-kind { grid-column: 1 / -1; width: 100%; min-width: 0; }
  .own-head .own-drop { grid-column: 1 / -1; }
  .own-head button { min-height: 38px; }
}

.own-upload-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-top:8px; }
.own-upload-row .own-file, .own-upload-row .own-upload { margin:0; }
.own-upload-row .own-file { position:relative; cursor:pointer; }
.own-file input { position:absolute; inset:0; display:block; width:100%; height:100%; opacity:0; cursor:pointer; }
.own-upload:disabled { opacity:.48; cursor:not-allowed; }
.own-preview { display:block; width:min(100%,360px); max-height:220px; margin:10px auto 4px; object-fit:contain; border-radius:12px; border:1px solid #a9dceb; background:#e8f8ff; }
.own-answer-label { margin:8px 0 0; color:var(--muted); font-size:13px; font-weight:700; }
.own-kind { cursor:pointer; }
@media(max-width:640px) { .own-upload-row>* { flex:1 1 140px; } }

.generation-options { margin-top:10px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.58); }
.checkbox-row { display:flex; align-items:flex-start; gap:9px; color:var(--ink); font-size:14px; line-height:1.35; }
.checkbox-row input { width:18px; height:18px; margin:1px 0 0; flex:0 0 auto; accent-color:#168aad; }
.generation-options small { display:block; margin:6px 0 0 27px; color:var(--muted); font-size:12px; line-height:1.35; }

.generation-options { margin-top:10px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.58); }
.checkbox-row { display:flex; align-items:flex-start; gap:9px; color:var(--ink); font-size:14px; line-height:1.35; }
.checkbox-row input { width:18px; height:18px; margin:1px 0 0; flex:0 0 auto; accent-color:#168aad; }
.generation-options small { display:block; margin:6px 0 0 27px; color:var(--muted); font-size:12px; line-height:1.35; }

.generation-options { margin-top:10px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.58); }
.checkbox-row { display:flex; align-items:flex-start; gap:9px; color:var(--ink); font-size:14px; line-height:1.35; }
.checkbox-row input { width:18px; height:18px; margin:1px 0 0; flex:0 0 auto; accent-color:#168aad; }
.generation-options small { display:block; margin:6px 0 0 27px; color:var(--muted); font-size:12px; line-height:1.35; }
