:root {
  --court-green: #2f8f4e;
  --court-green-dark: #1f6b38;
  --ball-yellow: #e8d800;
  --ball-yellow-dark: #c7ba00;
  --stop-red: #d9432f;
  --stop-red-dark: #b23223;
  --ink: #16241b;
  --paper: #ffffff;
  --paper-soft: #f4f7f3;
  --line: #dbe3dc;
  --muted: #5b6b60;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, var(--court-green) 0%, var(--court-green) 140px, var(--paper-soft) 140px);
  color: var(--ink);
  min-height: 100vh;
}

.app-header {
  text-align: center;
  padding: 28px 16px 18px;
  color: #fff;
}

.app-header h1 {
  margin: 0;
  font-size: 2.2rem;
  letter-spacing: 0.5px;
}

.app-header .subtitle {
  margin: 4px 0 0;
  opacity: 0.9;
  font-size: 0.95rem;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  margin-top: 8px;
}

h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 10px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

input[type="number"] {
  font-size: 1.1rem;
  padding: 10px 10px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-weight: 700;
  color: var(--ink);
  width: 100%;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--court-green);
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: 4px 0 14px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.primary {
  background: var(--court-green);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 700;
}

.primary:hover { background: var(--court-green-dark); }

.big {
  width: 100%;
}

.rules {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.rules ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Session screen */
.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.link-btn {
  background: none;
  border: none;
  color: var(--court-green-dark);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 4px;
}

.link-btn:hover { text-decoration: underline; }

.status-note {
  background: #fff8d6;
  border: 1px solid var(--ball-yellow-dark);
  color: #6b5f00;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin: 10px 0;
}

.courts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.court-card {
  background: var(--paper-soft);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.court-card .court-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--court-green-dark);
  margin-bottom: 6px;
}

.court-card .matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  flex-wrap: wrap;
  text-align: center;
}

.court-card .team {
  display: flex;
  gap: 6px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 50%;
  background: var(--ball-yellow);
  color: var(--ink);
  font-weight: 800;
}

.vs {
  color: var(--stop-red);
  font-weight: 800;
  font-size: 0.9rem;
}

.sitting-out {
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
  margin: 4px 0 0;
}

.timer-block {
  text-align: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.timer-display {
  font-size: 3.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.timer-display.warning {
  color: var(--stop-red);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.timer-btn {
  border: none;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: 800;
  padding: 18px 34px;
  color: #fff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.05s ease;
}

.timer-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.timer-btn.play { background: var(--court-green); }
.timer-btn.play:hover { background: var(--court-green-dark); }

.timer-btn.stop { background: var(--stop-red); }
.timer-btn.stop:hover { background: var(--stop-red-dark); }

.timer-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
  cursor: default;
  transform: none;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px;
}

footer a {
  color: var(--court-green-dark);
  margin-left: 6px;
}

@media (max-width: 480px) {
  .setup-grid { grid-template-columns: 1fr; }
  .timer-display { font-size: 2.6rem; }
  .timer-btn { padding: 16px 22px; font-size: 1.05rem; }
}
