:root {
  --bg: #f3f0e7;
  --panel: #fffef9;
  --ink: #12213a;
  --accent: #006747;
  --accent-soft: #d9efe5;
  --muted: #5f6c7a;
  --line: #d8d2c4;
  --disabled: #b9bcc4;
  --warn: #c81d25;
  --listed-width: minmax(28rem, 1fr);
  --rosters-width: 20rem;
  --top-row-height: auto;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 90% 10%, #fef9e8 0%, transparent 38%),
    radial-gradient(circle at 10% 80%, #e9f4ff 0%, transparent 42%),
    var(--bg);
  color: var(--ink);
}

.auth-shell,
.home-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card,
.home-card {
  width: min(25rem, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(16, 27, 44, 0.08);
}

.home-page {
  width: 100%;
  min-height: calc(100vh - 2rem);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 8px 24px rgba(16, 27, 44, 0.08);
}

#home-screen {
  display: block;
}

.auth-card h1,
.home-card h1 {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

.home-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.home-topbar h1 {
  margin-bottom: 0;
}

.home-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.home-message {
  min-height: 1.1rem;
  margin: 0.5rem 0 0.4rem;
  font-size: 0.82rem;
  color: #4b5c73;
}

.home-user {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #3b4c67;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 35, 0.45);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  width: min(28rem, 92vw);
  background: #fff;
  border-radius: 14px;
  border: 1px solid #d6deea;
  box-shadow: 0 18px 50px rgba(15, 24, 38, 0.25);
  padding: 1rem 1.2rem 1.1rem;
  display: grid;
  gap: 0.8rem;
  z-index: 1;
}

.modal-card.scrollable {
  height: 75vh;
  overflow: auto;
  align-content: start;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.icon-btn {
  border: 1px solid #cad5e2;
  background: #f7f9fc;
  color: #2b3c52;
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.modal-form {
  display: grid;
  gap: 0.7rem;
}

.modal-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #374761;
}

.modal-form label.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-form label.checkbox-row input {
  width: 1rem;
  height: 1rem;
  accent-color: #2a6fb3;
}

.modal-form input {
  border: 1px solid #c9d3e0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.modal-message {
  margin: 0;
  font-size: 0.8rem;
  color: #9a2b2b;
  min-height: 1rem;
}

.league-list {
  display: grid;
  gap: 0.5rem;
}

.league-section {
  display: grid;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.league-section + .league-section {
  border-top: 1px dashed #d5ddeb;
  padding-top: 0.9rem;
  margin-top: 0.5rem;
}

.league-section-title {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #4a5a74;
}

.league-section-list {
  display: grid;
  gap: 0.5rem;
}

.league-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.league-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid #d7dfec;
  border-radius: 9px;
  background: #fafcff;
  padding: 0.6rem;
}

.league-name {
  font-weight: 700;
  color: #1c2c47;
}

.league-owners {
  font-weight: 600;
  font-size: 0.72rem;
  color: #6a778b;
  margin-left: 0.35rem;
}

.commissioner-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  margin-left: 0.4rem;
  border-radius: 999px;
  background: #c81d25;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.league-status {
  font-size: 0.78rem;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  border: 1px solid #b9c6da;
  background: #edf3ff;
  color: #3b4c67;
}

.league-status.started {
  border-color: #a9ccb8;
  background: #e8f8ee;
  color: #24553a;
}

.league-action {
  border: 1px solid #0d5f44;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 0.42rem 0.68rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.82rem;
}

.league-action.view {
  border-color: #3d5276;
  background: #4a6188;
}

.league-action.invite {
  border-color: #8f6c2b;
  background: #b8862b;
}

.league-action.invite.code-shown {
  background: #6b6f7a;
  border-color: #505864;
}

.league-action.commish {
  border-color: #8b1e25;
  background: #c81d25;
}

.league-modal-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  z-index: 30;
}

.league-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 18, 33, 0.5);
  backdrop-filter: blur(2px);
}

.league-view-card {
  position: relative;
  width: 95vw;
  height: 95vh;
  background: #fff;
  border: 1px solid #d2d9e6;
  border-radius: 16px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 22px 55px rgba(14, 23, 38, 0.3);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.9rem;
  z-index: 1;
}

.league-view-header {
  display: grid;
  gap: 0.35rem;
}

.league-view-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.league-view-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.join-team-field.hidden {
  display: none;
}

.invite-code-display {
  border: 1px dashed #c8d3e3;
  background: #f7faff;
  border-radius: 10px;
  padding: 0.8rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.18rem;
  color: #1d2d4b;
}

.commish-sections {
  display: grid;
  gap: 0.7rem;
}

.commish-section {
  border: 1px solid #d8e0ee;
  border-radius: 10px;
  background: #f9fbff;
  padding: 0.4rem 0.6rem;
}

.commish-section summary {
  cursor: pointer;
  font-weight: 700;
  color: #233751;
  list-style: none;
  padding: 0.3rem 0.2rem;
}

.commish-section summary::-webkit-details-marker {
  display: none;
}

.commish-section summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.commish-section[open] summary::before {
  transform: rotate(90deg);
}

.commish-warning {
  display: grid;
  gap: 0.6rem;
  padding: 0.4rem 0.2rem 0.2rem;
  color: #5b2230;
}

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

.score-input {
  width: 4.5rem;
  text-align: right;
  padding: 0.25rem 0.4rem;
  border: 1px solid #c9d3e0;
  border-radius: 6px;
  font-size: 0.86rem;
}

.score-changes {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: #9a2b2b;
}

.score-change-line {
  display: inline;
}

.score-old {
  color: #7b2b2b;
  font-weight: 700;
}

.score-new {
  color: #1f4f7a;
  font-weight: 700;
}

.league-table-wrap {
  overflow: auto;
  border: 1px solid #dde4ef;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.4rem;
}

.league-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  table-layout: fixed;
}

.league-table th,
.league-table td {
  border-bottom: 1px solid #e2e8f2;
  padding: 0.55rem 0.6rem;
  text-align: left;
}

.league-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #4d5c72;
  background: #f1f5fb;
}

.league-table tbody tr.standings-row {
  cursor: pointer;
}

.league-table tbody tr.roster-row {
  cursor: default;
}

.league-table tbody tr.standings-row:hover {
  background: #f7faff;
  outline: 1px solid #c8d6ea;
  outline-offset: -2px;
}

.league-table .points-cell {
  font-weight: 700;
  color: #1b365a;
}

.league-table .pts-col {
  text-align: right;
  white-space: nowrap;
}

.league-table .remaining-col {
  text-align: center;
  width: 6.5rem;
  font-weight: 700;
  color: #2a3c58;
}

.league-table col.team-col {
  width: auto;
}

.league-table col.remaining-col {
  width: 6.5rem;
}

.league-table col.pts-col {
  width: 7.5rem;
}

.league-table .roster-toggle {
  border: none;
  background: transparent;
  color: #2a3c58;
  border-radius: 6px;
  padding: 0.1rem 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  margin-right: 0.35rem;
  line-height: 1;
}

.league-table .roster-toggle.open .roster-arrow {
  transform: rotate(90deg);
}

.league-table .roster-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}

.league-table .roster-row td {
  padding: 0.75rem 0.8rem 0.9rem;
  background: #f9fbff;
}

.league-table .roster-cell {
  padding-right: 0.4rem;
}

.league-table .roster-spacer {
  background: #f9fbff;
}

.league-table .roster-row.hidden {
  display: none;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  border: 1px solid #e0e7f2;
  table-layout: fixed;
}

.roster-table th,
.roster-table td {
  border-bottom: 1px solid #e0e7f2;
  border-right: 1px solid #e0e7f2;
  padding: 0.4rem 0.5rem;
  text-align: left;
}

.roster-table col.col-seed {
  width: 3.5rem;
}

.roster-table col.col-round-pick {
  width: 3.2rem;
}

.roster-table col.col-pts {
  width: 5.5rem;
}

.roster-table col.col-round {
  width: 3rem;
}

.roster-table col.col-team {
  width: 14rem;
}

.roster-table td:first-child,
.roster-table td:last-child {
  white-space: nowrap;
}

.roster-table th:last-child,
.roster-table td:last-child {
  border-right: none;
}

.roster-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5a6a82;
  background: #eef3fb;
}

.roster-sort {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.roster-sort-th:hover {
  outline: 1px solid #c8d6ea;
  outline-offset: -2px;
}

.roster-sort.active.desc::after {
  content: " ▼";
  font-size: 0.65rem;
}

.roster-sort.active.asc::after {
  content: " ▲";
  font-size: 0.65rem;
}

.roster-table .pts-col {
  text-align: right;
  white-space: nowrap;
}

.roster-table .round-cell {
  text-align: center;
  font-weight: 700;
  border-radius: 0;
  background: #f1f4f8;
  color: #111;
  position: relative;
}

.roster-table .round-cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #111c2c;
  color: #fff;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(17, 28, 44, 0.25);
  z-index: 5;
}

.roster-table .round-cell[data-tip]:hover::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #111c2c;
}

.roster-table .round-cell[data-tip]:hover {
  box-shadow:
    inset 0 0 0 1px rgba(28, 47, 74, 0.45),
    0 0 8px rgba(28, 47, 74, 0.35);
}

.roster-table .round-win {
  background: #dbf4e4 !important;
}

.roster-table .round-loss {
  background: #fde1e1 !important;
}

.roster-table .round-neutral {
  background: #f1f4f8 !important;
}


.subtle-btn {
  border: 1px solid #c6d0df;
  background: #f8fbff;
  color: #24354f;
  border-radius: 8px;
  padding: 0.42rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.subtle-btn:hover {
  background: #edf3ff;
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

.auth-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.auth-form input {
  border: 1px solid #cbd4e2;
  border-radius: 8px;
  padding: 0.48rem 0.6rem;
  font: inherit;
}

.auth-submit {
  margin-top: 0.2rem;
  border: 1px solid #0d5f44;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 0.54rem 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.auth-submit:hover {
  background: #025c3f;
}

.auth-toggle {
  margin-top: 0.5rem;
  border: none;
  background: transparent;
  color: #546177;
  font-size: 0.84rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.auth-message {
  min-height: 1.1rem;
  margin: 0.55rem 0 0;
  font-size: 0.82rem;
  color: #37465c;
}

.topbar {
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(120deg, #ffffff, #f7f3ea);
}

.topbar-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1,
h2,
h3 {
  margin: 0;
}

.topbar h1 {
  font-size: 1.4rem;
  text-align: center;
}

.exit-btn {
  justify-self: start;
}

.pick-banner {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  font-weight: 700;
}

.undo-btn {
  border: 1px solid #c7d0de;
  background: #f8fbff;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.undo-btn:hover:not([disabled]) {
  background: #ecf3ff;
}

.undo-btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.layout {
  display: grid;
  grid-template-columns: minmax(28rem, 1fr) var(--rosters-width);
  grid-template-rows: auto auto;
  grid-template-areas:
    "visual visual"
    "listed rosters";
  gap: 1rem;
  padding: 1rem;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 8px 24px rgba(16, 27, 44, 0.08);
}

.panel h2 {
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.listed-panel {
  grid-area: listed;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.rosters-panel {
  grid-area: rosters;
  display: flex;
  flex-direction: column;
  height: 100%;
}


.visual-panel {
  grid-area: visual;
  min-height: 24rem;
}

.visual-panel:has(.panel-expand:not([open])) {
  min-height: 0;
}

.panel-expand {
  display: grid;
  gap: 0.75rem;
}

.panel-expand summary {
  cursor: pointer;
  font-weight: 700;
  color: #223551;
  list-style: none;
}

.panel-expand summary::-webkit-details-marker {
  display: none;
}

.panel-expand summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.panel-expand[open] summary::before {
  transform: rotate(90deg);
}

.selection-board {
  overflow-x: auto;
  padding-bottom: 0.2rem;
  flex: 1;
}

.selection-layout {
  display: grid;
  gap: 0.75rem;
  min-width: 920px;
}

.bracket-visual-canvas {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.play-in-row,
.regions-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 0.75rem;
}

.bracket-visual-stage {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr);
  grid-template-rows: auto auto;
  gap: 0.75rem 2rem;
  position: relative;
}

.quadrant-slot {
  position: relative;
}

.top-left {
  grid-column: 1;
  grid-row: 1;
}

.top-right {
  grid-column: 2;
  grid-row: 1;
}

.bottom-left {
  grid-column: 1;
  grid-row: 2;
}

.bottom-right {
  grid-column: 2;
  grid-row: 2;
}

.center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32rem;
  z-index: 2;
  pointer-events: none;
}

.region,
.play-in {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: #fff;
}

.region h3,
.play-in h3 {
  font-size: 0.92rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
}

.seed-row {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.34rem;
}

.seed-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  border-radius: 6px;
  background: #eef2f8;
  border: 1px solid #d4dbe8;
  font-weight: 700;
  color: #3d4a5c;
  font-size: 0.66rem;
}

.region-bracket {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem;
  background: #fff;
}

.region-bracket h3 {
  font-size: 0.92rem;
  margin-bottom: 0.55rem;
  color: var(--muted);
}

.region-bracket.right-side h3 {
  text-align: right;
}

.bracket-tree {
  display: grid;
  grid-template-columns: 1.65fr 1.35fr 1.1fr 1fr;
  gap: 0.6rem;
  min-height: 510px;
}

.bracket-tree.mirror {
  grid-template-columns: 1fr 1.1fr 1.35fr 1.65fr;
}

.round {
  position: relative;
  display: flex;
  flex-direction: column;
}

.round-64 {
  justify-content: space-between;
}

.round-32 {
  justify-content: space-around;
  padding-top: 2.1rem;
  padding-bottom: 2.1rem;
}

.round-16 {
  justify-content: space-around;
  padding-top: 6.4rem;
  padding-bottom: 6.4rem;
}

.round-8 {
  justify-content: center;
  padding-top: 9rem;
  padding-bottom: 9rem;
}

.matchup {
  position: relative;
  border: 1px solid #d6deeb;
  border-radius: 8px;
  padding: 0.28rem;
  background: #fafcff;
}

/* connector lines removed for cleaner bracket */

.matchup-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #6c7a90;
  margin-bottom: 0.2rem;
}

.bracket-team {
  border: 1px solid #d2d9e5;
  border-radius: 6px;
  background: #f7faff;
  color: var(--ink);
  padding: 0.28rem 0.36rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
}

.bracket-team + .bracket-team {
  margin-top: 0.24rem;
}

.bracket-team.drafted {
  background: #edf0f4;
  border-color: #cdd4df;
  color: #485264;
}

.bracket-team.empty {
  background: #f8fafe;
  border-style: dashed;
  border-color: #d7dfec;
  min-height: 1.72rem;
}

.finals-hub {
  border: 1px solid #cad3e2;
  border-radius: 12px;
  background: #f8fbff;
  box-shadow: 0 8px 20px rgba(17, 37, 72, 0.12);
  padding: 0.65rem;
}

.finals-hub h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: #44556e;
}

.finals-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.45rem;
  align-items: stretch;
}

.finals-row .matchup::after,
.finals-row .matchup::before {
  display: none;
}

.championship {
  border-color: #93accd;
  background: #eef5ff;
}

.seed-slot {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 0.6rem;
  border-radius: 8px;
  border: 1px dashed #c8cfdb;
  background: #f6f8fc;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.game-header {
  font-weight: 700;
  font-size: 0.82rem;
  margin: 0 0 0.35rem;
  color: var(--muted);
}

.play-in .team-btn + .team-btn {
  margin-top: 0.38rem;
}

.team-btn {
  width: 100%;
  text-align: left;
  margin-bottom: 0;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #d2d9e5;
  background: #f7faff;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.74rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, opacity 120ms ease;
}

.team-btn:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 5px 10px rgba(0, 36, 96, 0.12);
}

.team-btn[disabled] {
  cursor: default;
  color: #596170;
  background: #edf0f4;
  border-color: #d1d5de;
  opacity: 0.75;
}

.team-btn .status {
  display: inline-block;
  margin-left: 0.45rem;
  font-weight: 700;
  color: var(--warn);
}

.roster-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: max-content;
  gap: 0.7rem;
  flex: 1;
  align-content: start;
  align-items: start;
  overflow: auto;
  padding-right: 0.2rem;
}

.roster-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.58rem;
  background: #fff;
}

.roster-card.current {
  border: 2px solid var(--accent);
  background: linear-gradient(180deg, #fbfffd, #eefbf5);
}

.roster-title {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.74rem;
  margin-bottom: 0.35rem;
}

.roster-list {
  margin: 0;
  padding-left: 1rem;
  min-height: 1rem;
  font-size: 0.72rem;
}

.roster-list li {
  margin-bottom: 0.12rem;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.roster-meta {
  margin-left: auto;
  color: #576987;
}

.roster-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
  font-size: 0.7rem;
}

.results-page {
  display: grid;
  gap: 0.65rem;
}

.results-board {
  display: grid;
  gap: 0.7rem;
}

.results-round {
  border: 1px solid #d7dfec;
  border-radius: 10px;
  background: #fafcff;
  padding: 0.6rem;
}

.results-round h3 {
  margin: 0 0 0.45rem;
  font-size: 0.88rem;
  color: #2f4261;
}

.results-round-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.randomize-round {
  font-size: 0.7rem;
  padding: 0.3rem 0.45rem;
}

.results-games {
  display: grid;
  gap: 0.45rem;
}

.result-game {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  border: 1px solid #d8e0ee;
  border-radius: 8px;
  background: #fff;
  padding: 0.45rem;
}

.result-game-main {
  display: grid;
  gap: 0.2rem;
}

.result-game-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #50617d;
}

.result-team-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.result-score-input {
  width: 4rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  text-align: right;
}

.result-score-final {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1f3654;
}

.result-state {
  font-size: 0.72rem;
  color: #5c6f8f;
}

.result-actions {
  display: grid;
  gap: 0.28rem;
  align-content: center;
}

.result-action {
  border: 1px solid #bcc8dc;
  background: #f4f8ff;
  color: #2a3f63;
  border-radius: 7px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
}

.result-action:disabled {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 1000px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "listed"
      "rosters"
      "visual";
  }

  .panel-resizer {
    display: none;
  }

  .row-resizer {
    display: none;
  }

  .listed-panel,
  .rosters-panel {
    height: auto;
  }

  .selection-board,
  .roster-grid {
    flex: initial;
    max-height: none;
  }
}
