html, body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ---------- Announcement bar ---------- */
.announcement-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  z-index: 250;
  height: var(--announce-height, 36px);
  display: flex;
  align-items: center;
}

.announcement-track {
  position: absolute;
  white-space: nowrap;
  will-change: transform;
}

html[dir="rtl"] .announcement-track {
  animation: qws-marquee-rtl var(--announce-duration, 15s) linear infinite;
}

html[dir="ltr"] .announcement-track {
  animation: qws-marquee-ltr var(--announce-duration, 15s) linear infinite;
}

@keyframes qws-marquee-rtl {
  from { transform: translateX(100vw); }
  to { transform: translateX(-100%); }
}

@keyframes qws-marquee-ltr {
  from { transform: translateX(-100vw); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .announcement-track {
    animation: none;
    position: static;
    width: 100%;
    text-align: center;
  }
}

body.has-announcement {
  padding-top: var(--announce-height, 36px);
}

/* ---------- Sticky category counter ---------- */
.cat-counter-sticky {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  background: var(--coffee);
  color: var(--cream-light);
  padding: 8px 20px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.cat-counter-sticky.complete {
  background: var(--palm-green);
  cursor: pointer;
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 24px;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ---------- Setup ---------- */
#screen-setup.active {
  align-items: center;
  justify-content: center;
}

.setup-card {
  background: var(--coffee);
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  max-width: 720px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.setup-card,
.question-card {
  box-shadow: var(--card-shadow);
}

.setup-card h1 {
  font-size: 2.4rem;
  margin: 0;
}

.tagline {
  color: var(--gold-light);
  margin-bottom: 24px;
}

.setup-card .form-row {
  text-align: right;
  margin-bottom: 16px;
}

html[dir="ltr"] .setup-card .form-row {
  text-align: left;
}

.logo-img {
  max-height: 90px;
  width: auto;
  margin-bottom: 12px;
  filter: none;
}

.site-footer {
  max-width: 460px;
  margin: 24px auto 0;
  padding: 16px 0 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-instagram {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--cream);
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-instagram:hover {
  color: var(--gold-light);
}

.footer-link {
  color: var(--gold-light);
  font-size: 0.9rem;
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

.footer-copyright {
  color: var(--cream);
  opacity: 0.7;
  font-size: 0.8rem;
}

.lang-theme-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.lang-theme-row select {
  flex: 1;
  min-width: 0;
}

.setup-card input {
  width: 100%;
  font-size: 1.1rem;
}

.btn-big {
  width: 100%;
  padding: 14px;
  font-size: 1.2rem;
  margin-top: 8px;
}

.setup-error {
  color: var(--danger);
  min-height: 1.2em;
  font-size: 0.9rem;
}

.hint a {
  color: var(--gold-light);
}

/* ---------- Category picker (setup accordion) ---------- */
.turn-indicator {
  background: var(--gold);
  color: var(--coffee-dark);
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 999px;
  font-size: 1.2rem;
}

.cat-picker-section {
  margin-bottom: 24px;
  text-align: initial;
}

.section-heading {
  font-size: 1.2rem;
  margin: 0 0 12px;
  color: var(--gold-light);
  text-align: center;
}

.cat-search {
  width: 100%;
  margin-bottom: 10px;
}

.cat-random-btn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}

.cat-counter {
  text-align: center;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--gold-light);
}

.cat-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cat-group {
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 10px;
}

.cat-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cat-group-toggle-btn {
  background: none;
  border: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 4px 0;
  flex: 1;
  text-align: right;
  cursor: pointer;
}

html[dir="ltr"] .cat-group-toggle-btn {
  text-align: left;
}

.cat-group-caret {
  font-size: 0.9rem;
}

.cat-group-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.cat-group-body.collapsed {
  display: none;
}

.cat-group-body .cat-pick-card {
  padding: 14px 8px;
}

.cat-group-body .cat-pick-card .icon {
  font-size: 1.8rem;
}

.cat-group-body .cat-pick-card .name {
  font-size: 0.95rem;
}

.cat-pick-check {
  position: absolute;
  top: 6px;
  inset-inline-end: 8px;
  font-weight: 900;
  color: var(--palm-green);
}

.cat-pick-card {
  position: relative;
  background: var(--cream-light);
  color: var(--coffee-dark);
  border-radius: var(--card-radius);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  border: 4px solid transparent;
  box-shadow: var(--card-shadow);
  transition: transform 0.15s ease;
}

.cat-pick-card:hover:not(.disabled) {
  transform: translateY(-4px) scale(1.02);
}

.cat-pick-card .icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 8px;
}

.cat-pick-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 8px;
}

.cat-pick-card .name {
  font-size: 1.3rem;
  font-weight: 700;
}

.cat-pick-card.taken-1 {
  border-color: var(--gold-light);
  background: #e6e6fd;
}

.cat-pick-card.taken-2 {
  border-color: var(--palm-green);
  background: #d7f5f1;
}

.cat-pick-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cat-info-badge {
  position: absolute;
  top: -10px;
  inset-inline-start: -10px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.cat-info-badge span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e6fd9;
  color: #fff;
  font-style: italic;
  font-weight: 700;
  font-family: Georgia, serif;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.cat-info-popover {
  position: fixed;
  z-index: 500;
  background: rgba(20, 14, 8, 0.95);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: min(320px, 90vw);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

/* ---------- Board ---------- */
.board-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.topbar-btn {
  background: var(--coffee);
  color: var(--cream-light);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
}

.topbar-btn .topbar-icon {
  font-size: 1.3rem;
}

.topbar-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--gold-light);
}

.board-blocks {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 16px;
  align-content: stretch;
}

.cat-block {
  display: flex;
  align-items: stretch;
  gap: 6px;
  background: var(--coffee);
  border-radius: 14px;
  padding: 10px;
}

.point-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.point-cell {
  flex: 1;
  background: var(--cream-light);
  color: var(--coffee-dark);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
  transition: transform 0.15s ease;
  min-height: 34px;
}

.point-cell:hover:not(.used) {
  transform: scale(1.05);
}

.point-cell.used {
  background: #4a4a4a;
  color: #7a7a7a;
  cursor: not-allowed;
  box-shadow: none;
}

.cat-card {
  flex: 1.4;
  background: var(--cream-light);
  color: var(--coffee-dark);
  border-radius: var(--card-radius);
  border-top: none;
  border-bottom: 4px solid var(--gold);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  text-align: center;
}

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

.cat-card-image {
  width: 100%;
  max-height: 60px;
  object-fit: cover;
  border-radius: 8px;
}

.cat-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.team-panels {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.team-panel {
  background: var(--coffee);
  border-radius: 999px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 280px;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.team-panel-1 { border-color: var(--gold-light); }
.team-panel-2 { border-color: var(--palm-green); }

.team-panel.active-turn {
  box-shadow: 0 0 0 4px rgba(212, 167, 44, 0.4);
}

.team-panel.steal-armed {
  box-shadow: 0 0 0 4px rgba(214, 87, 40, 0.55);
}

.team-panel-name {
  font-size: 1.2rem;
  font-weight: 700;
  white-space: nowrap;
}

.lifeline-row {
  display: flex;
  gap: 6px;
}

.lifeline-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--coffee-light);
  color: var(--cream-light);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 1;
  transition: opacity 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

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

.lifeline-btn.used {
  opacity: 0.3;
  background: var(--coffee-dark);
}

.lifeline-btn.armed {
  background: #d65728;
  box-shadow: 0 0 0 3px rgba(214, 87, 40, 0.5);
  opacity: 1;
}

.lifeline-row-question {
  justify-content: center;
  margin: 8px 0;
}

.help-timer {
  text-align: center;
  font-weight: 700;
  color: var(--gold-light);
  margin: -4px 0 8px;
}

.score-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  margin-left: auto;
}

.score-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--coffee-dark);
  font-size: 1.3rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.score-display {
  text-align: center;
  min-width: 60px;
}

.team-score {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--gold-light);
}

.finjan-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 2px;
  min-height: 14px;
}

.finjan {
  width: 12px;
  height: 12px;
  border-radius: 3px 3px 8px 8px;
  background: var(--gold);
}

/* ---------- Question overlay ---------- */
.overlay-screen.active {
  align-items: center;
  justify-content: center;
  background: var(--coffee-dark);
}

.question-card {
  position: relative;
  background: var(--coffee);
  border-radius: 20px;
  padding: 40px;
  max-width: 1100px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.question-team-label {
  position: absolute;
  top: -12px;
  inset-inline-start: 24px;
  background: var(--gold);
  color: var(--coffee-dark);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  white-space: nowrap;
}

.question-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.question-category {
  font-size: 1.3rem;
  color: var(--gold-light);
}

.question-timer {
  font-size: 2.4rem;
  font-weight: 900;
  background: var(--coffee-dark);
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--gold);
}

.question-timer.low {
  color: var(--danger);
  border-color: var(--danger);
}

.timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-restart-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: var(--coffee-dark);
  color: var(--gold-light);
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.timer-restart-btn:active {
  transform: rotate(-90deg);
}

.question-points {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
}

.question-image-wrap {
  margin-bottom: 16px;
}

.question-image-wrap img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
}

.question-text {
  font-size: 2.4rem;
  line-height: 1.5;
  margin: 20px 0;
}

/* ---------- Act (charades / QR) round ---------- */
.act-qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 12px 0 20px;
}

.act-qr-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gold-light);
}

.act-qr-box {
  width: min(300px, 68vw);
  aspect-ratio: 1;
  background: #fff;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.act-qr-box svg {
  display: block;
  width: 100%;
  height: 100%;
}

.act-qr-sub {
  font-size: 1.05rem;
  color: var(--cream);
  max-width: 420px;
  line-height: 1.6;
}


.question-answer {
  margin: 20px 0;
}

.answer-label {
  color: var(--gold-light);
  font-size: 1.1rem;
}

.answer-text {
  font-size: 2rem;
  font-weight: 700;
  color: var(--palm-green);
  background: var(--cream-light);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.question-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
}

.btn-award {
  padding: 14px 28px;
  font-size: 1.2rem;
  font-weight: 700;
  border-radius: 10px;
}

.award-1 { background: var(--gold-light); color: var(--coffee-dark); }
.award-2 { background: var(--palm-green); color: var(--cream-light); }
.award-none { background: var(--danger); color: var(--cream-light); }

.hidden {
  display: none !important;
}

#qActionsBackRow {
  margin-top: 10px;
}

.global-reset-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  font-size: 0.9rem;
  padding: 8px 16px;
}

/* ---------- Winner ---------- */
#screen-winner.active {
  align-items: center;
  justify-content: center;
}

.winner-card {
  text-align: center;
}

.winner-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin: 30px 0;
}

.winner-name {
  font-size: 1.6rem;
  font-weight: 700;
}

.winner-score {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--gold-light);
}

.winner-vs {
  font-size: 2rem;
  color: var(--gold);
}

@media (max-width: 900px) {
  .screen { padding: 16px; }
  .question-text { font-size: 1.6rem; }
  .point-cell { font-size: 1.1rem; }
  .board-blocks { grid-template-columns: repeat(2, 1fr); }
  .team-score { font-size: 1.4rem; }
  .team-panel { min-width: 45%; }
  .setup-card { padding: 28px 24px; }
  .question-card { padding: 24px; }
}

@media (max-width: 600px) {
  .screen { padding: 10px; }

  .setup-card { padding: 24px 18px; }
  .setup-card h1 { font-size: 1.8rem; }
  .lang-theme-row { flex-wrap: wrap; }

  .cat-group-body { grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
  .cat-pick-card { padding: 14px 10px; }
  .cat-pick-card .icon { font-size: 1.8rem; }
  .cat-pick-card .name { font-size: 1rem; }

  .board-topbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .board-topbar .topbar-actions { justify-content: center; }
  .board-blocks { grid-template-columns: 1fr; gap: 10px; }
  .cat-block { flex-wrap: wrap; }

  .team-panels { flex-direction: column; }
  .team-panel { min-width: 100%; flex-wrap: wrap; justify-content: center; padding: 10px 14px; }
  .lifeline-row { order: 2; }

  .question-card { padding: 16px; }
  .question-team-label { font-size: 0.75rem; padding: 3px 10px; inset-inline-start: 12px; }
  .question-top { flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
  .question-text { font-size: 1.3rem; }
  .answer-text { font-size: 1.4rem; padding: 12px; }
  .question-actions { flex-wrap: wrap; gap: 10px; }
  .btn-award { flex: 1; min-width: 100px; padding: 12px 16px; font-size: 1rem; }

  .winner-scores { flex-direction: column; gap: 16px; }
  .winner-score { font-size: 2.6rem; }
}
