* {
  box-sizing: border-box;
}

:root {
  --bg: #101214;
  --panel: #20242a;
  --panel-2: #2a3037;
  --panel-3: #353c44;
  --line: #48515b;
  --text: #f7f8fa;
  --muted: #aeb6bf;
  --silver: #d6dbe1;
  --gold: #d9b45f;
  --gold-dark: #7a612f;
  --green: #4d8566;
  --blue: #586f8a;
  --red: #965353;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 50% -20%, #545d67 0, #252a30 30%, var(--bg) 70%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.topbar {
  min-height: 70px;
  padding: 11px 3%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 18, 20, .9);
  backdrop-filter: blur(14px);
}

.top-btn {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel-2);
  text-decoration: none;
}

.danger-soft {
  background: #493136;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand strong {
  font-size: 23px;
}

.brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.page {
  width: min(1220px, 96%);
  margin: auto;
  padding: 22px 0 40px;
}

/* شاشة الإعداد */

.setup-screen {
  width: min(1050px, 100%);
  margin: auto;
}

.setup-hero {
  padding: 32px 20px 24px;
  text-align: center;
}

.setup-badge {
  display: inline-block;
  padding: 7px 14px;
  border: 1px solid #75633e;
  border-radius: 999px;
  color: #f2d99e;
  background: rgba(99, 79, 40, .35);
  font-size: 13px;
}

.setup-hero h1 {
  margin: 15px 0 8px;
  font-size: clamp(30px, 5vw, 48px);
}

.setup-hero p {
  margin: 0;
  color: var(--muted);
}

.team-setup {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.team-input-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(32, 36, 42, .95);
  box-shadow: 0 15px 35px rgba(0, 0, 0, .22);
}

.team-a-border {
  border-top: 4px solid var(--silver);
}

.team-b-border {
  border-top: 4px solid #8298b0;
}

.team-input-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.team-input-card input {
  width: 100%;
  padding: 13px;
  border: 1px solid #56616c;
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: #171a1e;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
}

.team-input-card input:focus {
  border-color: var(--gold);
}

.versus {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: auto;
  border: 1px solid #6d5c3b;
  border-radius: 50%;
  color: var(--gold);
  background: #2d2920;
  font-weight: 900;
}

.selection-panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(32, 36, 42, .95);
  box-shadow: 0 15px 35px rgba(0, 0, 0, .22);
}

.selection-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.selection-head h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.selection-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.selection-counter {
  min-width: 90px;
  padding: 10px 14px;
  border: 1px solid #675b43;
  border-radius: 13px;
  color: var(--gold);
  background: #29251d;
  text-align: center;
}

.selection-counter strong {
  font-size: 25px;
}

.category-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}

.category-search {
  min-height: 48px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid #4c5660;
  border-radius: 14px;
  color: var(--gold);
  background: rgba(16, 18, 20, .72);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.category-search:focus-within {
  border-color: var(--gold);
  background: #17191c;
  box-shadow: 0 0 0 3px rgba(217, 180, 95, .12);
}

.category-search > span {
  font-size: 25px;
  line-height: 1;
}

.category-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
}

.category-search input::placeholder {
  color: #8f98a2;
}

.category-search input::-webkit-search-cancel-button {
  cursor: pointer;
}

.category-results {
  min-width: 110px;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.category-empty {
  grid-column: 1 / -1;
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border: 1px dashed #4c5660;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  background: rgba(16, 18, 20, .35);
}

.category-empty > span {
  color: var(--gold);
  font-size: 36px;
}

.category-empty strong {
  color: var(--text);
}

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

.category-choice {
  min-height: 90px;
  padding: 13px;
  position: relative;
  border: 1px solid #4c5660;
  border-radius: 14px;
  color: var(--text);
  background: linear-gradient(145deg, #323941, #20252a);
  text-align: right;
  transition: .18s ease;
}

.category-choice:hover {
  transform: translateY(-2px);
  border-color: #8d98a3;
}

.category-choice.selected {
  border-color: var(--gold);
  background: linear-gradient(145deg, #5f512f, #302a20);
  box-shadow: 0 0 0 2px rgba(217, 180, 95, .18);
}

.category-choice .check {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid #68727c;
  border-radius: 50%;
  color: transparent;
  background: #1b1f23;
}

.category-choice.selected .check {
  color: #172019;
  border-color: var(--gold);
  background: var(--gold);
}

.category-choice strong {
  display: block;
  margin-bottom: 7px;
  font-size: 17px;
}

.category-choice small {
  color: var(--muted);
  font-size: 11px;
}

.setup-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 14px;
}

.primary-btn,
.secondary-btn,
.finish-btn {
  min-height: 48px;
  border-radius: 12px;
  color: var(--text);
  font-weight: 900;
}

.primary-btn {
  border: 1px solid #92743a;
  background: linear-gradient(135deg, #8b6d32, #58451f);
}

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

.secondary-btn {
  padding-inline: 18px;
  border: 1px solid var(--line);
  background: #2a3036;
}

.setup-error {
  min-height: 22px;
  margin: 9px 0 0;
  color: #efaaaa;
  text-align: center;
  font-size: 13px;
}

/* اللعبة */

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 180px 1fr;
  gap: 12px;
}

.team,
.turn-card,
.helper-team,
.board-shell {
  border: 1px solid var(--line);
  background: rgba(32, 36, 42, .94);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .22);
}

.team,
.turn-card {
  min-height: 132px;
  padding: 13px;
  border-radius: 16px;
  text-align: center;
}

.team-a {
  border-top: 3px solid var(--silver);
}

.team-b {
  border-top: 3px solid #8298b0;
}

.team-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.team > strong {
  font-size: 18px;
}

.score {
  margin: 7px 0;
  color: var(--gold);
  font-size: 38px;
  font-weight: 900;
}

.manual-score {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.manual-score button,
.turn-card button,
.timer-actions button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #343b43;
}

.turn-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.turn-card span {
  color: var(--muted);
  font-size: 12px;
}

.turn-card strong {
  margin: 7px 0 10px;
  font-size: 17px;
}

.helpers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}

.helper-team {
  padding: 11px;
  border-radius: 14px;
}

.helper-team h3 {
  margin: 0 0 9px;
  color: var(--silver);
  text-align: center;
  font-size: 14px;
}

.helper-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.helper-btn {
  min-height: 40px;
  padding: 7px;
  border: 1px solid #59636d;
  border-radius: 9px;
  color: var(--text);
  background: #30373e;
  font-size: 12px;
}

.helper-btn:hover:not(:disabled) {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.helper-btn.used,
.helper-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  text-decoration: line-through;
}

.helper-btn.selected {
  border-color: var(--gold);
  background: #57492c;
}

.board-shell {
  padding: 10px;
  overflow-x: auto;
  border-radius: 17px;
}

.board {
  min-width: 850px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
}

.category-column {
  display: grid;
  gap: 7px;
}

.category-header {
  min-height: 66px;
  padding: 8px;
  display: grid;
  place-items: center;
  border: 1px solid #606a74;
  border-radius: 10px;
  background: linear-gradient(145deg, #59636d, #353c43);
  text-align: center;
  font-size: 15px;
  font-weight: 900;
}

.question-button {
  min-height: 56px;
  border: 1px solid #4c5660;
  border-radius: 9px;
  color: var(--gold);
  background: linear-gradient(145deg, #30373e, #1f2429);
  font-size: 21px;
  font-weight: 900;
  transition: .18s ease;
}

.question-button:hover {
  border-color: var(--silver);
  transform: translateY(-2px);
  background: linear-gradient(145deg, #48515a, #292f35);
}

.question-button.used {
  opacity: .12;
  pointer-events: none;
  transform: scale(.94);
}

.question-button.pit-target {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(217, 180, 95, .25);
}

.bottom-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin-top: 12px;
}

.finish-btn {
  border: 1px solid #92743a;
  background: linear-gradient(135deg, #80632f, #4c3b1e);
}

/* النوافذ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .83);
}

.modal.active {
  display: flex;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 96vh;
  overflow-y: auto;
  padding: 25px;
  position: relative;
  border: 1px solid #5e6872;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, #48515a, #20252a 68%);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}

.close {
  position: absolute;
  top: 9px;
  left: 13px;
  border: 0;
  color: var(--text);
  background: transparent;
  font-size: 32px;
}

.question-meta {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-bottom: 12px;
}

.question-meta span,
.question-meta strong {
  padding: 7px 13px;
  border: 1px solid #5d6771;
  border-radius: 999px;
  background: #2c333a;
  font-size: 13px;
}

.timer {
  width: 83px;
  height: 83px;
  margin: auto;
  display: grid;
  place-content: center;
  border: 5px solid #9099a2;
  border-radius: 50%;
  background: #171a1d;
}

.timer span {
  line-height: 1;
  font-size: 28px;
  font-weight: 900;
}

.timer small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.timer.warning {
  border-color: var(--gold);
}

.timer.danger {
  border-color: #c56464;
  animation: pulse .8s infinite alternate;
}

@keyframes pulse {
  to {
    transform: scale(1.06);
  }
}

.timer-actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.helper-message {
  min-height: 0;
  margin-top: 9px;
  color: #ffe0a0;
  font-size: 13px;
  font-weight: 800;
}

.question-text {
  min-height: 105px;
  margin: 12px 0;
  display: grid;
  place-items: center;
  line-height: 1.7;
  font-size: clamp(21px, 3vw, 32px);
}

.answer-area {
  display: none;
  margin: 10px 0;
  padding: 14px;
  border: 1px solid #5d6771;
  border-radius: 13px;
  background: #171a1d;
}

.answer-area.visible {
  display: block;
}

.answer-area span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.answer-area strong {
  font-size: 21px;
}

.show-answer {
  width: 100%;
  min-height: 43px;
  margin-bottom: 9px;
  border: 1px solid #68727c;
  border-radius: 10px;
  color: var(--text);
  background: #3e464f;
  font-weight: 800;
}

.award-grid,
.wrong-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.award,
.wrong-btn,
.nobody {
  min-height: 45px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
}

.award-a {
  background: var(--green);
}

.award-b {
  background: var(--green);
}

.wrong-btn {
  background: #704949;
}

.nobody {
  width: 100%;
  background: #3f454b;
}

/* الفائز */

.winner-card {
  width: min(520px, 100%);
  padding: 30px 22px;
  border: 1px solid #78663f;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, #695733, #25292e 55%);
  text-align: center;
}

.trophy {
  font-size: 72px;
  animation: trophy .8s ease-in-out infinite alternate;
}

@keyframes trophy {
  to {
    transform: translateY(-7px) rotate(3deg);
  }
}

.winner-card > p {
  color: #d9c99e;
}

.winner-card h2 {
  margin: 8px 0;
  font-size: 34px;
}

.winner-score {
  color: var(--gold);
  font-size: 24px;
  font-weight: 900;
}

.victory-mark {
  width: 65px;
  height: 65px;
  margin: 18px auto;
  display: grid;
  place-items: center;
  border: 4px solid #70ad85;
  border-radius: 50%;
  color: #90d1a5;
  font-size: 35px;
  font-weight: 900;
}

.thanks {
  color: var(--muted) !important;
}

.winner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 15px;
}

.winner-actions button {
  min-height: 44px;
  border: 1px solid #6d6148;
  border-radius: 10px;
  color: #fff;
  background: #403a2e;
}

@media (max-width: 900px) {
  .category-picker {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  .team-setup {
    grid-template-columns: 1fr;
  }

  .versus {
    width: 52px;
    height: 52px;
  }

  .category-picker {
    grid-template-columns: repeat(2, 1fr);
  }

  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }

  .turn-card {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 95px;
  }

  .helpers {
    grid-template-columns: 1fr;
  }

  .helper-buttons {
    grid-template-columns: 1fr;
  }

  .award-grid,
  .wrong-grid {
    grid-template-columns: 1fr;
  }

  .bottom-actions,
  .setup-actions {
    grid-template-columns: 1fr;
  }

  .top-btn {
    padding: 8px;
    font-size: 11px;
  }

  .brand strong {
    font-size: 18px;
  }
}

@media (max-width: 470px) {
  .category-search-row {
    align-items: stretch;
    flex-direction: column;
  }

  .category-results {
    min-width: 0;
    text-align: right;
  }

  .category-picker {
    grid-template-columns: 1fr;
  }

  .selection-head {
    align-items: flex-start;
  }
}


/* تحسين واجهة السؤال */
.modal-card {
  width: min(820px, 100%);
  padding: 30px;
  border-color: #69737d;
  background:
    radial-gradient(circle at 50% -20%, #59636d 0, #323941 35%, #1d2227 78%);
}

.question-text {
  min-height: 130px;
  margin: 18px 0;
  font-size: clamp(25px, 3.3vw, 38px);
  letter-spacing: .1px;
}

.team-choice-title {
  margin: 12px 0 9px;
  color: #bfc7cf;
  font-size: 13px;
  font-weight: 800;
}

.premium-awards {
  gap: 12px;
}

.premium-awards .award {
  min-height: 58px;
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 22px rgba(0,0,0,.22);
  font-size: 18px;
  transition: transform .16s ease, filter .16s ease;
}

.premium-awards .award:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.nobody {
  min-height: 50px;
  margin-top: 2px;
  border: 1px solid #59626b;
  background: linear-gradient(145deg, #414850, #30363c);
  font-size: 16px;
}

.show-answer {
  min-height: 50px;
  margin-bottom: 12px;
  background: linear-gradient(145deg, #515a64, #394047);
}

.wrong-grid {
  display: none !important;
}


/* Director Edition — تدفق إجابة احترافي */
.judge-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.selected-team-label {
  grid-column: 1 / -1;
  min-height: 48px;
  padding: 13px;
  display: grid;
  place-items: center;
  border: 1px solid #66717c;
  border-radius: 12px;
  color: #f2d99d;
  background: linear-gradient(145deg, #3b4148, #292f35);
  font-size: 17px;
  font-weight: 900;
}

.judge-btn {
  min-height: 54px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 10px 22px rgba(0,0,0,.2);
  transition: transform .15s ease, filter .15s ease;
}

.judge-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

.judge-correct {
  background: linear-gradient(145deg, #589170, #3f6f55);
}

.judge-wrong {
  background: linear-gradient(145deg, #9a5b5b, #704343);
}

.judge-cancel {
  grid-column: 1 / -1;
  min-height: 43px;
  color: #dbe0e5;
  background: linear-gradient(145deg, #454d55, #343a40);
}

.premium-awards .award {
  min-height: 66px;
  font-size: 20px;
}

.question-meta {
  margin-top: 2px;
}

.timer {
  box-shadow: 0 0 0 7px rgba(255,255,255,.025), 0 12px 30px rgba(0,0,0,.26);
}

.board-shell {
  border-color: #59636d;
  background:
    linear-gradient(145deg, rgba(39,45,51,.98), rgba(24,28,32,.98));
}

.category-header {
  border-color: #68737e;
  background:
    linear-gradient(145deg, #65707b, #3b434b);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.question-button {
  min-height: 59px;
  color: #e0ba66;
  background:
    linear-gradient(145deg, #353c43, #20252a);
}

.question-button:hover {
  background:
    linear-gradient(145deg, #515b65, #30373d);
}

@media (max-width: 700px) {
  .judge-choices {
    grid-template-columns: 1fr;
  }

  .selected-team-label,
  .judge-cancel {
    grid-column: auto;
  }
}
/* واجهة لعبة الفئات الاحترافية */

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -15%, rgba(112, 124, 137, .7) 0, rgba(41, 47, 53, .88) 30%, var(--bg) 72%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  opacity: .24;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}

.ambient {
  position: fixed;
  z-index: -2;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(100px);
  opacity: .12;
}

.ambient-one {
  top: 120px;
  right: -170px;
  background: #d9b45f;
}

.ambient-two {
  bottom: 60px;
  left: -190px;
  background: #7999ba;
}

.topbar {
  min-height: 76px;
  padding-inline: max(3%, 18px);
  border-color: rgba(147, 159, 170, .28);
  background: rgba(14, 17, 20, .82);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}

.top-btn {
  min-height: 43px;
  padding-inline: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(140, 151, 161, .45);
  background: linear-gradient(145deg, rgba(60, 68, 76, .92), rgba(38, 44, 50, .92));
  font-weight: 800;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.top-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 180, 95, .72);
}

.danger-soft {
  border-color: rgba(163, 91, 91, .52);
  background: linear-gradient(145deg, #583b41, #3f2d32);
}

.brand strong {
  letter-spacing: -.2px;
}

.brand span {
  color: #d3b873;
}

.page {
  width: min(1180px, 94%);
  padding-top: 26px;
}

.setup-screen,
.game-screen {
  width: 100%;
  margin: auto;
  animation: screen-in .45s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes screen-in {
  from {
    transform: translateY(14px);
  }
  to {
    transform: translateY(0);
  }
}

.setup-hero {
  padding: 30px 20px 28px;
}

.setup-badge,
.section-kicker {
  font-weight: 900;
  letter-spacing: .2px;
}

.setup-hero h1 {
  margin-top: 17px;
  letter-spacing: -.8px;
}

.setup-hero p {
  font-size: 15px;
}

.setup-steps {
  width: min(690px, 100%);
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.setup-steps span {
  min-height: 46px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(111, 123, 134, .5);
  border-radius: 12px;
  color: #d6dce1;
  background: rgba(28, 33, 38, .72);
  font-size: 12px;
  font-weight: 800;
}

.setup-steps b {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2a2418;
  background: var(--gold);
}

.team-setup {
  gap: 16px;
}

.team-input-card {
  padding: 19px;
  position: relative;
  overflow: hidden;
  border-color: rgba(112, 124, 135, .52);
  background:
    linear-gradient(145deg, rgba(43, 49, 56, .97), rgba(28, 33, 38, .97));
}

.team-input-card::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 150px;
  top: -100px;
  left: -75px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .05);
}

.team-a-border {
  border-top-color: #e1e5e9;
}

.team-b-border {
  border-top-color: #8ca9c4;
}

.team-input-label {
  font-weight: 800;
}

.team-input-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
}

.team-mark {
  display: grid;
  place-items: center;
  border: 1px solid #626e79;
  border-radius: 12px;
  color: #182028;
  background: #d7dce0;
  font-size: 17px;
}

.team-mark-b {
  color: #18212b;
  background: #8ea8c1;
}

.team-input-card input {
  transition: border-color .18s ease, box-shadow .18s ease;
}

.team-input-card input:focus {
  box-shadow: 0 0 0 4px rgba(217, 180, 95, .1);
}

.versus {
  box-shadow: 0 0 0 8px rgba(217, 180, 95, .04), 0 12px 30px rgba(0, 0, 0, .24);
}

.selection-panel {
  padding: 21px;
  border-color: rgba(112, 124, 135, .56);
  background:
    linear-gradient(150deg, rgba(38, 44, 50, .97), rgba(26, 30, 35, .97));
}

.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: #d9b45f;
  font-size: 11px;
}

.selection-counter {
  min-width: 112px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.selection-counter small {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.selected-preview {
  min-height: 32px;
  margin: -2px 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selected-preview:empty::after {
  content: "لم تختر أي فئة بعد";
  color: #89939d;
  font-size: 11px;
}

.selected-chip {
  padding: 5px 9px;
  border: 1px solid rgba(217, 180, 95, .35);
  border-radius: 999px;
  color: #ead39b;
  background: rgba(91, 73, 40, .3);
  font-size: 10px;
  animation: chip-in .2s ease both;
}

@keyframes chip-in {
  from {
    opacity: 0;
    transform: scale(.92);
  }
}

.category-picker {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  min-height: 220px;
  visibility: visible !important;
  opacity: 1 !important;
}

.category-choice {
  min-height: 198px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 108px auto auto;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  isolation: isolate;
  border-color: rgba(105, 117, 128, .56);
  background:
    linear-gradient(145deg, rgba(53, 61, 69, .92), rgba(31, 36, 41, .96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
  text-align: right;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

.category-choice::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 100px;
  height: 100px;
  top: -55px;
  right: -50px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .035);
  transition: transform .25s ease;
}

.category-choice:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: #8d99a4;
  box-shadow: 0 15px 26px rgba(0, 0, 0, .2);
}

.category-choice:hover::before {
  transform: scale(1.25);
}

.category-choice:disabled:not(.selected) {
  opacity: .38;
  cursor: not-allowed;
}

.category-choice.selected {
  border-color: #d9b45f;
  background:
    radial-gradient(circle at 100% 0, rgba(217, 180, 95, .2), transparent 45%),
    linear-gradient(145deg, #574a2c, #302a20);
  box-shadow: 0 0 0 2px rgba(217, 180, 95, .14), 0 16px 28px rgba(0, 0, 0, .2);
}

.category-choice .category-art {
  width: 100%;
  height: 108px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(153, 164, 174, .28);
  border-radius: 14px;
  background: #171d23;
  box-shadow: inset 0 0 35px rgba(0, 0, 0, .18);
}

.category-choice .category-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}

.category-choice:hover .category-art img {
  transform: scale(1.055);
  filter: saturate(1.08) brightness(1.04);
}

.category-choice .category-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 30%, rgba(8, 11, 15, .45));
}

.category-choice .category-icon {
  width: 46px;
  height: 46px;
  position: absolute;
  right: 10px;
  bottom: 9px;
  z-index: 1;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 14px;
  color: #fff;
  background: rgba(11, 14, 18, .62);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .25);
  font-size: 22px;
  backdrop-filter: blur(5px);
}

.category-choice strong {
  margin: 0 5px;
}

.category-choice small {
  margin: 0 5px 4px;
  align-self: start;
  line-height: 1.45;
}

.category-choice .check {
  top: 8px;
  left: 8px;
  z-index: 2;
}

.setup-actions {
  margin-top: 16px;
}

.primary-btn,
.secondary-btn,
.finish-btn {
  min-height: 52px;
  border: 1px solid;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
}

.primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #a47f36, #6c5124);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 12px 26px rgba(0, 0, 0, .2);
}

.primary-btn > em {
  padding: 4px 8px;
  border: 1px solid rgba(113,235,225,.34);
  border-radius: 999px;
  color: #9af2eb;
  background: rgba(12,58,56,.55);
  font-size: 10px;
  font-style: normal;
}

.primary-btn:not(:disabled):hover,
.secondary-btn:hover,
.finish-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.secondary-btn {
  border-color: #596570;
  background: linear-gradient(145deg, #343c43, #282e34);
}

.setup-error {
  font-weight: 800;
}

.scoreboard {
  gap: 14px;
}

.team,
.turn-card {
  min-height: 140px;
  position: relative;
  overflow: hidden;
  border-color: rgba(111, 124, 136, .54);
  background:
    radial-gradient(circle at 50% -50%, rgba(114, 128, 141, .2), transparent 62%),
    linear-gradient(145deg, #2b3238, #1d2227);
}

.team-accent {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: #dfe4e8;
}

.team-b .team-accent {
  background: #8ba6c0;
}

.team-label {
  display: block;
  color: #aeb8c1;
}

.score {
  text-shadow: 0 8px 26px rgba(217, 180, 95, .16);
}

.turn-card {
  border-color: rgba(217, 180, 95, .38);
  background:
    radial-gradient(circle at top, rgba(217, 180, 95, .12), transparent 58%),
    linear-gradient(145deg, #302d27, #202429);
}

.turn-card button {
  min-height: 34px;
  font-weight: 800;
}

.game-progress {
  margin-top: 12px;
  padding: 12px 15px;
  border: 1px solid rgba(101, 114, 125, .48);
  border-radius: 14px;
  background: rgba(27, 32, 37, .88);
}

.game-progress > div:first-child {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.game-progress strong {
  color: #f0d394;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #14181b;
}

.progress-track i {
  width: 0;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #80632f, #e1bc65);
  transition: width .35s ease;
}

.helpers {
  gap: 14px;
}

.helper-team {
  padding: 14px;
  border-color: rgba(101, 114, 125, .5);
  background:
    linear-gradient(145deg, rgba(42, 49, 56, .96), rgba(27, 32, 37, .96));
}

.helper-team h3 {
  margin-bottom: 11px;
}

.helper-buttons {
  gap: 8px;
}

.helper-btn {
  min-height: 78px;
  padding: 9px 8px;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 7px;
  align-items: center;
  border: 1px solid rgba(98, 111, 122, .6);
  border-radius: 11px;
  color: var(--text);
  background: linear-gradient(145deg, #343c43, #272d33);
  text-align: right;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
}

.helper-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: #d9b45f;
  background: linear-gradient(145deg, #454637, #302f29);
}

.helper-icon {
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #f0d494;
  background: rgba(217, 180, 95, .1);
  font-size: 16px;
}

.helper-btn b {
  font-size: 11px;
}

.helper-btn small {
  color: #9fa9b2;
  font-size: 8px;
}

.helper-btn.used,
.helper-btn:disabled {
  opacity: .32;
  text-decoration: none;
}

.helper-btn.used::after {
  content: "تم الاستخدام";
  grid-column: 1 / -1;
  color: #d6b96f;
  font-size: 8px;
  text-align: center;
}

.helper-btn.selected {
  border-color: #d9b45f;
  background: linear-gradient(145deg, #5a4c2d, #342d22);
  box-shadow: 0 0 0 2px rgba(217, 180, 95, .13);
}

.helper-btn.selected:disabled {
  opacity: 1;
  cursor: default;
}

.helper-btn.selected::after {
  content: "جاهزة للسؤال القادم";
  color: #fff0bb;
}

.board-shell {
  padding: 12px;
  border-color: rgba(102, 115, 127, .58);
  background:
    linear-gradient(145deg, rgba(39, 45, 51, .98), rgba(23, 27, 31, .98));
}

.board {
  min-width: 810px;
  gap: 8px;
}

.category-column {
  gap: 8px;
}

.category-header {
  min-height: 72px;
  border-color: rgba(145, 157, 168, .56);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, .09), transparent 62%),
    linear-gradient(145deg, #5d6873, #343c43);
}

.question-button {
  min-height: 62px;
  position: relative;
  overflow: hidden;
  border-color: rgba(86, 98, 109, .64);
  background:
    linear-gradient(145deg, #343c43, #20252a);
}

.question-button::after {
  content: "";
  position: absolute;
  inset: auto 16% 0;
  height: 2px;
  border-radius: 99px;
  background: rgba(217, 180, 95, .36);
}

.question-button:hover {
  background:
    linear-gradient(145deg, #515c66, #30373d);
  box-shadow: 0 10px 18px rgba(0, 0, 0, .18);
}

.question-button.used {
  opacity: .1;
}

.bottom-actions {
  margin-top: 14px;
}

.finish-btn {
  border-color: #8f7041;
  background: linear-gradient(135deg, #80612e, #4e3b1e);
}

.modal {
  padding: 18px;
  background: rgba(5, 7, 9, .86);
  backdrop-filter: blur(13px);
}

.modal.active {
  animation: backdrop-in .2s ease both;
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}

.modal.active > * {
  animation: modal-in .3s cubic-bezier(.2, .85, .25, 1) both;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.975);
  }
}

.modal-card {
  width: min(780px, 100%);
  padding: 30px;
  border-color: rgba(132, 145, 156, .65);
  background:
    radial-gradient(circle at 50% -25%, #5e6974 0, #31383f 37%, #1c2126 78%);
}

.close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, .14);
  transition: background .18s ease, transform .18s ease;
}

.close:hover {
  transform: rotate(6deg);
  background: rgba(255, 255, 255, .08);
}

.question-meta span,
.question-meta strong {
  border-color: rgba(129, 142, 153, .55);
}

.timer {
  width: 94px;
  height: 94px;
  position: relative;
  isolation: isolate;
  border: 0;
  background:
    conic-gradient(#d9b45f var(--timer-progress), #343b42 0);
  box-shadow: 0 0 0 7px rgba(255, 255, 255, .025), 0 14px 32px rgba(0, 0, 0, .3);
}

.timer::before {
  content: "";
  position: absolute;
  inset: 7px;
  z-index: -1;
  border-radius: 50%;
  background: #171b1f;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, .34);
}

.timer.warning {
  background: conic-gradient(#d99b54 var(--timer-progress), #343b42 0);
}

.timer.danger {
  background: conic-gradient(#c75f5f var(--timer-progress), #343b42 0);
}

.timer.paused {
  filter: grayscale(.4);
  opacity: .72;
}

.timer.running {
  animation: timer-breathe 1.25s ease-in-out infinite;
}

.timer.danger.running {
  animation-duration: .55s;
}

@keyframes timer-breathe {
  50% {
    box-shadow:
      0 0 0 9px rgba(217, 180, 95, .08),
      0 14px 38px rgba(217, 180, 95, .18);
    transform: scale(1.025);
  }
}

.timer-actions button {
  min-width: 74px;
  min-height: 36px;
  font-weight: 800;
  transition: border-color .18s ease, background .18s ease;
}

.timer-actions button.active {
  border-color: #d9b45f;
  color: #f1d698;
  background: #4d422b;
}

.timer-actions .timer-skip {
  border-color: rgba(217, 180, 95, .55);
  color: #fff1c5;
  background: linear-gradient(145deg, #70572b, #4f3f24);
}

.helper-message {
  min-height: 24px;
}

.question-helpers {
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  background: rgba(3, 8, 25, .38);
}

.question-helpers > span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 900;
}

.question-helper-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.helper-quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 13px;
  color: var(--text);
  background: rgba(255,255,255,.055);
}

.helper-quick:hover:not(:disabled) {
  border-color: rgba(47, 228, 255, .48);
  background: rgba(47, 228, 255, .1);
}

.helper-quick b,
.helper-quick small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.helper-quick b { font-size: .8rem; }
.helper-quick small { color: var(--muted); }

.helper-quick.used {
  border-color: rgba(255,255,255,.05);
  opacity: .42;
}

.question-text {
  min-height: 125px;
  font-size: clamp(24px, 3.2vw, 36px);
}

.answer-area {
  border-color: rgba(217, 180, 95, .4);
  background:
    linear-gradient(145deg, rgba(39, 38, 31, .95), rgba(22, 25, 28, .95));
}

.answer-area.visible {
  animation: answer-in .28s ease both;
}

@keyframes answer-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
}

.show-answer,
.nobody {
  min-height: 50px;
  font-size: 15px;
}

.flow-title {
  margin: 12px 0 9px;
  color: #c1c9d0;
  font-weight: 900;
}

.award-grid {
  gap: 11px;
}

.award {
  min-height: 62px;
  border: 1px solid rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 10px 22px rgba(0, 0, 0, .2);
  font-size: 18px;
  transition: transform .16s ease, filter .16s ease;
}

.award:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.judge-box > strong {
  min-height: 50px;
  padding: 13px;
  display: grid;
  place-items: center;
  border: 1px solid #65717c;
  border-radius: 12px;
  color: #f1d798;
  background: #30373e;
}

.judge-box > div {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.correct-btn,
.wrong-btn,
.change-btn {
  min-height: 52px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  font-weight: 900;
  transition: transform .16s ease, filter .16s ease;
}

.correct-btn:hover,
.wrong-btn:hover,
.change-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.correct-btn {
  background: linear-gradient(145deg, #5b9877, #3f7156);
}

.wrong-btn {
  background: linear-gradient(145deg, #a35f5f, #744545);
}

.change-btn {
  width: 100%;
  margin-top: 9px;
  background: linear-gradient(145deg, #49525a, #353c42);
}

.winner-card {
  width: min(560px, 100%);
  padding: 34px 28px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(217, 180, 95, .58);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% -12%, rgba(217, 180, 95, .36), transparent 39%),
    linear-gradient(155deg, #38342a, #24292e 62%);
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.premium-celebration .winner-card {
  border-color:#ffcb69;
  box-shadow:0 30px 80px rgba(0,0,0,.5),0 0 46px rgba(255,180,78,.32);
  animation:celebration-glow 1.8s ease-in-out infinite;
}

.premium-celebration .winner-card::before,
.premium-celebration .winner-card::after {
  color:#ffe39a;
  animation:celebration-star 1.4s ease-in-out infinite alternate;
}

@keyframes celebration-glow {
  50% { filter:brightness(1.08);box-shadow:0 30px 80px rgba(0,0,0,.5),0 0 68px rgba(255,180,78,.48); }
}

@keyframes celebration-star {
  to { transform:translateY(-8px) rotate(35deg) scale(1.25); }
}

.winner-card::before,
.winner-card::after {
  content: "✦";
  position: absolute;
  color: rgba(217, 180, 95, .34);
  font-size: 30px;
}

.winner-card::before {
  top: 34px;
  right: 38px;
}

.winner-card::after {
  bottom: 35px;
  left: 40px;
  font-size: 20px;
}

.trophy {
  font-size: 76px;
  animation: trophy 1s ease-in-out infinite alternate;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, .26));
}

.winner-kicker {
  display: block;
  margin-top: 5px;
  color: #e6c779;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.4px;
}

.winner-card > p {
  margin-bottom: 4px;
}

.winner-card h2 {
  margin: 7px 0;
  font-size: clamp(29px, 6vw, 40px);
}

.winner-score {
  color: #e4c36f !important;
  font-size: 28px !important;
}

.winner-stats {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.winner-stats article {
  padding: 12px 8px;
  border: 1px solid rgba(130, 142, 153, .38);
  border-radius: 12px;
  background: rgba(13, 16, 19, .28);
}

.winner-stats span {
  display: block;
  color: #aeb7bf;
  font-size: 9px;
}

.winner-stats b {
  display: block;
  margin-top: 6px;
  color: #fff;
  font-size: 18px;
}

.reward-summary {
  margin: 15px 0;
  padding: 11px;
  border: 1px solid rgba(217, 180, 95, .2);
  border-radius: 11px;
  color: #efd28d;
  background: rgba(10, 12, 14, .22);
  font-size: 12px;
}

.winner-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.winner-actions button,
.winner-actions a {
  min-height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #7d6940;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #5d4b29, #40351f);
  font-weight: 900;
  text-decoration: none;
}

.winner-actions a {
  border-color: #58636d;
  background: linear-gradient(145deg, #3b434b, #2b3137);
}

.confirm-card {
  width: min(450px, 100%);
  padding: 30px;
  border: 1px solid #6d7882;
  border-radius: 22px;
  background:
    radial-gradient(circle at top, #48515a, #21262b 66%);
  text-align: center;
  box-shadow: 0 28px 75px rgba(0, 0, 0, .48);
}

.confirm-icon {
  width: 64px;
  height: 64px;
  margin: auto;
  display: grid;
  place-items: center;
  border: 1px solid #806a3e;
  border-radius: 50%;
  color: #e2c16e;
  background: rgba(217, 180, 95, .09);
  font-size: 30px;
}

.confirm-card h2 {
  margin: 16px 0 7px;
}

.confirm-card p {
  margin: 0 0 19px;
  color: var(--muted);
}

.confirm-card > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.toast {
  position: fixed;
  right: 50%;
  bottom: 22px;
  z-index: 150;
  max-width: min(420px, calc(100% - 30px));
  padding: 12px 17px;
  pointer-events: none;
  opacity: 0;
  transform: translate(50%, 18px);
  border: 1px solid #6a7580;
  border-radius: 12px;
  color: #fff;
  background: rgba(36, 42, 48, .96);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .34);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  transition: opacity .22s ease, transform .22s ease;
}

.toast.active {
  opacity: 1;
  transform: translate(50%, 0);
}

.toast.success {
  border-color: #5a8f70;
}

.toast.warning {
  border-color: #a87949;
}

@media (max-width: 900px) {
  .category-picker {
    grid-template-columns: repeat(3, 1fr);
  }

  .helper-buttons {
    grid-template-columns: 1fr;
  }

  .question-helper-buttons {
    grid-template-columns: 1fr;
  }

  .helper-btn {
    min-height: 60px;
  }
}

@media (max-width: 700px) {
  body { padding-bottom:env(safe-area-inset-bottom); }
  .topbar {
    min-height:calc(62px + env(safe-area-inset-top));
    padding-top:max(9px,env(safe-area-inset-top));
    position:sticky;
    top:0;
    z-index:70;
    backdrop-filter:blur(14px);
  }
  .page {
    width:100%;
    padding:12px;
  }

  .setup-hero {
    padding-inline: 4px;
  }

  .setup-steps {
    grid-template-columns: 1fr;
  }

  .team-setup {
    grid-template-columns: 1fr;
  }

  .versus {
    width: 48px;
    height: 48px;
  }

  .selection-panel {
    padding: 15px;
  }

  .selection-head {
    align-items: flex-start;
  }

  .category-picker {
    grid-template-columns: repeat(2, 1fr);
  }

  .category-choice {
    min-height: 180px;
    grid-template-columns: 1fr;
    grid-template-rows: 92px auto auto;
  }

  .category-choice .category-art {
    height: 92px;
  }

  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }

  .turn-card {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 96px;
  }

  .helpers {
    grid-template-columns: 1fr;
  }

  .helper-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .helper-btn {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    text-align: center;
  }

  .helper-icon {
    grid-row: auto;
    margin: auto;
  }

  .modal-card {
    max-height:calc(100dvh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding:20px 14px max(18px,env(safe-area-inset-bottom));
    overflow-y:auto;
    border-radius:22px;
  }

  .question-text {
    min-height:82px;
    font-size:clamp(19px,5.4vw,25px);
    line-height:1.55;
  }

  .timer { width:82px;height:82px;margin-block:10px; }
  .timer-actions { margin-block:6px; }
  .timer-actions button { min-width:92px;min-height:42px; }
  .helper-message { min-height:20px;font-size:11px;line-height:1.45; }
  .question-helpers { margin-top:9px;padding:9px;border-radius:14px; }
  .helper-quick { min-height:40px; }
  .answer-area { padding:13px; }
  .answer-area strong { font-size:clamp(17px,4.8vw,23px);line-height:1.55; }
  .show-answer,.nobody,.correct-btn,.wrong-btn,.change-btn { min-height:46px;font-size:13px; }

  .award-grid,
  .judge-box > div {
    grid-template-columns: 1fr;
  }

  .winner-card {
    padding: 28px 17px;
  }
}

@media (max-width: 470px) {
  .topbar {
    min-height: 66px;
    padding-inline: 10px;
  }

  .top-btn {
    min-height: 40px;
    padding-inline: 10px;
    font-size: 10px;
  }

  .brand strong {
    font-size: 17px;
  }

  .brand span {
    font-size: 9px;
  }

  .setup-hero h1 {
    font-size: 31px;
  }

  .setup-hero p,
  .selection-head p {
    max-width:32ch;
    margin-inline:auto;
    font-size:11px;
    line-height:1.55;
  }

  .selection-head {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .selection-counter {
    min-width: 84px;
  }

  .category-picker {
    grid-template-columns: 1fr;
  }

  .category-choice {
    min-height: 86px;
  }

  .setup-actions,
  .bottom-actions,
  .winner-actions,
  .confirm-card > div {
    grid-template-columns: 1fr;
  }

  .helper-buttons {
    grid-template-columns: 1fr;
  }

  .helper-btn {
    min-height: 58px;
    grid-template-columns: 34px 1fr;
    grid-template-rows: auto auto;
    text-align: right;
  }

  .helper-icon {
    grid-row: 1 / 3;
    margin: 0;
  }

  .winner-stats {
    grid-template-columns: 1fr;
  }
}

.score-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 92px));
  justify-content: center;
  gap: 8px;
}

.score-controls button {
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid rgba(217, 180, 95, .35);
  border-radius: 10px;
  color: #f7e6b8;
  background: linear-gradient(145deg, #3c3b34, #282b2e);
  font-weight: 900;
  touch-action: manipulation;
}

.score-controls button:hover,
.score-controls button:focus-visible {
  border-color: #d9b45f;
  background: linear-gradient(145deg, #55492f, #302d27);
}

.question-image {
  width: min(520px, 100%);
  margin: 8px auto;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 15px;
  background: #0f1418;
}

.question-image[hidden] { display: none; }
.question-image img { width: 100%;height: 150px;display: block;object-fit: cover; }
.question-image figcaption { padding: 4px 8px;color: #89949d;font-size: 9px;text-align: start; }

@media (max-width: 700px) {
  .team,
  .turn-card {
    min-height: 120px;
    padding: 11px 8px;
  }

  .team > strong { font-size: 15px; }
  .score { margin: 5px 0 7px;font-size: 30px; }
  .score-controls { grid-template-columns: repeat(2, minmax(0, 1fr));gap: 6px; }
  .score-controls button { min-height: 44px;padding-inline: 6px;font-size: 12px; }

  .modal { padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  .modal-card {
    width: 100%;
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    padding: 14px 12px max(14px, env(safe-area-inset-bottom));
    border-radius: 18px;
  }
  .close { width: 44px;height: 44px; }
  .question-meta { margin-inline: 42px; }
  .timer { width: 68px;height: 68px;margin-block: 5px; }
  .timer span { font-size: 23px; }
  .timer-actions { margin-block: 4px; }
  .timer-actions button { min-width: 84px;min-height: 44px; }
  .helper-message:empty { display: none; }
  .question-image img { height: 92px; }
  .question-image figcaption { display: none; }
  .question-text { min-height: 66px;margin-block: 8px;font-size: clamp(18px, 5vw, 23px);line-height: 1.45; }
  .flow-title { margin-block: 8px; }
}

@media (max-width: 390px) {
  .page { padding-inline: 8px; }
  .scoreboard { gap: 7px; }
  .team-label { font-size: 9px; }
  .team > strong { font-size: 13px; }
  .score { font-size: 27px; }
  .score-controls button { font-size: 11px; }
  .helper-team { padding: 10px; }
  .helper-btn { min-height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
.top-btn,#newGame,.category-search input{min-height:44px}
