:root {
  --blue: #2b6cff;
  --blue-dark: #1b3f99;
  --red: #ff3b3b;
  --red-dark: #99201b;
  --ink: #1a1a1a;
  --paper: #f4f4f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--ink);
  color: white;
  font-weight: 700;
}

.topbar .category {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.topbar .timer {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.15rem 1rem;
  border-radius: 14px;
}

.floating-qr {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  background: white;
  border-radius: 14px;
  padding: 0.6rem 0.7rem 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.floating-qr-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.floating-qr-text {
  margin-top: 0.3rem;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  color: var(--ink);
}

.score-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  font-size: 1.25rem;
  font-weight: 700;
}

.score-row .blue-score {
  color: var(--blue);
}

.score-row .red-score {
  color: var(--red);
}

.rope-track {
  position: relative;
  height: 190px;
  margin: 0.5rem 1.5rem 1rem;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(to bottom, #8ecbff 0%, #cfe9ff 100%);
}

.rope-cloud {
  position: absolute;
  width: 46px;
  height: 16px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
}

.rope-cloud::before,
.rope-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 999px;
}

.rope-cloud::before {
  width: 24px;
  height: 24px;
  top: -10px;
  left: 6px;
}

.rope-cloud::after {
  width: 18px;
  height: 18px;
  top: -6px;
  left: 26px;
}

.rope-cloud.c1 {
  top: 14px;
  left: -60px;
  animation: cloud-drift 22s linear infinite;
}

.rope-cloud.c2 {
  top: 34px;
  left: -60px;
  animation: cloud-drift 30s linear infinite;
  animation-delay: -12s;
}

@keyframes cloud-drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(480px);
  }
}

.rope-sun {
  position: absolute;
  top: 10px;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff6c9, #ffd76a 70%);
  box-shadow: 0 0 16px 4px rgba(255, 215, 106, 0.55);
}

.rope-grass {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42%;
  background: linear-gradient(to bottom, #86df5f, #4fae2f);
}

.rope-grass::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(90deg, #4fae2f 0 6px, transparent 6px 14px);
}

.rope-flagpole {
  position: absolute;
  bottom: 42%;
  width: 4px;
  height: 50px;
  background: #6b4423;
  z-index: 1;
}

.rope-flagpole.left {
  left: 12px;
}

.rope-flagpole.right {
  right: 12px;
}

.rope-flagpole .pennant {
  position: absolute;
  top: 0;
  width: 22px;
  height: 15px;
  transform-origin: top;
  animation: flag-wave 1.6s ease-in-out infinite;
}

.rope-flagpole.left .pennant {
  left: 4px;
  background: var(--blue);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.rope-flagpole.right .pennant {
  right: 4px;
  background: var(--red);
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

@keyframes flag-wave {
  0%,
  100% {
    transform: skewY(6deg);
  }
  50% {
    transform: skewY(-6deg);
  }
}

.rope-line {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 56%;
  height: 6px;
  background: repeating-linear-gradient(90deg, #d9b46a 0 12px, #b8894a 12px 24px);
  border-radius: 4px;
  z-index: 2;
}

.rope-knot {
  position: absolute;
  top: 56%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -11px;
  background: #6b4423;
  border: 3px solid #3f2712;
  border-radius: 50%;
  transition: left 0.6s ease;
  z-index: 3;
}

.tow-kids {
  position: absolute;
  bottom: 0;
  height: 42%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  z-index: 1;
}

.tow-kids.left-side {
  left: 34px;
}

.tow-kids.right-side {
  right: 34px;
  flex-direction: row-reverse;
}

.tow-kid-wrap {
  width: 34px;
  height: 96px;
  position: relative;
}

.tow-kid-wrap.mirror {
  transform: scaleX(-1);
}

.tow-kid {
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
  animation: tow-pull 1.1s ease-in-out infinite;
}

@keyframes tow-pull {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(-16deg);
  }
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  gap: 1.5rem;
}

.question-panels {
  display: flex;
  width: 100%;
  max-width: 1100px;
  gap: 1rem;
  padding: 0 1.5rem;
}

.panel {
  flex: 1;
  border-radius: 16px;
  padding: 1.25rem;
  color: white;
}

.panel.blue {
  background: var(--blue);
}

.panel.red {
  background: var(--red);
}

.panel .team-label {
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel .team-sub {
  margin-top: 0.4rem;
  opacity: 0.9;
}

.question-card {
  width: 100%;
  max-width: 700px;
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.question-card .round-counter {
  color: #777;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.question-card .prompt {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.question-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.question-card li {
  background: var(--paper);
  border-radius: 10px;
  padding: 0.6rem;
  font-weight: 600;
}

.choice-btn {
  display: block;
  width: 100%;
  margin: 0.4rem 0;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #ddd;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--ink);
}

.choice-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: none;
}

.choice-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.choice-btn.correct {
  background: #2ecc71;
  color: white;
}

.choice-btn.incorrect {
  background: #7f8c8d;
  color: white;
}

.lobby {
  text-align: center;
  padding: 2rem;
}

.join-code {
  font-size: 3rem;
  letter-spacing: 0.2em;
  font-weight: 800;
  margin: 0.5rem 0;
}

.qr-box {
  display: inline-block;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  margin: 1rem 0;
}

.roster {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin: 1rem 0;
}

.roster-team-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.roster-team-name.blue {
  color: var(--blue);
}

.roster-team-name.red {
  color: var(--red);
}

.roster-names {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #666;
  max-width: 180px;
}

.team-mode {
  margin-top: 1.5rem;
}

.team-mode-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.team-mode-btn {
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: 2px solid #ddd;
  background: white;
  color: #888;
  cursor: pointer;
}

.team-mode-btn.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.btn {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: white;
  background: var(--ink);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.team-pick {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1rem 0;
}

.team-pick button {
  flex: 1;
  max-width: 160px;
  padding: 1rem;
  border-radius: 12px;
  border: 3px solid transparent;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
  cursor: pointer;
}

.team-pick button.blue {
  background: var(--blue);
}

.team-pick button.red {
  background: var(--red);
}

.team-pick button.selected {
  border-color: var(--ink);
}

.form-row {
  margin: 1rem auto;
  max-width: 320px;
}

.form-row input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1.1rem;
  border-radius: 10px;
  border: 2px solid #ccc;
  text-align: center;
}

.winner-banner {
  text-align: center;
  padding: 3rem 1rem;
}

.winner-banner h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.hint {
  color: #666;
  font-size: 0.9rem;
}

.error-text {
  color: var(--red);
  font-weight: 600;
}

.brand-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem 0;
  font-weight: 700;
  color: #444;
  font-size: 0.9rem;
}

.brand-line img {
  height: 28px;
  width: auto;
  display: block;
}

.brand-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e2e2;
  text-align: center;
}

.brand-footer img.brand-signature {
  height: 40px;
  width: auto;
  opacity: 0.85;
}

.brand-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.brand-hero img {
  height: 96px;
  width: auto;
}

.admin-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-btn-sm {
  font-size: 0.85rem;
  padding: 0.5rem 1.1rem;
}

.admin-subhead {
  margin-top: 2rem;
  font-size: 1.1rem;
}

.admin-table-scroll {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: white;
  border-radius: 10px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.admin-table td:nth-child(2) {
  white-space: normal;
  min-width: 220px;
}

.admin-table th {
  background: var(--paper);
  font-weight: 700;
  color: #555;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.brand-hero .tagline {
  color: #666;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.85rem;
}
