 :root {
  --team-a-color: #ff3f88;
  --team-b-color: #2d7dff;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: #000;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

body.mode-screen {
  cursor: none;
}

body.mode-screen #controlMode {
  display: none;
}

body.mode-screen #screenMode {
  pointer-events: none;
}

body.mode-control {
  background: #f2f4f7;
  color: #1d2530;
}

body.mode-control #screenMode {
  display: none;
}

body.mode-control #controlMode {
  display: flex;
}

.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.intro-screen,
.scoreboard-screen,
.game-title-overlay,
.buzzer-overlay,
.answer-feedback-overlay,
.buzzer-flash {
  position: absolute;
  inset: 0;
  display: none;
}

.intro-screen.is-visible,
.scoreboard-screen.is-visible,
.game-title-overlay.is-visible,
.buzzer-overlay.is-visible,
.answer-feedback-overlay.is-visible {
  display: flex;
}

.intro-screen {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 5vh 5vw;
  background: radial-gradient(circle at center, #151521 0%, #050507 65%, #010102 100%);
}

.intro-title {
  margin: 0;
  font-size: clamp(4rem, 12vw, 12rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  transform: scale(0.95);
}

.intro-subtitle {
  margin: clamp(1rem, 3vh, 2.4rem) 0 0;
  font-size: clamp(1.6rem, 4.2vw, 4.2rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  opacity: 0;
}

.intro-screen.is-animating .intro-title {
  animation: introTitleFadeZoom 2.1s ease forwards, introGlowPulse 2.3s ease-in-out 0.4s;
}

.intro-screen.is-animating .intro-subtitle {
  animation: introSubtitleReveal 1.1s ease 1.2s forwards;
}

.scoreboard-screen {
  align-items: stretch;
  justify-content: center;
  background: #050507;
}

.team-panel {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2.4vh, 2rem);
  padding: 4vh 2vw;
  text-align: center;
}

.team-panel-a {
  background: var(--team-a-color);
  border-right: 0.35vw solid rgba(255, 255, 255, 0.2);
}

.team-panel-b {
  background: var(--team-b-color);
}

.team-panel-buzzed {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 0.45rem rgba(255, 255, 255, 0.42);
}

.team-name {
  margin: 0;
  font-size: clamp(2.2rem, 4.8vw, 5.6rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
}

.team-score {
  margin: 0;
  font-size: clamp(8rem, 25vw, 30rem);
  font-weight: 900;
  line-height: 0.85;
  letter-spacing: 0.03em;
}

.team-panel-a .team-score,
.team-panel-b .team-score {
  color: #ffffff;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.35);
}

.team-score.is-updating {
  animation: scorePulse 320ms ease;
}

.qr-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 2.5vh, 2.5rem) clamp(1rem, 4vw, 4rem);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-120%);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms ease, visibility 0ms linear 420ms;
}

.qr-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms ease;
}

.qr-overlay-grid {
  width: min(95vw, 1800px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(220px, 16vw, 260px);
}

.qr-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.9rem, 1.8vh, 1.5rem);
}

.qr-team-name {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 900;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.55);
}

.qr-team-name-a {
  color: var(--team-a-color, #ff3f88);
}

.qr-team-name-b {
  color: var(--team-b-color, #2d7dff);
}

.qr-image {
  display: block;
  width: clamp(350px, 24vw, 400px);
  height: clamp(350px, 24vw, 400px);
  background: #fff;
  border-radius: 1rem;
  padding: 0.6rem;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

@media (max-width: 1200px) {
  .qr-overlay-grid {
    gap: clamp(220px, 16vw, 260px);
  }

  .qr-image {
    width: clamp(300px, 31vw, 360px);
    height: clamp(300px, 31vw, 360px);
  }
}

.game-title-overlay {
  z-index: 10;
  align-items: center;
  justify-content: center;
  padding: 5vh 4vw;
  pointer-events: none;
  opacity: 0;
}

.game-title-backdrop {
  max-width: min(94vw, 1800px);
  padding: clamp(1rem, 3vh, 3rem) clamp(1.4rem, 4vw, 4rem);
  border-radius: 1.2rem;
  background: radial-gradient(circle at center, rgba(26, 28, 38, 0.95) 0%, rgba(10, 10, 15, 0.88) 78%);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7), 0 0 120px rgba(70, 75, 100, 0.25);
}

.game-title-text {
  margin: 0;
  font-size: clamp(2.6rem, 8.8vw, 10rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.5), 0 0 28px rgba(121, 223, 255, 0.4);
}

.game-title-overlay.is-animating {
  animation: gameTitleOverlayVisibility 3s ease forwards;
}

.game-title-overlay.is-animating .game-title-backdrop {
  animation: gameTitleCardFloat 3s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

.buzzer-flash {
  z-index: 19;
  pointer-events: none;
  opacity: 0;
  background: rgba(255, 255, 255, 0.85);
}

.buzzer-flash.is-visible {
  display: block;
  animation: buzzerFlash 400ms ease-out forwards;
}

.buzzer-overlay {
  z-index: 20;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background: rgba(0, 0, 0, 0.58);
}

.answer-feedback-overlay {
  z-index: 22;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  pointer-events: none;
}

.answer-feedback-card {
  width: min(92vw, 1300px);
  border-radius: 1.2rem;
  padding: clamp(1rem, 4.2vh, 3.2rem);
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.answer-feedback-card h2 {
  margin: 0;
  font-size: clamp(3rem, 10vw, 9rem);
  line-height: 1.04;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.answer-feedback-card.is-positive {
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.96) 0%, rgba(25, 130, 70, 0.96) 100%);
}

.answer-feedback-card.is-negative {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.96) 0%, rgba(171, 46, 34, 0.96) 100%);
}

.answer-feedback-card.is-neutral {
  background: linear-gradient(135deg, rgba(249, 251, 255, 0.97) 0%, rgba(227, 233, 243, 0.97) 100%);
  color: #1f2938;
}

.buzzer-overlay-card {
  width: min(95vw, 1300px);
  border-radius: 1rem;
  padding: clamp(1rem, 4vh, 3rem);
  background: var(--team-a-color);
  text-align: center;
}

.buzzer-overlay-card h2 {
  margin: 0;
  font-size: clamp(2.8rem, 8.6vw, 8rem);
  line-height: 1.05;
}

#buzzerOverlayPlayerText {
  margin: 0;
  min-height: 0.5rem;
}

.buzzer-overlay-next {
  margin: clamp(0.6rem, 1.8vh, 1.2rem) 0 0;
  font-size: clamp(1.2rem, 3.2vw, 2.3rem);
  font-weight: 700;
  opacity: 0.95;
}

.buzzer-overlay-ranking {
  margin: clamp(1rem, 2.2vh, 1.8rem) auto 0;
  padding: 0;
  list-style: none;
  max-width: min(88vw, 980px);
  font-size: clamp(1.2rem, 2.6vw, 2.1rem);
  font-weight: 700;
  text-align: left;
}

.buzzer-overlay-ranking li + li {
  margin-top: 0.35rem;
}
.control-panel {
  display: none;
  min-height: 100%;
  max-width: 42rem;
  margin: 0 auto;
  box-sizing: border-box;
  flex-direction: column;
  gap: 1.15rem;
  padding: 1rem;
}

.control-title {
  margin: 0;
  font-size: 1.35rem;
}

.control-section-danger {
  margin-top: auto;
  border-color: #f0b6be;
  background: #fff7f8;
}

.control-section {
  background: #ffffff;
  border: 1px solid #d9dee7;
  border-radius: 0.85rem;
  padding: 1rem;
  display: grid;
  gap: 0.85rem;
}

.control-section-title {
  margin: 0;
  font-size: 1.05rem;
  color: #293246;
}

.control-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}


.team-score-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.team-score-column {
  border-radius: 0.75rem;
  padding: 0.55rem;
  display: grid;
  gap: 0.45rem;
}

.team-score-column-a {
  background: color-mix(in srgb, var(--team-a-color) 20%, #ffffff);
}

.team-score-column-b {
  background: color-mix(in srgb, var(--team-b-color) 20%, #ffffff);
}

.team-score-title {
  font-size: 0.9rem;
}

.team-score-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.team-score-buttons .team-score-action {
  min-height: 2rem;
  border-radius: 0.65rem;
  font-size: 1rem;
  font-weight: 800;
}

.team-score-column-a .team-score-action {
  background: color-mix(in srgb, var(--team-a-color) 82%, #111111);
}

.team-score-column-b .team-score-action {
  background: color-mix(in srgb, var(--team-b-color) 82%, #111111);
}


.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.control-buttons-single-column {
  grid-template-columns: 1fr;
}

.control-buttons-score {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.score-validation-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.compact-inline-form {
  margin-top: 0.55rem;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.compact-inline-form label {
  font-size: 0.92rem;
  color: #445067;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.control-grid-game {
  align-items: stretch;
}

.control-button-compact {
  padding: 8px 10px;
  min-height: 2.2rem;
  font-size: 14px;
  border-radius: 6px;
}

.control-button {
  border: none;
  border-radius: 7px;
  padding: 8px 10px;
  min-height: 2.5rem;
  font-size: 14px;
  font-weight: 700;
  background: #2b2f46;
  color: #fff;
}

.control-buttons-score .control-button {
  min-height: 2.35rem;
}

.control-button-positive {
  background: #27ae60;
}

.control-button-negative {
  background: #e74c3c;
}

.control-button-reset {
  background: #a42653;
}

.control-button-setup {
  background: #3b425f;
}

.control-button-danger {
  background: #d7264c;
}

.control-button-danger:hover,
.control-button-danger:focus-visible {
  background: #ba1e40;
}

.control-section-setup {
  background: #f7f9fc;
}

.control-button-team-a {
  background: var(--team-a-color);
  color: #fff;
}

.control-button-team-b {
  background: var(--team-b-color);
  color: #fff;
}


.title-form,
.game-list-form,
.lighting-config-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.55rem;
}

.control-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: #293246;
}

input[type='text'],
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #c8d0dc;
  border-radius: 0.65rem;
  padding: 0.8rem;
  font-size: 1rem;
}

.control-button.is-active {
  outline: 3px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}


.buzz-decision {
  display: grid;
  gap: 0.65rem;
}

.buzz-action-group {
  border: 1px solid #d4dbe7;
  border-radius: 0.75rem;
  padding: 0.7rem;
  display: grid;
  gap: 0.6rem;
}

.buzz-action-group-positive {
  background: #f3fcf6;
  border-color: #bde8cd;
}

.buzz-action-group-negative {
  background: #fff4f2;
  border-color: #f2c4be;
}

.buzz-action-group-neutral {
  background: #f6f8fb;
  border-color: #d9e0eb;
}

.buzz-action-group-title {
  margin: 0;
  font-size: 0.92rem;
  color: #445067;
}

.buzz-score-buttons {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.buzz-score-buttons .control-button,
.score-validation-buttons .control-button {
  min-height: 2.35rem;
  border-radius: 0.65rem;
  font-size: 0.98rem;
  font-weight: 800;
  padding: 0.4rem 0.5rem;
}

.control-button-validation-good {
  background: #27ae60;
}

.control-button-validation-bad {
  background: #e74c3c;
}

.buzz-decision-title {
  margin: 0;
  font-size: 0.98rem;
  color: #445067;
}

.buzz-queue-list {
  margin: 0;
  padding: 0.75rem 0.75rem 0.75rem 1.8rem;
  border: 1px solid #cfd6e1;
  border-radius: 0.65rem;
  background: #f8faff;
  min-height: 2.7rem;
}

.buzz-queue-list li {
  margin: 0;
  color: #293246;
  font-weight: 700;
  line-height: 1.35;
}

.buzz-queue-list-empty {
  list-style: none;
  margin-left: -1rem;
  color: #5e6a80;
  font-weight: 500;
}

.control-section-help {
  margin: -0.15rem 0 0;
  color: #556074;
  font-size: 0.92rem;
}

.game-list-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.game-list-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.game-list-button {
  flex: 1;
  min-height: 3.9rem;
  padding: 0.95rem 1rem;
  text-align: left;
  font-size: 1.1rem;
  line-height: 1.2;
  background: #3b425f;
}

.game-list-button:hover,
.game-list-button:focus-visible {
  background: #303751;
}

.game-list-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.game-list-icon-button {
  width: 2.8rem;
  min-width: 2.8rem;
  min-height: 2.8rem;
  padding: 0.4rem;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  background: #eef2f8;
  color: #1d2530;
  border: 1px solid #cfd6e1;
}

.game-list-icon-button:disabled {
  opacity: 0.45;
}

.game-list-delete-button {
  background: #fdeef2;
  border-color: #f1bac8;
  color: #9f1c45;
}

.game-list-empty {
  margin: 0;
  border: 1px dashed #cfd6e1;
  border-radius: 0.65rem;
  padding: 0.8rem;
  color: #5e6a80;
  text-align: center;
  background: #f7f9fd;
}

.control-button-ghost {
  min-height: 2.7rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.92rem;
  background: #f3f5fa;
  color: #293246;
  border: 1px solid #cfd6e1;
}

.app-version {
  margin: 0.25rem 0 0;
  color: #556074;
  font-size: 0.88rem;
  text-align: center;
}

@keyframes scorePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes introTitleFadeZoom {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes introSubtitleReveal {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes introGlowPulse {
  0%,
  100% {
    text-shadow: 0 0 22px rgba(255, 255, 255, 0.2);
  }
  50% {
    text-shadow: 0 0 48px rgba(116, 229, 255, 0.55);
  }
}

@keyframes gameTitleOverlayVisibility {
  0% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes gameTitleCardFloat {
  0% {
    transform: translateY(28px) scale(0.94);
    opacity: 0;
  }
  12% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  84% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-20px) scale(0.97);
    opacity: 0;
  }
}

@keyframes buzzerFlash {
  from { opacity: 0.95; }
  to { opacity: 0; }
}

.lighting-test-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
