:root {
  --bg: #0a0f12;
  --panel: #121a1f;
  --panel-2: #172227;
  --line: #26343b;
  --text: #eef4f1;
  --muted: #91a39d;
  --accent: #5ee0a0;
  --accent-2: #66b7ff;
  --warn: #ffcf66;
  --bad: #ff6b7a;
  --good: #59d98e;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 16% 0%, rgba(94, 224, 160, 0.18), transparent 28rem),
    radial-gradient(circle at 78% 12%, rgba(102, 183, 255, 0.14), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(10, 15, 18, 0.84);
  backdrop-filter: blur(18px);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06110d;
  font-weight: 900;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.05;
  margin: 0;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: transparent;
  border-radius: 8px;
  padding: 11px 12px;
  text-align: left;
}

.nav button.active {
  color: var(--text);
  background: #19252b;
}

.content {
  padding: 28px;
  max-width: 1480px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.topbar h2 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.subtle {
  color: var(--muted);
  margin: 7px 0 0;
}

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

.btn {
  background: var(--accent);
  color: #04120c;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 800;
  min-height: 42px;
}

.btn.secondary {
  background: #1a262d;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.danger {
  background: #32181e;
  color: #ffb9c2;
  border: 1px solid #63303a;
}

.btn:disabled,
.input:disabled,
.select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.main {
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, 0.8fr);
  align-items: start;
}

.panel,
.stat,
.row-card {
  border: 1px solid var(--line);
  background: rgba(18, 26, 31, 0.9);
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.panel {
  padding: 18px;
  overflow-x: auto;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.stat {
  padding: 16px;
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat .value {
  font-size: 28px;
  font-weight: 900;
  margin-top: 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1317;
}

.segmented button {
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 800;
}

.segmented button.active {
  color: #04120c;
  background: var(--accent);
}

.input,
.select,
.textarea {
  width: 100%;
  color: var(--text);
  background: #0c1317;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  min-height: 42px;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

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

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leaderboard-scroll-panel {
  overflow: hidden;
}

.leaderboard-scroll {
  max-height: 760px;
  overflow: auto;
  padding-right: 4px;
}

.leaderboard-scroll .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(18, 26, 31, 0.98);
}

.leaderboard-full-panel {
  overflow: hidden;
}

.leaderboard-full-panel .toolbar {
  margin-bottom: 0;
  min-width: min(360px, 100%);
}

.leaderboard-full-scroll {
  overflow: auto;
  max-height: calc(100vh - 230px);
  padding-bottom: 4px;
}

.full-leaderboard-table {
  min-width: 1500px;
}

.full-leaderboard-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(18, 26, 31, 0.98);
}

.full-leaderboard-table th:first-child,
.full-leaderboard-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #10181d;
}

.full-leaderboard-table th:nth-child(2),
.full-leaderboard-table td:nth-child(2) {
  position: sticky;
  left: 78px;
  z-index: 3;
  background: #10181d;
}

.full-leaderboard-table tr.selected td:first-child,
.full-leaderboard-table tr.selected td:nth-child(2),
.full-leaderboard-table tbody tr:hover td:first-child,
.full-leaderboard-table tbody tr:hover td:nth-child(2) {
  background: #17262d;
}

.entry-name-cell {
  min-width: 210px;
  font-weight: 800;
}

.golfer-table-cell {
  position: relative;
  min-width: 150px;
  min-height: 66px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f171b;
  overflow: hidden;
}

.golfer-table-cell.empty {
  min-height: 42px;
  color: var(--muted);
  place-items: center;
}

.golfer-cell-main {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.golfer-cell-main small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.1;
}

.golfer-cell-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.mini-pill {
  position: relative;
  z-index: 1;
  justify-self: start;
  padding: 3px 7px;
  font-size: 11px;
}

.table tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover,
.table tbody tr.selected {
  background: #17262d;
}

.table tbody tr.theoretical {
  background: rgba(94, 224, 160, 0.08);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
  background: #213039;
  color: var(--text);
}

.pill.good {
  background: rgba(89, 217, 142, 0.14);
  color: #8af0b0;
}

.pill.perfect {
  background: rgba(102, 183, 255, 0.18);
  color: #a8d7ff;
}

.pill.warn {
  background: rgba(255, 207, 102, 0.14);
  color: #ffe09a;
}

.pill.bad {
  background: rgba(255, 107, 122, 0.14);
  color: #ff9aa5;
}

.entry-detail {
  position: sticky;
  top: 22px;
}

.entry-detail.compact-detail {
  max-height: none;
  overflow: visible;
}

.pick-list {
  display: grid;
  gap: 10px;
}

.pick-inputs {
  display: grid;
  gap: 8px;
}

.edit-lookup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.pick {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px;
  background: #0f171b;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.pick.leverage-pick {
  border-color: rgba(94, 224, 160, calc(0.18 + var(--leverage) * 0.72));
  background:
    linear-gradient(#0f171b, #0f171b) padding-box,
    linear-gradient(
      135deg,
      rgba(94, 224, 160, calc(0.14 + var(--leverage) * 0.72)),
      rgba(94, 224, 160, calc(0.03 + var(--leverage) * 0.22)),
      rgba(94, 224, 160, calc(0.18 + var(--leverage) * 0.62))
    ) border-box;
  box-shadow: 0 0 calc(var(--leverage) * 22px) rgba(94, 224, 160, calc(var(--leverage) * 0.16));
}

.pick > div {
  position: relative;
  z-index: 1;
}

.pick strong {
  display: block;
}

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

.pick-trend {
  position: absolute;
  inset: 7px 8px;
  width: calc(100% - 16px);
  height: calc(100% - 14px);
  opacity: 0.24;
  pointer-events: none;
  z-index: 0;
}

.pick-trend path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pick-trend.good-trend path {
  stroke: var(--good);
}

.pick-trend.bad-trend path {
  stroke: var(--bad);
}

.pga-table tbody tr {
  cursor: pointer;
}

.pga-detail {
  max-height: 650px;
  overflow: auto;
}

.entry-chip-list {
  display: grid;
  gap: 8px;
}

.entry-chip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f171b;
  padding: 10px;
}

.entry-chip span {
  color: var(--muted);
}

.bar {
  height: 9px;
  background: #0c1317;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.exposure-row {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

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

.field label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.group-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.group-builder {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.5fr);
  gap: 16px;
  align-items: start;
}

.ranked-pool {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 18px;
}

.ranked-list {
  display: grid;
  gap: 8px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.golfer-chip,
.group-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  background: #0f171b;
  border-radius: 8px;
  padding: 10px;
}

.golfer-chip {
  cursor: grab;
}

.golfer-chip strong,
.group-player span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.golfer-chip small,
.group-player small {
  color: var(--muted);
}

.chip-actions {
  display: grid;
  grid-template-columns: 72px auto;
  gap: 8px;
}

.chip-actions .select {
  min-width: 72px;
}

.group-drop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.group-drop {
  min-height: 180px;
  border: 1px dashed rgba(145, 163, 157, 0.38);
  background: rgba(15, 23, 27, 0.72);
  border-radius: 8px;
  padding: 12px;
}

.group-drop-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}

.group-player {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 8px;
}

.mini-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.mini-actions button {
  color: var(--muted);
  background: #18242a;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 7px;
  font-size: 12px;
  font-weight: 800;
}

.notice {
  border: 1px solid var(--line);
  background: #10191e;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--muted);
}

.instructions-panel.compact {
  box-shadow: none;
  background: transparent;
  border: 0;
  padding: 0;
  overflow: visible;
}

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

.instruction-section {
  background: #0f171b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.instruction-section h4 {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.instruction-section ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.instruction-section li {
  margin: 0 0 8px;
  line-height: 1.42;
}

.instruction-section li:last-child {
  margin-bottom: 0;
}

.instructions-dropdown {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c1317;
  margin-bottom: 16px;
}

.instructions-dropdown summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
  padding: 12px 14px;
}

.instructions-dropdown[open] {
  padding-bottom: 14px;
}

.instructions-dropdown .instructions-panel {
  padding: 0 14px;
}

.admin-gate {
  max-width: 520px;
}

.admin-login {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.movement-panel {
  overflow: hidden;
}

.movement-chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-grid {
  stroke: rgba(145, 163, 157, 0.16);
  stroke-width: 1;
}

.chart-label,
.chart-entry-label {
  fill: var(--muted);
  font-size: 12px;
}

.chart-entry-label {
  fill: var(--accent);
  font-weight: 800;
}

.movement-line {
  cursor: pointer;
}

.movement-line path {
  fill: none;
  stroke: rgba(145, 163, 157, 0.28);
  stroke-width: 2;
}

.movement-line circle {
  fill: rgba(145, 163, 157, 0.72);
}

.movement-line.selected path {
  stroke: var(--accent);
  stroke-width: 4;
}

.movement-line.selected circle {
  fill: var(--accent);
}

.movement-legend {
  border: 1px solid var(--line);
  background: rgba(15, 23, 27, 0.72);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 260px;
}

.movement-legend strong,
.movement-legend > span {
  display: block;
}

.movement-legend > span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.movement-change-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.movement-change-list span {
  border-radius: 999px;
  padding: 3px 7px;
  background: #0c1317;
  font-size: 12px;
  font-weight: 800;
}

.movement-legend .good-change {
  color: var(--good);
}

.movement-legend .bad-change {
  color: var(--bad);
}

.error {
  color: #ff9aa5;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 12px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav button {
    flex: 0 0 auto;
    min-height: 42px;
    white-space: nowrap;
  }

  .content {
    padding: 16px;
  }

  .grid.stats,
  .grid.main,
  .form-grid,
  .group-editor,
  .group-builder,
  .group-drop-grid,
  .edit-lookup,
  .instruction-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 28px;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-detail {
    position: static;
  }

  .entry-detail.compact-detail,
  .leaderboard-scroll {
    max-height: 700px;
  }

  .ranked-pool {
    position: static;
  }

  .stat .value {
    font-size: 23px;
  }

}

@media (max-width: 560px) {
  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .panel,
  .stat {
    padding: 14px;
  }

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

  .actions,
  .toolbar {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
