:root {
  --bg: #fdf7f9;
  --surface: #ffffff;
  --border: #ece0e5;
  --text: #2b1d25;
  --muted: #6f5462;
  --gold: #b8873c;
  --radius: 16px;

  /* Kényelmes érintőfelület — minden kattintható elem legalább ekkora. */
  --tap: 44px;

  /* A --accent és --on-accent értéket a user színe írja felül belépéskor. */
  --accent: #9b7fa6;
  --on-accent: #ffffff;

  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 60%, var(--muted));
  --accent-ink: color-mix(in srgb, var(--accent) 45%, var(--text));
  --glow: color-mix(in srgb, var(--accent) 22%, var(--bg));

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1218;
    --surface: #241a20;
    --border: #3a2a33;
    --text: #f6eaef;
    --muted: #cbb1bd;
    --gold: #e0b775;
    --accent: #c6a9d1;
    --glow: color-mix(in srgb, var(--accent) 16%, var(--bg));
  }
}

* {
  box-sizing: border-box;
}

/* A hidden attribútum mindig rejtsen, akkor is, ha egy szabály display-t állít. */
[hidden] {
  display: none !important;
}

html,
body {
  /* iOS fekvő módban ne nagyítson bele a szövegbe. Az iOS-es Chrome/Vivaldi a
     szövegméret-beállítást inline stílussal teszi a body-ra — az !important
     ezt is felülírja, így a szöveg mindig 1:1 méretben jelenik meg. */
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* A vízszintes 16px-hez hozzáadjuk a kivágott kijelzők biztonsági sávját. */
  padding: clamp(28px, 7vw, 56px) calc(16px + env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  background: radial-gradient(900px 420px at 50% -120px, var(--glow), transparent 70%), var(--bg);
  color: var(--text);
  font:
    17px/1.6 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  /* Hosszú szó (pl. link a leírásban) ne tolja szét a kártyát telefonon. */
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease;
}

.page {
  max-width: 680px;
  margin: 0 auto;
}

.page__header {
  margin-bottom: clamp(22px, 5vw, 30px);
  text-align: center;
}

.page__kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

.page__header h1 {
  margin: 0 0 10px;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(30px, 8.5vw, 40px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page__lead {
  margin: 0 auto;
  max-width: 46ch;
  color: var(--muted);
}

.name-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 4.5vw, 22px);
  box-shadow: 0 10px 30px -22px rgba(60, 20, 40, 0.5);
}

.name-form__label {
  display: block;
  margin-bottom: 9px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.name-form__row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.name-form__input {
  flex: 1 1 200px;
  min-width: 0;
  min-height: var(--tap);
  padding: 12px 14px;
  /* Legalább 16px, különben az iOS Safari ráközelít a mezőre fókuszkor. */
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.name-form__input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.name-form__input:focus-visible,
.button:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

.button {
  min-height: var(--tap);
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  cursor: pointer;
  /* Nincs 300 ms-os késleltetés koppintáskor. */
  touch-action: manipulation;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

/* Érintőképernyőn nincs hover, ott a ráragadt világosítás csak zavaró. */
@media (hover: hover) {
  .button:hover {
    filter: brightness(1.06);
  }
}

.button:active {
  filter: brightness(0.94);
}
.button[disabled] {
  opacity: 0.55;
  cursor: default;
  filter: none;
}

.button--danger {
  color: #fff;
  background: #c92a2a;
  border-color: #c92a2a;
}

.confirm-dialog__message {
  margin: 0 0 18px;
  font-size: 16px;
  line-height: 1.5;
}

.button--ghost {
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border-color: var(--border);
}

.error {
  margin: 14px 0 0;
  padding: 10px 13px;
  font-size: 14px;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 11px;
}

@media (prefers-color-scheme: dark) {
  .error {
    color: #ffb4ab;
    background: #33201f;
    border-color: #55302f;
  }
}

.result {
  margin-top: clamp(26px, 6vw, 36px);
}

.result__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 6px;
}

.result__greeting {
  margin: 0;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(21px, 5.5vw, 24px);
  font-weight: 600;
}

.result__header .button--ghost {
  padding: 7px 15px;
  font-size: 14px;
}

.status {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
}
.status--done {
  color: var(--accent-ink);
  font-weight: 600;
}

.tasks {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 14px;
}

.task {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 15px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.task--pending {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  box-shadow: 0 14px 34px -26px var(--accent-line);
}

.task--passed {
  opacity: 0.7;
}
.task--passed .task__summary {
  text-decoration: line-through;
}

.task__ordinal {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
}

.task--pending .task__ordinal {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent-line);
}

.task__summary {
  margin: 6px 0 0;
  font-size: clamp(17px, 4.6vw, 18px);
  font-weight: 600;
}
.task__description {
  margin: 7px 0 0;
  color: var(--muted);
}

.task__actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.task__action {
  padding: 9px 20px;
  font-size: 15px;
}
.task__action.button--ghost {
  border-color: var(--accent-line);
}

.task__badge {
  display: inline-block;
  margin: 10px 0 0;
  padding: 3px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  border-radius: 999px;
}

.task__badge--done {
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent-line);
}

.task__badge--passed {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border);
}

/* --- Menü képernyő --- */

.menu {
  margin-top: clamp(26px, 6vw, 36px);
}

.menu__lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.menu__lead .button--ghost {
  padding: 7px 15px;
  font-size: 14px;
}

.menu__grid {
  display: grid;
  gap: 14px;
}
.menu__empty {
  margin: 8px 0 0;
  text-align: center;
}

.menu__logout {
  display: block;
  min-height: var(--tap);
  margin: 40px auto 0;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.75;
  cursor: pointer;
}

.menu-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}

.menu-card--active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  box-shadow: 0 14px 34px -26px var(--accent-line);
}

@media (hover: hover) {
  .menu-card--active:hover {
    filter: brightness(1.04);
  }
}
.menu-card--active:active {
  filter: brightness(0.96);
}

.menu-card--soon {
  opacity: 0.55;
  cursor: default;
  filter: none;
}

/* A súgó gomb a kártya testvére (gomb nem lehet gombban), a sarokba pozicionálva. */
.menu-item {
  position: relative;
  display: grid;
}

.menu-help {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  font: inherit;
  font-size: 0;
  color: var(--muted);
}

/* Kicsi látható kör, de a koppintási felület a teljes 44px. */
.menu-help::before {
  content: '?';
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

@media (hover: hover) {
  .menu-help:hover {
    color: var(--text);
  }
}
.menu-help:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: -4px;
}

.menu-card__icon {
  font-size: 28px;
  margin-bottom: 4px;
}
.menu-card__title {
  font-size: clamp(17px, 4.6vw, 18px);
  font-weight: 600;
}
.menu-card__desc {
  color: var(--muted);
  font-size: 14px;
}

.menu-card__badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 11px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 999px;
}

.menu-card--locked {
  opacity: 0.5;
  cursor: default;
  filter: none;
  pointer-events: none;
}

.menu-card__badge[hidden] {
  display: none;
}

.menu-card__badge--locked {
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border);
}

/* --- Admin panel --- */

.admin-controls {
  margin-top: 22px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.admin-controls__title {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  cursor: pointer;
}

.toggle-row + .toggle-row {
  border-top: 1px solid var(--border);
}

.toggle-row__label {
  font-size: 15px;
  font-weight: 500;
}

.toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  background: var(--border);
  border-radius: 999px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle__input:checked + .toggle {
  background: var(--accent);
}
.toggle__input:checked + .toggle::after {
  transform: translateX(18px);
}

.toggle__input:focus-visible + .toggle {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}

/* --- Kvíz --- */

.quiz {
  margin-top: clamp(26px, 6vw, 36px);
}

.quiz__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.quiz__header .button--ghost {
  padding: 7px 15px;
  font-size: 14px;
}

.quiz__progress {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.quiz__label {
  margin: 0 0 18px;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(19px, 5vw, 22px);
  font-weight: 600;
  line-height: 1.35;
}

.quiz__options {
  display: grid;
  gap: 10px;
}

.quiz__option {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 14px 18px;
  font: inherit;
  font-size: 16px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

@media (hover: hover) {
  .quiz__option:not([disabled]):hover {
    border-color: var(--accent-line);
    background: var(--accent-soft);
  }
}
.quiz__option:not([disabled]):active {
  filter: brightness(0.96);
}

.quiz__option[disabled] {
  cursor: default;
}

.quiz__option--correct {
  color: #fff;
  background: #2f9e44;
  border-color: #2f9e44;
}

.quiz__option--wrong {
  color: #fff;
  background: #e03131;
  border-color: #e03131;
}

/* Semleges arany, hogy egy piros/zöld saját szín ne tűnjön helyes/hibás jelölésnek. */
.quiz__option--selected {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 16%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--gold);
}

.quiz__option[disabled]:not(.quiz__option--correct):not(.quiz__option--wrong):not(.quiz__option--selected) {
  opacity: 0.6;
}

.quiz__score-line {
  margin: 22px 0 0;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.quiz__title {
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(21px, 5.5vw, 24px);
  font-weight: 600;
}

/* --- Kvíz: admin vezérlés --- */

.qa-panel {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.qa-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.qa-phase {
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
}
.qa-phase--open {
  color: #fff;
  background: #2f9e44;
}
.qa-phase--closed {
  color: var(--text);
  background: var(--border);
}

.qa-options {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.qa-option {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.qa-option--correct {
  border-color: #2f9e44;
  background: color-mix(in srgb, #2f9e44 14%, var(--surface));
}
.qa-option__letter {
  font-weight: 700;
  color: var(--muted);
}
.qa-option__count {
  min-width: 2ch;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.qa-answered {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.qa-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}
.qa-wide {
  width: 100%;
  margin-top: 10px;
}

.qa-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.qa-footer .button {
  padding: 9px 16px;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.next-button {
  margin-top: 22px;
  width: 100%;
}

/* Telefon: a sorba tördelt gombok helyett teljes szélesség, hogy hüvelykujjal
   is könnyű legyen eltalálni őket. */
@media (max-width: 520px) {
  .name-form__row {
    flex-direction: column;
    align-items: stretch;
  }
  .name-form__input {
    flex: 0 0 auto;
  }
  .name-form__row .button {
    width: 100%;
  }
  .result__header .button--ghost {
    padding: 9px 16px;
  }
  .menu__lead .button--ghost {
    padding: 9px 16px;
  }
  .task__action {
    flex: 1 1 110px;
    padding: 9px 12px;
  }
}

/* Nagyon keskeny kijelző (iPhone SE és hasonlók): kompaktabb kártya. */
@media (max-width: 380px) {
  .task {
    grid-template-columns: 30px 1fr;
    gap: 12px;
    padding: 15px;
  }
  .task__ordinal {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  .task__summary {
    margin-top: 3px;
  }
  .page__kicker {
    letter-spacing: 0.16em;
  }
}

/* Alacsony, fekvő módú telefon: kevesebb üres hely felül. */
@media (max-height: 520px) and (orientation: landscape) {
  body {
    padding-top: 24px;
  }
  .page__header {
    margin-bottom: 18px;
  }
}

/* --- Kupakos gyilkos --- */

.bottlecap {
  margin-top: clamp(26px, 6vw, 36px);
}

.bottlecap__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.bottlecap__header .button--ghost {
  padding: 7px 15px;
  font-size: 14px;
}

.bottlecap__title {
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(21px, 5.5vw, 24px);
  font-weight: 600;
}

.bc-killer__cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 40px 24px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
}
.bc-killer__cover-icon {
  font-size: 48px;
}
.bc-killer__cover-title {
  font-size: 20px;
  font-weight: 700;
}
.bc-killer__cover-hint {
  font-size: 14px;
  color: var(--muted);
}

.bc-killer__close {
  margin-top: 18px;
  font-size: 13px;
  opacity: 0.75;
}

.bc-killer__card {
  width: 100%;
  font: inherit;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: 0 14px 34px -12px var(--accent-line);
}

.bc-killer__icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.bc-killer__text {
  margin: 0;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bc-killer__hint {
  margin: 12px 0 0;
  font-size: 15px;
  opacity: 0.85;
}

#bc-killer {
  margin-bottom: 24px;
}

.bc-killer__text,
.bc-killer__hint,
.bc-killer__rule,
.bc-killer__close {
  display: block;
}

.bc-killer__rule {
  margin: 10px 0 0;
  font-size: 15px;
  font-weight: 700;
}

.bc-report {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.bc-report .name-form__input {
  flex: 1 1 200px;
}
.bc-report .button {
  white-space: nowrap;
}

.bc-already__text {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 24px;
}

.bc-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 15px;
}

.bc-table th,
.bc-table td {
  padding: 10px 14px;
  text-align: left;
}

.bc-table th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.bc-table td {
  border-bottom: 1px solid var(--border);
}
.bc-table tbody tr:last-child td {
  border-bottom: none;
}

#bc-kills {
  margin-bottom: 22px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#bc-kills h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#bc-empty {
  color: var(--muted);
  font-size: 14px;
}

#bc-new-killer {
  width: 100%;
}

.bc-report .name-form__input {
  font-size: 16px;
}

@media (max-width: 520px) {
  .bc-report {
    flex-direction: column;
    align-items: stretch;
  }
  .bc-report .name-form__input {
    flex: 0 0 auto;
  }
  .bc-report .button {
    width: 100%;
  }
  .bottlecap__header .button--ghost {
    padding: 9px 16px;
  }
  .bc-table th,
  .bc-table td {
    padding: 8px 10px;
    font-size: 14px;
  }
  .bc-table th {
    font-size: 11px;
  }
  .bc-table {
    min-width: 320px;
  }
}

/* --- Sörpong / csocsó --- */

.score-form {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 16px 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.score-form__check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}

.score-form__check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.score-mine {
  margin: 10px 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.score-list h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.bc-table.score-table {
  min-width: 0;
}
.score-table th:first-child,
.score-table td:first-child {
  width: 3ch;
  color: var(--muted);
}
.score-table th:nth-child(3),
.score-table td:nth-child(3) {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.score-table__me td {
  background: var(--accent-soft);
}

.score-table td.score-table__fix,
.score-table th.score-table__fix {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.score-fix {
  width: 36px;
  height: 36px;
  margin-left: 6px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
}
.score-fix[disabled] {
  opacity: 0.5;
  cursor: default;
}

.score-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.score-add__select {
  flex: 1 1 180px;
  min-width: 0;
  min-height: var(--tap);
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.score-reset {
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 520px) {
  .score-form .button {
    width: 100%;
  }
  .score-add .button {
    width: 100%;
  }
}

/* --- Kupakos: körtörténet, admin gombok --- */

.bc-history {
  margin-bottom: 22px;
}
.bc-history h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.bc-history__list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bc-history__item {
  padding: 10px 14px;
  font-size: 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.bc-history__meta {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}
.bc-admin {
  display: grid;
  gap: 10px;
}

/* --- Részegbiztos apróságok --- */

/* Hosszú nyomásra ne jelöljön ki szöveget és ne jöjjön fel a rendszer menüje. */
button,
.menu-card,
.quiz__option,
.task__actions,
.bc-killer {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* --- Kapcsolat-jelző (felül) --- */

.offline-bar {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  left: 50%;
  z-index: 12;
  width: min(440px, calc(100vw - 32px));
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: #5c3b00;
  background: #ffe8a3;
  border: 1px solid #f5c542;
  border-radius: 12px;
  box-shadow: 0 10px 24px -12px rgb(0 0 0 / 0.5);
  transform: translateX(-50%);
}

/* --- Alsó navigáció (aloldalakon) --- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 10px calc(16px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.bottom-nav__button {
  display: block;
  width: min(440px, 100%);
  min-height: 52px;
  margin: 0 auto;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  cursor: pointer;
}
body.has-bottom-nav {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
body.has-bottom-nav .undo-bar,
body.has-bottom-nav .toast {
  bottom: calc(86px + env(safe-area-inset-bottom));
}
@media print {
  .bottom-nav {
    display: none !important;
  }
}

/* --- Visszavonás-sáv (Kész / Passz / Nyertem egy kört után 5 mp-ig) --- */

.undo-bar {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(440px, calc(100vw - 32px));
  padding: 10px 10px 10px 16px;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--accent-line);
  border-radius: 14px;
  box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.5);
  transform: translateX(-50%);
}
.undo-bar__text {
  flex: 1;
  font-weight: 600;
}
.undo-bar__button {
  min-height: var(--tap);
  padding: 8px 16px;
  font: inherit;
  font-weight: 700;
  color: var(--on-accent);
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
}
.undo-bar__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
}
.undo-bar:not([hidden]) .undo-bar__timer {
  animation: undo-countdown var(--undo-seconds, 5s) linear forwards;
}
@keyframes undo-countdown {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

/* Kvíz: a kivetítővel egyező A–D betűjelek. */
.quiz__option {
  display: flex;
  align-items: center;
  gap: 12px;
}
.quiz__letter {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  font-weight: 700;
  color: var(--bg);
  background: var(--gold);
  border-radius: 50%;
}

/* --- Hibasáv (a belépő képernyőn kívüli hibákhoz) --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 10;
  width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  font-size: 15px;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 12px;
  box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.45);
  transform: translateX(-50%);
  cursor: pointer;
}

/* --- Admin összesítő --- */

.table-row--link {
  cursor: pointer;
}
.table-row--link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
@media (hover: hover) {
  .table-row--link:hover td {
    background: var(--accent-soft);
  }
}

.admin-tasks {
  display: grid;
  gap: 10px;
  margin: 12px 0 4px;
  padding: 0;
  list-style: none;
}
.admin-task {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.admin-task__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-task__summary {
  font-weight: 600;
}
.admin-task__status {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.admin-task__status--pending {
  color: var(--gold);
}
.admin-task__status--done {
  color: #2f9e44;
}
.admin-task__description {
  margin: 6px 0 10px;
  font-size: 14px;
  color: var(--muted);
}
.admin-task__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-task__actions .button {
  padding: 7px 14px;
  font-size: 14px;
}
#tasks-dialog .error {
  margin: 8px 0 0;
}

.bc-table.stats-table {
  min-width: 0;
}
.stats-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stats-table td.num {
  font-weight: 700;
}
.stats-table td.num--muted {
  color: var(--muted);
  font-weight: 400;
}

/* --- QR kódok (admin) --- */

/* Egysoros admin menüpont a kapcsolók alatt, kapcsoló helyett nyíllal. */
.admin-link {
  width: 100%;
  min-height: var(--tap);
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  font: inherit;
  color: inherit;
  text-align: left;
  touch-action: manipulation;
}
.admin-link[disabled] {
  opacity: 0.55;
  cursor: default;
}
.admin-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.admin-controls__title + .admin-link {
  border-top: none;
}
.admin-link__chevron {
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}

.qr {
  margin-top: clamp(26px, 6vw, 36px);
}

.qr__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.qr__title {
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(21px, 5.5vw, 24px);
  font-weight: 600;
}

.qr__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.qr__actions .button {
  padding: 7px 15px;
  font-size: 14px;
}

.bc-table.qr-table {
  width: 100%;
  min-width: 0;
}
.qr-table__row {
  cursor: pointer;
}
.qr-table__row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
@media (hover: hover) {
  .qr-table__row:hover td {
    background: var(--accent-soft);
  }
}
.qr-table__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

.help-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 22px 22px 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.help-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.help-dialog__title {
  margin: 0 0 12px;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}

.help-dialog__body p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.55;
}
.help-dialog__close {
  width: 100%;
  margin-top: 8px;
}
.help-dialog__stats {
  width: 100%;
  margin-top: 8px;
}
.help-dialog__stats + .help-dialog__close {
  margin-top: 14px;
}

.visitor-form {
  display: grid;
  gap: 14px;
}
.visitor-form__field {
  display: grid;
  gap: 6px;
}
.visitor-form__field--inline {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
}
.visitor-form__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.visitor-form__color {
  width: 64px;
  height: var(--tap);
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}
.visitor-form__hint {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.visitor-form .error {
  margin: 0;
}
.visitor-form__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.visitor-result__card .qr-card {
  border: none;
  padding: 12px 0;
}
.visitor-result__card .qr-card__image {
  max-width: 240px;
}
.visitor-result__card .qr-card__code {
  font-size: 20px;
}

.qr-dialog__actions {
  margin-bottom: 10px;
}
.qr-dialog__delete {
  color: #e03131;
  border-color: color-mix(in srgb, #e03131 50%, var(--border));
}

.qr-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.qr-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}
.qr-dialog .qr-card {
  border: none;
  padding: 0 0 14px;
}
.qr-dialog .qr-card__name {
  font-size: 20px;
}
.qr-dialog .qr-card__image {
  max-width: 280px;
}
.qr-dialog .qr-card__code {
  font-size: 18px;
}

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

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.qr-card__name {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.qr-card__image {
  display: block;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 1;
  border-radius: 6px;
}

.qr-card__code {
  margin: 8px 0 0;
  font:
    600 15px/1.2 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  letter-spacing: 0.12em;
}

@media (max-width: 520px) {
  .qr__actions .button {
    padding: 9px 16px;
  }
}

/* Nyomtatáskor csak a QR rács marad, fehér lapon, soronként 4 kártya. */
@media print {
  @page {
    margin: 12mm;
  }

  body.view-qr {
    padding: 0;
    background: #fff;
    color: #000;
  }
  body.view-qr .page {
    max-width: none;
  }
  body.view-qr .page__header,
  body.view-qr .qr__header {
    display: none;
  }
  body.view-qr .qr {
    margin: 0;
  }
  body.view-qr .qr-table,
  body.view-qr .qr-dialog__actions {
    margin-bottom: 10px;
  }
  .qr-dialog__delete {
    color: #e03131;
    border-color: color-mix(in srgb, #e03131 50%, var(--border));
  }

  .qr-dialog {
    display: none;
  }

  body.view-qr .qr-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6mm;
  }
  body.view-qr .qr-card {
    padding: 4mm;
    background: #fff;
    border: 1px dashed #999;
    border-radius: 0;
    break-inside: avoid;
  }
  body.view-qr .qr-card__name {
    color: #000;
  }
  body.view-qr .qr-card__image {
    max-width: 38mm;
    border-radius: 0;
  }
  body.view-qr .qr-card__code {
    color: #000;
  }
}

/* --- Kivetítő --- */

body.projector {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 5vw;
  --accent: #b8873c;
}

.projector__stage {
  width: 100%;
  max-width: 1600px;
}

.projector__progress {
  margin: 0 0 2vh;
  font-size: clamp(16px, 2.2vw, 32px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
}

.projector__label {
  margin: 0 0 5vh;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(28px, 4.6vw, 80px);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.projector__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5vh 2.5vw;
  margin: 0;
  padding: 0;
  list-style: none;
}

.projector__option {
  display: flex;
  align-items: center;
  gap: 1.4vw;
  padding: 3vh 2.4vw;
  font-size: clamp(20px, 3vw, 52px);
  font-weight: 600;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 24px;
  transition:
    opacity 0.4s ease,
    background-color 0.4s ease,
    border-color 0.4s ease;
}

.projector__letter {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.8em;
  height: 1.8em;
  color: var(--bg);
  background: var(--gold);
  border-radius: 50%;
}

.projector__option--correct {
  color: #fff;
  background: #2f9e44;
  border-color: #2f9e44;
}
.projector__option--correct .projector__letter {
  color: #2f9e44;
  background: #fff;
}
.projector__option--dim {
  opacity: 0.35;
}

.projector__results {
  display: grid;
  gap: 1.4vh;
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.projector__result {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  align-items: center;
  gap: 1.4vw;
  padding: 1.6vh 2.4vw;
  font-size: clamp(20px, 2.8vw, 48px);
  font-weight: 600;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
}

.projector__result--first {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 18%, var(--surface));
}
.projector__rank {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.projector__score {
  font-variant-numeric: tabular-nums;
}

.projector__message {
  margin: 0;
  font-family: 'Iowan Old Style', Palatino, Georgia, serif;
  font-size: clamp(28px, 5vw, 88px);
  text-align: center;
}

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

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
