/* ZEQA Tier Testing — professional tournament UI */

:root {
  --gold: #e6a817;
  --gold-light: #ffd54f;
  --gold-dim: rgba(230, 168, 23, 0.15);
  --red: #c62828;
  --bg: #0f0d0b;
  --bg-elevated: #161310;
  --surface: #1c1814;
  --surface-2: #242019;
  --border: #2e2820;
  --border-light: #3d352a;
  --text: #f5f0e8;
  --muted: #9a9084;
  --green: #43a047;
  --font-display: 'Press Start 2P', monospace;
  --font: 'Inter', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --topbar-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 20px);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }

.container-wide {
  width: min(1200px, 100% - 40px);
  margin-inline: auto;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--topbar-h);
  background: rgba(15, 13, 11, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 0 0 2px var(--bg), 0 0 16px rgba(230, 168, 23, 0.25);
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text small {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 600;
}

.topnav {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 4px;
}

.topnav a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.topnav a:hover {
  color: var(--text);
  background: var(--surface);
}

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

.live-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sync-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.sync-status.sync-ok {
  color: var(--green);
  border-color: rgba(67, 160, 71, 0.35);
  background: rgba(67, 160, 71, 0.08);
}

.sync-status.sync-err {
  color: #ef5350;
  border-color: rgba(239, 83, 80, 0.35);
  background: rgba(239, 83, 80, 0.08);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.admin-trigger {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.admin-trigger.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  color: var(--gold);
  border-color: var(--gold-dim);
}

/* ---- Logo circle ---- */
.logo-circle {
  width: 160px;
  height: 160px;
  margin-inline: auto;
  border-radius: 50%;
  padding: 6px;
  background: linear-gradient(145deg, var(--gold-light), var(--gold), #b8860b);
  box-shadow: 0 0 0 4px var(--bg), 0 0 40px rgba(230, 168, 23, 0.2);
}

.logo-circle img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
}

.logo-circle--modal { width: 100px; height: 100px; }
.logo-circle--sm { width: 48px; height: 48px; padding: 3px; }

/* ---- Banner ---- */
.tournament-banner {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
}

.banner-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 32px 48px;
  align-items: center;
}

.banner-copy h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  margin: 8px 0 12px;
}

.eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.lede { color: var(--muted); max-width: 420px; }

.banner-logo { grid-row: 1 / 3; grid-column: 2; }

.banner-stats {
  grid-column: 1;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.metric {
  min-width: 120px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.metric--highlight {
  border-color: rgba(230, 168, 23, 0.4);
  background: var(--gold-dim);
}

.metric-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ---- Sections ---- */
.section-block {
  padding: 56px 0;
}

.section-block--dark {
  background: var(--bg-elevated);
  border-block: 1px solid var(--border);
}

.section-header { margin-bottom: 28px; }
.section-header--center { text-align: center; }

.section-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-header p { color: var(--muted); font-size: 0.92rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---- Dashboard ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.player-profile { padding: 24px; }

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #b8860b);
  color: var(--bg);
  font-weight: 800;
  font-size: 1.25rem;
  display: grid;
  place-items: center;
}

.profile-head h3 { font-size: 1.1rem; font-weight: 700; }

.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.profile-fields dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 2px;
}

.profile-fields dd { font-weight: 500; font-size: 0.92rem; }

.match-panel { padding: 24px; }

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title i { color: var(--gold); }

.match-round {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 16px;
}

.versus {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.versus-you { flex: 1; font-weight: 700; text-align: right; }
.versus-opp { flex: 1; font-weight: 700; }
.versus-vs {
  font-family: var(--font-display);
  font-size: 0.45rem;
  color: var(--muted);
  padding: 4px 8px;
  background: var(--surface-2);
  border-radius: 4px;
}

.match-hint {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

.btn-report { margin-top: 4px; }

/* ---- Tags & alerts ---- */
.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.tag--green { background: rgba(67, 160, 71, 0.15); color: var(--green); }
.tag--gold { background: var(--gold-dim); color: var(--gold-light); }
.tag--red { background: rgba(198, 40, 40, 0.2); color: #ef5350; }

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert--ok { background: rgba(67, 160, 71, 0.12); color: var(--green); border: 1px solid rgba(67, 160, 71, 0.25); }
.alert--warn { background: rgba(230, 168, 23, 0.12); color: var(--gold-light); border: 1px solid rgba(230, 168, 23, 0.25); }
.alert--error { background: rgba(198, 40, 40, 0.12); color: #ef5350; border: 1px solid rgba(198, 40, 40, 0.25); }

/* ---- Bracket ---- */
.bracket-frame { padding: 0; overflow: hidden; }

.bracket-scroll {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 24px;
  min-height: 480px;
}

.round-col {
  flex: 0 0 200px;
  padding-right: 20px;
  border-right: 1px solid var(--border);
}

.round-col:last-child { border-right: none; }

.round-head {
  font-family: var(--font-display);
  font-size: 0.42rem;
  text-align: center;
  color: var(--gold);
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.round-matches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.round-col[data-round="1"] .round-matches { gap: 22px; padding-top: 8px; }
.round-col[data-round="2"] .round-matches { gap: 56px; padding-top: 28px; }
.round-col[data-round="3"] .round-matches { gap: 140px; padding-top: 72px; }
.round-col[data-round="4"] .round-matches { padding-top: 200px; }

.match {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.match--final { border-color: rgba(230, 168, 23, 0.5); }
.match--done { opacity: 0.85; }

.slot {
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  min-height: 34px;
  display: flex;
  align-items: center;
}

.slot--tbd { color: var(--muted); font-style: italic; }
.slot--win { background: var(--gold-dim); color: var(--gold-light); font-weight: 700; }
.slot--loss { opacity: 0.45; text-decoration: line-through; }

.match-vs {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  padding: 2px;
  background: var(--surface-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---- Rules ---- */
.rules-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.rule-item {
  padding: 22px;
  text-align: center;
}

.rule-item i {
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 12px;
}

.rule-item h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.rule-item p { font-size: 0.84rem; color: var(--muted); }

/* ---- Footer ---- */
.site-footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
}

.footer-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.footer-row p { font-size: 0.8rem; color: var(--muted); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  width: 100%;
}

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

.btn-gold {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: #1a1008;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text);
}

.btn-danger {
  background: rgba(198, 40, 40, 0.15);
  border: 1px solid rgba(198, 40, 40, 0.4);
  color: #ff8a80;
}

.btn-sm { width: auto; padding: 8px 14px; font-size: 0.8rem; }

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
}

.modal {
  width: min(440px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  animation: modalIn 0.3s ease;
}

.modal--admin { width: min(560px, 100%); }
.modal--result { width: min(480px, 100%); }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}

.modal-x:hover { color: var(--text); }

.modal-logo-wrap { display: flex; justify-content: center; margin-bottom: 16px; }

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.modal-desc {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

/* ---- Registration form ---- */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.field input:focus {
  outline: none;
  border-color: var(--gold);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  font-size: 0.88rem;
  cursor: pointer;
}

.payout-group { border: none; margin-bottom: 14px; }

.payout-group legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

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

.payout-chip input { position: absolute; opacity: 0; }

.payout-chip span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.payout-chip input:checked + span {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.notice {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin: 12px 0;
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

/* ---- WIN/LOSS modal ---- */
.step-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 14px;
  text-align: center;
}

.claim-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.claim-btn {
  padding: 24px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.claim-btn--win:hover { border-color: var(--green); background: rgba(67, 160, 71, 0.1); color: var(--green); }
.claim-btn--loss:hover { border-color: var(--red); background: rgba(198, 40, 40, 0.1); color: #ef5350; }

.claim-selected {
  text-align: center;
  font-weight: 700;
  margin-bottom: 14px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.claim-selected.is-win { background: rgba(67, 160, 71, 0.12); color: var(--green); }
.claim-selected.is-loss { background: rgba(198, 40, 40, 0.12); color: #ef5350; }

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  margin-bottom: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone.is-drag,
.upload-zone:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.upload-zone i { font-size: 1.8rem; color: var(--gold); }
.upload-zone small { color: var(--muted); font-size: 0.75rem; }

.upload-preview {
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.upload-preview img { width: 100%; max-height: 200px; object-fit: contain; background: var(--bg); }

.success-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}

#result-step-done h3 {
  text-align: center;
  margin-bottom: 8px;
}

#result-step-done p {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

/* ---- Admin ---- */
.admin-block {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.admin-block--highlight {
  background: var(--bg);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.admin-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-block h3 {
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gold-dim);
  color: var(--gold-light);
}

.review-queue {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 340px;
  overflow-y: auto;
}

.empty-queue {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 20px;
}

.review-card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.review-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.review-detail { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }

.review-ai {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.review-thumb {
  display: block;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.review-thumb img {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  background: #000;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.inline-form input,
.inline-form select {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.admin-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-status {
  margin-top: 12px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--green);
  min-height: 18px;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .banner-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .banner-logo { grid-row: auto; grid-column: 1; order: -1; }
  .banner-stats { justify-content: center; }
  .lede { margin-inline: auto; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .rules-row { grid-template-columns: 1fr 1fr; }

  .topnav { display: none; }
}

@media (max-width: 560px) {
  .rules-row { grid-template-columns: 1fr; }
  .profile-fields { grid-template-columns: 1fr; }
  .claim-row { grid-template-columns: 1fr; }
  .payout-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
