/* KCC Arena Portal: mobile-first styles. Colours are tokens in the KCC
   palette: deep black background, vivid gold for primary actions and accents,
   pure white for text, borders and secondary actions. Layout uses logical
   properties so the portal works right-to-left in Arabic. */

:root {
  color-scheme: dark;
  --black: #090909;
  --white: #ffffff;
  --bg: var(--black);
  --surface: #121212;
  --surface-2: #1a1a1a;
  --text: var(--white);
  --text-2: #d9d9d9;
  --muted: #a3a3a3;
  --border: #2a2a2a;
  --border-strong: #4a4a4a;
  --ink: var(--black);
  --ink-2: #141414;
  --on-ink: var(--white);
  --on-ink-muted: #c7c7c7;
  --gold: #ffd000;
  --gold-hover: #ffdc3d;
  --gold-strong: var(--gold);
  --gold-soft: rgba(255, 208, 0, 0.12);
  --primary: var(--gold);
  --primary-hover: var(--gold-hover);
  --on-primary: #000000;
  /* Status colours (functional, tuned for the black background) */
  --green: #4fd38c;
  --green-soft: rgba(79, 211, 140, 0.14);
  --red: #ff7b72;
  --red-soft: rgba(255, 123, 114, 0.12);
  --amber: #ffb547;
  --amber-soft: rgba(255, 181, 71, 0.14);
  --blue: #7fb0ff;
  --blue-soft: rgba(127, 176, 255, 0.14);
  --focus: var(--gold);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 6px 20px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --radius-sm: 10px;
  /* chart */
  --series-1: var(--gold);
  --grid: #2a2a2a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.1rem);
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

img {
  max-width: 100%;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  background: var(--surface);
  padding: 8px 12px;
  border-radius: 8px;
}

.skip-link:focus {
  left: 8px;
}

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

.small {
  font-size: 0.875rem;
}

.num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 48px;
  flex: 1;
  outline: none;
}

.stack > * + * {
  margin-top: 16px;
}

/* ---------- Arena bar (under the website header) ---------- */

.topbar {
  position: relative;
  z-index: 20;
  background: #141414;
  color: var(--on-ink);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-mark {
  border-radius: 50%;
}

.brand-text {
  font-weight: 600;
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--on-ink);
  text-decoration: none;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.brand-mark {
  border-radius: 9px;
  display: block;
}

.brand-text b {
  color: var(--gold);
}

.nav {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav a:not(.btn),
.nav .nav-btn {
  color: var(--on-ink);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.95rem;
  white-space: nowrap;
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.nav a:not(.btn):hover,
.nav .nav-btn:hover,
.nav a.active {
  background: rgba(255, 255, 255, 0.1);
}

.nav .btn {
  color: #000000;
  padding: 7px 14px;
  margin-inline-start: 4px;
  white-space: nowrap;
}

.nav .nav-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  background: rgba(38, 137, 90, 0.25);
}

.connection {
  background: var(--amber-soft);
  color: var(--amber);
  text-align: center;
  font-size: 0.85rem;
  padding: 4px 12px;
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 8px 12px 6px;
  }
  .nav {
    width: 100%;
    margin-inline-start: 0;
    padding-bottom: 2px;
  }
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 16px 32px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  min-height: 42px;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn.is-busy {
  opacity: 0.6;
  cursor: progress;
}

/* Primary action: vivid gold with black text. */
.btn-primary,
.btn-gold {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  font-weight: 700;
}

.btn-primary:hover,
.btn-gold:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

/* Secondary action: black with a white border and white text. */
.btn-secondary {
  background: var(--black);
  color: var(--white);
  border-color: var(--white);
}

.btn-secondary:hover {
  background: var(--white);
  color: #000000;
}

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--red);
  color: #000000;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--red);
  border-color: var(--border-strong);
}

.btn-danger-ghost:hover {
  background: var(--red-soft);
}

.btn-sm {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 14px 22px;
  min-height: 52px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

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

/* ---------- Cards, sections, layout ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  min-width: 0;
}

.card + .card,
.card + .section,
.section + .card,
.grid-2 + .card,
.card + .grid-2,
.stat-grid + .card,
.grid-2 + .grid-2 {
  margin-top: 16px;
}

@media (max-width: 520px) {
  .card {
    padding: 16px;
    border-radius: 14px;
  }
}

.section {
  margin-top: 32px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
}

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

@media (min-width: 860px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.grid-2 > .card,
.card-grid > .card,
.standings-layout > .card {
  margin-top: 0;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 6px 0 4px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.crumbs {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.crumbs a {
  color: var(--muted);
  text-decoration: none;
}

.crumbs a::before {
  content: "← ";
}

[dir="rtl"] .crumbs a::before {
  content: "→ ";
}

.count {
  display: inline-block;
  min-width: 24px;
  padding: 0 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  text-align: center;
  vertical-align: middle;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 18px 8px;
  margin: 0;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 64px 0;
  color: var(--muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Badges & status ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-neutral {
  background: var(--surface-2);
  color: var(--text-2);
  border-color: var(--border);
}

.badge-muted {
  background: var(--surface-2);
  color: var(--muted);
}

.badge-info {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-live,
.badge-ok {
  background: var(--green-soft);
  color: var(--green);
}

.badge-warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-danger {
  background: var(--red-soft);
  color: var(--red);
}

.badge-gold {
  background: var(--gold-soft);
  color: var(--gold-strong);
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22b16a;
  box-shadow: 0 0 0 0 rgba(34, 177, 106, 0.6);
  animation: pulse 1.8s infinite;
  flex: none;
  display: inline-block;
}

.badge .live-dot {
  width: 8px;
  height: 8px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 177, 106, 0.55);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(34, 177, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 177, 106, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot,
  .spinner,
  .waiting-mark {
    animation: none !important;
  }
}

.live-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: 1rem;
}

.live-line .timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
}

.live-line.finished,
.live-line.upcoming {
  color: var(--text-2);
}

/* ---------- Alerts & toasts ---------- */

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  margin: 0 0 12px;
}

.alert-info {
  background: var(--blue-soft);
  color: var(--text);
  border-color: color-mix(in srgb, var(--blue) 25%, transparent);
}

.alert-ok {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 25%, transparent);
}

.alert-warn {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 30%, transparent);
}

.alert-danger {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 30%, transparent);
}

.alert-title {
  font-weight: 800;
  display: block;
  margin-bottom: 2px;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(460px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  color: var(--on-ink);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  font-weight: 600;
  pointer-events: auto;
  border-inline-start: 4px solid var(--gold);
  animation: toast-in 0.2s ease-out;
}

.toast-ok {
  border-inline-start-color: #22b16a;
}

.toast-danger {
  border-inline-start-color: #e5534b;
}

.toast-warn {
  border-inline-start-color: #f0a73a;
}

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

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 11, 14, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}

@media (min-width: 560px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal {
  background: var(--surface);
  color: var(--text);
  border-radius: 18px;
  width: min(460px, 100%);
  padding: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.18s ease-out;
}

.modal h2 {
  font-size: 1.25rem;
}

.modal-body {
  color: var(--text-2);
  margin-bottom: 16px;
}

.modal-field,
.modal .form-error {
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-actions .btn {
  flex: 1 1 140px;
}

/* ---------- Forms ---------- */

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

.field {
  display: grid;
  gap: 6px;
  align-content: start;
}

.field > span:first-child {
  font-weight: 600;
  font-size: 0.92rem;
}

.field .optional {
  font-weight: 400;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  min-height: 46px;
}

.field textarea {
  min-height: 80px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent);
}

.field-hint {
  font-size: 0.83rem;
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .form-row.three {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.form-error {
  background: var(--red-soft);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-weight: 600;
}

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}

.check input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  flex: none;
}

details.optional-fields {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

details.optional-fields summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-2);
}

details.optional-fields[open] summary {
  margin-bottom: 12px;
}

.photo-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.photo-picker input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.auth {
  max-width: 480px;
  margin: 12px auto 0;
}

.auth-alt {
  text-align: center;
  margin: 16px 0 0;
  color: var(--muted);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th {
  text-align: start;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table th.num {
  text-align: end;
}

.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tr.is-me td {
  background: var(--gold-soft);
}

.table tr.is-dq td {
  color: var(--muted);
}

.table .rank {
  font-weight: 800;
  color: var(--text-2);
  width: 40px;
}

.table .score {
  font-weight: 800;
  font-size: 1.05rem;
}

.table a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.table a:hover {
  text-decoration: underline;
}

.player-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-cell small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.delta {
  font-weight: 700;
  font-size: 0.8rem;
}

.delta.up {
  color: var(--green);
}

.delta.down {
  color: var(--red);
}

@media (max-width: 560px) {
  .hide-sm {
    display: none;
  }
  .table td,
  .table th {
    padding: 8px 6px;
  }
}

/* ---------- Avatars ---------- */

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gold-soft);
  color: var(--gold-strong);
  font-weight: 800;
  overflow: hidden;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 0.75rem;
}

.avatar-md {
  width: 44px;
  height: 44px;
  font-size: 0.95rem;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 1.3rem;
}

.avatar-xl {
  width: 96px;
  height: 96px;
  font-size: 2rem;
}

/* ---------- Facts / stats ---------- */

.facts {
  display: grid;
  gap: 10px;
  margin: 0 0 12px;
}

.facts > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

.facts dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.facts dd {
  margin: 0;
  font-weight: 600;
}

.stat-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 16px 0;
}

@media (min-width: 720px) {
  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .stat-grid.wide {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  min-width: 0;
}

.stat-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.stat-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.15;
  margin-top: 2px;
}

.stat.tone-live {
  border-color: color-mix(in srgb, var(--green) 40%, var(--border));
}

.stat.tone-warn .stat-value {
  color: var(--amber);
}

.stat.tone-danger {
  border-color: color-mix(in srgb, var(--red) 45%, var(--border));
}

.stat.tone-danger .stat-value {
  color: var(--red);
}

.me-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.me-strip .stat {
  text-align: center;
  padding: 12px 8px;
}

.me-strip .stat-value {
  font-size: 1.6rem;
}

/* ---------- Home ---------- */

.hero {
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 208, 0, 0.1) 0%, transparent 55%), var(--black);
  border: 1px solid var(--border-strong);
  color: var(--on-ink);
  border-radius: 22px;
  padding: clamp(24px, 5vw, 44px);
  position: relative;
  overflow: hidden;
  display: flex;
  gap: clamp(16px, 4vw, 32px);
  align-items: center;
  flex-wrap: wrap;
}

.hero > div {
  flex: 1;
  min-width: 260px;
}

.hero-logo {
  flex: none;
  width: clamp(72px, 12vw, 120px);
  height: auto;
  border-radius: 50%;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.hero h1 {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  margin: 8px 0 12px;
}

.hero h1 span {
  color: var(--gold);
}

.hero .lead {
  max-width: 620px;
  color: var(--on-ink-muted);
  font-size: 1.05rem;
}

.hero-mark {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--gold);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.hero .btn-secondary {
  background: transparent;
  color: var(--on-ink);
  border-color: rgba(255, 255, 255, 0.3);
}

.hero .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.live-banner {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 35%, transparent);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.live-banner-timer {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  margin-top: 2px;
}

.live-banner-timer span {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  counter-reset: step;
}

.steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  counter-increment: step;
  display: grid;
  gap: 4px;
}

.steps li::before {
  content: counter(step);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--gold-strong);
  font-weight: 800;
  margin-bottom: 6px;
}

.steps span {
  color: var(--text-2);
  font-size: 0.92rem;
}

/* ---------- Arena cards & details ---------- */

.arena-card {
  display: flex;
  flex-direction: column;
}

.arena-card h3 {
  font-size: 1.2rem;
  margin: 10px 0 12px;
}

.arena-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.arena-card .facts > div {
  grid-template-columns: 96px 1fr;
}

.arena-card .btn {
  margin-top: auto;
}

.arena-card-head {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.reg-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 8px 0 14px;
}

.reg-name {
  font-weight: 800;
  font-size: 1.1rem;
}

.reg-id {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  color: var(--text-2);
  font-size: 0.92rem;
}

.reg-ok {
  color: var(--green);
  font-weight: 800;
  margin-top: 2px;
}

/* ---------- Live arena: current game ---------- */

.arena-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.arena-status h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.game-card {
  text-align: center;
  position: relative;
}

.game-card.is-new {
  animation: flash 1.2s ease-out 2;
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 rgba(196, 154, 44, 0.7);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(196, 154, 44, 0);
  }
}

.game-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  text-align: start;
}

.board-number {
  margin: 4px auto 14px;
  display: inline-grid;
  justify-items: center;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 20px;
  padding: 12px 30px 14px;
  border: 2px solid var(--gold);
}

.board-number span {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold);
}

.board-number strong {
  font-size: clamp(3.4rem, 16vw, 5rem);
  line-height: 1;
  font-weight: 900;
}

.matchup {
  display: grid;
  gap: 6px;
  text-align: start;
  max-width: 460px;
  margin: 0 auto;
}

.side {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.side.is-me {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.piece {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.7rem;
  line-height: 1;
  font-variant-emoji: text;
}

.piece-white {
  background: #000000;
  color: #ffffff;
  border: 1px solid var(--border-strong);
}

.piece-black {
  background: #ffffff;
  color: #000000;
}

.side-info {
  display: grid;
  min-width: 0;
  flex: 1;
}

.side-color {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}

.side-name {
  font-weight: 800;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.side-elo {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  font-weight: 600;
}

.vs {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.game-meta {
  color: var(--text-2);
  font-size: 0.92rem;
  margin: 14px 0;
  font-variant-numeric: tabular-nums;
}

.result-card {
  text-align: center;
  border-color: color-mix(in srgb, var(--green) 45%, var(--border));
}

.result-card .big-icon {
  font-size: 2.4rem;
  line-height: 1;
}

.result-card .result-score {
  font-size: 1.6rem;
  font-weight: 900;
  margin: 6px 0;
}

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

.waiting-mark {
  font-size: 2.6rem;
  line-height: 1;
  display: inline-block;
  animation: bob 2.4s ease-in-out infinite;
  color: var(--gold);
}

@keyframes bob {
  50% {
    transform: translateY(-6px);
  }
}

.big-status {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 8px 0 6px;
}

.leave-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

/* ---------- Report result ---------- */

.report-options {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.report-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border-radius: 16px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  text-align: start;
}

.report-option:hover {
  border-color: var(--text-2);
}

.report-option small {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.report-option .opt-icon {
  font-size: 1.6rem;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: none;
}

.report-option.win .opt-icon {
  background: var(--green-soft);
}

.report-option.draw .opt-icon {
  background: var(--blue-soft);
}

.report-option.loss .opt-icon {
  background: var(--red-soft);
}

.report-option.selected {
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* ---------- Boards & queue ---------- */

.board-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.board-tile {
  display: block;
  border: 1px solid var(--border);
  border-inline-start: 5px solid var(--border-strong);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

a.board-tile:hover {
  background: var(--surface-2);
}

.board-tile.status-playing {
  border-inline-start-color: #22b16a;
}

.board-tile.status-awaiting_result {
  border-inline-start-color: #f0a73a;
}

.board-tile.status-disputed {
  border-inline-start-color: #e5534b;
  background: var(--red-soft);
}

.board-tile.status-available {
  opacity: 0.75;
}

.board-tile-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.board-tile-head strong {
  font-size: 0.95rem;
}

.board-players {
  font-size: 0.92rem;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.board-players div {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-players .piece {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 0.85rem;
}

.board-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

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

.queue li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
}

.queue li:last-child {
  border-bottom: 0;
}

.queue li.is-me {
  font-weight: 800;
}

.queue-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.queue-wait {
  font-size: 0.85rem;
  width: 52px;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.standings-layout {
  display: grid;
  gap: 16px;
}

@media (min-width: 960px) {
  .standings-layout.with-aside {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* ---------- Tabs & chips ---------- */

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 20px 0 14px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--gold);
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--ink);
  color: var(--on-ink);
  border-color: var(--ink);
}

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

.admin-head {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-title h1 {
  margin: 0;
}

.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.control-bar .live-line {
  margin-inline-end: auto;
}

.attention {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.attention-item.disputed {
  background: var(--red-soft);
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
}

.attention-item .grow {
  flex: 1;
  min-width: 180px;
}

.reports {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
}

.report-row .who {
  flex: 1;
  min-width: 160px;
}

.report-row .what {
  font-weight: 800;
}

.resolve-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin: 12px 0;
}

.official {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}

.inline-form .field {
  flex: 1 1 200px;
}

/* ---------- Profile ---------- */

.profile-card {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.profile-main {
  flex: 1;
  min-width: 200px;
}

.profile-main h1 {
  margin: 0 0 2px;
}

.kcc-id {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-weight: 700;
  color: var(--gold-strong);
  background: var(--gold-soft);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.profile-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-2);
  margin-bottom: 8px;
}

.profile-elo {
  text-align: center;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 16px;
  padding: 12px 22px;
  border: 2px solid var(--gold);
}

.profile-elo .label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.profile-elo .value {
  display: block;
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.1;
}

.outcome {
  font-weight: 800;
}

.outcome-WIN {
  color: var(--green);
}

.outcome-LOSS {
  color: var(--red);
}

.outcome-DRAW {
  color: var(--text-2);
}

/* ---------- Elo chart ---------- */

.chart {
  position: relative;
  margin-top: 8px;
  outline-offset: 4px;
  touch-action: pan-y;
  direction: ltr;
}

.chart svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.chart .grid-line {
  stroke: var(--grid);
  stroke-width: 1;
}

.chart .axis-text {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart .end-label {
  fill: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.chart .series-line {
  fill: none;
  stroke: var(--series-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart .series-area {
  fill: var(--series-1);
  opacity: 0.1;
}

.chart .series-dot {
  fill: var(--series-1);
  stroke: var(--surface);
  stroke-width: 2;
}

.chart .crosshair {
  stroke: var(--muted);
  stroke-width: 1;
}

.chart-tooltip {
  position: absolute;
  top: 0;
  pointer-events: none;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.35;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  z-index: 2;
}

.chart-tooltip .tt-value {
  font-size: 1.05rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-tooltip .tt-key {
  width: 14px;
  height: 2px;
  background: var(--series-1);
  display: inline-block;
}

.chart-tooltip .tt-sub {
  color: var(--on-ink-muted);
}

/* ---------- TV mode (venue screen) ---------- */

body.tv .topbar,
body.tv .footer,
body.tv .site-header,
body.tv .site-footer,
body.tv .sponsor-strip {
  display: none;
}

body.tv .container {
  max-width: none;
  padding: 24px 32px;
}

body.tv {
  font-size: 20px;
}

body.tv .standings-head h1 {
  font-size: 2.6rem;
}

body.tv .live-line .timer {
  font-size: 2rem;
}

body.tv .table {
  font-size: 1.15rem;
}

body.tv .table .score {
  font-size: 1.35rem;
}

body.tv .board-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ================================================================
   KCC platform additions
   ================================================================ */

.arena-portal {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}

.badge-free {
  background: var(--green-soft);
  color: var(--green);
}

.badge-paid {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-male {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge-female {
  background: rgba(255, 143, 192, 0.14);
  color: #ff8fc0;
}

.arena-card.is-featured {
  border-color: var(--gold);
}

.pname {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

.side-name .kt,
.queue-name .kt,
.board-players .kt {
  margin-inline-end: 4px;
}

.board-players .kt-info {
  display: none;
}

.bp-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-section {
  margin: 12px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 1.05rem;
}

.upload-label {
  position: relative;
  overflow: hidden;
}

.upload-label input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.sponsor-pick {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.sponsor-pick legend {
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.sponsor-pick-logo {
  height: 22px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  vertical-align: middle;
  margin-inline-end: 6px;
}

.cell-input {
  width: 100%;
  min-width: 90px;
  font: inherit;
  font-size: 15px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.num-input {
  max-width: 110px;
  text-align: end;
}

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

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

.title-history li {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

tr.is-adjustment td {
  background: var(--amber-soft);
}

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

.me-strip .kt {
  margin: 0;
  font-size: 1.1rem;
}

.arena-description {
  white-space: pre-line;
}

/* Paid arenas: payment instructions */
.payment-box {
  display: grid;
  gap: 12px;
}

.payment-text {
  white-space: pre-line;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.payment-image {
  display: block;
  max-width: 100%;
  max-height: 460px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Prizes */
.prize-lines {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.prize-lines li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}

.prize-medal {
  font-size: 1.4rem;
}

.prize-place {
  font-weight: 800;
  min-width: 6.5em;
}

.prize-notes {
  margin-top: 10px;
  white-space: pre-line;
}

/* Sponsors */
.sponsor-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 22px;
  margin-top: 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.sponsor-strip-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.sponsor-strip img {
  height: 34px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
}

.sponsor-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.sponsor-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
}

.sponsor-ad {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
}

.sponsor-card-body {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  align-items: flex-start;
}

.sponsor-card-body p {
  margin: 4px 0;
  color: var(--text-2);
}

.sponsor-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  flex: none;
}

.modal-wide {
  width: min(640px, 100%);
}

/* ---------- Final Winners Display (TV) ---------- */

body.tv-winners {
  background: var(--black);
}

body.tv-winners .site-header,
body.tv-winners .site-footer,
body.tv-winners .topbar,
body.tv-winners .announcement {
  display: none;
}

body.tv-winners .container {
  max-width: none;
  padding: 0;
}

.winners-stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Sizes follow the screen height so the display fits one TV screen. */
  gap: clamp(8px, 1.6vh, 20px);
  padding: clamp(16px, 2.6vh, 36px) clamp(16px, 4vw, 60px) clamp(16px, 2.4vh, 30px);
  color: var(--white);
  background: radial-gradient(1200px 700px at 50% 0%, rgba(255, 208, 0, 0.14), transparent 65%),
    radial-gradient(900px 500px at 50% 110%, rgba(255, 208, 0, 0.1), transparent 60%), var(--black);
  overflow: hidden;
  isolation: isolate;
  text-align: center;
}

.winners-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: repeating-conic-gradient(rgba(255, 255, 255, 0.03) 0 25%, transparent 0 50%);
  background-size: 90px 90px;
  mask-image: radial-gradient(circle at 50% 40%, #000 20%, transparent 75%);
}

.winners-tools {
  position: absolute;
  top: 12px;
  inset-inline: 12px;
  display: flex;
  justify-content: space-between;
  opacity: 0.35;
  transition: opacity 0.2s;
}

.winners-tools:hover,
.winners-tools:focus-within {
  opacity: 1;
}

.winners-tools .btn {
  color: var(--white);
}

:fullscreen .winners-tools {
  opacity: 0;
}

:fullscreen .winners-tools:hover {
  opacity: 1;
}

.winners-logo {
  width: clamp(80px, 11vh, 150px);
  height: auto;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--gold), 0 20px 50px rgba(0, 0, 0, 0.6);
}

.winners-eyebrow {
  margin: 8px 0 0;
  font-size: clamp(0.9rem, 1.8vh, 1.3rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.winners-head h1 {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: clamp(2rem, 6vh, 4.4rem);
  margin: 4px 0;
  color: #fff;
  letter-spacing: 0.02em;
}

.winners-meta {
  margin: 0;
  color: #d9d9d9;
  font-size: clamp(0.95rem, 2vh, 1.3rem);
}

.podium-stage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(10px, 2vw, 32px);
  width: min(1200px, 100%);
  margin-top: clamp(6px, 2vh, 24px);
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  animation: rise 0.8s ease-out both;
}

.podium-col.place-1 {
  animation-delay: 0.35s;
}

.podium-col.place-2 {
  animation-delay: 0.15s;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
}

.podium-person {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 0 6px clamp(10px, 2vh, 20px);
}

.medal-disc {
  font-size: clamp(2.4rem, 6.5vh, 4.8rem);
  line-height: 1;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.w-place {
  font-size: clamp(0.8rem, 1.7vh, 1.15rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 800;
}

.w-place small {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}

.w-photo {
  width: clamp(64px, 11vh, 130px);
  height: clamp(64px, 11vh, 130px);
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gold);
}

.w-name {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: clamp(1.3rem, 3.6vh, 2.6rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.w-name .kt-code {
  font-size: 0.6em;
}

.w-name .kt-info {
  color: #bdbdbd;
}

.w-title {
  color: #d9d9d9;
  font-size: clamp(0.85rem, 1.8vh, 1.15rem);
}

.w-score {
  font-size: clamp(1.1rem, 2.6vh, 1.8rem);
  color: var(--gold);
}

.w-score b {
  font-size: 1.4em;
  color: #fff;
}

.w-stats {
  color: #b3b3b3;
  font-size: clamp(0.78rem, 1.6vh, 1rem);
}

.podium-block {
  display: grid;
  place-items: center;
  border-radius: 14px 14px 0 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-weight: 800;
  font-size: clamp(2rem, 7vh, 4.6rem);
  color: rgba(0, 0, 0, 0.75);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 20px 50px rgba(0, 0, 0, 0.45);
}

.place-1 .podium-block {
  height: clamp(90px, 17vh, 220px);
  background: linear-gradient(180deg, #ffe066, var(--gold));
}

.place-2 .podium-block {
  height: clamp(70px, 12vh, 160px);
  background: linear-gradient(180deg, #ffffff, #cfcfcf);
}

.place-3 .podium-block {
  height: clamp(50px, 8.5vh, 120px);
  background: linear-gradient(180deg, #e0a061, #cd7f32);
}

.is-empty .podium-block {
  opacity: 0.35;
}

.winners-empty,
.winners-note {
  color: #d9d9d9;
  font-size: 1.2rem;
}

.winners-prizes {
  width: min(760px, 100%);
  border-radius: 16px;
  border: 1px solid var(--gold);
  background: rgba(255, 255, 255, 0.04);
  text-align: start;
}

.winners-prizes summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 18px;
  font-size: clamp(1rem, 2.2vh, 1.4rem);
  font-weight: 800;
  color: var(--gold);
  text-align: center;
}

.winners-prizes summary::-webkit-details-marker {
  display: none;
}

.winners-prizes[open] summary span {
  display: inline-block;
  transform: rotate(180deg);
}

.winners-prizes .prize-lines {
  padding: 0 16px 16px;
}

.winners-prizes .prize-lines li {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: clamp(1rem, 2.2vh, 1.35rem);
}

.winners-prizes .prize-notes {
  padding: 0 16px 16px;
  color: #d9d9d9;
}

.winners-sponsors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 28px;
  margin-top: auto;
  padding: 12px 22px;
  border-radius: 16px;
  background: var(--white);
  color: #000000;
}

.winners-sponsors span {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #444444;
}

.winners-sponsors img {
  height: clamp(30px, 6vh, 60px);
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.winners-disclaimer {
  margin: 0;
  font-size: 0.78rem;
  color: #a3a3a3;
}

@media (max-width: 640px) {
  .podium-stage {
    grid-template-columns: 1fr;
  }
  .podium-col.place-1 {
    order: -1;
  }
  .podium-block {
    display: none;
  }
}

/* ---------- Venue QR code ---------- */

.qr-sheet {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto 18px;
  padding: 28px 22px;
  border-radius: 22px;
  background: #ffffff;
  color: #000000;
  border: 1px solid var(--border);
  text-align: center;
}

.qr-sheet h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  margin: 4px 0 0;
}

.qr-logo {
  border-radius: 50%;
}

.qr-arena {
  font-weight: 800;
  font-size: 1.2rem;
  margin: 0;
}

.qr-code {
  width: min(440px, 82vw);
}

.qr-code svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Check-in code under the check-in QR code, large enough to type from across a table. */
.qr-checkin-code {
  display: grid;
  gap: 2px;
  margin: 4px 0 0;
}

.qr-checkin-code span {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #444444;
}

.qr-checkin-code strong {
  font-family: ui-monospace, Consolas, monospace;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  letter-spacing: 0.25em;
  color: #000000;
}

/* Waiting list of a full arena */
.waitlist-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 12px;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.waitlist-box p {
  margin: 2px 0 0;
}

.waitlist-pos {
  display: grid;
  place-items: center;
  flex: none;
  min-width: 56px;
  height: 56px;
  padding: 0 8px;
  border-radius: 50%;
  background: var(--gold);
  color: #000000;
  font-size: 1.3rem;
  font-weight: 800;
}

.waitlist-offer {
  margin-bottom: 12px;
}

/* Trophies and achievement badges on the player profile */
.trophy {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  flex: none;
  vertical-align: -0.2em;
}

.trophy-gold {
  color: var(--gold);
  filter: drop-shadow(0 0 6px rgba(255, 208, 0, 0.45));
}

.trophy-silver {
  color: #c9ced6;
}

.trophy-bronze {
  color: #cd7f32;
}

.trophy-counts {
  display: inline-flex;
  gap: 6px;
  margin-inline-start: 10px;
  vertical-align: middle;
}

.trophy-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
}

.trophy-shelf,
.badge-grid {
  list-style: none;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.trophy-shelf {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr));
}

.badge-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
}

.trophy-item,
.ach {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 4px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
}

.trophy-item .trophy {
  width: 2.6rem;
  height: 2.6rem;
}

.trophy-item-gold {
  border-color: rgba(255, 208, 0, 0.45);
}

.trophy-place {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ach {
  opacity: 0.55;
}

.ach.is-earned {
  opacity: 1;
  border-color: rgba(255, 208, 0, 0.4);
}

.ach-medal {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border: 3px dashed var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
}

.ach.is-earned .ach-medal {
  border: 3px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, #ffe45c, var(--gold) 55%, #c79c00);
  color: #000000;
}

.ach-medal .icon {
  width: 26px;
  height: 26px;
}

.badge-num {
  font-weight: 900;
}

.ach-name {
  font-weight: 700;
}

.ach-text {
  color: var(--muted);
  font-size: 0.78rem;
}

.ach-date {
  font-size: 0.74rem;
  font-weight: 650;
}

.ach.is-earned .ach-date {
  color: var(--gold);
}

.checkin-form input[name="code"] {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-align: center;
  text-transform: uppercase;
}

.qr-url {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1rem;
  margin: 0;
  word-break: break-all;
}

.qr-steps {
  color: #444444;
  margin: 0;
}

body.qr-full .site-header,
body.qr-full .site-footer,
body.qr-full .topbar,
body.qr-full .no-print {
  display: none !important;
}

body.qr-full .container {
  max-width: none;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #fff;
}

body.qr-full .qr-sheet {
  border: 0;
  max-width: none;
}

body.qr-full .qr-code {
  width: min(78vh, 90vw);
}

@media print {
  .site-header,
  .site-footer,
  .topbar,
  .no-print,
  .toasts {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .container {
    padding: 0;
  }
  .qr-sheet {
    border: 0;
  }
  .qr-code {
    width: 12cm;
  }
}

/* ---------- Arabic ---------- */

:lang(ar) body {
  font-family: "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  line-height: 1.7;
}

:lang(ar) .eyebrow,
:lang(ar) .table th,
:lang(ar) .side-color,
:lang(ar) .board-number span,
:lang(ar) .profile-elo .label,
:lang(ar) .w-place,
:lang(ar) .winners-eyebrow,
:lang(ar) .sponsor-strip-title,
:lang(ar) .winners-sponsors span,
:lang(ar) .vs {
  letter-spacing: 0;
  text-transform: none;
}

:lang(ar) .winners-head h1 {
  font-family: "Segoe UI", "Noto Naskh Arabic", Tahoma, sans-serif;
}
