:root {
  --bg: #123d70;
  --bg2: #0c2c52;
  --card: rgba(255,255,255,.94);
  --text: #102033;
  --accent: #ffcc33;
  --green: #19a463;
  --red: #d84040;
  --blue: #1f6fbf;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg), var(--bg2));
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-58 {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .17;
  background-image:
    repeating-linear-gradient(25deg, transparent 0 70px, rgba(255,255,255,.14) 70px 72px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='90'%3E%3Ctext x='10' y='65' font-size='54' font-family='Arial' fill='white' font-weight='900'%3E58%3C/text%3E%3Ctext x='95' y='42' font-size='34' font-family='Arial' fill='white' font-weight='700'%3E58%3C/text%3E%3C/svg%3E");
}

.card {
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(0,0,0,.25);
  padding: 28px;
}

.hidden { display: none !important; }
.small { opacity: .8; font-size: 16px; }
.error { color: #b00020; font-weight: 800; }
.ok { color: var(--green); font-weight: 800; }

h1 { font-size: clamp(36px, 6vw, 70px); margin: 0 0 14px; }
h2 { margin-top: 0; }

button, .home-buttons a {
  border: 0;
  border-radius: 16px;
  padding: 16px 22px;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  color: #102033;
  background: #eef5ff;
  display: inline-block;
  text-align: center;
}

.primary { background: linear-gradient(180deg, #ffe27a, var(--accent)); }
.danger { background: #ffd6d6; }

.home, .admin, .team {
  width: min(900px, 94vw);
  margin: 6vh auto;
  text-align: center;
}

.home-buttons {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.controls {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  text-align: left;
  align-items: end;
}

label { font-weight: 800; display:block; text-align:left; margin: 12px 0; }

input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 2px solid #cfd8e3;
  font-size: 20px;
  margin-top: 6px;
}

.projector {
  width: min(1380px, 97vw);
  margin: 24px auto;
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 24px;
}

.stage { min-height: 88vh; }

.topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  background: linear-gradient(90deg, #174d8a, #1f6fbf);
  border-radius: 18px;
  padding: 16px 20px;
  font-size: 24px;
  font-weight: 900;
}

#timer { color: #ffec99; font-size: 32px; }

.main-area {
  min-height: 520px;
  display: grid;
  place-items: center;
  text-align: center;
}

.question {
  font-size: clamp(38px, 5vw, 76px);
  line-height: 1.12;
  font-weight: 1000;
}

.question img {
  max-width: min(760px, 90%);
  max-height: 470px;
  object-fit: contain;
  border-radius: 24px;
  display: block;
  margin: 0 auto 20px;
  box-shadow: 0 12px 35px rgba(0,0,0,.25);
}

.projector-answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
}

.projector-answer {
  min-height: 110px;
  border-radius: 20px;
  background: #eef5ff;
  border: 5px solid transparent;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 900;
  padding: 18px;
}

.projector-answer.correct {
  background: #dff8ec;
  border-color: var(--green);
}

.answer-stats {
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.score-row, .team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  border-radius: 14px;
  background: #eef5ff;
  font-weight: 900;
}

.score-row.leader {
  background: #fff2bd;
  outline: 3px solid #ffcc33;
}

.connected { color: var(--green); }
.disconnected { color: var(--red); }

#teamButtons, .team-answers {
  display: grid;
  gap: 14px;
}

.team-pick, .team-answer {
  width: 100%;
  min-height: 70px;
}

.team-answer {
  background: #eef5ff;
}

.team-answer.sent {
  background: #fff2bd;
}

.team-status {
  font-size: 22px;
  font-weight: 900;
  background: #eef5ff;
  border-radius: 18px;
  padding: 18px;
  margin: 18px 0;
}

#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

@media (max-width: 900px) {
  .projector { grid-template-columns: 1fr; }
  .projector-answers { grid-template-columns: 1fr; }
}
