*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #000;
  font-family: "Arial Rounded MT Bold", "Arial Black", Arial, sans-serif;
  color: #fff;
  user-select: none;
}
body { display: grid; place-items: center; }
.stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  overflow: hidden;
  background: #000;
}
.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }

.start-btn {
  position: absolute;
  left: 50%;
  top: 78%;
  transform: translateX(-50%);
  padding: 0.55em 1.6em;
  font: inherit;
  font-size: clamp(18px, 3.2vmin, 42px);
  letter-spacing: 0.04em;
  color: #1a1030;
  background: linear-gradient(#ffe38a, #e0b13a);
  border: 3px solid #fff4c4;
  border-radius: 0.7em;
  box-shadow: 0 8px 24px rgba(0,0,0,.55);
  cursor: pointer;
}
.start-btn:hover { filter: brightness(1.08); }

.xs {
  position: absolute;
  left: 34.6%;
  top: 1.6%;
  width: 31%;
  height: 16%;
  display: flex;
  justify-content: center;
  gap: 1.5%;
  pointer-events: none;
  z-index: 4;
}
.xs img {
  height: 100%;
  width: auto;
  opacity: 0;
  transform: scale(.7);
}
.xs img.on {
  opacity: 1;
  transform: scale(1);
}

.panel {
  position: absolute;
  left: 6.7%;
  top: 15.6%;
  width: 85.7%;
  height: 77.5%;
  background: linear-gradient(180deg, #2a1848 0%, #140a28 100%);
  border: 5px solid #e7c35a;
  border-radius: 2.2vmin;
  box-shadow: 0 0 0 3px #7a4a16, 0 18px 40px rgba(0,0,0,.55);
  display: flex;
  flex-direction: column;
  padding: 1.2% 1.6% 1%;
  z-index: 2;
}

.top-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5%;
  min-height: 18%;
}
.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2em;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
.team-score {
  min-width: 2.2em;
  padding: 0.08em 0.45em;
  font-size: clamp(22px, 5.2vmin, 64px);
  line-height: 1;
  color: #ffe56a;
  background: radial-gradient(circle at 50% 30%, #3b2a6b, #12081f);
  border: 3px solid #e7c35a;
  border-radius: 0.25em;
  text-shadow: 0 2px 0 #000;
}
.team-name {
  font-size: clamp(10px, 1.7vmin, 18px);
  letter-spacing: 0.08em;
  color: #f7e7a6;
  outline: none;
}
.center-score { text-align: center; }
.round-label {
  font-size: clamp(10px, 1.8vmin, 20px);
  letter-spacing: 0.14em;
  color: #f3d56a;
}
.board-total {
  font-size: clamp(28px, 6.4vmin, 78px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 3px 0 #4a2a00;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(4, 1fr);
  gap: 3.2% 2.6%;
  padding: 1.5% 1% 1.2%;
  grid-auto-flow: column;
}
.slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  padding: 0;
  font: inherit;
  color: #fff;
  cursor: pointer;
  border-radius: 0.55em;
  background: linear-gradient(#3d7dff, #1546c9 55%, #0d2f96);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.35), 0 4px 0 #081a55;
  overflow: hidden;
}
.slot.empty {
  opacity: 0.35;
  cursor: default;
}
.slot .num {
  font-size: clamp(22px, 4.6vmin, 56px);
  color: #ffe56a;
  text-shadow: 0 2px 0 #0a1a4a;
}
.slot.revealed {
  justify-content: space-between;
  padding: 0 0.7em 0 0.85em;
  background: linear-gradient(#5a3d10, #2a1604);
  box-shadow: inset 0 2px 0 rgba(255,230,140,.3), 0 4px 0 #120800;
  cursor: default;
}
.slot .ans {
  display: none;
  font-size: clamp(11px, 2.05vmin, 26px);
  letter-spacing: 0.04em;
  text-align: left;
  flex: 1;
  padding-right: 0.4em;
}
.slot .pts {
  display: none;
  font-size: clamp(16px, 3.2vmin, 40px);
  color: #ffe56a;
  min-width: 1.4em;
  text-align: right;
}
.slot.revealed .num { display: none; }
.slot.revealed .ans,
.slot.revealed .pts { display: block; }

.bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.4%;
  height: 14.5%;
}
.bar button {
  font: inherit;
  font-size: clamp(8px, 1.45vmin, 15px);
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #241404;
  background: linear-gradient(#ffe38a, #d9a62e);
  border: 2px solid #fff1b0;
  border-radius: 0.7em;
  cursor: pointer;
  box-shadow: 0 3px 0 #7a4e10;
}
.bar button:hover { filter: brightness(1.08); }

.side-btn {
  position: absolute;
  z-index: 3;
  width: 6.4%;
  height: 11%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font-size: clamp(16px, 3vmin, 32px);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.6));
}
.side-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.mute-on { left: 2.4%; top: 58.7%; }
.mute-off { left: 2.6%; top: 70.8%; }
.clap { left: 89.6%; top: 59%; }
.wrong {
  left: 90.2%;
  top: 69.5%;
  width: 7.2%;
  height: 12.8%;
  background: radial-gradient(circle at 50% 40%, #ff4d4d, #c40000 70%);
  border-radius: 18%;
  box-shadow: 0 4px 10px rgba(0,0,0,.5);
  color: #fff;
  font-size: clamp(18px, 4.4vmin, 52px);
  font-weight: 800;
  line-height: 1;
}
.wrong img { display: none; }

.question-card {
  position: absolute;
  left: 12%;
  top: 28%;
  width: 76%;
  min-height: 38%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4%;
  background: linear-gradient(#2c1a4e, #12081f);
  border: 6px solid #e7c35a;
  border-radius: 1.4vmin;
  box-shadow: 0 20px 50px rgba(0,0,0,.65);
  cursor: pointer;
}
.question-card p {
  margin: 0;
  text-align: center;
  font-size: clamp(18px, 3.6vmin, 44px);
  line-height: 1.25;
  color: #fff;
  text-wrap: balance;
}
.tap-hint {
  margin-top: 1.2em;
  font-size: clamp(10px, 1.4vmin, 14px);
  letter-spacing: 0.12em;
  color: #e7c35a;
  text-transform: uppercase;
}

.strike-flash {
  position: absolute;
  left: 28%;
  top: 30%;
  width: 44%;
  height: 40%;
  z-index: 7;
  background: url("media/x.png") center / contain no-repeat;
  pointer-events: none;
}
.strike-flash.triple {
  background:
    url("media/x.png") 10% center / 40% no-repeat,
    url("media/x.png") 50% center / 40% no-repeat,
    url("media/x.png") 90% center / 40% no-repeat;
}

.end-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 56%;
  padding: 4%;
  text-align: center;
  background: linear-gradient(#2c1a4e, #12081f);
  border: 6px solid #e7c35a;
  border-radius: 1.4vmin;
}
.end-scores {
  display: flex;
  justify-content: space-around;
  margin-bottom: 6%;
  font-size: clamp(14px, 2vmin, 22px);
  color: #f7e7a6;
}
.end-num {
  font-size: clamp(28px, 6vmin, 72px);
  color: #ffe56a;
}
.end-card .start-btn { position: static; transform: none; }

@media (max-width: 700px) {
  .bar button { font-size: 8px; }
  .slot .ans { font-size: 9px; }
}
