@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,500;0,600;0,700;0,800;0,900;1,800;1,900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg1: #0c2a1b; --bg2: #1f4a31;
  --a: #c4f04a; --b: #3cb8f5; --accent: #c4f04a; --ball: #d9f25a;
  --text: #ffffff; --btn-text: #0b1f14;
  --glass: rgba(255,255,255,.06); --glass-2: rgba(255,255,255,.10);
  --line: rgba(255,255,255,.10); --muted: rgba(255,255,255,.55);
  --radius: 28px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans); color: var(--text);
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--bg2) 80%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg1) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
}
body.court::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .07; z-index: 0;
  background:
    linear-gradient(var(--text), var(--text)) 50% 0/2px 100% no-repeat,
    linear-gradient(var(--text), var(--text)) 0 50%/100% 2px no-repeat,
    linear-gradient(var(--text), var(--text)) 0 22%/100% 2px no-repeat,
    linear-gradient(var(--text), var(--text)) 0 78%/100% 2px no-repeat;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: var(--accent); }
.mono { font-family: var(--mono); letter-spacing: .22em; text-transform: uppercase; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Layout móvil ---------- */
.wrap { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 18px 18px 110px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.round-btn {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--glass); border: 1px solid var(--line);
}
.round-btn svg { width: 28px; height: 28px; }
.title-block { flex: 1; min-width: 0; }
.title-block .kicker { font-family: var(--mono); font-size: 13px; letter-spacing: .25em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.title-block h1 { margin: 2px 0 0; font-size: 26px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px; border-radius: 999px;
  background: var(--glass-2); border: 1px solid var(--line); font-weight: 600; font-size: 17px; white-space: nowrap;
}
.dot { width: 11px; height: 11px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px #22c55e; }
.dot.off { background: #ef4444; box-shadow: 0 0 10px #ef4444; }
.dot.warn { background: #f59e0b; box-shadow: 0 0 10px #f59e0b; }

.card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; backdrop-filter: blur(10px);
}
.h2 { font-size: 22px; font-weight: 800; margin: 26px 2px 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* ---------- Formularios ---------- */
label.field { display: block; }
label.field span { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px 4px; }
.input, select.input {
  width: 100%; padding: 15px 16px; border-radius: 16px; color: var(--text);
  background: rgba(0,0,0,.25); border: 1px solid var(--line); outline: none; font-size: 16px;
}
.input:focus { border-color: var(--accent); }
select.input option { color: #000; }
.btn {
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  padding: 15px 20px; border-radius: 18px; font-weight: 800; font-size: 16px;
  background: var(--accent); color: var(--btn-text); width: 100%;
}
.btn.ghost { background: var(--glass-2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: #ef4444; color: #fff; }
.btn.sm { width: auto; padding: 10px 14px; font-size: 14px; border-radius: 14px; }
.btn:disabled { opacity: .5; }
.seg { display: flex; background: rgba(0,0,0,.25); border-radius: 16px; padding: 4px; gap: 4px; border: 1px solid var(--line); }
.seg button { flex: 1; padding: 11px 6px; border-radius: 12px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--btn-text); }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: rgba(255,255,255,.18); transition: .2s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(22px); }

/* ---------- Listas ---------- */
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px;
  background: var(--glass); border: 1px solid var(--line); margin-bottom: 10px; width: 100%; text-align: left;
}
.avatars { display: flex; flex: none; }
.avatars b {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  color: var(--btn-text); border: 3px solid var(--bg1);
}
.avatars b + b { margin-left: -12px; }
.chip { font-family: var(--mono); font-size: 10px; letter-spacing: .15em; padding: 5px 9px; border-radius: 99px; background: var(--glass-2); text-transform: uppercase; white-space: nowrap; }
.chip.live { background: var(--accent); color: var(--btn-text); }
.empty { text-align: center; padding: 40px 10px; color: var(--muted); }

/* ---------- Navegación inferior ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg1) 92%, transparent) 30%);
}
.tabbar nav { display: flex; gap: 4px; padding: 6px; border-radius: 26px; background: rgba(0,0,0,.35); border: 1px solid var(--line); backdrop-filter: blur(14px); max-width: 560px; width: 100%; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px; border-radius: 20px; font-size: 11px; font-weight: 700; color: var(--muted); }
.tabbar button svg { width: 22px; height: 22px; }
.tabbar button.on { background: var(--glass-2); color: var(--text); }

/* ---------- Hojas (bottom sheet) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50; opacity: 0; pointer-events: none; transition: .2s; }
.sheet-bg.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 88dvh; overflow: auto;
  max-width: 600px; margin: 0 auto; border-radius: 30px 30px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--bg2), var(--bg1)); border: 1px solid var(--line); border-bottom: 0;
  transform: translateY(105%); transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.sheet.open { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.25); margin: 4px auto 14px; }
.sheet h3 { margin: 0 0 16px; font-size: 22px; font-weight: 800; }

.toast {
  position: fixed; left: 50%; top: 18px; transform: translate(-50%, -150%); z-index: 99; transition: .25s;
  background: #0b1f14; border: 1px solid var(--line); padding: 12px 18px; border-radius: 16px; font-weight: 700; max-width: 90vw; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast.err { background: #7f1d1d; }

/* ---------- Marcador (control) ---------- */
.ctl .wrap { padding: 14px 14px 24px; }
.ctl .topbar { gap: 10px; margin-bottom: 14px; }
.ctl .round-btn { width: 48px; height: 48px; }
.ctl .round-btn svg { width: 22px; height: 22px; }
.ctl .title-block .kicker { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctl .title-block h1 { font-size: 20px; }
.ctl .pill { font-size: 14px; padding: 7px 14px; gap: 8px; }
.ctl .dot { width: 9px; height: 9px; }
.score-card { padding: 16px 14px 12px; position: relative; border-radius: 22px; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.team-row + .team-row { margin-top: 10px; }
.team-row .bar { width: 5px; align-self: stretch; border-radius: 6px; background: var(--a); flex: none; }
.team-row.b .bar { background: var(--b); }
.team-row .names { flex: 1; min-width: 0; font-weight: 800; font-size: 17px; line-height: 1.12; text-transform: uppercase; letter-spacing: -.01em; padding-left: 4px; }
.team-row .names div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.serve { width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.serve i { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f5ffb0, var(--ball) 55%, color-mix(in srgb, var(--ball) 60%, #556b00)); box-shadow: 0 0 0 4px rgba(217,242,90,.18), 0 0 14px rgba(217,242,90,.55); opacity: 0; transform: scale(.4); transition: .25s; }
.serve.on i { opacity: 1; transform: none; }
.box { min-width: 38px; height: 50px; padding: 0 6px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; font-size: 28px; background: var(--glass); border: 1px solid var(--line); flex: none; font-variant-numeric: tabular-nums; }
.box.prev { min-width: 28px; font-size: 17px; color: var(--muted); border-radius: 10px; height: 38px; padding: 0 4px; }
.box.prev.won { color: var(--text); }
.box.pts { min-width: 74px; background: #fff; color: #0b1f14; font-size: 38px; border-radius: 16px; height: 54px; font-weight: 700; border: 0; }
.box.pts.small { font-size: 28px; }
.box.pts.bump { animation: cbump .4s; }
@keyframes cbump { 30% { transform: scale(1.08); } }
.score-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.score-foot .sum { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.score-foot button { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; font-weight: 700; color: var(--muted); }
.score-foot button svg { width: 16px; height: 16px; }
.tag-chip { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); padding: 5px 12px; border-radius: 99px; background: var(--accent); color: var(--btn-text); font-family: var(--mono); font-weight: 700; font-size: 10px; letter-spacing: .18em; white-space: nowrap; box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.tag-chip.star { background: linear-gradient(90deg, #fde047, #f59e0b); color: #1c1100; }
.tag-chip.hot { background: #ef4444; color: #fff; }

.point-btn {
  display: block; width: 100%; margin-top: 16px; padding: 16px 20px 20px; border-radius: 34px; text-align: center; position: relative; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--a) 100%, #fff 8%), color-mix(in srgb, var(--a) 80%, #000 12%));
  color: var(--btn-text); box-shadow: 0 8px 30px color-mix(in srgb, var(--a) 22%, transparent), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .08s; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.point-btn.b { background: linear-gradient(180deg, color-mix(in srgb, var(--b) 100%, #fff 8%), color-mix(in srgb, var(--b) 80%, #000 12%)); box-shadow: 0 8px 30px color-mix(in srgb, var(--b) 22%, transparent), inset 0 1px 0 rgba(255,255,255,.5); }
.point-btn:active { transform: scale(.975); }
.point-btn .lbl { position: absolute; left: 24px; top: 16px; font-family: var(--mono); font-size: 12px; letter-spacing: .3em; font-weight: 500; opacity: .85; }
.point-btn .big { display: block; font-size: clamp(48px, 15vw, 64px); font-weight: 900; font-style: italic; letter-spacing: -.04em; line-height: 1; margin-top: 26px; }
.point-btn .who { display: block; font-size: 17px; font-weight: 700; margin-top: 12px; text-transform: uppercase; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.point-btn:disabled { filter: grayscale(.6) brightness(.7); }
.point-btn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,.55); transform: scale(0); animation: rip .5s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(4); opacity: 0; } }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.actions button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 20px; background: rgba(0,0,0,.22); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.actions button svg { width: 26px; height: 26px; }
.actions button .badge { position: absolute; top: 7px; right: calc(50% - 22px); width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg1); }
.actions button:disabled { opacity: .4; }

.winner-banner { margin-top: 16px; padding: 22px; border-radius: 30px; text-align: center; background: var(--glass-2); border: 1px solid var(--line); }
.winner-banner .trophy { font-size: 44px; }
.winner-banner h2 { margin: 6px 0 4px; font-size: 24px; font-weight: 900; text-transform: uppercase; }

/* Tablets / pantallas grandes: control más amplio */
@media (min-width: 700px) {
  .team-row .names { font-size: 24px; }
  .box { min-width: 52px; height: 66px; font-size: 36px; }
  .box.pts { min-width: 100px; height: 72px; font-size: 50px; }
  .point-btn .big { font-size: 84px; }
}

/* Colores rápidos para avatares */
.bg-a { background: var(--a); } .bg-b { background: var(--b); }

