/* SC2 Torneo — estilos globales.
   Estiliza directamente las etiquetas HTML de las páginas existentes.
   Tema por raza: <html data-race="protoss|terran|zerg"> */
:root {
  --bg: #080b16; --surface: #0f1424; --surface-2: #161c33; --line: #26304f;
  --text: #e6ebf7; --muted: #8a95b5;
  --ok: #4ade80; --danger: #f87171;
  --accent: #4cc3ff; --accent-2: #f0c25a; --accent-ink: #04111c;
  --cut: 14px; --maxw: 1180px;
  --font-display: "Rajdhani", "Segoe UI", sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;
}
[data-race="terran"] { --accent: #ff9a3c; --accent-2: #7fa3c9; --accent-ink: #1a0d00; }
[data-race="zerg"]   { --accent: #c45bff; --accent-2: #ff4d7d; --accent-ink: #14001f; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg);
  color: var(--text); font: 400 1rem/1.6 var(--font-body);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { width: min(100% - 2rem, var(--maxw)); margin-inline: auto; display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font: 700 1.5rem var(--font-display);
    color: var(--text);
    text-decoration: none;
}
.brand:hover {
    text-decoration: none;
}
/* Elimina por completo la clase .brand-mark, ya no se usa */

.brand-logo {
    display: inline-block;
    height: 45px; /* Ajusta este número para hacerlo más grande o pequeño */
    width: auto;  /* Esto hace que el ancho se calcule solo manteniendo la proporción */
    object-fit: contain;
	max-width: 180px;
    /* Si el logo es muy oscuro, puedes añadir un filtro drop-shadow para que resalte */
    filter: drop-shadow(0 0 8px var(--accent));
}

.brand-text {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: .04em;
    white-space: nowrap;
}
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); padding: .5rem .9rem; font: 600 1.05rem var(--font-display); border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.role-tag { font: 700 .85rem var(--font-display); color: var(--accent-2); border: 1px solid var(--accent-2); padding: 0 .5rem; }
.nav-toggle { display: none; margin-left: auto; }
.race-switch { display: flex; gap: .3rem; margin-left: .5rem; }
.race-switch button { width: 30px; height: 30px; padding: 0; }
.race-switch button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- Contenido ---------- */
.page { flex: 1; width: min(100% - 2rem, var(--maxw)); margin-inline: auto; padding-block: 2rem 3rem; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin-top: 0; }
h1::after { content: ""; display: block; width: 64px; height: 4px; background: var(--accent); margin-top: .5rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.35rem; } h4 { font-size: 1.1rem; color: var(--muted); }
p { max-width: 75ch; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
small { color: var(--muted); }
li::marker { color: var(--accent); }
ul, ol { padding-left: 1.3rem; }

/* ---------- Tablas ---------- */
table { display: block; max-width: 100%; overflow-x: auto; border: 0; border-collapse: collapse; background: var(--surface); margin: .5rem 0 1rem; }
th, td { padding: .65rem 1rem; text-align: left; border: 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font: 600 .95rem var(--font-display); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tbody tr:hover, table tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
td form { display: inline; }

/* ---------- Botones y formularios ---------- */
button, input[type="submit"], .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .45rem 1.1rem; border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font: 700 1.02rem var(--font-display); cursor: pointer; text-decoration: none;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
  transition: background .15s, color .15s;
}
button:hover, .btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); text-decoration: none; }
button[type="submit"]:not(.race-switch button), .btn-primary { background: var(--accent); color: var(--accent-ink); }
button[type="submit"]:not(.race-switch button):hover, .btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]), select, textarea {
  background: var(--surface); border: 1px solid var(--line); color: var(--text); padding: .55rem .75rem; font: inherit; border-radius: 0; max-width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--accent); }
label { font-weight: 500; }
td input:not([type="radio"]):not([type="checkbox"]) { padding: .3rem .5rem; }

/* ---------- Tarjetas: formularios, secciones y acordeones ---------- */
.page > form, .page > section, .page > details, .page section[style], details {
  background: var(--surface) !important; border: 0 !important; border-left: 3px solid var(--accent) !important;
  padding: 1.1rem 1.3rem !important; margin: 0 0 1.2rem !important;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}
details table { background: var(--bg); }
summary { cursor: pointer; font: 600 1.15rem var(--font-display); }
details[open] summary { margin-bottom: .6rem; }

/* ---------- Mensajes (los <p style="color:red/green"> existentes) ---------- */
p[style*="red"], p[style*="green"] { color: var(--text) !important; background: var(--surface); padding: .8rem 1rem; border-left: 3px solid var(--danger); max-width: none; }
p[style*="green"] { border-left-color: var(--ok); }

/* ---------- Footer ---------- */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); background: var(--surface); padding: 1.8rem 0; }
.footer-inner { width: min(100% - 2rem, var(--maxw)); margin-inline: auto; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.footer-inner a { color: var(--muted); } .footer-inner a:hover { color: var(--accent); }
.footer-links { display: flex; gap: 1.2rem; flex-wrap: wrap; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: .5rem 1rem; margin: 0; }
  .nav.open { display: flex; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Clasificación (tarjetas) ---------- */
.ranking { list-style: none; padding: 0; margin: 1rem 0 1.5rem; display: grid; gap: .7rem; }
.rank-card {
  display: grid; grid-template-columns: 56px 1fr auto auto; align-items: center; gap: 1rem;
  background: var(--surface); border-left: 3px solid var(--line); padding: .8rem 1rem;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.rank-card:hover { background: var(--surface-2); }
.rank-card.pos-1 { border-left-color: #f0c25a; background: linear-gradient(90deg, color-mix(in srgb, #f0c25a 14%, var(--surface)), var(--surface) 60%); }
.rank-card.pos-2 { border-left-color: #c0c8d8; }
.rank-card.pos-3 { border-left-color: #cd7f32; }
.rank-pos { font: 700 2rem var(--font-display); text-align: center; color: var(--muted); }
.pos-1 .rank-pos { color: #f0c25a; } .pos-2 .rank-pos { color: #c0c8d8; } .pos-3 .rank-pos { color: #cd7f32; }
.rank-who strong { display: block; font: 700 1.25rem var(--font-display); }
.rank-who small { color: var(--muted); margin-right: .6rem; }
.chip { display: inline-block; padding: 0 .55rem; border: 1px solid var(--accent-2); color: var(--accent-2); font: 700 .85rem var(--font-display); }
.rank-stats { display: flex; gap: 1.1rem; margin: 0; }
.rank-stats div { text-align: center; }
.rank-stats dt { font-size: .8rem; color: var(--muted); }
.rank-stats dd { margin: 0; font: 700 1.15rem var(--font-display); }
.rank-pts { text-align: right; line-height: 1; }
.rank-pts b { display: block; font: 700 2rem var(--font-display); color: var(--accent); }
.rank-pts small { color: var(--muted); }
.members { list-style: none; padding: 0; margin: .3rem 0 0; color: var(--muted); font-size: .9rem; }
@media (max-width: 700px) {
  .rank-card { grid-template-columns: 44px 1fr auto; }
  .rank-stats { grid-column: 1 / -1; justify-content: space-between; }
}

/* ---------- Cuadro de eliminación ---------- */
.bracket-scroll { overflow-x: auto; padding: .5rem 0 1rem; }
.bracket { display: flex; gap: 28px; align-items: stretch; min-width: max-content; }
.round { display: flex; flex-direction: column; width: 260px; }
.round-title { margin: 0 0 .6rem; font-size: 1.15rem; color: var(--accent-2); text-align: center; }
.round-body { flex: 1; display: flex; flex-direction: column; }
.pair { flex: 1; display: flex; flex-direction: column; position: relative; }
.bm-wrap { flex: 1; display: flex; align-items: center; padding: .4rem 0; }
.pair.joined::after { content: ""; position: absolute; right: -14px; top: 25%; bottom: 25%; width: 14px; border: 2px solid var(--line); border-left: 0; }
.pair.joined::before { content: ""; position: absolute; right: -28px; top: 50%; width: 14px; border-top: 2px solid var(--line); }
.bm {
  width: 100%; background: var(--surface); border-left: 3px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.bm.finished { border-left-color: var(--accent); }
.bm.in_progress { border-left-color: var(--danger); }
.bm-head { display: flex; justify-content: space-between; padding: .3rem .7rem; font: 600 .85rem var(--font-display); color: var(--muted); border-bottom: 1px solid var(--line); }
.bm-row { display: flex; justify-content: space-between; gap: .8rem; padding: .4rem .7rem; }
.bm-row.win { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-2); font-weight: 600; }
.bm-row.tbd { color: var(--muted); font-style: italic; }
.bm-score { font: 700 1.1rem var(--font-display); }
.bm-foot { padding: .3rem .7rem .5rem; font: 600 .95rem var(--font-display); }
.bracket-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.third-place { max-width: 260px; }

.inline-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
}

.inline-fields label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.inline-fields input {
  width: 8rem;
}

@media (max-width: 640px) {
    .brand-logo { 
        height: 32px; 
    }
}