#matchPage .game-board {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 0;
}

#matchPage .match-codex {
  --match-bg: #f6f9ff;
  --match-surface: #ffffff;
  --match-surface-soft: #eaf2fb;
  --match-surface-strong: #dce8f5;
  --match-line: rgba(0, 21, 42, 0.08);
  --match-primary: #00152a;
  --match-secondary: #59636f;
  --match-accent: #ffb77d;
  --match-shadow: 0 18px 36px rgba(13, 31, 68, 0.08);
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100vh - 170px);
  height: calc(100vh - 170px);
  padding: 6px 0 0;
  font-family: "Barlow", sans-serif;
  color: var(--match-primary);
}

#matchPage .match-codex__sidebar,
#matchPage .match-codex__main,
#matchPage .match-codex__players-panel,
#matchPage .match-codex__entry-panel,
#matchPage .match-codex__hero-card {
  min-height: 0;
}

#matchPage .match-codex__sidebar {
  display: flex;
}

#matchPage .match-codex__players-panel {
  width: 100%;
  border-radius: 24px;
  background: rgba(230, 239, 249, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--match-shadow);
  padding: 12px 10px;
  overflow: hidden;
}

#matchPage .match-codex__players {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#matchPage .match-codex__player-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 21, 42, 0.05);
  transition: background 0.2s ease, transform 0.2s ease;
}

#matchPage .match-codex__player-row.is-active {
  background: linear-gradient(180deg, #102a43 0%, #00152a 100%);
  color: #ffffff;
  transform: translateX(2px);
  box-shadow: 0 14px 28px rgba(0, 21, 42, 0.22);
}

#matchPage .match-codex__player-slot {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(0, 21, 42, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#matchPage .match-codex__player-row.is-active .match-codex__player-slot {
  background: rgba(255, 183, 125, 0.2);
  color: var(--match-accent);
}

#matchPage .match-codex__player-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#matchPage .match-codex__player-copy strong,
#matchPage .match-codex__player-score {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

#matchPage .match-codex__player-copy strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#matchPage .match-codex__player-copy span {
  color: var(--match-secondary);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
}

#matchPage .match-codex__player-row.is-active .match-codex__player-copy span {
  color: rgba(255, 255, 255, 0.72);
}

#matchPage .match-codex__player-score {
  font-size: 1.22rem;
}

#matchPage .match-codex__main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  min-width: 0;
}

#matchPage .match-codex__scoreboard {
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 0;
}

#matchPage .match-codex__hero-card {
  width: 100%;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 248, 255, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--match-shadow);
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  padding: 22px 28px 18px;
  text-align: center;
  overflow: hidden;
}

#matchPage .match-codex__hero-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

#matchPage .match-codex__hero-mainline {
  width: min(100%, 920px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 24px;
  align-items: center;
}

#matchPage .match-codex__hero-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#matchPage .match-codex__hero-playername {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--match-secondary);
}

#matchPage .match-codex__hero-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--match-secondary);
}

#matchPage .match-codex__hero-score {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(7rem, 17vw, 12rem);
  line-height: 0.82;
  font-weight: 700;
  letter-spacing: -0.08em;
  color: var(--match-primary);
}

#matchPage .match-codex__checkout {
  width: min(100%, 620px);
  border-radius: 28px;
  background: rgba(220, 232, 245, 0.78);
  border: 1px solid rgba(0, 21, 42, 0.06);
  padding: 18px 22px 22px;
  box-shadow: 0 18px 28px rgba(0, 21, 42, 0.08);
}

#matchPage .match-codex__checkout--inline {
  width: 100%;
  padding: 16px 18px 18px;
  border-radius: 24px;
  margin: 0;
}

#matchPage .match-codex__checkout.hidden {
  display: none;
}

#matchPage .match-codex__checkout-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  background: #102a43;
  color: #ffffff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#matchPage .match-codex__checkout-steps {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
  flex-wrap: wrap;
}

#matchPage .match-codex__checkout--inline .match-codex__checkout-steps {
  gap: 10px;
  margin-top: 12px;
}

#matchPage .match-codex__checkout-step {
  min-width: 112px;
  padding: 18px 20px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 8px 16px rgba(0, 21, 42, 0.08);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.8rem, 2.2vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
  color: var(--match-primary);
}

#matchPage .match-codex__checkout--inline .match-codex__checkout-step {
  min-width: 88px;
  padding: 14px 14px;
  font-size: clamp(1.55rem, 1.8vw, 2.15rem);
}

#matchPage .match-codex__checkout-step.is-final {
  background: var(--match-accent);
  color: #240f00;
}

#matchPage .match-codex__hero-stats {
  width: min(100%, 640px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

#matchPage .match-codex__hero-stats > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

#matchPage .match-codex__hero-stats span {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--match-secondary);
}

#matchPage .match-codex__hero-stats strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--match-primary);
}

#matchPage .match-codex__entry-panel {
  border-radius: 28px;
  background: rgba(236, 245, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: var(--match-shadow);
  padding: 12px 12px 12px;
}

#matchPage .match-codex__form {
  display: grid;
  gap: 10px;
}

#matchPage .match-codex__toolbar {
  display: grid;
  grid-template-columns: 86px 40px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

#matchPage .match-codex__total-card {
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid rgba(0, 21, 42, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 5px 6px;
}

#matchPage .match-codex__total-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--match-secondary);
}

#matchPage .match-codex__total-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2.2rem;
  line-height: 0.9;
  font-weight: 700;
  color: var(--match-primary);
}

#matchPage .match-codex__toolbar-btn {
  border: 0;
  border-radius: 12px;
  background: var(--match-surface-strong);
  color: var(--match-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

#matchPage .match-codex__toolbar-btn:hover {
  background: rgba(255, 218, 214, 0.9);
  color: #ba1a1a;
  transform: translateY(-1px);
}

#matchPage .match-codex__submit.primary-btn {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #00152a 0%, #102a43 100%);
  box-shadow: 0 12px 28px rgba(0, 21, 42, 0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 14px;
}

#matchPage .match-codex__hint {
  display: none !important;
}

#matchPage .match-codex__input-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 10px;
  align-items: stretch;
}

#matchPage .match-codex__keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#matchPage .match-codex__key {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(0, 21, 42, 0.06);
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 21, 42, 0.05);
  color: var(--match-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
}

#matchPage .match-codex__key:hover {
  background: #f8fbff;
}

#matchPage .match-codex__key--clear {
  background: var(--match-surface-strong);
  color: var(--match-secondary);
}

#matchPage .match-codex__key--checkout {
  background: rgba(220, 232, 245, 0.92);
  color: var(--match-primary);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#matchPage .match-codex__key--checkout:disabled {
  opacity: 0.45;
}

#matchPage .match-codex__bust.ghost-btn {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 218, 214, 0.3);
  color: #ba1a1a;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#matchPage .match-codex__quick {
  display: flex;
  min-width: 0;
}

#matchPage .match-codex__quick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
}

#matchPage .match-codex__quick-btn {
  min-height: 38px;
  border-radius: 12px;
  border: 0;
  background: rgba(220, 232, 245, 0.92);
  color: var(--match-primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

#matchPage .match-codex__quick-btn:hover {
  background: #102a43;
  color: #ffffff;
  transform: translateY(-1px);
}

#matchPage .match-codex__quick-btn--accent {
  background: rgba(255, 183, 125, 0.28);
  color: #240f00;
}

#matchPage .match-codex__hidden-actions {
  display: none !important;
}

#matchPage .match-codex__hero-caption,
#matchPage .match-codex__hero-meta,
#matchPage .match-codex__hero-stats > div:last-child {
  display: none !important;
}

@media (max-width: 1180px) {
  #matchPage .match-codex {
    grid-template-columns: 96px minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }

  #matchPage .match-codex__input-grid {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  #matchPage .match-codex__hero-score {
    font-size: clamp(6rem, 15vw, 9rem);
  }

  #matchPage .match-codex__hero-mainline {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    gap: 18px;
  }
}

@media (max-width: 960px) {
  #matchPage .match-codex {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  #matchPage .match-codex__sidebar {
    order: 2;
  }

  #matchPage .match-codex__players-panel {
    padding: 10px;
  }

  #matchPage .match-codex__players {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  #matchPage .match-codex__main {
    order: 1;
  }

  #matchPage .match-codex__hero-mainline {
    grid-template-columns: 1fr;
  }

  #matchPage .match-codex__input-grid {
    grid-template-columns: 1fr;
  }

  #matchPage .match-codex__quick-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
