:root {
  --bg: #0e0e10;
  --surface: rgba(20, 20, 22, 0.84);
  --surface-strong: rgba(14, 14, 16, 0.95);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f6f6;
  --muted: #b3b3b7;
  --accent: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-2: #e8e8ea;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.06), transparent 18%),
    radial-gradient(circle at 82% 0%, rgba(255, 255, 255, 0.05), transparent 16%),
    linear-gradient(180deg, #101012 0%, #09090b 100%);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(1460px, calc(100% - 24px));
  margin: 14px auto 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.page-shell > * {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.topbar > div {
  width: 100%;
}

.topbar h1 {
  margin: 6px 0 8px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  letter-spacing: -0.03em;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: #c9c9cb;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.76rem;
  font-weight: 700;
}

.subtitle,
.hint,
.board-hint,
.entry-meta,
.request-meta,
.audit-time,
.modal-meta {
  color: var(--muted);
}

.subtitle {
  margin: 0;
  line-height: 1.65;
  max-width: 72ch;
  margin-inline: auto;
}

.topbar-actions {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: none;
}

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

.badge-accent {
  background: rgba(255, 255, 255, 0.1);
}

.board-shell {
  margin: 8px 0 22px;
  display: grid;
  place-items: center;
  justify-items: center;
}

.board-frame {
  position: relative;
  width: min(100%, 1000px);
  margin: 0 auto;
  aspect-ratio: 1366 / 1600;
  border-radius: 34px;
  overflow: hidden;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.board-surface {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.04), transparent 22%),
    radial-gradient(circle at 50% 64%, rgba(255, 255, 255, 0.03), transparent 24%),
    linear-gradient(180deg, #151515 0%, #0e0e0f 100%);
  overflow: hidden;
}

.board-surface::before,
.board-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(0, 0, 0, 0.55), transparent 24%),
    radial-gradient(circle at 50% 52%, rgba(0, 0, 0, 0.48), transparent 26%),
    radial-gradient(circle at 50% 84%, rgba(0, 0, 0, 0.42), transparent 24%);
  pointer-events: none;
}

.board-ribbon {
  position: absolute;
  z-index: 0;
  opacity: 0.9;
}

.ribbon-a {
  top: 0;
  left: 0;
  width: 100%;
  height: 2.5%;
  background: linear-gradient(90deg, #d80b0b 0 44%, #e5f000 44% 58%, #84ff00 58% 84%, #b58cff 84% 100%);
}

.ribbon-b {
  left: 0;
  top: 0;
  width: 2.5%;
  height: 100%;
  background: linear-gradient(180deg, #d80b0b 0 70%, #2b6cff 70% 100%);
}

.ribbon-c {
  right: 0;
  top: 0;
  width: 2.5%;
  height: 100%;
  background: linear-gradient(180deg, #b58cff 0 74%, #ff4a00 74% 100%);
}

.ribbon-d {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2.5%;
  background: linear-gradient(90deg, #2b6cff 0 34%, #69f5e8 34% 74%, #ff4a00 74% 100%);
}

.board-title {
  position: absolute;
  top: 6%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 82%;
  font-size: clamp(1.9rem, 4.35vw, 4.9rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.board-champion {
  position: absolute;
  left: 50%;
  top: 31%;
  transform: translateX(-50%);
  z-index: 1;
  text-align: center;
  display: grid;
  gap: 2px;
  justify-items: center;
}

.board-champion em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  min-height: 74px;
  margin-top: 10px;
  border-radius: 28px 18px 28px 18px;
  background: rgba(255, 255, 255, 0.52);
  color: #111;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-style: normal;
  font-weight: 900;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.28);
}

.board-trophy {
  position: absolute;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  z-index: 1;
  font-size: clamp(4rem, 8vw, 8rem);
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.32));
}

.board-foot {
  position: absolute;
  left: 50%;
  bottom: 4.5%;
  transform: translateX(-50%);
  z-index: 1;
  font-size: clamp(4rem, 7vw, 7.4rem);
  font-weight: 900;
  letter-spacing: -0.08em;
}

.board-image {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.match-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.board-hotspot {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  border-radius: 14px;
  padding: 0;
  outline: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.board-hotspot.slot {
  border-radius: 12px;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
}

.board-hotspot.node {
  border-radius: 16px;
}

.team-chip {
  display: grid;
  align-items: center;
  justify-content: center;
  justify-items: center;
  gap: 0;
  min-height: 100%;
  width: 100%;
  padding: 0;
  text-align: center;
  font-size: clamp(0.5rem, 0.66vw, 0.78rem);
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.96);
  text-wrap: balance;
  border-radius: inherit;
  overflow: hidden;
}

.team-flag {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3));
}

.team-flag-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}

.team-name {
  display: none;
}

.team-chip-node {
  font-size: clamp(0.52rem, 0.68vw, 0.82rem);
}

.team-chip-node .team-flag {
  width: 100%;
  height: 100%;
}

.team-chip-placeholder {
  font-size: clamp(0.72rem, 1vw, 1rem);
}

.team-chip-empty {
  opacity: 0;
}

.board-hotspot.is-hidden-pick {
  background: rgba(255, 255, 255, 0.015);
  border-color: rgba(255, 255, 255, 0.06);
}

.board-hotspot::after {
  content: none;
  display: none;
}

.board-hotspot:hover,
.board-hotspot:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 12px 26px rgba(0, 0, 0, 0.28);
  transform: scale(1.02);
}

.board-hotspot.selected {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55);
}

.hover-tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(16, 16, 18, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  max-width: min(240px, 55%);
}

.hover-tip.visible {
  opacity: 1;
  transform: translateY(0);
}

.board-hint {
  text-align: center;
  margin-top: 12px;
  font-size: 0.94rem;
}

.board-actions {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.board-actions .btn-secondary {
  width: min(100%, 320px);
}

.controls-grid,
.records-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 16px;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(24, 24, 27, 0.88), rgba(12, 12, 14, 0.96));
  border-radius: 26px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 6px 0 0;
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}

.stacked {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 0.92rem;
}

input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

input::placeholder {
  color: #8f8f95;
}

input:focus {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  border: 0;
  border-radius: 16px;
  padding: 12px 15px;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover,
.btn-danger:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #ffffff, #d0d0d4);
  color: #101012;
  font-weight: 700;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-danger {
  background: rgba(230, 42, 42, 0.12);
  color: #ffd5d5;
  border: 1px solid rgba(255, 94, 94, 0.28);
}

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

.status-box {
  margin: 6px 0 16px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  line-height: 1.7;
}

.admin-only.hidden {
  display: none !important;
}

.request-card,
.audit-card,
.entry-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.request-card,
.audit-card,
.entry-card {
  padding: 16px;
}

.request-card p,
.audit-card p,
.entry-history {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.request-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.entries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.entry-history {
  display: grid;
  gap: 10px;
}

.entry-actions,
.version-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.version-actions {
  justify-content: flex-start;
}

.entry-history article {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  background: linear-gradient(180deg, rgba(20, 20, 22, 0.98), rgba(12, 12, 14, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.modal-meta {
  margin: 0 0 14px;
  line-height: 1.6;
}

.winner-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.winner-choice {
  min-height: 120px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 16px;
  text-align: start;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.winner-choice strong {
  font-size: 1.05rem;
}

.choice-team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.choice-flag {
  display: block;
  width: 58px;
  height: 38px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
}

.champion-flag {
  display: block;
  width: 46px;
  height: 30px;
  object-fit: cover;
  border-radius: 8px;
  margin: 0 auto 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.34);
}

.winner-choice span {
  color: var(--muted);
  font-size: 0.92rem;
}

.winner-choice:hover,
.winner-choice.selected {
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.09);
}

.winner-choice:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.modal-close {
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .winner-choices {
    grid-template-columns: 1fr;
  }

  .board-frame {
    width: min(100%, 940px);
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 14px, 1460px);
    margin-top: 10px;
  }

  .topbar h1 {
    font-size: clamp(1.45rem, 8vw, 2.2rem);
  }

  .board-shell {
    justify-items: start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .board-shell::after {
    content: "Swipe sideways to see the full bracket";
    justify-self: center;
    min-width: min(860px, 100%);
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
  }

  .board-frame {
    width: 860px;
    max-width: none;
    scroll-snap-align: center;
    border-radius: 24px;
  }

  .board-actions,
  .board-hint {
    min-width: 860px;
  }

  .board-actions .btn-secondary {
    width: min(320px, calc(100vw - 32px));
  }

  .controls-grid,
  .records-grid {
    grid-template-columns: 1fr;
  }

  .chip,
  .badge {
    padding: 8px 11px;
  }

  .modal-card {
    border-radius: 22px;
  }

  .board-title {
    top: 6%;
    width: 82%;
    font-size: 3.15rem;
    letter-spacing: -0.05em;
  }

  .board-champion {
    top: 31%;
  }
}
