:root {
  --grass-900: #06281d;
  --grass-800: #093827;
  --grass-700: #0e5c3a;
  --grass-500: #18a558;
  --line: rgba(255, 255, 255, 0.15);
  --card: rgba(255, 255, 255, 0.09);
  --card-strong: rgba(255, 255, 255, 0.14);
  --text: #f8fafc;
  --muted: #bdd4c7;
  --gold: #ffd166;
  --red: #ef476f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(24, 165, 88, 0.45), transparent 35%),
    radial-gradient(circle at bottom right, rgba(255, 209, 102, 0.18), transparent 30%),
    linear-gradient(135deg, var(--grass-900), var(--grass-800));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(255,255,255,0.08) 49.8%, rgba(255,255,255,0.08) 50.2%, transparent 50.3%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 96px);
  opacity: 0.75;
}

.app {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
  position: relative;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.18);
  font-weight: 700;
  font-size: 0.88rem;
}

h1 {
  margin: 16px 0 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: -0.05em;
  line-height: 0.98;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.bracket-card,
.form-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.bracket-card {
  padding: 22px;
  overflow-x: auto;
}

.bracket {
  display: grid;
  grid-template-columns: minmax(320px, 1.4fr) minmax(260px, 1fr) minmax(240px, 0.9fr);
  gap: 22px;
  min-width: 860px;
}

.round {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.round h2 {
  margin: 0 0 2px;
  font-size: 1rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.match {
  position: relative;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.13), rgba(255,255,255,0.055));
  min-height: 156px;
}

.match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -23px;
  width: 23px;
  border-top: 2px dashed rgba(255,255,255,0.22);
}

.round-final .match::after {
  display: none;
}

.match-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.13);
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
}

.team-row {
  display: grid;
  grid-template-columns: 42px 1fr 64px;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.15);
}

.crest {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.35));
}

.team-name {
  font-size: 1rem;
  font-weight: 800;
}

.goal-input {
  width: 58px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 14px;
  text-align: center;
  color: var(--text);
  background: rgba(255,255,255,0.11);
  font-size: 1.05rem;
  font-weight: 900;
  outline: none;
}

.goal-input:focus,
#playerName:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.14);
}

.vs {
  margin: 7px 0;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.empty-team {
  padding: 17px 14px;
  border: 1px dashed rgba(255,255,255,0.24);
  border-radius: 16px;
  color: rgba(248,250,252,0.72);
  background: rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

.final-card {
  border-color: rgba(255, 209, 102, 0.4);
}

.form-card {
  margin-top: 24px;
  padding: 22px;
}

.form-card label {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-weight: 900;
}

.save-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

#playerName {
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255,255,255,0.1);
  font-size: 1rem;
  outline: none;
}

#playerName::placeholder {
  color: rgba(248,250,252,0.5);
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 16px;
  padding: 0 18px;
  min-height: 52px;
  color: #06281d;
  background: var(--gold);
  font-weight: 950;
  font-size: 0.98rem;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.secondary-btn,
.danger-btn {
  margin-top: 12px;
  margin-right: 8px;
  min-height: 42px;
  color: var(--text);
  background: rgba(255,255,255,0.14);
  border: 1px solid var(--line);
}

.danger-btn {
  background: rgba(239, 71, 111, 0.16);
  border-color: rgba(239, 71, 111, 0.32);
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.status.error {
  color: #ffb4c6;
}

.status.success {
  color: #bcffd7;
}

.local-results {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.local-results summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 800;
}

.results-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.result-item {
  padding: 12px;
  border-radius: 14px;
  background: rgba(0,0,0,0.16);
  color: var(--muted);
  font-size: 0.92rem;
}

.result-item strong {
  color: var(--text);
}



.penalty-box {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255, 209, 102, 0.24);
  border-radius: 16px;
  background: rgba(255, 209, 102, 0.08);
}



.penalty-box[hidden] {
  display: none !important;
}

.penalty-box span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.penalty-winner {
  min-height: 40px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 12px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(255,255,255,0.11);
  font-weight: 800;
  outline: none;
}

.penalty-winner:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.14);
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 620px);
    padding: 22px 0;
  }

  .bracket-card {
    padding: 14px;
    border-radius: 22px;
  }

  .bracket {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .match::after {
    display: none;
  }

  .round {
    gap: 14px;
  }

  .save-row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .team-row {
    grid-template-columns: 38px 1fr 58px;
  }

  .crest {
    width: 38px;
    height: 38px;
  }
}


.login-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  padding: 22px;
  max-width: 620px;
  margin: 0 auto 24px;
}

.login-content h2,
.server-results h2 {
  margin: 0;
  color: var(--gold);
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.login-content p {
  margin: 10px 0 16px;
  color: var(--muted);
}

.login-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

#loginPassword {
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--text);
  background: rgba(255,255,255,0.1);
  font-size: 1rem;
  outline: none;
}

#loginPassword::placeholder {
  color: rgba(248,250,252,0.5);
}

#loginPassword:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.14);
}

.server-results {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.results-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.result-grid {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.result-match {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.result-match span:last-child {
  color: var(--text);
  font-weight: 900;
}

@media (max-width: 760px) {
  .login-row,
  .results-header {
    grid-template-columns: 1fr;
    display: grid;
  }
}


/* V5.1 - Corrige contraste del desplegable de penaltis en navegadores que renderizan opciones con fondo claro */
.penalty-winner option {
  color: #06281d;
  background: #ffffff;
}

.penalty-winner option:checked {
  color: #06281d;
  background: #ffd166;
}
