:root {
  --bg-top: #09111d;
  --bg-mid: #050b13;
  --bg-bottom: #02060b;
  --panel: rgba(10, 16, 26, 0.82);
  --panel-2: rgba(15, 22, 34, 0.9);
  --panel-3: rgba(18, 28, 44, 0.88);
  --text: #f7fbff;
  --muted: #a4afbf;
  --muted-2: #7d899c;
  --orange: #ff7a00;
  --orange-2: #ff9a3d;
  --blue: #00bfff;
  --blue-2: #47d1ff;
  --success: #5ff0b0;
  --danger: #ff6b7d;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.28);
  --glow-blue: 0 0 28px rgba(0, 191, 255, 0.18);
  --glow-orange: 0 0 28px rgba(255, 122, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 122, 0, 0.08), transparent 22%),
    radial-gradient(circle at 50% 10%, rgba(0, 191, 255, 0.08), transparent 30%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 44%, var(--bg-bottom) 100%);
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,0.04), transparent 18%),
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: auto, 100% 120px, 120px 100%;
  opacity: 0.26;
  mix-blend-mode: screen;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.game-card {
  width: min(100%, 1040px);
  padding: 30px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10, 16, 26, 0.92), rgba(7, 12, 20, 0.94));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: pageFadeIn 220ms ease;
}

.site-nav,
.hero-panel,
.chain-board-panel,
.player-chip,
.share-modal {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015)),
    linear-gradient(180deg, rgba(16, 24, 38, 0.94), rgba(8, 13, 22, 0.96));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 16px 18px;
  border-radius: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  text-decoration: none;
}

.brand-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: white;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  box-shadow: 0 14px 28px rgba(255, 122, 0, 0.18), 0 0 20px rgba(0, 191, 255, 0.12);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-link,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.nav-link {
  min-height: 42px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.03em;
  position: relative;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.nav-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--glow-blue);
}

.nav-link:active {
  transform: scale(0.97);
}

.nav-link.is-active {
  background: linear-gradient(135deg, rgba(255, 122, 0, 0.16), rgba(0, 191, 255, 0.14));
  border-color: rgba(255,255,255,0.12);
  box-shadow: inset 0 -2px 0 var(--orange), 0 0 18px rgba(255, 122, 0, 0.14);
}

.hero-panel,
.chain-board-panel {
  border-radius: 16px;
  padding: 26px;
  margin-top: 20px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.hero-panel:hover,
.chain-board-panel:hover,
.player-chip:hover,
.chain-player:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.1);
}

.daily-hero {
  background:
    linear-gradient(180deg, rgba(255, 122, 0, 0.08), rgba(0, 191, 255, 0.06)),
    linear-gradient(180deg, rgba(18, 24, 38, 0.95), rgba(8, 13, 22, 0.97));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34), 0 0 24px rgba(255, 122, 0, 0.08);
}

.hero-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
  font-weight: 900;
}

.subtitle,
.board-subtitle,
.score-challenge,
.player-chip span,
.brand-copy span,
.example-notes,
.daily-date,
.daily-support,
.daily-countdown,
.input-helper-text,
.results-empty {
  color: var(--muted);
}

.intro-lines {
  line-height: 1.72;
  margin: 0;
  max-width: 760px;
}

.example-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.example-label,
.chain-player-label,
.player-chip span {
  margin: 0 0 8px;
  color: var(--muted-2);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.example-chain {
  margin: 0;
  font-weight: 800;
  line-height: 1.6;
}

.example-notes {
  margin: 10px 0 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.daily-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 122, 0, 0.14);
  border: 1px solid rgba(255, 122, 0, 0.24);
  color: #ffd2a8;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.daily-subtitle {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fbfdff;
}

.daily-date {
  margin: 0 0 12px;
  font-size: 0.94rem;
}

.daily-support {
  margin: 12px 0 0;
}

.daily-countdown {
  margin: 10px 0 0;
  color: #ffcf9e;
  font-size: 0.9rem;
}

.hero-action-wrap {
  display: flex;
  align-items: center;
}

button,
.puzzle-action-btn,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 0.98rem;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: transform 180ms ease, filter 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

button:hover,
.puzzle-action-btn:hover,
.primary-btn:hover,
.secondary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:active,
.puzzle-action-btn:active,
.primary-btn:active,
.secondary-btn:active {
  transform: scale(0.97);
}

.primary-btn,
.puzzle-action-btn {
  min-width: 154px;
  color: white;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  box-shadow: 0 14px 28px rgba(255, 122, 0, 0.18), 0 0 22px rgba(0, 191, 255, 0.12);
}

.daily-action-btn {
  box-shadow: 0 14px 28px rgba(255, 122, 0, 0.18), 0 0 20px rgba(0, 191, 255, 0.1);
}

.secondary-btn,
.button-link.secondary-btn {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
}

.challenge-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.player-chip {
  flex: 1;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    linear-gradient(180deg, rgba(16, 24, 38, 0.95), rgba(10, 16, 26, 0.97));
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.player-chip:hover {
  box-shadow: var(--glow-blue), var(--shadow-soft);
}

.player-chip strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.2;
}

.player-chip.accent {
  box-shadow: inset 0 0 0 1px rgba(0,191,255,0.05);
}

.challenge-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.challenge-arrow {
  font-size: 2rem;
  font-weight: 800;
  color: var(--orange-2);
  text-shadow: 0 0 18px rgba(255, 122, 0, 0.22);
}

.difficulty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(0, 191, 255, 0.12);
  border: 1px solid rgba(0, 191, 255, 0.22);
  color: #dff6ff;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02), 0 0 18px rgba(0, 191, 255, 0.08);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.section-header.compact h2,
.results-panel h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
}

.board-subtitle {
  margin: 0;
  line-height: 1.6;
}

.builder-controls-clean {
  display: block;
  margin-top: 18px;
}

.builder-input-wrap input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(4, 10, 18, 0.8);
  color: var(--text);
  padding: 15px 16px;
  font-size: 1rem;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.builder-input-wrap input::placeholder {
  color: rgba(164, 175, 191, 0.66);
}

.builder-input-wrap input:focus {
  border-color: rgba(0, 191, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(0, 191, 255, 0.12), 0 0 20px rgba(255, 122, 0, 0.08);
  background: rgba(5, 11, 20, 0.95);
}

.input-helper-text {
  margin: 8px 4px 0;
  font-size: 0.84rem;
}

.chain-board {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}

.chain-player {
  position: relative;
  min-width: 150px;
  max-width: 220px;
  padding: 16px 18px;
  border-radius: 15px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015)),
    linear-gradient(180deg, rgba(19, 29, 45, 0.96), rgba(10, 16, 26, 0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 28px rgba(0,0,0,0.24);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.chain-player:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--glow-blue), var(--shadow-soft);
}

.chain-player.is-new {
  animation: playerCardIn 220ms ease;
}

.chain-player.error {
  border-color: rgba(255, 107, 125, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 107, 125, 0.08), rgba(255, 107, 125, 0.04)),
    linear-gradient(180deg, rgba(36, 18, 24, 0.96), rgba(20, 10, 14, 0.98));
  box-shadow: 0 12px 26px rgba(255, 107, 125, 0.08);
}

.chain-player strong {
  font-size: 1rem;
  line-height: 1.35;
}

.chain-player-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.08);
  color: var(--text);
  padding: 0;
  font-size: 0.95rem;
}

.chain-connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}

.chain-arrow {
  font-size: 1.62rem;
  color: var(--blue-2);
  text-shadow: 0 0 18px rgba(0, 191, 255, 0.2);
  animation: arrowPulse 2200ms ease-in-out infinite;
}

.chain-team {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.chain-connector.valid .chain-team {
  color: #ddfff1;
  border-color: rgba(95, 240, 176, 0.28);
  background: rgba(95, 240, 176, 0.1);
  box-shadow: 0 0 18px rgba(95, 240, 176, 0.08), 0 0 18px rgba(0, 191, 255, 0.06);
}

.chain-connector.invalid .chain-arrow,
.chain-connector.invalid .chain-team {
  color: #ffd1d7;
}

.chain-connector.invalid .chain-team {
  border-color: rgba(255, 107, 125, 0.28);
  background: rgba(255, 107, 125, 0.1);
  box-shadow: 0 0 18px rgba(255, 107, 125, 0.06);
}

.chain-board.is-celebrating .chain-player,
.chain-board.is-celebrating .chain-connector .chain-team {
  box-shadow: 0 0 0 1px rgba(255, 122, 0, 0.24), 0 0 28px rgba(0, 191, 255, 0.16);
  filter: brightness(1.08);
}

.scoreboard {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  font-weight: 900;
  color: #fff3e4;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.score-pill:first-child {
  background: rgba(255, 122, 0, 0.12);
  border-color: rgba(255, 122, 0, 0.24);
  color: #ffd7b5;
}

.score-pill.accent {
  background: rgba(0, 191, 255, 0.12);
  border-color: rgba(0, 191, 255, 0.22);
  color: #dff7ff;
}

.score-challenge {
  margin-top: 16px;
}

.results-empty {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-message {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-weight: 700;
}

.result-message.success {
  background: rgba(95, 240, 176, 0.12);
  color: #d7ffef;
  border: 1px solid rgba(95, 240, 176, 0.28);
}

.result-message.error {
  background: rgba(255, 107, 125, 0.12);
  color: #ffd7dd;
  border: 1px solid rgba(255, 107, 125, 0.28);
}

.connections-list {
  display: grid;
  gap: 12px;
}

.connection-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.connection-item strong {
  display: block;
  margin-bottom: 8px;
}

.connection-item.valid {
  border-color: rgba(95, 240, 176, 0.24);
  background: rgba(95, 240, 176, 0.07);
}

.connection-item.invalid {
  border-color: rgba(255, 107, 125, 0.24);
  background: rgba(255, 107, 125, 0.07);
}

.connection-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.step-icon {
  margin-left: 6px;
}

.shared-team {
  display: inline-block;
  margin: 4px 8px 0 0;
  background: rgba(0, 191, 255, 0.12);
  color: #dff7ff;
  border: 1px solid rgba(0, 191, 255, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.92rem;
}

.no-team {
  display: inline-block;
  color: #ffd1d7;
  background: rgba(255, 107, 125, 0.12);
  border: 1px solid rgba(255, 107, 125, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.92rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 30;
}

.share-modal {
  position: relative;
  width: min(100%, 540px);
  padding: 30px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48), 0 0 30px rgba(255, 122, 0, 0.08);
  animation: modalIn 220ms ease;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.modal-eyebrow {
  margin-top: 0;
  color: var(--orange-2);
}

.modal-matchup {
  font-size: 1.08rem;
  font-weight: 800;
}

.modal-full-chain {
  font-weight: 800;
  line-height: 1.65;
}

.modal-score-row,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.copy-feedback {
  color: var(--muted);
  min-height: 20px;
  margin-bottom: 0;
}

.is-hidden {
  display: none;
}

.debug-textarea {
  display: none;
}

.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes playerCardIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes arrowPulse {
  0%, 100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .page-shell {
    padding: 18px;
  }

  .game-card {
    padding: 20px;
    border-radius: 16px;
  }

  .site-nav,
  .hero-header-row,
  .challenge-bar,
  .chain-board,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-links,
  .hero-action-wrap {
    width: 100%;
  }

  .nav-links .nav-link,
  .puzzle-action-btn {
    flex: 1;
    width: 100%;
  }

  .challenge-arrow,
  .chain-arrow {
    transform: rotate(90deg);
  }

  .challenge-center {
    order: 2;
  }

  .chain-connector,
  .chain-player {
    width: 100%;
    max-width: none;
  }
}