:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #d8e0ea;
  --text: #15202b;
  --muted: #66788a;
  --blue: #0a3d91;
  --blue-dark: #072e6d;
  --blue-soft: #eaf2ff;
  --success-bg: #edf8f0;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mlb-logo {
  width: 64px;
  height: 42px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.topbar-title-wrap {
  min-width: 0;
}

.topbar-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.topbar-subtitle {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
}

.topbar-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: white;
  color: var(--blue-dark);
  font-weight: 700;
  cursor: pointer;
}

.topbar-button.secondary {
  background: rgba(255, 255, 255, 0.14);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-card {
  padding: 18px;
}

.status-card.highlight {
  background: linear-gradient(180deg, #f3f8ff 0%, #e8f1ff 100%);
  border-color: #bfd3f6;
}

.card-label {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.card-value {
  font-size: 1.4rem;
  font-weight: 800;
}

.left-column,
.right-column {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  padding: 20px;
}

.form-panel,
.order-panel,
.log-panel {
  margin-bottom: 20px;
}

.turn-form {
  display: block;
}

.panel-header h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
}

.panel-header p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.current-turn-banner {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border: 1px solid #caddff;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-weight: 700;
}

.banner-label {
  opacity: 0.8;
  margin-right: 6px;
}

.banner-owner {
  font-weight: 800;
}

.pick-section {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.pick-section-header h3 {
  margin: 0 0 14px;
  font-size: 1.02rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.9rem;
  font-weight: 700;
}

.form-field input {
  border: 1px solid var(--border);
  background: white;
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 0.96rem;
  outline: none;
}

.form-field input:focus {
  border-color: #7ea8ea;
  box-shadow: 0 0 0 3px rgba(10, 61, 145, 0.1);
}

.form-actions {
  margin-top: 6px;
}

.primary-button {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: var(--blue);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  padding: 14px 16px;
  cursor: pointer;
}

.primary-button:hover,
.topbar-button:hover {
  filter: brightness(0.97);
}

.draft-order-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 12px;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.order-slot {
  font-weight: 800;
  color: var(--blue-dark);
}

.order-owner {
  font-weight: 700;
}

.order-row.current {
  border-color: #86aef0;
  background: #eef5ff;
}

.order-row.next {
  border-color: #d5dfec;
  background: #fbfcfe;
}

.draft-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.turn-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background: white;
}

.turn-card-header {
  background: #f7faff;
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.turn-owner {
  font-size: 1rem;
  font-weight: 800;
}

.turn-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.turn-picks {
  padding: 10px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.turn-pick {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: var(--surface-alt);
}

.turn-pick-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.turn-team {
  font-weight: 800;
  color: var(--blue-dark);
}

.turn-player {
  font-weight: 800;
}

.turn-details {
  color: var(--muted);
  font-size: 0.94rem;
}

.empty-state {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  background: #fbfcfe;
}

/* --- Modal / Overlay --- */
.hidden {
  display: none !important;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.modal-close-button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-label {
  font-size: 0.92rem;
  font-weight: 700;
}

.modal-select {
  width: 100%;
  border: 1px solid var(--border);
  background: white;
  border-radius: 12px;
  padding: 12px 13px;
  font-size: 0.96rem;
  outline: none;
}

.modal-select:focus {
  border-color: #7ea8ea;
  box-shadow: 0 0 0 3px rgba(10, 61, 145, 0.1);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

.modal-cancel-button {
  background: #eef2f7;
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-save-button {
  background: var(--blue);
  color: white;
}

@media (max-width: 1080px) {
  .status-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 14px 16px;
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-right {
    justify-content: stretch;
  }

  .topbar-button {
    width: 100%;
  }

  .page-shell {
    padding: 16px;
  }

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

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

  .order-row {
    grid-template-columns: 1fr;
  }

  .modal-header,
  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-actions .topbar-button,
  .modal-close-button {
    width: 100%;
  }
}