@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f6fbff;
  --bg-soft: #eef6ff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --text: #132238;
  --muted: #5f728a;
  --border: #d4e1f2;
  --primary: #2166f3;
  --primary-2: #00bfa5;
  --accent: #ff8f4d;
  --accent-2: #7b61ff;
  --shadow: 0 10px 30px rgba(26, 68, 132, 0.08);
}

* { box-sizing: border-box; }

body {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(0, 191, 165, 0.12) 0 12%, transparent 13%),
    radial-gradient(circle at 86% 14%, rgba(123, 97, 255, 0.12) 0 10%, transparent 11%),
    radial-gradient(circle at 80% 78%, rgba(255, 143, 77, 0.14) 0 12%, transparent 13%),
    radial-gradient(circle at 18% 80%, rgba(33, 102, 243, 0.12) 0 10%, transparent 11%),
    linear-gradient(180deg, #f7fbff 0%, #edf6ff 100%);
}

body::before {
  content: '🏓 🎾 🏓 🎾';
  position: fixed;
  inset: 0;
  font-size: clamp(70px, 9vw, 120px);
  letter-spacing: 48px;
  opacity: 0.045;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  width: 70%;
  max-width: 800px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

h1 {
  margin: 0 0 6px;
  font-family: Outfit, Inter, sans-serif;
  font-size: clamp(1.5rem, 2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  background: linear-gradient(90deg, var(--primary), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  color: var(--muted);
  margin: 0;
  font-weight: 500;
}

.card {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(190, 209, 232, 0.8);
  border-radius: 16px;
  padding: 14px;
  margin-top: 14px;
  box-shadow: var(--shadow);
}

h2 {
  margin: 0 0 8px;
  font-family: Outfit, Inter, sans-serif;
  font-size: 1.02rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(160px, 0.8fr);
  gap: 12px;
  align-items: start;
}

.stack-col {
  display: grid;
  gap: 10px;
}

.slot-col {
  display: grid;
  align-content: start;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #3d4e64;
}

input, button, textarea {
  border-radius: 10px;
  border: 1px solid #c9dbf3;
  padding: 8px 9px;
  font-size: 13px;
  font-family: Inter, system-ui, sans-serif;
}

input, textarea {
  background: #fff;
  color: var(--text);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(33, 102, 243, 0.16);
}

textarea {
  width: 100%;
  resize: vertical;
}

button {
  background: #ffffff;
  color: #274266;
  border-color: #bfd4ef;
  cursor: pointer;
  transition: .2s ease;
  font-weight: 600;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(33, 102, 243, 0.16);
}

button.primary {
  background: linear-gradient(135deg, var(--primary), #5a7fff);
  border-color: transparent;
  color: #fff;
}

button.primary:hover {
  box-shadow: 0 8px 18px rgba(33, 102, 243, 0.3);
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.player-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 8px;
  border-bottom: 1px dashed #d3e2f4;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.hidden { display: none; }
.muted { color: var(--muted); font-size: 13px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  border: 1px solid #dbe7f7;
  padding: 8px;
  vertical-align: top;
  min-width: 230px;
}

th {
  background: linear-gradient(180deg, #f9fcff, #f1f8ff);
}

th.sticky, td.sticky {
  position: sticky;
  left: 0;
  background: var(--surface-strong);
  z-index: 1;
  min-width: 140px;
}

.slot-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-head .times {
  display: flex;
  gap: 6px;
  align-items: center;
}

.slot-head input {
  width: 90px;
  padding: 6px;
}

.cell-line { margin: 0 0 6px; }

@media (max-width: 900px) {
  .container {
    width: 94%;
    max-width: 800px;
  }
  .setup-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .container { padding: 14px 10px 20px; }
  h1 { font-size: 1.35rem; }
  th, td { min-width: 170px; }
}

@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .card, .table-wrap, th, td { border-color: #999; box-shadow: none; }
  .row, .hint, #buildBtn, #printBtn, #parsePasteBtn, #clearPlayersBtn, #addPlayerBtn { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  h1 { color: #000 !important; -webkit-text-fill-color: #000; background: none; }
  th, td { font-size: 10px; padding: 4px; min-width: 120px; }
  @page { size: landscape; margin: 8mm; }
}