* { box-sizing: border-box; }

:root {
  --bg: #080a0d;
  --surface: #10141b;
  --surface-2: #151b24;
  --line: #293342;
  --text: #f6f8fb;
  --muted: #92a1b3;
  --green: #19f28f;
  --green-soft: rgba(25, 242, 143, 0.16);
  --blue: #48a8ff;
  --coral: #ff4d6d;
  --yellow: #ffd166;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(25, 242, 143, 0.08), transparent 260px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 14px),
    var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 49.8%, rgba(255, 255, 255, 0.06) 50%, transparent 50.2%),
    linear-gradient(180deg, transparent 0 68%, rgba(255, 255, 255, 0.04) 68.2%, transparent 68.4%);
  opacity: 0.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10000;
  padding: 0.75rem 0.9rem;
  color: #07100c;
  background: var(--green);
  border-radius: 8px;
  font-weight: 900;
  text-decoration: none;
  transform: translateY(-140%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

main {
  position: relative;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.15rem;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.35rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 18px rgba(25, 242, 143, 0.65);
}

h1 {
  margin: 0;
  font-size: 5rem;
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lede {
  max-width: 620px;
  color: var(--muted);
  margin: 0.75rem 0 0;
  font-size: 1.02rem;
  line-height: 1.45;
}

.score-strip {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}

.score-strip > div {
  min-width: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 20, 27, 0.82);
  box-shadow: var(--shadow);
  padding: 0.75rem 0.85rem;
}

.score-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.score-strip strong {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.98rem;
}

#game {
  display: grid;
  gap: 1rem;
}

.account-panel {
  padding: 0.85rem;
  background: rgba(16, 20, 27, 0.72);
  border: 1px solid rgba(25, 242, 143, 0.24);
  border-radius: 8px;
}

.account-toggle {
  display: none;
}

.account-content {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 0.55fr) minmax(260px, 1fr);
  gap: 0.75rem;
  align-items: stretch;
}

.account-form {
  display: grid;
  gap: 0.45rem;
}

.account-form label,
.player-score span,
.leaderboard-title {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.account-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

.account-entry input {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.75rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
}

.account-entry input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(25, 242, 143, 0.14);
}

.account-entry button {
  min-height: 46px;
  padding: 0.65rem 0.9rem;
  box-shadow: none;
}

.player-score {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  align-content: center;
  padding: 0.75rem;
  background: rgba(8, 10, 13, 0.5);
  border: 1px solid rgba(246, 248, 251, 0.1);
  border-radius: 8px;
}

.player-score strong {
  color: var(--text);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.leaderboard {
  min-width: 0;
  padding: 0.75rem;
  background: rgba(8, 10, 13, 0.5);
  border: 1px solid rgba(246, 248, 251, 0.1);
  border-radius: 8px;
}

.leaderboard ol {
  display: grid;
  gap: 0.32rem;
  margin: 0.45rem 0 0;
  padding: 0;
  list-style: none;
}

.leaderboard li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  color: #d7e0ea;
  font-size: 0.9rem;
}

.leaderboard li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard li strong {
  color: var(--green);
}

.config {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.85rem;
  background: rgba(16, 20, 27, 0.72);
  border: 1px solid rgba(72, 168, 255, 0.28);
  border-radius: 8px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.config label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}

.config select {
  appearance: none;
  min-width: 210px;
  min-height: 46px;
  padding: 0.62rem 2rem 0.62rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  background:
    linear-gradient(45deg, transparent 50%, var(--green) 50%) right 0.85rem top 49% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--green) 50%, transparent 50%) right 0.55rem top 49% / 7px 7px no-repeat,
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.config select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(25, 242, 143, 0.16);
}

.club-filter {
  flex: 1 1 320px;
}

.club-picker {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 0.45rem;
  min-width: min(360px, 100%);
}

.selected-club-crest {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.selected-club-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.club-picker input {
  width: 100%;
  min-height: 44px;
  padding: 0.62rem 0.75rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
}

.club-picker input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(25, 242, 143, 0.14);
}

#clear-club {
  min-height: 44px;
  height: 44px;
  padding: 0;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 77, 109, 0.12);
  border-color: rgba(255, 77, 109, 0.32);
  box-shadow: none;
  font-size: 1.1rem;
}

.club-dropdown {
  position: absolute;
  z-index: 1100;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #0d1118;
  border: 1px solid rgba(25, 242, 143, 0.36);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.club-dropdown:empty {
  display: none;
}

.club-dropdown li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
}

.club-dropdown li:hover,
.club-dropdown li.active {
  background: rgba(25, 242, 143, 0.12);
}

.club-crest {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(246, 248, 251, 0.08);
}

.club-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.club-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.club-count {
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 900;
}

.board {
  position: relative;
  min-height: 254px;
  overflow: visible;
  border: 1px solid rgba(25, 242, 143, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(17, 111, 68, 0.72), rgba(14, 82, 58, 0.78)),
    #0d5038;
  box-shadow: var(--shadow);
}

.board-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 8px;
}

.board-lines::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 5px;
}

.board-lines::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 104px 0 40px rgba(255, 255, 255, 0.04);
  transform: translateX(-1px);
}

.chain {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0.7rem;
  min-height: 254px;
  padding: 1.25rem;
  overflow: visible;
}

.chain-row {
  display: grid;
  gap: 0.7rem;
  align-items: center;
}

.chain-row.cols-3 {
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr) 46px minmax(0, 1fr);
}

.chain-row.cols-2 {
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
}

.chain-row.cols-1 {
  grid-template-columns: minmax(0, 1fr);
}

.loading {
  width: 100%;
  text-align: center;
  color: var(--text);
  font-weight: 700;
}

.player {
  position: relative;
  z-index: 2;
  width: 100%;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.88rem;
  color: var(--text);
  background: rgba(8, 10, 13, 0.88);
  border: 1px solid rgba(246, 248, 251, 0.16);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.player:focus-within {
  z-index: 40;
}

.player.fixed {
  border-color: rgba(255, 209, 102, 0.55);
}

.player.fixed.start {
  box-shadow: inset 4px 0 0 var(--yellow), 0 12px 26px rgba(0, 0, 0, 0.28);
}

.player.fixed.end {
  box-shadow: inset 4px 0 0 var(--coral), 0 12px 26px rgba(0, 0, 0, 0.28);
}

.player.slot {
  border-style: dashed;
  border-color: rgba(246, 248, 251, 0.26);
  background: rgba(8, 10, 13, 0.66);
}

.player.slot:not(.filled) {
  display: block;
}

.player.slot:not(.filled) .player-label {
  margin-bottom: 0.52rem;
}

.player.slot.filled {
  border-style: solid;
  border-color: rgba(25, 242, 143, 0.74);
  background: rgba(11, 22, 18, 0.94);
  box-shadow: 0 0 0 1px rgba(25, 242, 143, 0.12), 0 14px 30px rgba(0, 0, 0, 0.32);
  padding-bottom: 2.2rem;
}

.player-badge-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.player-badge {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--green); /* default; overridden inline with hashed gradient */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -10px 28px rgba(0, 0, 0, 0.42),
    0 14px 30px rgba(0, 0, 0, 0.44);
}

.badge-initials {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.96);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.player-badge.has-photo {
  background: #0d1118;
  border: 2px solid rgba(25, 242, 143, 0.78);
}

.player-badge.has-photo .badge-initials {
  display: none;
}

.player-badge img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge-flag {
  position: absolute;
  bottom: 0;
  right: 0;
  z-index: 5;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: 50%;
  background: rgba(8, 10, 13, 0.92);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.55),
    0 0 0 2px rgba(8, 10, 13, 0.92),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.badge-flag:empty {
  display: none;
}

.player-copy {
  min-width: 0;
}

.player-label {
  margin-bottom: 0.22rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.player-name {
  font-size: 1.02rem;
  line-height: 1.18;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.slot-input {
  width: 100%;
  min-height: 46px;
  padding: 0.8rem 0.82rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(246, 248, 251, 0.16);
  border-radius: 7px;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
}

.slot-entry {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 40px 40px;
  gap: 0.45rem;
  align-items: center;
}

.degree-control {
  min-height: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.24);
}

.degree-control.add {
  color: #07100c;
  background: var(--green);
  border-color: var(--green);
}

.degree-control.remove {
  color: var(--text);
  background: rgba(255, 77, 109, 0.18);
  border-color: rgba(255, 77, 109, 0.46);
}

.degree-control:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.slot-card-controls {
  position: absolute;
  right: 0.5rem;
  bottom: 0.45rem;
  display: flex;
  gap: 0.35rem;
}

.slot-card-controls .degree-control {
  width: 40px;
  min-height: 40px;
  height: 40px;
  font-size: 1rem;
  border-radius: 7px;
  box-shadow: none;
}

.slot-input::placeholder { color: rgba(246, 248, 251, 0.48); }
.slot-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(25, 242, 143, 0.16);
}

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1000;
  max-height: 250px;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: #0d1118;
  border: 1px solid rgba(25, 242, 143, 0.36);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dropdown:empty { display: none; }

.dropdown li {
  min-height: 44px;
  padding: 0.72rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.93rem;
  font-weight: 800;
}

.dropdown li:hover,
.dropdown li.active {
  color: #07100c;
  background: var(--green);
}

.clear {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(246, 248, 251, 0.14);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  box-shadow: none;
  text-transform: none;
}

.clear:hover {
  color: #fff;
  background: var(--coral);
  border-color: var(--coral);
}

.arrow {
  position: relative;
  width: 46px;
  height: 54px;
  background: none;
  box-shadow: none;
}

.arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-top: 5px solid rgba(246, 248, 251, 0.56);
  border-right: 5px solid rgba(246, 248, 251, 0.56);
  transform: translateY(-50%) rotate(45deg);
  filter: drop-shadow(0 0 8px rgba(25, 242, 143, 0.2));
}

.arrow::after {
  left: 12px;
}

.arrow.valid::after,
.row-turn.valid::after {
  border-top-color: var(--green);
  border-right-color: var(--green);
  border-bottom-color: var(--green);
  filter: drop-shadow(0 0 14px rgba(25, 242, 143, 0.7));
}

.arrow.broken::after,
.row-turn.broken::after {
  border-top-color: var(--coral);
  border-right-color: var(--coral);
  border-bottom-color: var(--coral);
  filter: drop-shadow(0 0 14px rgba(255, 77, 109, 0.7));
}

.row-turn {
  position: relative;
  justify-self: center;
  width: 120px;
  height: 38px;
  margin: -0.1rem 0;
}

.row-turn::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 18px;
  height: 18px;
  border-right: 5px solid rgba(246, 248, 251, 0.48);
  border-bottom: 5px solid rgba(246, 248, 251, 0.48);
  transform: rotate(45deg);
  filter: drop-shadow(0 0 8px rgba(25, 242, 143, 0.22));
}

.row-turn::after {
  left: 51px;
  border-color: rgba(25, 242, 143, 0.62);
}

.actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.75rem;
}

button {
  min-height: 48px;
  padding: 0.75rem 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.26);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

button:hover {
  transform: translateY(-2px);
  border-color: rgba(246, 248, 251, 0.28);
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.26);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

button.primary {
  color: #07100c;
  background: var(--green);
  border-color: var(--green);
}

button.secondary {
  color: var(--yellow);
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.32);
}

.player-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.player-info:empty { display: none; }

.info-card {
  min-width: 0;
  background: rgba(16, 20, 27, 0.84);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.95rem;
}

.info-header {
  margin-bottom: 0.55rem;
  color: var(--text);
  font-size: 1.02rem;
  font-weight: 900;
}

.info-body {
  color: #cbd6e3;
  font-size: 0.92rem;
  line-height: 1.5;
}

.info-body p { margin: 0 0 0.55rem; }

.info-thumb {
  float: right;
  width: 82px;
  height: 82px;
  object-fit: cover;
  margin: 0 0 0.6rem 0.75rem;
  border: 2px solid rgba(246, 248, 251, 0.16);
  border-radius: 8px;
}

.info-link {
  display: inline-flex;
  margin-top: 0.25rem;
  color: var(--green);
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
}

.info-link:hover { text-decoration: underline; }

.full-bio {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}

.full-bio > summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 900;
  list-style: none;
  user-select: none;
}

.full-bio > summary::before {
  content: "+ ";
}

.full-bio[open] > summary::before {
  content: "- ";
}

.full-bio > summary::-webkit-details-marker { display: none; }

.bio-content {
  max-height: 58vh;
  overflow-y: auto;
  margin-top: 0.65rem;
  padding-right: 0.4rem;
  font-size: 0.88rem;
  line-height: 1.55;
}

.bio-content p { margin: 0 0 0.55rem; }

.bio-content h3,
.bio-content h4,
.bio-content h5,
.bio-content h6 {
  margin: 0.9rem 0 0.4rem;
  color: var(--text);
}

.bio-content h3 { font-size: 1rem; }
.bio-content h4,
.bio-content h5,
.bio-content h6 {
  color: var(--muted);
  font-size: 0.88rem;
}

#result {
  min-height: 0;
}

#result h2 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  letter-spacing: 0;
}

#result p {
  margin: 0.35rem 0;
}

.good,
.bad {
  border-radius: 8px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.good {
  color: var(--text);
  background: rgba(7, 30, 21, 0.9);
  border: 1px solid rgba(25, 242, 143, 0.48);
}

.good h2 { color: var(--green); }

.bad {
  color: var(--text);
  background: rgba(36, 12, 18, 0.9);
  border: 1px solid rgba(255, 77, 109, 0.48);
}

.bad h2 { color: var(--coral); }

.connection-hints {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(246, 248, 251, 0.14);
}

.connection-hints h3 {
  margin: 0 0 0.5rem;
  color: var(--yellow);
  font-size: 0.95rem;
  font-weight: 800;
}

.connection-hints ul {
  margin: 0;
  padding-left: 1.1rem;
}

.connection-hints li {
  margin: 0.45rem 0;
  color: #d7e0ea;
  list-style: none;
}

.connection-hints ul {
  padding-left: 0;
}

.hint-role {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  margin-right: 0.35rem;
  border-radius: 4px;
  background: rgba(72, 168, 255, 0.18);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.score-delta {
  display: inline-flex;
  margin-top: 0.45rem;
  padding: 0.35rem 0.55rem;
  border-radius: 7px;
  font-weight: 900;
}

.score-delta.win {
  color: #07100c;
  background: var(--green);
}

.score-delta.loss {
  color: #fff;
  background: var(--coral);
}

.err {
  color: var(--coral);
  font-weight: 800;
}

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

@media (max-width: 980px) {
  h1 {
    font-size: 3.8rem;
  }

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

  .score-strip {
    width: 100%;
  }

  .score-strip > div {
    flex: 1;
  }

  .account-content {
    grid-template-columns: 1fr;
  }

  .player-info {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(180deg, rgba(25, 242, 143, 0.08), transparent 220px),
      var(--bg);
  }

  body::before {
    opacity: 0.18;
  }

  main {
    padding: 1rem 0.7rem calc(7rem + env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 2.65rem;
    line-height: 0.95;
  }

  .lede {
    font-size: 0.98rem;
  }

  .score-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .score-strip > div {
    min-width: 0;
    padding: 0.62rem;
  }

  .score-strip span {
    font-size: 0.66rem;
  }

  .score-strip strong {
    font-size: 0.86rem;
    overflow-wrap: anywhere;
  }

  .account-panel,
  .config {
    padding: 0.7rem;
  }

  .account-toggle {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.72rem 0.85rem;
    color: var(--text);
    background: rgba(8, 10, 13, 0.58);
    border: 1px solid rgba(246, 248, 251, 0.12);
    border-radius: 8px;
    box-shadow: none;
    text-transform: none;
  }

  .account-toggle:hover {
    transform: none;
  }

  .account-toggle span {
    font-weight: 900;
  }

  .account-toggle strong {
    color: var(--green);
    font-size: 0.82rem;
    text-transform: uppercase;
  }

  .account-toggle::after {
    content: "";
    width: 0.65rem;
    height: 0.65rem;
    border-right: 3px solid var(--green);
    border-bottom: 3px solid var(--green);
    transform: rotate(45deg);
    transition: transform 0.16s ease;
  }

  .account-panel:not(.account-collapsed) .account-toggle::after {
    transform: rotate(225deg);
  }

  .account-content {
    padding-top: 0.75rem;
  }

  .account-panel.account-collapsed .account-content {
    display: none;
  }

  .leaderboard ol {
    grid-template-columns: 1fr;
    max-height: 132px;
    overflow-y: auto;
    padding-right: 0.2rem;
  }

  .config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .config-row,
  .club-filter {
    width: 100%;
    flex: initial;
    align-items: stretch;
    flex-direction: column;
  }

  .config label {
    white-space: normal;
  }

  .config select,
  .club-picker {
    width: 100%;
    min-width: 0;
  }

  .club-filter {
    grid-column: 1 / -1;
  }

  .board {
    min-height: 0;
    border-color: rgba(25, 242, 143, 0.25);
    background:
      linear-gradient(180deg, rgba(14, 82, 58, 0.9), rgba(9, 55, 40, 0.92)),
      #0d5038;
  }

  .board-lines {
    opacity: 0.38;
  }

  .chain {
    gap: 0.5rem;
    min-height: 0;
    padding: 0.75rem;
  }

  .chain-row {
    gap: 0.5rem;
  }

  .chain-row.cols-1 {
    display: block;
  }

  .row-turn {
    width: 100%;
    height: 26px;
    margin: -0.05rem 0;
  }

  .row-turn::after {
    left: 50%;
    top: 0;
    width: 14px;
    height: 14px;
    border-right-width: 4px;
    border-bottom-width: 4px;
    transform: translateX(-50%) rotate(45deg);
  }

  .player {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 0.75rem;
    min-height: 112px;
    padding: 0.72rem;
  }

  .player.fixed.start,
  .player.fixed.end {
    box-shadow: inset 3px 0 0 var(--yellow), 0 8px 20px rgba(0, 0, 0, 0.26);
  }

  .player.fixed.end {
    box-shadow: inset 3px 0 0 var(--coral), 0 8px 20px rgba(0, 0, 0, 0.26);
  }

  .player-badge-wrap {
    width: 86px;
    height: 86px;
  }

  .badge-initials {
    font-size: 1.45rem;
  }

  .badge-flag {
    width: 26px;
    height: 26px;
    font-size: 0.82rem;
  }

  .player-label {
    font-size: 0.68rem;
  }

  .player-name {
    font-size: 1rem;
  }

  .player.slot.filled {
    padding-bottom: 3.15rem;
  }

  .slot-entry {
    grid-template-columns: minmax(0, 1fr) 46px 46px;
    gap: 0.45rem;
  }

  .slot-card-controls {
    right: 0.72rem;
    bottom: 0.62rem;
  }

  .slot-card-controls .degree-control {
    width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .dropdown,
  .club-dropdown {
    max-height: min(320px, 56vh);
  }

  .actions {
    position: sticky;
    bottom: 0;
    z-index: 1200;
    grid-template-columns: 1.15fr 0.85fr;
    margin: 0 -0.7rem;
    padding: 0.7rem 0.7rem calc(0.7rem + env(safe-area-inset-bottom));
    background: rgba(8, 10, 13, 0.96);
    border-top: 1px solid rgba(246, 248, 251, 0.12);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.34);
  }

  .actions button {
    min-height: 54px;
    padding-inline: 0.65rem;
    font-size: 0.86rem;
  }

  .info-card {
    padding: 0.82rem;
  }

  .info-thumb {
    width: 72px;
    height: 72px;
  }

  .good,
  .bad {
    padding: 0.9rem;
  }
}

@media (max-width: 440px) {
  main {
    padding-inline: 0.55rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  .score-strip {
    gap: 0.4rem;
  }

  .score-strip > div {
    padding: 0.55rem 0.45rem;
  }

  .score-strip strong {
    font-size: 0.78rem;
  }

  .account-entry {
    grid-template-columns: 1fr;
  }

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

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

  .player {
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 102px;
  }

  .player-badge-wrap {
    width: 74px;
    height: 74px;
  }

  .slot-entry {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
  }

  .player.slot:not(.filled) {
    min-height: 116px;
  }

  .actions {
    margin-inline: -0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
