:root {
  --bg: #f6f5f1;
  --ink: #111;
  --ink-dim: #6b6b6b;
  --buenas: #1d65d6;
  --malas: #d13a2b;
  --card: #ffffff;
  --border: #e3e0d7;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 12px;
}

.card {
  width: 100%;
  max-width: 520px;
  height: calc(100dvh - 24px);
  max-height: 820px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

h1 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.01em;
}

.board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 6px;
  min-width: 0;
  min-height: 0;
}

.team-name {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.zone {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.zone-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.zone-label.buenas { color: var(--buenas); }
.zone-label.malas { color: var(--malas); }

.palos {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.palo {
  width: 42px;
  height: 60px;
  flex-shrink: 0;
}

.divider {
  width: 80%;
  height: 1px;
  background: var(--border);
  margin: 4px 0;
  flex-shrink: 0;
}

.vdivider {
  width: 1px;
  background: var(--border);
  margin: 0 6px;
}

.score {
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink-dim);
  line-height: 1;
  flex-shrink: 0;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
  width: 100%;
  flex-shrink: 0;
}

button {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 0;
  border-radius: 10px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: transform 80ms ease, background 120ms ease;
  touch-action: manipulation;
}

button:active { transform: translateY(1px); }

button.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}

button.ghost:hover { background: rgba(0,0,0,0.04); }

button.small { padding: 6px 10px; font-size: 0.85rem; }

button.primary { background: var(--ink); color: #fff; border-color: var(--ink); }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--ink-dim);
  font-size: 0.88rem;
  flex-shrink: 0;
}

.target select {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 6px;
  margin-left: 4px;
  font: inherit;
}

dialog {
  border: none;
  border-radius: 14px;
  padding: 20px 20px 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  max-width: 300px;
}

dialog::backdrop { background: rgba(0,0,0,0.45); }

dialog h2 { margin: 0 0 14px; font-size: 1.15rem; }

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

body.target-15 .zone-label,
body.target-15 .divider { display: none; }

body.target-15 .team > .zone:last-of-type { display: none; }

body.target-15 .team > .zone:first-of-type { flex: 1; }

@media (max-width: 380px) {
  .palo { width: 34px; height: 48px; }
  .team-name { font-size: 0.92rem; }
  .score { font-size: 1.5rem; }
  button { font-size: 0.88rem; padding: 9px 0; }
}
