body {
  font-size: 15px;
  line-height: 1.5;
}

/* ── SETUP ── */
.setup-nav {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 24px 0;
}

#setup {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.setup-title {
  font-size: clamp(2rem, 5.5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
  background: linear-gradient(135deg, #a78bfa 0%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.setup-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 36px;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

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

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  min-height: 28px;
}

.panel-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.btn-load-team {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.btn-load-team:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-load-team.has-team {
  border-color: rgba(167,139,250,0.4);
  color: var(--accent-light);
  background: rgba(167,139,250,0.08);
}

.entry-list { display: flex; flex-direction: column; gap: 8px; }
.entry-row { display: flex; align-items: center; gap: 8px; }

.color-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.entry-input {
  flex: 1;
  min-width: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.entry-input::placeholder { color: #3a3a70; }
.entry-input:focus { border-color: var(--accent); }

.btn-x {
  background: none;
  border: none;
  color: #3a3a70;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.btn-x:hover { color: #f87171; }

.btn-add {
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent-light); }

.count-note {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 14px;
  min-height: 20px;
}
.count-note.warn { color: #fb923c; }

.btn-start {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #7c6fff 0%, #06b6d4 100%);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  font-family: inherit;
}
.btn-start:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-start:active { transform: translateY(0); opacity: 1; }

/* ── GAME ── */
#game {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 12px;
  height: 100vh;
}

.game-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1080px;
  margin-bottom: 24px;
  gap: 12px;
}

.game-logo {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex: 1;
  text-align: center;
}

.nav-btns { display: flex; gap: 8px; }

.btn-nav {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-nav:hover { border-color: var(--accent); color: var(--accent-light); }
.btn-nav.accent {
  background: rgba(124, 111, 255, 0.1);
  border-color: rgba(124, 111, 255, 0.5);
  color: var(--accent-light);
}
.btn-nav:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

.ladder-scroll {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

#ladder-svg { display: block; width: 100%; height: 100%; }

.hint {
  margin-top: 8px;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ── MODAL ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 18, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
}
.modal-backdrop.visible { opacity: 1; }

.modal {
  background: var(--surface);
  border: 1px solid #2a2a5a;
  border-radius: 20px;
  padding: 28px 24px 24px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-backdrop.visible .modal { transform: scale(1) translateY(0); }

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #a78bfa, #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-sub {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 20px;
}

.result-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
}
.result-row.show { opacity: 1; transform: translateY(0); }

.result-row-color {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.result-row-player {
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-row-arrow {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.result-row-value {
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.btn-modal {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.12s;
  border: none;
  font-family: inherit;
}
.btn-modal:hover { opacity: 0.82; transform: translateY(-1px); }
.btn-modal:active { transform: translateY(0); }
.btn-modal.secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn-modal.primary {
  background: linear-gradient(135deg, #7c6fff, #06b6d4);
  color: #fff;
}
