:root {
  --blue: #00008b;
  --blue-deep: #000066;
  --blue-soft: #e8eaf6;
  --gold: #feda00;
  --gold-dark: #e6c200;
  --red: #d80000;
  --white: #ffffff;
  --bg: #f7f8fc;
  --text: #1a1a2e;
  --muted: #5a5a72;
  --ok: #1b7a3d;
  --shadow: 0 8px 28px rgba(0, 0, 139, 0.12);
  --radius: 16px;
  --font: "Montserrat", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  hyphens: none;
  -webkit-hyphens: none;
  word-break: normal;
  overflow-wrap: anywhere;
}

body {
  background:
    radial-gradient(ellipse at top right, rgba(254, 218, 0, 0.18), transparent 45%),
    radial-gradient(ellipse at bottom left, rgba(0, 0, 139, 0.08), transparent 40%),
    var(--bg);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(560px, 100%);
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  text-align: center;
}

.brand img {
  width: 110px;
  height: auto;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 139, 0.18));
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  color: var(--blue);
  line-height: 1.25;
}

.brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: var(--white);
  border: 2px solid rgba(254, 218, 0, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card + .card {
  margin-top: 14px;
}

.card-title {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 1.15rem;
}

.card-lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

label {
  display: block;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.field {
  margin-bottom: 14px;
  position: relative;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 14px 14px;
  border: 2px solid #cfd3ea;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(254, 218, 0, 0.35);
}

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  z-index: 20;
  background: #fff;
  border: 2px solid var(--gold);
  border-radius: 0 0 12px 12px;
  max-height: 220px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.suggestions button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
}

.suggestions button:hover,
.suggestions button:focus {
  background: var(--blue-soft);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.privacy {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.privacy input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  flex-shrink: 0;
}

.privacy a {
  color: var(--blue);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s, background 0.12s, box-shadow 0.12s;
  box-shadow: 0 8px 18px rgba(0, 0, 139, 0.25);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  color: var(--blue-deep);
  box-shadow: 0 8px 18px rgba(254, 218, 0, 0.4);
}

.btn-outline {
  background: #fff;
  color: var(--blue);
  border: 2px solid var(--blue);
  box-shadow: none;
}

.topic-grid {
  display: grid;
  gap: 12px;
}

.topic-btn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-align: left;
  padding: 18px;
  border-radius: 14px;
  border: 2px solid #cfd3ea;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.topic-btn strong {
  color: var(--blue);
  font-size: 1.05rem;
}

.topic-btn span {
  color: var(--muted);
  font-size: 0.88rem;
}

.topic-btn:active {
  transform: scale(0.98);
}

.topic-btn.selected,
.topic-btn:focus-visible {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(254, 218, 0, 0.35);
}

.error-box {
  background: #ffe8e8;
  color: var(--red);
  border: 1px solid #ffb4b4;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-text {
  font-weight: 700;
  color: var(--blue);
}

.timer {
  min-width: 72px;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
}

.timer.warn {
  background: #fff3cd;
  color: #8a6d00;
}

.timer.danger {
  background: #ffe8e8;
  color: var(--red);
  animation: pulse 0.7s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    transform: scale(1.05);
  }
}

.progress-bar {
  height: 8px;
  background: #e4e7f5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  transition: width 0.25s ease;
}

.q-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  margin-bottom: 12px;
  border: 2px solid rgba(254, 218, 0, 0.5);
  background: #0a1f6e;
}

.q-text {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--blue-deep);
  line-height: 1.35;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #cfd3ea;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  min-height: 52px;
}

.option:active {
  transform: scale(0.99);
}

.option.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.result-hero {
  text-align: center;
  padding: 12px 0 4px;
}

.result-hero .score {
  font-size: clamp(2.2rem, 10vw, 3rem);
  font-weight: 800;
  color: var(--blue);
  margin: 8px 0;
}

.result-hero.pass .score {
  color: var(--ok);
}

.result-hero.fail .score {
  color: var(--red);
}

.result-hero p {
  color: var(--muted);
  margin: 0 0 8px;
}

/* ===== DISPLAY (kijelző) ===== */
.display-body {
  min-height: 100dvh;
  margin: 0;
  background: #f7f8fc;
  overflow-x: hidden;
}

.display-wrap {
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(16px, 3vh, 36px) clamp(20px, 4vw, 48px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2.5vh, 28px);
}

.display-header {
  display: flex;
  align-items: center;
  gap: 20px;
}

.display-header img {
  width: clamp(72px, 9vh, 110px);
  height: auto;
  flex-shrink: 0;
}

.display-titles h1 {
  margin: 0;
  color: var(--blue);
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1.15;
}

.display-titles p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
}

.display-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  min-height: 0;
}

.display-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.display-qr img {
  width: min(460px, 42vw, 70vh);
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.display-qr .scan-hint {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 700;
  color: var(--blue);
}

.display-qr .quiz-url {
  color: var(--muted);
  font-size: 0.95rem;
}

.display-board {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

.display-board h2 {
  margin: 0 0 16px;
  color: var(--blue);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
}

.leader-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: auto;
}

.leader-list li {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 139, 0.08);
}

.leader-list li.top {
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 139, 0.08);
}

.leader-list li.top .lname {
  color: var(--blue);
}

.rank {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.leader-list li.top .rank {
  background: var(--gold);
  color: var(--blue-deep);
}

.lname {
  font-weight: 700;
  color: var(--blue-deep);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
}

.lmeta {
  font-size: 0.85rem;
  color: var(--muted);
}

.lscore {
  text-align: right;
  font-weight: 800;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

.empty-board {
  color: var(--muted);
  padding: 24px 0;
}

.wheel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 40, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.wheel-modal {
  width: min(720px, 100%);
  background: #fff;
  border-radius: 24px;
  border: 3px solid var(--gold);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 22px 22px 28px;
  text-align: center;
}

.wheel-modal h2 {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.wheel-modal .sub {
  margin: 0 0 16px;
  color: var(--muted);
}

.wheel-countdown {
  font-size: clamp(3.5rem, 10vw, 5.5rem);
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
  margin: 0 0 10px;
  letter-spacing: 2px;
  text-shadow: 0 4px 0 rgba(254, 218, 0, 0.55);
}

.wheel-waiting {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 139, 0.06);
  color: var(--blue-deep);
  font-weight: 600;
  font-size: 0.95rem;
}

.wheel-stage {
  position: relative;
  width: min(420px, 80vw);
  margin: 0 auto 18px;
  aspect-ratio: 1;
}

.wheel-stage canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0, 0, 139, 0.25);
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 28px solid var(--red);
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

.prize-result {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--blue);
  min-height: 1.5em;
}

@media (max-width: 960px) {
  .display-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .display-qr img {
    width: min(320px, 80vw);
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 12px 12px 24px;
  }

  .brand img {
    width: 88px;
  }
}
