/* Artifact platform tokens — auto-resolved */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 32px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  padding: 16px;
  border-bottom: 1px solid var(--neutral);
}
.app-header h1 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  text-align: center;
}
.top-nav {
  display: flex;
  gap: 8px;
}
.nav-btn {
  flex: 1;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--neutral);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
}
.nav-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.app-main { padding: 16px; }

/* Loading */
.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.loading-card {
  text-align: center;
  padding: 32px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--neutral);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Team picker */
.team-picker {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.team-picker h2 { margin: 0 0 4px; text-align: center; }
.helper { text-align: center; color: var(--text-muted); margin: 0 0 20px; }

.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.team-pick-btn {
  padding: 20px 12px;
  border: none;
  border-radius: var(--radius-lg);
  color: white;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  text-align: center;
  min-height: 110px;
}
.team-pick-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.team-pick-points { font-size: 1rem; opacity: 0.95; }
.team-pick-count { font-size: 0.85rem; opacity: 0.9; margin-top: 4px; }

/* My team banner */
.my-team-banner {
  background: var(--surface);
  border-radius: var(--radius-md);
  border-left: 6px solid var(--primary);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.my-team-label { font-size: 0.75rem; color: var(--text-muted); }
.my-team-name { font-size: 1.1rem; font-weight: 700; }
.my-team-stats {
  margin-left: auto;
  display: flex;
  gap: 16px;
}
.my-team-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-num { font-size: 1.1rem; font-weight: 700; }
.stat-label { font-size: 0.7rem; color: var(--text-muted); }
.change-team-btn {
  background: transparent;
  border: 1px solid var(--neutral);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

/* Current player card */
.current-player-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-bottom: 16px;
}
.player-progress {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.player-position-badge {
  display: inline-block;
  background: var(--primary-tint);
  color: var(--primary-dark);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.player-name {
  font-size: 2rem;
  margin: 4px 0;
}
.player-rating {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.top-bid-area {
  background: var(--primary-tint);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}
.top-bid-label { font-size: 0.85rem; color: var(--text-muted); }
.top-bid-amount {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 4px 0;
}
.top-bid-team {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
}
.no-bid {
  color: var(--text-muted);
  padding: 16px 0;
}

.team-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Bid input */
.bid-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.bid-input {
  flex: 1;
  font-size: 1.3rem;
  padding: 14px;
  border: 2px solid var(--neutral);
  border-radius: var(--radius-md);
  text-align: center;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
}
.bid-input:focus {
  outline: none;
  border-color: var(--primary);
}
.bid-btn {
  padding: 14px 24px;
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}
.bid-btn:hover { background: var(--primary-dark); }

.quick-bid-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.quick-bid-btn {
  flex: 1;
  padding: 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--neutral);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
}

.bid-message {
  background: var(--warning);
  color: white;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.finalize-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.sold-btn {
  flex: 2;
  padding: 16px;
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--success);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}
.sold-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pass-btn {
  flex: 1;
  padding: 16px;
  font-size: 1rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--neutral);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-sans);
}
.finalize-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 10px 0 0;
}

/* Bid history */
.bid-history {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.bid-history h3 { margin: 0 0 12px; font-size: 1rem; }
.empty { color: var(--text-muted); font-size: 0.9rem; margin: 0; }
.bid-list { list-style: none; padding: 0; margin: 0; }
.bid-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--neutral);
}
.bid-item:last-child { border-bottom: none; }
.bid-team { font-weight: 600; flex: 1; }
.bid-amount { font-weight: 700; color: var(--primary-dark); }
.bid-bidder { color: var(--text-muted); font-size: 0.85rem; min-width: 60px; text-align: right; }

/* Team status */
.team-status {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.team-status h3 { margin: 0 0 12px; font-size: 1rem; }
.team-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.team-status-card {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px;
  border-top: 4px solid var(--primary);
  text-align: center;
}
.team-status-card.mine {
  box-shadow: 0 0 0 2px var(--primary);
}
.ts-name { font-weight: 700; margin-bottom: 4px; }
.ts-points { font-size: 1.1rem; font-weight: 700; }
.ts-count { font-size: 0.8rem; color: var(--text-muted); }

/* Done screen */
.done-screen {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.done-screen h2 { margin: 0 0 10px; }
.done-screen p { color: var(--text-muted); margin-bottom: 20px; }

/* Results */
.results-view h2 { text-align: center; margin: 0 0 16px; }
.results-teams {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.result-team-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  border-top: 5px solid var(--primary);
  box-shadow: var(--shadow-sm);
}
.result-team-card h3 { margin: 0 0 12px; }
.result-stats {
  display: flex;
  justify-content: space-around;
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 12px;
}
.result-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.rs-num { font-weight: 700; }
.rs-label { font-size: 0.75rem; color: var(--text-muted); }

.result-player-list, .unsold-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.result-player-list li, .unsold-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--neutral);
}
.result-player-list li:last-child, .unsold-list li:last-child { border-bottom: none; }
.pos-badge {
  background: var(--primary-tint);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.pname { flex: 1; font-weight: 600; }
.pprice { font-weight: 700; color: var(--primary-dark); }

.unsold-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.unsold-section h3 { margin: 0 0 12px; }
.unsold-tag {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--warning);
  color: white;
}
.unsold-tag.passed { background: var(--text-muted); }

button:focus-visible, input:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
