:root {
  --paper: #e8e8e8;
  --ink: #101010;
  --ink-soft: #5e5e5e;
  --brand: #7f112b;
  --brand-deep: #5f0b20;
  --sky: #2f2f2f;
  --mint: #b8b8b8;
  --card: rgba(246, 246, 246, 0.92);
  --border: rgba(16, 16, 16, 0.12);
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  display: none;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.site-header {
  position: relative;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(232, 232, 232, 0.9);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  justify-content: flex-end;
}

.brand {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 0.55rem;
  row-gap: 0.08rem;
}

.brand-mark {
  grid-row: 1 / span 2;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 50%;
  border: 2px solid #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.05em;
}

.brand-mark span {
  display: block;
}

.brand-title {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
}

.top-nav {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.top-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  padding: 0.34rem 0.58rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.top-nav a:hover {
  background: rgba(127, 17, 43, 0.08);
}

.top-nav a.is-active {
  background: rgba(127, 17, 43, 0.12);
  color: var(--brand);
  border-color: rgba(127, 17, 43, 0.2);
}

.top-nav a.is-locked {
  opacity: 0.62;
}

.top-nav a:focus-visible {
  outline: 2px solid rgba(15, 61, 90, 0.24);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(245, 245, 245, 0.86);
  font-size: 0.82rem;
  font-weight: 700;
}

.lang-switch select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.2rem 0.35rem;
  min-width: 4rem;
}

.staff-access-wrap {
  margin-top: 1.1rem;
  display: flex;
  justify-content: flex-end;
}

.staff-access-link {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.64;
  padding: 0.2rem 0;
}

.staff-access-link:hover,
.staff-access-link:focus-visible {
  opacity: 1;
  color: var(--brand);
  outline: none;
}

.staff-access-link.is-locked {
  opacity: 0.46;
}

.rules-points-table {
  margin-bottom: 1rem;
}

.rules-points-table th:last-child,
.rules-points-table td:last-child {
  text-align: center;
  width: 5.2rem;
  font-weight: 700;
}

.page {
  display: none;
}

.page.page-active {
  display: block;
}

.eyebrow {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  font-weight: 700;
}

h1 {
  margin: 0.45rem 0;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  line-height: 1.15;
}

.home-ranking-shell {
  padding: 1.35rem 0 1.9rem;
  display: grid;
  gap: 0.9rem;
}

.ranking-head {
  border: 1px solid var(--border);
  border-radius: 26px;
  background: rgba(245, 245, 245, 0.92);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr minmax(260px, 0.75fr);
  gap: 0.9rem;
  align-items: center;
}

.ranking-copy .eyebrow {
  color: var(--brand);
}

.ranking-title {
  margin-top: 0.3rem;
}

.ranking-meta {
  display: grid;
  gap: 0.55rem;
}

.hero-copy {
  margin: 0;
  max-width: 56ch;
  color: var(--ink-soft);
}

.hero-mini {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.hero-stats-compact {
  margin-top: 0;
}

.hero-stats article {
  background: rgba(245, 245, 245, 0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem;
}

.hero-stats span {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
}

.hero-stats small {
  color: var(--ink-soft);
  display: block;
  line-height: 1.22;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.panel {
  margin: 1.1rem 0;
  padding: 1.1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: reveal 0.75s ease both;
}

.panel-head h2 {
  margin: 0;
}

.panel-head p {
  margin: 0.35rem 0 1rem;
  color: var(--ink-soft);
}

.panel-head-tight p {
  margin-bottom: 0.55rem;
}

.home-board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.home-board-grid .panel {
  margin: 0;
}

.top3-panel {
  display: grid;
  gap: 0.65rem;
}

.top3-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.top3-list li {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0.62rem 0.72rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.55rem;
  align-items: center;
  font-weight: 600;
}

.top3-rank {
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: rgba(127, 17, 43, 0.14);
  color: var(--brand);
  border: 1px solid rgba(127, 17, 43, 0.24);
}

.concept-grid,
.prize-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.concept-card,
.prize-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.66);
}

.concept-card h3,
.prize-card h3 {
  margin: 0 0 0.38rem;
}

.concept-card p {
  margin: 0;
  color: var(--ink-soft);
}

.prize-list {
  margin: 0;
  padding-left: 1.1rem;
}

.prize-list li {
  margin: 0.24rem 0;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.grid-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.92rem;
}

#resident-code-wrap small {
  margin-top: 0.1rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
}

.field-label {
  display: inline-block;
}

.grid-form label.consent-line {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 500;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.58);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
}

.grid-form label.consent-line input {
  margin-top: 0.2rem;
}

.full-width {
  grid-column: 1 / -1;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.58rem 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(230, 74, 25, 0.3);
  border-color: var(--brand);
}

.hint-box,
.status-box {
  grid-column: 1 / -1;
  border-radius: 12px;
  border: 1px dashed var(--border);
  padding: 0.65rem 0.75rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.55);
}

.status-ok {
  border-color: rgba(67, 160, 71, 0.4);
  background: rgba(67, 160, 71, 0.08);
  color: #2f6c33;
}

.status-error {
  border-color: rgba(211, 47, 47, 0.36);
  background: rgba(211, 47, 47, 0.08);
  color: #8a2d2d;
}

.status-warn {
  border-color: rgba(245, 124, 0, 0.44);
  background: rgba(245, 124, 0, 0.08);
  color: #8f4c05;
}

.actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.btn {
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 0.6rem 0.8rem;
  font-weight: 700;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(100deg, var(--brand) 0%, var(--brand-deep) 100%);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-ghost {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.fixtures-list,
.admin-list {
  display: grid;
  gap: 0.8rem;
}

.fixtures-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.fixtures-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.fixtures-filters label.inline-toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: rgba(255, 255, 255, 0.58);
}

.groups-grid {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.group-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.7rem;
}

.group-card h4 {
  margin: 0 0 0.45rem;
}

.group-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.group-card li {
  margin: 0.2rem 0;
  font-size: 0.9rem;
}

.fixture-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 0.6rem;
}

.fixture-head {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  flex-wrap: wrap;
  align-items: center;
}

.fixture-title {
  font-weight: 700;
}

.admin-key-line {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-section-head {
  margin: 1rem 0 0.6rem;
}

.admin-section-head h3 {
  margin: 0 0 0.3rem;
}

.admin-section-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.admin-prize-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0.7rem 0;
}

.admin-prize-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.admin-prize-grid textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.58rem 0.65rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  resize: vertical;
  min-height: 5.8rem;
}

.admin-prize-grid textarea:focus {
  outline: 2px solid rgba(230, 74, 25, 0.3);
  border-color: var(--brand);
}

#admin-stats-summary {
  margin: 0.45rem 0 0.6rem;
}

#admin-stats-table {
  margin-bottom: 0.8rem;
}

#admin-players-table {
  margin-bottom: 0.8rem;
}

#admin-audit-table {
  margin-bottom: 0.8rem;
}

.admin-btn-danger {
  border-color: rgba(127, 17, 43, 0.35);
  color: var(--brand);
  background: rgba(127, 17, 43, 0.08);
}

.admin-moderation-btn {
  min-width: 7.8rem;
}

.fixture-meta {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.score-inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto auto;
  gap: 0.5rem;
  align-items: center;
}

.score-inputs input {
  width: 100%;
}

.score-inputs .sep {
  font-weight: 700;
  text-align: center;
}

.lock-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  line-height: 1.2;
  padding: 0.2rem 0.45rem;
  min-width: 5.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  text-align: center;
}

.lock-open {
  color: #1b5e20;
  border-color: rgba(27, 94, 32, 0.26);
}

.lock-closed {
  color: #8d2b2b;
  border-color: rgba(141, 43, 43, 0.3);
}

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

.leaderboard-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 240px));
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.leaderboard-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.88rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 330px;
}

th,
td {
  padding: 0.58rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid rgba(20, 32, 56, 0.08);
  font-size: 0.9rem;
}

th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-soft);
  font-weight: 700;
}

tr.me {
  background: rgba(127, 17, 43, 0.12);
}

.site-footer {
  padding: 2.2rem 0 2.6rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .header-actions {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .brand {
    grid-template-columns: auto;
    grid-template-rows: auto auto auto;
    row-gap: 0.18rem;
  }

  .brand-mark {
    grid-row: auto;
  }

  .ranking-head {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .ranking-meta {
    min-width: 0;
  }

  .home-board-grid {
    grid-template-columns: 1fr;
  }

  .grid-form,
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .leaderboard-filters {
    grid-template-columns: 1fr;
  }

  .fixtures-filters {
    grid-template-columns: 1fr;
  }

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

  .concept-grid,
  .prize-grid,
  .admin-prize-grid {
    grid-template-columns: 1fr;
  }

  .score-inputs {
    grid-template-columns: 1fr auto 1fr;
  }

  .score-inputs .score-status {
    grid-column: 1 / -1;
  }
}
