:root {
  --stone: #efe9dd;
  --stone-2: #e6ddcc;
  --card: #faf7f0;
  --ink: #21302a;
  --ink-soft: #55655d;
  --ink-faint: #8a978f;
  --gold: #b98a2f;
  --gold-soft: #d8b866;
  --gold-line: rgba(185, 138, 47, 0.45);
  --hairline: rgba(33, 48, 42, 0.14);
  --terra: #a34d33;
  --terra-deep: #82402a;
  --palm: #1f6a52;
  --palm-deep: #16503d;
  --danger: #b0432f;
  --shadow: 0 14px 34px rgba(33, 48, 42, 0.12);
  --shadow-sm: 0 6px 18px rgba(33, 48, 42, 0.1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { height: 100%; }

body {
  min-height: 100dvh;
  font-family: "IBM Plex Sans Arabic", sans-serif;
  color: var(--ink);
  background:
    repeating-linear-gradient(45deg, rgba(33, 48, 42, 0.016) 0 1px, transparent 1px 14px),
    radial-gradient(1100px 600px at 50% -15%, #f7f2e8, transparent 60%),
    linear-gradient(175deg, var(--stone), var(--stone-2));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

h1, h2, .logo-mark, .brand-mark, .tile-value, .chip-score, .q-val, #timer-text, .vs-badge, .step-btn, .screen-title, .winner-title, .final-chip strong {
  font-family: "Noto Kufi Arabic", sans-serif;
}

.screen {
  display: none;
  flex: 1;
  width: 100%;
  padding: clamp(18px, 3vw, 36px) clamp(14px, 3vw, 28px) 104px;
}

.screen.active { display: flex; flex-direction: column; align-items: center; animation: screenIn 0.45s var(--ease); }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

.sadu-strip {
  height: 9px;
  width: 100%;
  background:
    radial-gradient(circle 2.2px at 50% 50%, var(--gold) 98%, transparent) 0 0 / 30px 9px repeat-x,
    linear-gradient(90deg, transparent 0%, var(--gold-line) 18%, var(--gold-line) 82%, transparent 100%) 50% 50% / 100% 1px no-repeat;
}

.btn {
  border: 1px solid var(--hairline);
  cursor: pointer;
  border-radius: 12px;
  padding: 14px 30px;
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), filter 0.2s var(--ease);
}

.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--gold-line); }

.btn:not(:disabled):active { transform: translateY(0); }

.btn:disabled { opacity: 0.42; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #2b3d35, var(--ink));
  color: var(--gold-soft);
  border-color: var(--ink);
}

.btn-primary:not(:disabled):hover { filter: brightness(1.15); border-color: var(--ink); }

.btn-plain { background: var(--card); }

.btn-team-a { background: linear-gradient(180deg, #b45a3e, var(--terra)); color: #fdf3ee; border-color: var(--terra); }

.btn-team-b { background: linear-gradient(180deg, #27795f, var(--palm)); color: #eefbf5; border-color: var(--palm); }

.btn-wide { width: min(420px, 100%); margin-top: 30px; }

.btn-small { font-size: 0.92rem; padding: 10px 22px; }

.home-wrap {
  width: min(640px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 26px;
  margin: auto;
}

.hero-frame {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(26px, 4.5vw, 42px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  position: relative;
}

.hero-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--gold-line);
  border-radius: 16px;
  pointer-events: none;
}

.logo-mark {
  font-size: clamp(3.8rem, 13vw, 6.2rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.tagline { font-size: clamp(0.98rem, 2.4vw, 1.12rem); color: var(--ink-soft); font-weight: 500; letter-spacing: 0.02em; }

.home-actions { display: flex; flex-direction: column; gap: 12px; width: min(340px, 100%); }

.rules-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: clamp(20px, 3.4vw, 30px);
  text-align: right;
  box-shadow: var(--shadow-sm);
}

.rules-card h2 {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rule-diamond { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); display: inline-block; }

.rules-card ul { list-style: none; display: grid; gap: 11px; }

.rules-card li { padding-right: 22px; position: relative; line-height: 1.9; font-weight: 500; color: var(--ink-soft); }

.rules-card li::before {
  content: "";
  position: absolute;
  right: 2px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  background: var(--gold);
}

.setup-wrap { width: min(800px, 100%); margin: 0 auto; }

.screen-title {
  text-align: center;
  font-size: clamp(1.6rem, 4.6vw, 2.1rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.title-tick { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); }

.teams-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.team-input {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 6px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s var(--ease);
}

.team-flag { width: 11px; height: 11px; transform: rotate(45deg); flex-shrink: 0; }

.team-input.team-a .team-flag { background: var(--terra); }

.team-input.team-b .team-flag { background: var(--palm); }

.team-input.team-a:focus-within { border-color: var(--terra); }

.team-input.team-b:focus-within { border-color: var(--palm); }

.team-input input {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: 1.04rem;
  font-weight: 700;
  padding: 13px 0;
}

.team-input input::placeholder { color: var(--ink-faint); font-weight: 500; }

.team-input input:focus { outline: none; }

.section-heading {
  margin: 32px 0 16px;
  font-size: 1.18rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}

#cat-counter { color: var(--gold); font-family: "Noto Kufi Arabic", sans-serif; font-size: 1.02rem; font-weight: 700; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 20px 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.cat-card .cat-icon { font-size: 1.9rem; }

.cat-card:hover { transform: translateY(-3px); border-color: var(--gold-line); box-shadow: var(--shadow); }

.cat-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.cat-card.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fbf5e6, #f6ecd4);
  box-shadow: 0 8px 24px rgba(185, 138, 47, 0.22);
  transform: translateY(-3px);
}

.board-header {
  width: min(1060px, 100%);
  margin: 0 auto 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(12px, 2vw, 20px);
}

.score-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 13px 20px 17px;
  box-shadow: var(--shadow-sm);
  opacity: 0.6;
  overflow: hidden;
  transition: opacity 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.score-chip::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 3px;
  opacity: 0;
  background-size: 200% 100%;
  transition: opacity 0.3s var(--ease);
}

.score-chip.team-a::after { background-image: linear-gradient(90deg, var(--terra), var(--gold-soft), var(--terra)); }

.score-chip.team-b::after { background-image: linear-gradient(90deg, var(--palm), var(--gold-soft), var(--palm)); }

.score-chip.active-turn { opacity: 1; box-shadow: var(--shadow); }

.score-chip.team-a.active-turn { border-color: var(--terra); }

.score-chip.team-b.active-turn { border-color: var(--palm); }

.score-chip.active-turn::after { opacity: 1; animation: goldSweep 2.2s linear infinite; }

@keyframes goldSweep {
  from { background-position: 200% 0; }
  to { background-position: 0% 0; }
}

.score-chip .chip-name {
  font-weight: 700;
  font-size: clamp(0.95rem, 2.3vw, 1.08rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-chip.team-a .chip-name { color: var(--terra); }

.score-chip.team-b .chip-name { color: var(--palm); }

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--stone);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}

.step-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}

.step-btn:hover { transform: scale(1.08); border-color: var(--gold); }

.step-btn:active { transform: scale(0.9); }

.step-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.chip-score { font-size: 1.45rem; font-weight: 700; line-height: 1; min-width: 56px; text-align: center; color: var(--ink); }

.vs-box { display: flex; flex-direction: column; align-items: center; gap: 7px; }

.brand-mark {
  font-size: clamp(1.5rem, 3.2vw, 1.9rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
  position: relative;
  padding-bottom: 4px;
  animation: brandFloat 3.6s ease-in-out infinite;
}

.brand-mark::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 10%;
  left: 10%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  background-size: 200% 100%;
  animation: goldSweep 2.6s linear infinite;
}

@keyframes brandFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.vs-badge {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  transform: rotate(45deg);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.vs-badge i { transform: rotate(-45deg); font-style: normal; color: var(--gold-soft); font-weight: 700; font-size: 1.02rem; }

.turn-caption { font-size: 0.84rem; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }

.turn-caption strong { color: var(--gold); }

.board-grid {
  width: min(1060px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: clamp(10px, 1.6vw, 16px);
}

.board-col { display: flex; flex-direction: column; gap: clamp(10px, 1.6vw, 16px); }

.col-head {
  background: linear-gradient(180deg, #2b3d35, var(--ink));
  color: #f4efe4;
  border: 1px solid var(--ink);
  border-radius: 14px;
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.col-head::after {
  content: "";
  position: absolute;
  bottom: 6px;
  right: 14%;
  left: 14%;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--gold-soft), transparent);
}

.col-head .cat-icon { font-size: 1.55rem; }

.col-head .cat-name {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: #f8f4ea;
}

.tile {
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 6px;
  height: 76px;
  background: var(--card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.tile .tile-value { font-size: clamp(1.3rem, 2.5vw, 1.55rem); font-weight: 700; color: var(--ink); }

.tile:not(.done):hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 10px 26px rgba(185, 138, 47, 0.2);
}

.tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.tile.done {
  cursor: pointer;
  background: var(--stone);
  border-color: var(--hairline);
  box-shadow: none;
}

.tile.done:hover { transform: translateY(-2px); border-color: var(--gold-line); box-shadow: var(--shadow-sm); }

.tile .tile-by {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  max-width: 96%;
  border: 1px solid currentColor;
  border-radius: 9px;
  animation: fadeUp 0.3s var(--ease);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tile .tile-by b {
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile .tile-by i {
  font-style: normal;
  font-family: "Noto Kufi Arabic", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.25;
}

.tile .tile-by.by-a { color: var(--terra); background: rgba(163, 77, 51, 0.06); }

.tile .tile-by.by-b { color: var(--palm); background: rgba(31, 106, 82, 0.06); }

.tile .tile-by.by-none { color: var(--danger); font-size: 1.1rem; border: none; background: none; }

.board-footer { margin: 30px 0 52px; text-align: center; }

.q-stage {
  width: min(860px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.q-cat {
  background: var(--ink);
  color: #f4efe4;
  border-radius: 999px;
  padding: 9px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-sm);
}

.q-val {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, #fbf5e6, #f3e8cd);
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  padding: 7px 20px;
}

.answering-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 9px 24px;
  font-weight: 700;
  font-size: clamp(0.92rem, 2.5vw, 1.04rem);
  background: var(--card);
  border: 1px solid currentColor;
  box-shadow: var(--shadow-sm);
}

.answering-banner.for-a { color: var(--terra); }

.answering-banner.for-b { color: var(--palm); }

.pulse-dot {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: currentColor;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: rotate(45deg) scale(1); opacity: 1; }
  50% { transform: rotate(45deg) scale(1.35); opacity: 0.5; }
}

.phase-badge {
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--stone);
  color: var(--ink-soft);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 3px 12px;
}

.stage-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  padding: clamp(58px, 8vw, 72px) clamp(20px, 3.6vw, 40px) clamp(24px, 3.6vw, 34px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  text-align: center;
  overflow: visible;
}

.card-sadu {
  position: absolute;
  top: 16px;
  right: 26px;
  left: 26px;
  height: 7px;
  background:
    radial-gradient(circle 1.8px at 50% 50%, var(--gold) 98%, transparent) 0 0 / 26px 7px repeat-x,
    linear-gradient(90deg, transparent 0%, var(--gold-line) 15%, var(--gold-line) 85%, transparent 100%) 50% 50% / 100% 1px no-repeat;
}

.timer-bar {
  position: absolute;
  top: 32px;
  right: 26px;
  left: 26px;
  height: 6px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--stone);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  float: right;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 1s linear, background 0.3s ease;
}

.timer-bar.danger .timer-fill { background: linear-gradient(90deg, var(--danger), #d4715c); }

.timer-coin {
  position: absolute;
  top: 0;
  right: 50%;
  width: 88px;
  height: 88px;
  transform: translate(50%, -54%);
  background: var(--card);
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(33, 48, 42, 0.16), inset 0 0 0 5px var(--card), inset 0 0 0 6px var(--gold-line);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s ease;
}

.coin-inner { display: flex; flex-direction: column; align-items: center; line-height: 1; }

.timer-coin #timer-text { font-size: 1.8rem; font-weight: 700; color: var(--ink); }

.timer-coin small { font-size: 0.6rem; font-weight: 700; color: var(--ink-faint); font-family: "IBM Plex Sans Arabic", sans-serif; }

.timer-coin.danger { border-color: var(--danger); animation: coinPulse 0.6s ease-in-out infinite; }

.timer-coin.danger #timer-text { color: var(--danger); }

@keyframes coinPulse {
  0%, 100% { transform: translate(50%, -54%) scale(1); }
  50% { transform: translate(50%, -54%) scale(1.05); }
}

.q-text {
  font-size: clamp(1.25rem, 3.4vw, 1.75rem);
  font-weight: 700;
  line-height: 2;
  color: var(--ink);
  width: 100%;
}

.lifelines { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.lifeline {
  border: 1px solid var(--hairline);
  background: var(--stone);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 20px;
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
}

.lifeline:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--gold); box-shadow: var(--shadow-sm); }

.lifeline:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.lifeline:disabled { opacity: 0.38; cursor: not-allowed; text-decoration: line-through; }

.q-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

.answer-block { width: 100%; animation: screenIn 0.4s var(--ease); }

.answer-label { color: var(--ink-faint); font-weight: 700; margin-bottom: 8px; font-size: 0.92rem; letter-spacing: 0.02em; }

.answer-text {
  font-size: clamp(1.25rem, 3.2vw, 1.6rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 20px;
  background: linear-gradient(180deg, #fbf5e6, #f6edd6);
  border: 1px solid var(--gold-line);
  border-right: 4px solid var(--gold);
  border-radius: 12px;
  padding: 16px 20px;
}

.judge-label { font-weight: 700; margin-bottom: 14px; font-size: 1rem; color: var(--ink-soft); }

.judge-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

.winner-wrap {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
  width: min(560px, 100%);
}

.trophy { font-size: 4.2rem; animation: floatY 1.8s ease-in-out infinite; }

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.winner-title {
  font-size: clamp(1.9rem, 5.6vw, 2.5rem);
  font-weight: 700;
  color: var(--ink);
  position: relative;
  padding-bottom: 12px;
}

.winner-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 15%;
  left: 15%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.winner-sub { color: var(--ink-soft); font-size: 1.1rem; font-weight: 500; }

.final-scores { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: 100%; margin: 12px 0 20px; }

.final-chip {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.final-chip::after { content: ""; position: absolute; bottom: 0; right: 0; left: 0; height: 3px; }

.final-chip.team-a::after { background: var(--terra); }

.final-chip.team-b::after { background: var(--palm); }

.final-chip strong { font-size: 1.9rem; font-weight: 700; }

.final-chip.team-a strong { color: var(--terra); }

.final-chip.team-b strong { color: var(--palm); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(33, 48, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 25;
}

.review-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--gold-line);
  border-radius: 22px;
  box-shadow: 0 26px 60px rgba(33, 48, 42, 0.3);
  padding: clamp(22px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  animation: screenIn 0.3s var(--ease);
}

.review-close {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--stone);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}

.review-close:hover { transform: scale(1.1); border-color: var(--gold); }

.review-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 4px; }

.review-label { font-weight: 700; color: var(--ink-faint); font-size: 0.9rem; margin-top: 6px; }

.review-q { font-size: clamp(1.05rem, 2.7vw, 1.3rem); font-weight: 700; line-height: 1.95; }

.review-a {
  font-size: clamp(1.05rem, 2.7vw, 1.3rem);
  font-weight: 700;
  color: var(--ink);
  background: linear-gradient(180deg, #fbf5e6, #f6edd6);
  border: 1px solid var(--gold-line);
  border-right: 4px solid var(--gold);
  border-radius: 12px;
  padding: 12px 18px;
  width: 100%;
}

.review-result { font-weight: 700; font-size: 1rem; margin-top: 4px; }

.review-result.res-a { color: var(--terra); }

.review-result.res-b { color: var(--palm); }

.review-result.res-none { color: var(--danger); }

.sound-btn {
  position: fixed;
  bottom: 72px;
  inset-inline-end: 16px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: var(--card);
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 15;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}

.sound-btn:hover { transform: scale(1.08); border-color: var(--gold); }

.sound-btn:active { transform: scale(0.92); }

.sound-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.toast {
  position: fixed;
  bottom: 108px;
  right: 50%;
  transform: translateX(50%) translateY(20px);
  background: var(--ink);
  color: #f4efe4;
  border-radius: 12px;
  padding: 13px 26px;
  font-weight: 700;
  font-size: 0.98rem;
  max-width: min(92vw, 480px);
  text-align: center;
  box-shadow: 0 16px 36px rgba(33, 48, 42, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 30;
}

.toast.show { opacity: 1; transform: translateX(50%) translateY(0); }

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

.site-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  text-align: center;
  z-index: 10;
  background: var(--stone);
}

.site-footer span {
  display: block;
  padding: 11px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.footer-strip { height: 9px; }

@media (max-width: 900px) {
  .board-grid { grid-template-columns: repeat(3, 1fr); }
  .board-header { grid-template-columns: 1fr 1fr; }
  .vs-box { grid-column: 1 / -1; order: -1; flex-direction: row; gap: 14px; }
  .stage-meta { justify-content: center; }
}

@media (max-width: 540px) {
  .teams-inputs { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: repeat(2, 1fr); }
  .final-scores { grid-template-columns: 1fr; }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .q-actions .btn, .judge-buttons .btn { width: 100%; }
  .score-chip { flex-direction: column; align-items: stretch; text-align: center; gap: 8px; }
  .stepper { justify-content: center; }
  .timer-coin { width: 76px; height: 76px; }
  .timer-coin #timer-text { font-size: 1.55rem; }
  .vs-badge { width: 40px; height: 40px; }
}

@media (min-width: 1400px) {
  .board-grid, .board-header { width: min(1240px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .score-chip.active-turn::after { opacity: 1; }
}
