:root {
  --bg: #1B2028;
  --bg-raised: #232A34;
  --bg-card: #262E39;
  --line: #333D4A;
  --field: #2F6B4F;
  --field-bright: #3E8563;
  --mustard: #D9A441;
  --bone: #F1EEE6;
  --bone-dim: #A9AFB9;
  --win: #4C8C5C;
  --win-bg: #24352A;
  --loss: #C1584A;
  --loss-bg: #35262A;
  --push: #7A7F8A;

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Inter', sans-serif;

  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

button, select {
  font-family: inherit;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 0 20px 32px;
  animation: fade-in 0.18s ease;
}
.screen.active { display: flex; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Landing ---------- */

.landing-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding-top: 8vh;
}

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

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  letter-spacing: 0.5px;
  color: var(--bone);
}

.brand-sub {
  font-size: 14px;
  color: var(--mustard);
  margin-top: 6px;
  letter-spacing: 0.3px;
}

.field-label {
  font-size: 13px;
  color: var(--bone-dim);
  margin-bottom: -10px;
}

.select-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--bone);
  font-size: 17px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1L7 7L13 1' stroke='%23A9AFB9' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  padding: 15px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--field);
  color: var(--bone);
}
.btn-primary:not(:disabled):hover { filter: brightness(1.08); }

.btn-secondary {
  background: transparent;
  color: var(--bone);
  border: 1px solid var(--line);
}

.btn-ghost {
  background: var(--bg-raised);
  color: var(--bone-dim);
  border: 1px solid var(--line);
  font-size: 13px;
  padding: 10px 12px;
}

.btn-danger { color: var(--loss); }

.landing-aux {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--bone-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 6px;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.dot { color: var(--line); }

.dev-tools {
  margin-top: auto;
  padding-top: 24px;
  color: var(--bone-dim);
}
.dev-tools summary {
  font-size: 12px;
  cursor: pointer;
  color: var(--bone-dim);
  padding: 8px 0;
}
.dev-note { font-size: 12px; margin: 4px 0 10px; color: var(--bone-dim); }
.dev-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.dev-status { font-size: 12px; color: var(--mustard); min-height: 16px; }

/* ---------- Shared screen header ---------- */

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 14px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.header-sub {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--bone-dim);
  margin-top: 2px;
}

.header-spacer { width: 38px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--bone);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.week-picker {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--bone);
  padding: 8px 10px;
  font-size: 13px;
  max-width: 100px;
}

/* ---------- Predict flow ---------- */

.predict-card-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.predict-card-wrap.hidden, .predict-empty.hidden, #predict-empty.hidden, #view-empty.hidden, .hidden {
  display: none !important;
}

.lock-banner {
  font-size: 12px;
  color: var(--bone-dim);
  text-align: center;
  margin-bottom: 14px;
}

.matchup-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.matchup-teams {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.at-sign {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--bone-dim);
}

.team-btn {
  flex: 1;
  aspect-ratio: 1 / 1;
  background: var(--bg-card);
  border: 2px solid var(--line);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.08s ease;
}
.team-btn:active { transform: scale(0.97); }

.team-btn.selected {
  border-color: var(--field-bright);
  background: var(--win-bg);
}

.team-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  line-height: 1.05;
}

.team-spread {
  font-size: 13px;
  color: var(--mustard);
  font-weight: 600;
}

.predict-nav {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.predict-nav .btn { flex: 1; }

.btn-submit { margin-top: 12px; }

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--bone-dim);
  gap: 6px;
  padding: 40px 20px;
}
.empty-sub { font-size: 13px; }

/* ---------- Predictions grid ---------- */

.grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.predictions-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.predictions-table th, .predictions-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.predictions-table th {
  background: var(--bg-raised);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  position: sticky;
  top: 0;
}

.predictions-table td.matchup-cell {
  text-align: left;
  font-weight: 500;
  position: sticky;
  left: 0;
  background: var(--bg);
}

.predictions-table td.spread-cell {
  color: var(--mustard);
  font-size: 12px;
}

.pick-cell.correct { background: var(--win-bg); color: var(--win); font-weight: 600; }
.pick-cell.incorrect { background: var(--loss-bg); color: var(--loss); font-weight: 600; }
.pick-cell.pending { color: var(--bone-dim); }
.pick-cell.push { color: var(--push); }
.pick-cell.missed { color: var(--bone-dim); font-style: italic; }

/* ---------- Leaderboard ---------- */

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

.leader-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.leader-rank {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--mustard);
  width: 30px;
  text-align: center;
}

.leader-info { flex: 1; }

.leader-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
}

.leader-stats {
  font-size: 12px;
  color: var(--bone-dim);
  margin-top: 3px;
}

.leader-points {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--field-bright);
}
.leader-points-label {
  font-size: 10px;
  color: var(--bone-dim);
  text-align: center;
  margin-top: -2px;
}

/* ---------- Previous weeks ---------- */

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

.week-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  color: var(--bone);
  font-size: 15px;
  width: 100%;
}

.week-status {
  font-size: 11px;
  color: var(--bone-dim);
  text-transform: capitalize;
}
