:root {
  --bg: #f4f7fb;
  --bg-strong: #0f1f3a;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #12223f;
  --ink-soft: #4f617f;
  --line: #d6e1f0;
  --accent: #ff6b2c;
  --accent-2: #1cbf9d;
  --danger: #e64955;
  --warning: #f59f00;
  --success: #2f9e44;
  --shadow-md: 0 12px 28px rgba(11, 25, 52, 0.08);
  --shadow-sm: 0 6px 18px rgba(11, 25, 52, 0.06);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Montserrat", "Nunito", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% -15%, rgba(255, 107, 44, 0.2), transparent 35%),
    radial-gradient(circle at 92% -10%, rgba(28, 191, 157, 0.16), transparent 30%),
    var(--bg);
  min-height: 100vh;
}

body.is-drawer-open {
  overflow: hidden;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 31, 58, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(8px);
}

.app-header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.brand-chip {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff9b55, var(--accent));
  color: #351402;
}

.brand-text {
  font-size: 16px;
}

.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
}

.quick-link {
  color: #06231d;
  background: linear-gradient(135deg, #72e2cf, var(--accent-2));
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px;
  border-radius: 999px;
}

.desktop-nav {
  display: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(5, 12, 24, 0.48);
}

.app-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(82vw, 330px);
  z-index: 50;
  background: #0f1f3a;
  color: #fff;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.2);
}

.app-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.drawer-nav {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.drawer-nav a {
  color: #ecf2ff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 11px 12px;
}

.drawer-nav a.is-active {
  background: linear-gradient(135deg, #ff9058, var(--accent));
  border-color: transparent;
  color: #351402;
  font-weight: 800;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
  transition: opacity 0.15s ease;
}
.container.is-navigating {
  opacity: 0.45;
  pointer-events: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 16px;
  margin-bottom: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-header h1,
.card-header h2,
.card-header h3,
.card-header h4 {
  margin-bottom: 0;
}

.card.highlight {
  background: linear-gradient(155deg, #fff7f2, #f7fcff 48%, #f6fffc);
}

.card.compact {
  background: var(--surface-soft);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

h1, h2, h3, h4 {
  margin: 0 0 10px;
  line-height: 1.2;
}

p {
  margin: 0 0 8px;
}

/* Ensure forms don't hug the text above them */
p + .form,
.ok + .form,
.warn + .form,
.info + .form {
  margin-top: 8px;
}

.small {
  font-size: 13px;
  color: var(--ink-soft);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

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

.kpi {
  background: #f2f8ff;
  border: 1px solid #dbe9fb;
  border-radius: 11px;
  padding: 10px;
}

.kpi strong {
  display: block;
  font-size: 18px;
}

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

.field-label,
label {
  display: grid;
  gap: 5px;
  color: var(--ink-soft);
  font-size: 13px;
}

.title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.title-random-btn {
  min-width: 72px;
  box-shadow: none;
}

input:not([type="checkbox"]):not([type="radio"]), select, button, textarea {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

select {
  cursor: pointer;
  padding-right: 38px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 19px) 50%,
    calc(100% - 13px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

select:hover {
  border-color: #a9bfdd;
  background-color: #f8fbff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #5b91e0;
  box-shadow: 0 0 0 3px rgba(91, 145, 224, 0.18);
  outline: none;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: auto;
  -webkit-appearance: auto;
  width: 16px;
  height: 16px;
  margin: 0 8px 0 0;
  padding: 0;
  border: none;
  box-shadow: none;
  accent-color: var(--accent);
  vertical-align: middle;
}

.choice-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid #b8c9e3;
  border-radius: 6px;
  background: #fff;
  box-shadow: inset 0 0 0 2px #fff;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.choice-item input[type="checkbox"]::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  opacity: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

.choice-item input[type="checkbox"]:checked {
  background: linear-gradient(135deg, #ff9058, var(--accent));
  border-color: var(--accent);
}

.choice-item input[type="checkbox"]:checked::before {
  opacity: 1;
}

.choice-item input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 107, 44, 0.18);
}

.choice-item:has(input[type="checkbox"]:checked) {
  border-color: rgba(255, 107, 44, 0.35);
  background: #fff8f3;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin: 0;
  background: #fbfdff;
}

legend {
  padding: 0 6px;
  color: var(--ink-soft);
  font-size: 12px;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #dde7f6;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  color: var(--ink);
}

.choice-item span {
  line-height: 1.2;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #eef5ff;
}

.segment-btn {
  min-height: 40px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 800;
  box-shadow: none;
}

.segment-btn.is-active {
  background: #fff;
  border-color: #c8d8ef;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.segment-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(91, 145, 224, 0.2);
}

.participants-list {
  display: grid;
  gap: 8px;
}

.participant-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}

.participant-row .btn {
  min-height: 40px;
}

.btn,
a.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 800;
  border: none;
  cursor: pointer;
  min-height: 42px;
  border-radius: var(--radius-md);
  padding: 11px 14px;
  box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.62;
  cursor: not-allowed;
}

.btn.primary,
.btn:not(.secondary):not(.tertiary):not(.danger) {
  background: linear-gradient(135deg, #ff9058, var(--accent));
  color: #391603;
}

.btn.secondary {
  background: linear-gradient(135deg, #60ddc8, var(--accent-2));
  color: #062822;
}

.btn.tertiary {
  background: #f4f8ff;
  border: 1px solid #cdddf5;
  color: #244069;
}

.btn.danger {
  background: #fff1f2;
  border: 1px solid #f5c2c6;
  color: #b02a35;
}

.btn.ghost {
  min-height: 34px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  box-shadow: none;
  width: 100%;
  justify-content: center;
}

a.btn:visited {
  color: inherit;
}

.btn.loading::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-top-color: transparent;
  margin-left: 8px;
  animation: spin 0.8s linear infinite;
}

.form.is-loading input,
.form.is-loading select,
.form.is-loading textarea,
.form.is-loading button {
  pointer-events: none;
}

.form.is-loading {
  cursor: wait;
}

.confirm-dialog {
  width: min(92vw, 440px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(8, 20, 42, 0.28);
}

.confirm-dialog::backdrop {
  background: rgba(5, 12, 24, 0.54);
}

.confirm-dialog-body {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid #dce8f7;
  border-radius: 10px;
  background: #f8fbff;
  font-size: 14px;
}

.summary-label {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-value {
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.confirm-actions {
  justify-content: stretch;
  flex-wrap: nowrap;
}

.confirm-actions .btn {
  flex: 1;
  justify-content: center;
}

.warn,
.ok,
.info {
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
}

.warn {
  background: #fff4e8;
  border: 1px solid #ffd6ae;
  color: #8f4a08;
}

.ok {
  background: #edfbf0;
  border: 1px solid #b7eec2;
  color: #19692c;
}

.info {
  background: #edf4ff;
  border: 1px solid #c8dcfb;
  color: #1f4f93;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mode-block {
  padding: 11px;
  border: 1px solid #d8e6f8;
  border-radius: 12px;
  background: #f9fcff;
}

.extra-round-suggestion {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #cfdced;
}

.extra-round-suggestion summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.extra-round-suggestion .form {
  margin-top: 10px;
}

.photo-preview {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid #d8e6f8;
  border-radius: 12px;
  background: #eef5ff;
}

/* ── Photo mode block ───────────────────────────────────────────────────── */
#mode_photo {
  display: grid;
  gap: 14px;
}

/* ── Detected card chips ─────────────────────────────────────────────────── */
.photo-result-ranks {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  min-height: 40px;
}

.detected-chip {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 6px 14px 10px;
  background: #e8f1ff;
  border: 1.5px solid #b0ccf2;
  border-radius: 10px;
  color: var(--ink);
  line-height: 1.2;
  text-align: center;
}

.detected-chip--empty {
  font-size: 18px;
  font-weight: 400;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-color: var(--line);
}

/* ── Photo result / card confirmation ───────────────────────────────────── */
.photo-result-card {
  display: grid;
  gap: 18px;
}

.cards-confirm-label {
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.cards-confirm-label input {
  font-size: 20px;
  padding: 14px 18px;
  text-align: center;
  letter-spacing: 0.08em;
  border: 2px solid #5b91e0;
  border-radius: 14px;
  background: #f4f8ff;
  font-weight: 600;
  width: 100%;
  box-sizing: border-box;
  color: var(--ink);
  text-transform: uppercase;
}

.cards-confirm-label input::placeholder {
  color: #b8cce8;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: none;
}

.cards-confirm-label input:focus {
  border-color: #2e6edc;
  background: #eaf1ff;
  box-shadow: 0 0 0 4px rgba(91, 145, 224, 0.18);
  outline: none;
}

.photo-confidence-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-soft);
  letter-spacing: 0;
  text-align: right;
  opacity: 0.65;
}

.action-row--confirm {
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.action-row--confirm .btn.primary {
  width: 100%;
  justify-content: center;
  font-size: 17px;
  padding: 15px;
}

@media (min-width: 640px) {
  .photo-result-card {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
  }

  .detected-chip {
    font-size: 22px;
    padding: 7px 16px;
  }

  .action-row--confirm {
    flex-direction: row;
  }

  .action-row--confirm .btn.primary {
    flex: 1;
    font-size: 16px;
  }
}

.winner-form {
  margin-top: 18px;
}

.cancel-form {
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px dashed #cfdced;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.status-finished {
  background: #e8f8ec;
  color: #21753d;
}

.status-progress {
  background: #fff1e9;
  color: #944312;
}

.list-clean {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list-clean li {
  padding: 8px 0;
  border-bottom: 1px solid #edf2fa;
}

.list-clean li:last-child {
  border-bottom: none;
}

/* ── Player round list ── */
.player-round-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-round-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.muted { color: var(--ink-soft); }

.inline-form { margin: 0; }

.btn.btn-sm {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.podium {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.podium-place {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dbe9fb;
  border-radius: 12px;
  background: #f8fbff;
}

.podium-place strong {
  display: block;
  font-size: 17px;
}

.podium-place-1 {
  border-color: rgba(255, 107, 44, 0.34);
  background: #fff8f3;
}

.podium-rank {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9058, var(--accent));
  color: #351402;
  font-weight: 900;
}

.finished-celebration {
  position: relative;
  overflow: hidden;
  animation: winnerPop 0.5s ease both;
}

.finished-celebration::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 107, 44, 0.22), transparent 12%),
    radial-gradient(circle at 82% 20%, rgba(28, 191, 157, 0.2), transparent 12%),
    radial-gradient(circle at 58% 88%, rgba(91, 145, 224, 0.16), transparent 16%);
  opacity: 0;
  animation: winnerGlow 1.2s ease 0.15s both;
}

.score-recap-card {
  padding: 12px;
}

.score-recap-card h3 {
  margin-bottom: 4px;
}

.score-recap-list {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.score-recap-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #dce8f7;
  border-radius: 9px;
  background: #f8fbff;
  font-size: 14px;
}

.score-recap-item strong {
  overflow-wrap: anywhere;
}

.score-recap-item.is-winner {
  border-color: rgba(255, 107, 44, 0.36);
  background: #fff8f3;
}

.score-recap-rank {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e9f2ff;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 900;
}

.score-recap-item.is-winner .score-recap-rank {
  background: linear-gradient(135deg, #ff9058, var(--accent));
  color: #351402;
}

.hero-title {
  font-size: 31px;
  letter-spacing: -0.4px;
}

.hero-sub {
  color: #334f7a;
  font-size: 15px;
}

.round {
  border: 1px solid #e4ecf8;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fdfefe;
}

.round-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
  margin-bottom: 6px;
}

.round-header h4 {
  margin: 0;
}

.round-score-grid {
  display: grid;
  gap: 6px;
}

.round-score-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 8px;
  padding: 7px 8px;
  border: 1px solid #edf2fa;
  border-radius: 9px;
  background: #fff;
}

.round-score-main {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.round-score-main strong {
  overflow-wrap: anywhere;
}

.round-score-points {
  font-weight: 900;
  color: var(--ink);
}

a {
  color: #1b5fb7;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes winnerPop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes winnerGlow {
  0% { opacity: 0; }
  35% { opacity: 1; }
  100% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .finished-celebration,
  .finished-celebration::after {
    animation: none;
  }
}

@media (min-width: 820px) {
  #drawer_toggle {
    display: none;
  }

  .app-drawer,
  .drawer-backdrop {
    display: none;
  }

  .app-header-inner {
    padding: 12px 20px;
  }

  .container {
    padding: 24px;
  }

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

  .kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .podium-full {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .round-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .desktop-nav {
    margin-left: auto;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
  }

  .desktop-nav a {
    text-decoration: none;
    color: #eef4ff;
    font-size: 13px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 7px 11px;
    background: rgba(255, 255, 255, 0.08);
  }

  .desktop-nav a.is-active {
    background: linear-gradient(135deg, #ff9058, var(--accent));
    border-color: transparent;
    color: #351402;
    font-weight: 800;
  }

  .quick-link { display: none; }
}

/* ── Label review page ─────────────────────────────── */
.labels-page { max-width: 900px; margin: 0 auto; }

.labels-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.labels-title { font-size: 20px; font-weight: 800; margin: 0; flex: 1 1 auto; }

.labels-summary { display: flex; gap: 6px; }

.labels-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}

.labels-list { display: flex; flex-direction: column; gap: 12px; }

.label-row {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  border-left: 4px solid transparent;
}

.label-row.is-mismatch { border-left-color: var(--warning); }

.label-photo {
  flex: 0 0 auto;
  display: block;
  width: 120px;
}

.label-photo img {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}

.label-info { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }

.label-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.label-id { font-weight: 800; font-size: 13px; color: var(--ink-soft); }

.label-conf-badge { font-size: 11px; color: var(--ink-soft); }

.label-cards-section { display: flex; flex-direction: column; gap: 5px; }

.label-cards-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }

.label-cards-label {
  font-size: 11px;
  font-weight: 700;
  min-width: 72px;
  flex-shrink: 0;
}

.confirmed-label { color: var(--success); }
.ocr-label { color: var(--ink-soft); }

.label-chips { display: flex; flex-wrap: wrap; gap: 4px; }

.card-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
  background: #e8f8ec;
  color: #1a5c2e;
}

.chip-confirmed { background: #e8f8ec; color: #1a5c2e; }
.chip-ok        { background: #eef7ff; color: #1a4a8a; }
.chip-wrong     { background: #fff0f0; color: var(--danger); }

.label-empty { font-size: 12px; color: var(--ink-soft); }

.label-edit-form {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.label-edit-input {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface-soft);
}

.label-edit-input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.label-save-btn { padding: 6px 14px; font-size: 13px; }

@media (max-width: 480px) {
  .label-row { flex-direction: column; }
  .label-photo, .label-photo img { width: 100%; height: 200px; }
}

/* ── Last round highlight ── */
.last-round-tag {
  display: inline-block;
  font-size: 0.65em;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #7a4f00;
  background: #fff3cd;
  border: 1px solid #f0c040;
  border-radius: 6px;
  padding: 1px 7px 2px;
  vertical-align: middle;
  line-height: 1.5;
}

.last-round-card {
  border: 2px solid #f0c040 !important;
  box-shadow: 0 0 0 4px rgba(240,192,64,0.15), var(--shadow-md) !important;
}

/* ── Dashboard game history ─────────────────────────────────────────────── */
.game-history-list { display: flex; flex-direction: column; gap: 12px; }

.game-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.game-history-item:last-child { border-bottom: none; }
.game-history-main { grid-column: 1; display: flex; flex-direction: column; gap: 2px; }
.game-history-meta { grid-column: 2; grid-row: 1 / 3; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.game-history-players { grid-column: 1; color: var(--ink-soft); }
.game-history-item form { grid-column: 2; grid-row: 3; display: flex; justify-content: flex-end; }

/* ── Player presets ─────────────────────────────────────────────────────── */
.preset-list { display: flex; flex-direction: column; gap: 8px; }

.preset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.preset-item:last-child { border-bottom: none; }
.preset-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.preset-info .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-actions { display: flex; gap: 6px; flex-shrink: 0; }

.preset-loader { margin-bottom: 12px; }
.preset-loader-row { display: flex; gap: 8px; align-items: center; }
.preset-loader-row select { flex: 1; }

.save-preset-details { margin-top: 10px; }
.save-preset-details summary { cursor: pointer; color: var(--ink-soft); }
.save-preset-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.save-preset-row input { flex: 1; }

/* ── Scanner mode ────────────────────────────────────────────────────────────── */
.scanner-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #111;
  border-radius: 10px;
  overflow: hidden;
}

#scanner_video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scanner-wrap.is-scanning::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid var(--color-primary, #4f7cff);
  border-radius: 10px;
  animation: scanner-pulse 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scanner-pulse {
  0%, 100% { opacity: 0.35; }
  50%       { opacity: 1; }
}

.scanner-status {
  margin: 0.5rem 0 0.25rem;
  min-height: 1.4em;
}

.scanner-result {
  margin-top: 0.5rem;
}

/* Photo consent and privacy */
.consent-choice { align-items: flex-start; }
.photo-consent-note { margin-top: 0.25rem; }
.photo-consent-card form { gap: 0.5rem; }
.label-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  background: var(--surface-soft);
  border: 1px dashed var(--line);
}
.site-footer { padding-top: 0; padding-bottom: 1.5rem; text-align: center; }
.privacy-page ul { padding-left: 1.2rem; }
.privacy-page li { margin-bottom: 0.4rem; }
