:root {
  --azul: #0053EA;
  --violeta: #6B5BE2;
  --navy: #0B2559;
  --texto: #4F5F80;
  --borde: #D6E0F5;
  --amarillo: #EEBA2C;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--navy); font-family: 'Everyday Sans', Arial, Helvetica, sans-serif; font-size: 16px; background: linear-gradient(180deg, #F4F8FD 0%, #D3E5F7 30%, #BCD6F1 65%, #E1ECF8 100%); min-height: 100svh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 3px; }
.wrap { width: min(1320px, 100%); margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }
.nav { background: #FFFFFFF5; color: var(--azul); border-bottom: 1px solid var(--borde); }
.nav-inner { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand strong { font-size: 22px; font-weight: 800; letter-spacing: -.03em; }
.brand small { display: block; color: #5945B5; font-size: 13px; margin-top: 3px; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.button { min-height: 44px; border: 1px solid var(--borde); border-radius: 999px; color: var(--azul); background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; font-size: 14px; font-weight: 700; }
.button svg, .search svg { width: 20px; height: 20px; flex-shrink: 0; }
.icon-button { width: 44px; padding: 10px; }
.share-button { background: var(--azul); color: white; border-color: var(--azul); }
.button:hover { box-shadow: inset 0 0 0 1px currentColor; }
.button:disabled { cursor: wait; opacity: .5; }
main { flex: 1; }
.intro { padding: 36px 0 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 10px; font-size: 12px; letter-spacing: .1em; color: #5945B5; font-weight: 800; line-height: 1.5; }
h1 { font-size: clamp(28px, 3.5vw, 42px); line-height: 1.15; letter-spacing: -.045em; margin: 0; font-weight: 800; }
.intro-text { margin: 10px 0 0; color: var(--texto); line-height: 1.5; }
.live { display: flex; align-items: center; gap: 10px; color: var(--texto); font-size: 13px; padding-bottom: 4px; flex-shrink: 0; }
.connection-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: #8393AE; }
.connection-dot.connected { background: #15803D; box-shadow: 0 0 0 4px #15803D12; }
.connection-dot.error { background: #B45309; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px; border: 1px solid var(--borde); border-radius: 16px; background: #FFFFFFDC; }
.stat > span { font-size: 14px; font-weight: 600; color: var(--texto); line-height: 1.4; }
.stat > strong { font-size: 32px; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.stat-finished { background: #EAF7F0; border-color: #C1E5D2; }
.stat-finished strong { color: #14763D; }
.stat-motto strong { color: #5945B5; }
.ranking-card { overflow: hidden; background: white; border-radius: 20px; border: 1px solid var(--borde); box-shadow: 0 12px 36px #0B255908; }
.ranking-heading { padding: 26px 28px 20px; }
.ranking-heading .eyebrow { margin-bottom: 5px; }
h2 { font-size: 26px; font-weight: 800; letter-spacing: -.035em; margin: 0; line-height: 1.25; }
.ranking-heading p:last-child { font-size: 14px; line-height: 1.5; margin: 9px 0 0; color: var(--texto); max-width: 54ch; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; padding: 0 28px 18px; }
.filters { display: flex; padding: 4px; border-radius: 12px; background: #F0F3FA; gap: 4px; }
.filter-button { min-height: 44px; border: 0; border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 700; background: transparent; color: var(--texto); }
.filter-button[aria-pressed="true"] { background: var(--azul); color: white; box-shadow: 0 2px 6px #0053EA25; }
.filter-button:hover { box-shadow: inset 0 0 0 1px var(--azul); }
.search { position: relative; min-width: 0; width: min(320px, 40%); display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; color: var(--texto); pointer-events: none; }
input { width: 100%; border-radius: 12px; border: 1px solid var(--borde); padding: 13px 12px 13px 42px; min-height: 48px; color: var(--navy); background: #FAFBFE; font-size: 16px; }
input::placeholder { color: #627291; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 0 28px 20px; color: var(--texto); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; }
.legend-done { background: #15803D; }
.legend-locked { background: #B45309; }
.legend-pending { background: #B9C6DD; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { padding: 14px 14px; background: #F7F9FD; border-top: 1px solid #E5EBF5; border-bottom: 1px solid #E5EBF5; color: var(--texto); font-size: 12px; font-weight: 700; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 28px; }
th:last-child, td:last-child { padding-right: 28px; }
td { border-bottom: 1px solid #E9EEF7; padding: 22px 14px; font-size: 14px; }
.participant-group th { background: #EEF3FD; color: var(--navy); padding-top: 14px; padding-bottom: 14px; font-size: 14px; }
.participant-group.finished-group th { background: #EDF8F2; color: #126B37; }
.group-count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; min-height: 24px; margin-left: 10px; border-radius: 7px; background: #FFFFFFB3; font-size: 12px; }
.participant-row:hover { background: #FAFBFF; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 11px; font-weight: 800; color: #5945B5; background: #F0EDFF; }
.rank-first { background: #FFF1BD; color: #775500; border: 1px solid #E9D281; }
.rank-pending { display: inline-flex; width: 34px; justify-content: center; color: #7283A0; }
.nickname { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; min-width: 130px; }
.started { display: block; color: var(--texto); font-size: 12px; margin-top: 6px; font-weight: 400; }
.station-progress { display: flex; gap: 5px; }
.station { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px; font-size: 14px; font-weight: 700; border: 1px solid #D6E0F5; background: #F5F7FC; color: #536587; border-radius: 7px; }
.station.completado { background: #E8F6EF; color: #14763D; border-color: #A9DABE; }
.station.bloqueado { background: #FFF4E5; color: #965307; border-color: #E6C08A; }
.progress-label { display: block; font-size: 12px; margin-top: 8px; color: var(--texto); line-height: 1.4; }
.status { font-size: 14px; font-weight: 600; display: inline-block; border-radius: 8px; padding: 7px 9px; white-space: nowrap; background: #EEF3FF; color: #3456A0; }
.status.finished { background: #E8F6EF; color: #14763D; }
.status.motto { background: #F0EDFF; color: #5945B5; }
.time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-value { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.time-label { display: block; color: var(--texto); font-size: 12px; margin-top: 5px; }
.time.finished .time-value { color: #14763D; }
.finished-at { color: var(--texto); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; }
.card-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 28px; background: #FBFCFF; color: var(--texto); font-size: 12px; line-height: 1.4; }
.empty-state { padding: 40px 24px; text-align: center; }
.empty-state h3 { font-size: 18px; margin: 0 0 10px; }
.empty-state p { color: var(--texto); font-size: 16px; line-height: 1.5; margin: 0; }
.access-message { background: white; border: 1px solid var(--borde); padding: 28px; border-radius: 16px; margin: 12px 0 40px; }
.access-message p { line-height: 1.6; color: var(--texto); margin: 12px 0 0; }
.read-only-note { text-align: center; font-size: 12px; line-height: 1.6; color: var(--texto); margin: 20px 0 0; }
.notice { color: #965307; font-size: 14px; line-height: 1.6; margin: 16px 0 26px; text-align: center; }
.notice:empty { margin: 0 0 24px; }
.footer { margin-top: 20px; color: #C9D3EA; background: var(--navy); }
.footer .wrap { min-height: 80px; display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: 12px; }
.footer strong { color: white; font-size: 18px; }
.footer strong span { font-weight: 400; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 1000px) {
  .intro { align-items: flex-start; flex-direction: column; gap: 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .nav-inner { min-height: 72px; gap: 8px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 19px; }
  .brand small { font-size: 12px; }
  .brand img { width: 28px; height: 28px; }
  .share-button { padding: 10px; font-size: 14px; gap: 6px; }
  .header-actions { gap: 6px; }
  .intro { padding: 26px 0 20px; gap: 16px; }
  .intro .eyebrow { font-size: 11px; letter-spacing: .075em; }
  .intro-text { margin-top: 8px; }
  .stats { gap: 8px; margin-bottom: 18px; }
  .stat { padding: 14px; border-radius: 12px; gap: 8px; }
  .stat > strong { font-size: 28px; }
  .ranking-card { border-radius: 16px; }
  .ranking-heading { padding: 22px 16px 18px; }
  h2 { font-size: 23px; }
  .toolbar { flex-direction: column; gap: 12px; padding: 0 16px 16px; }
  .filters { width: 100%; }
  .filter-button { flex: 1; min-width: 0; padding: 10px 7px; }
  .search { width: 100%; }
  .legend { padding: 0 16px 18px; gap: 12px; }
  .table-scroll { overflow: visible; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .participant-group { display: block; }
  .participant-group th { display: block; padding: 13px 16px; white-space: normal; }
  .participant-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: 'position nickname time' 'stations stations stations' 'status status status' 'finish finish finish'; column-gap: 10px; row-gap: 16px; padding: 20px 16px; border-bottom: 1px solid #E9EEF7; }
  td, td:first-child, td:last-child { display: block; padding: 0; border: 0; }
  .participant-row.is-pending { grid-template-areas: 'position nickname time' 'stations stations stations' 'status status status'; }
  .position { grid-area: position; }
  .nickname { grid-area: nickname; min-width: 0; line-height: 1.4; }
  .progress-cell { grid-area: stations; }
  .status-cell { grid-area: status; }
  .time { grid-area: time; text-align: right; }
  .time-value { font-size: 19px; }
  .time-label { font-size: 12px; }
  .station-progress { gap: 7px; }
  .station { width: auto; height: 34px; flex: 1; }
  .progress-label { font-size: 13px; }
  .finished-at { grid-area: finish; }
  .finished-at::before { content: 'Finalizó a las '; }
  td.pending-date { display: none; }
  .card-footer { padding: 16px; flex-direction: column; gap: 6px; }
  .footer .wrap { padding-top: 22px; padding-bottom: 22px; flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 420px) {
  .share-button span { display: none; }
  .share-button { width: 44px; }
}
@media (max-width: 360px) {
  .stat { padding: 12px; }
}

.login-panel { max-width: 480px; margin: 12px auto 40px; }
.login-panel .eyebrow { margin: 0 0 8px; color: #5945B5; font-size: 12px; font-weight: 800; }
.login-panel form { margin-top: 24px; }
.login-panel label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.login-panel input { padding: 14px; }
.login-panel .login-error { color: #9C3018; font-size: 14px; min-height: 20px; margin: 10px 0; }
.login-panel .login-submit { width: 100%; font-size: 16px; min-height: 48px; }
