:root {
  --bg: #0f1115; --card: #181b22; --card2: #222631; --line: #2e3340; --text: #f5f1e8; --muted: #9aa0ad;
  --acc: #ff6a4d; --acc-bg: rgba(255, 106, 77, .14); --ok: #3ddbb0; --ok-bg: rgba(61, 219, 176, .14);
  --red: #ff4d6d; --red-bg: rgba(255, 77, 109, .14); --radius: 16px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: "Arial Black", "Segoe UI Black", Impact, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: radial-gradient(1000px 480px at 50% -120px, #2a2236, var(--bg)); background-attachment: fixed; color: var(--text); font: 15px/1.45 var(--sans); min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px 120px; gap: 18px; }
.login .ficha { color: var(--acc); }
.ico { width: 1.25em; height: 1.25em; vertical-align: -.25em; flex: none; }
.btn .ico, .chip .ico { margin-right: 6px; }
.top .back .ico { width: 26px; height: 26px; }
.login h1 { font-family: var(--display); font-style: italic; color: var(--acc); text-transform: uppercase; font-size: 26px; text-align: center; }
.login .card { width: 100%; max-width: 380px; }
.login .sub { color: var(--muted); text-align: center; margin: 0; font-size: 13px; }

.shell { max-width: 820px; margin: 0 auto; padding: 0 14px calc(96px + env(safe-area-inset-bottom)); }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; margin: 0 -14px;
  background: rgba(15, 17, 21, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top b { flex: 1; font-family: var(--display); font-style: italic; text-transform: uppercase; font-size: 15px; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { background: none; border: 0; font-size: 22px; padding: 0 6px; color: var(--acc); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--card2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.gold { background: var(--acc-bg); color: var(--acc); border-color: rgba(255, 106, 77, .35); }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(76, 194, 122, .35); }
.chip.red { background: var(--red-bg); color: var(--red); border-color: rgba(255, 107, 95, .35); }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; gap: 4px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(12, 14, 18, .96); border-top: 1px solid var(--line); }
.tabs button { flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; background: none; border: 0; border-radius: 12px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tabs button .ico { width: 26px; height: 26px; margin: 0; }
.tabs button.on { color: var(--acc); background: var(--acc-bg); }

.view { padding-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
h2.sec { font-family: var(--display); font-style: italic; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; color: var(--acc); margin: 6px 2px -4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.vacio { color: var(--muted); text-align: center; padding: 22px 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.sp { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
input[type=text], input[type=password], input[type=number], input[type=date], select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0d0f13; font-size: 16px; }
input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; min-height: 46px; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
input:focus, select:focus { outline: 2px solid var(--acc); outline-offset: 0; }
.btn { background: var(--acc); color: #1c0b06; border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 800; }
.btn.sec { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.red { background: var(--red); color: #fff; }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 11px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); font-weight: 700; }
.seg button.on { background: var(--acc); color: #1c0b06; border-color: var(--acc); }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

.sub-tabs { display: flex; gap: 6px; }
.sub-tabs button { flex: 1; padding: 9px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-weight: 700; font-size: 13px; }
.sub-tabs button.on { background: var(--acc-bg); color: var(--acc); border-color: rgba(255, 106, 77, .4); }

.torneo { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.torneo b { font-size: 16px; }

.mesa { border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--card); }
.mesa h3 { font-family: var(--display); font-style: italic; font-size: 13px; text-transform: uppercase; color: var(--acc); margin-bottom: 8px; }
.eq { display: grid; grid-template-columns: 1fr 76px; gap: 8px; align-items: center; padding: 6px 0; }
.eq .n { font-size: 16px; font-weight: 600; line-height: 1.25; }
.eq .p { text-align: center; font-family: var(--display); font-size: 26px; }
.eq.gana .n, .eq.gana .p { color: var(--ok); }
.eq input { text-align: center; font-size: 20px; font-weight: 800; padding: 9px 4px; }
.vs { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.descansa { color: var(--muted); font-size: 14px; padding: 4px 2px; display: flex; align-items: center; gap: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 8px 4px; text-align: center; }
td { padding: 9px 4px; text-align: center; border-top: 1px solid var(--line); }
th:nth-child(2), td:nth-child(2) { text-align: left; }
td.pos { font-family: var(--display); color: var(--muted); width: 28px; }
tr.top1 td { color: var(--acc); font-weight: 700; }
.podio { text-align: center; padding: 18px 10px; background: linear-gradient(135deg, #3b1f19, var(--card)); border: 1px solid rgba(255, 106, 77, .4); border-radius: var(--radius); }
.podio .t { color: var(--acc); } .podio .t .ico { width: 54px; height: 54px; }
.podio .n { font-family: var(--display); font-size: 22px; color: var(--acc); margin: 4px 0; }
.chk { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-top: 1px solid var(--line); margin: 0; font-size: 16px; color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 500; }
.chk input { width: 20px; height: 20px; accent-color: var(--acc); }
.chk:first-of-type { border-top: 0; }

#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: #000; border: 1px solid var(--line); padding: 10px 18px; border-radius: 99px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; max-width: 90vw; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.mal { border-color: var(--red); color: var(--red); }

#instalar { position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--card2); border: 1px solid var(--acc); border-radius: 14px; }
body:has(.tabs) #instalar { bottom: calc(84px + env(safe-area-inset-bottom)); }
body:has(#instalar:not([hidden])) .shell { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
#instalar[hidden], #hoja-ios[hidden] { display: none; }
#instalar div { flex: 1; font-size: 13px; line-height: 1.3; } #instalar strong, #instalar span { display: block; }
#instalar .si { background: var(--acc); color: #1c0b06; border: 0; border-radius: 9px; padding: 8px 14px; font-weight: 800; }
#instalar .no { background: none; border: 0; font-size: 22px; color: var(--muted); }
#hoja-ios { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .7); display: flex; align-items: flex-end; }
#hoja-ios .caja { background: var(--card); width: 100%; padding: 20px; border-radius: 20px 20px 0 0; }
#hoja-ios button.ok { background: var(--acc); border: 0; border-radius: 12px; padding: 12px; width: 100%; font-weight: 800; color: #1c0b06; }
#instalar img { border-radius: 10px; }
