/* ---- Paleta (misma que la app Flet) ---- */
:root {
    --bg: #0F1115;
    --surface: #181B22;
    --surface2: #212530;
    --accent: #5B8DEF;
    --accent-soft: #2A3550;
    --text: #E7E9EE;
    --muted: #8A90A0;
    --green: #4ADE80;
    --red: #F87171;
    --gold: #FBBF24;
    --silver: #CBD5E1;
    --bronze: #D89A6A;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* ---- tipografía ---- */
h1 { font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.label { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .5px; margin: 18px 0 8px; }

/* ---- inputs ---- */
input[type=text], input[type=password], input[type=number] {
    width: 100%;
    height: 54px;
    background: var(--surface);
    border: 1px solid var(--surface2);
    border-radius: 14px;
    color: var(--text);
    font-size: 16px;
    padding: 0 16px;
    outline: none;
}
input:focus { border-color: var(--accent); }
input.num { text-align: center; font-size: 18px; }

/* ---- botones ---- */
.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 58px; border: none; border-radius: 16px;
    background: var(--accent); color: var(--bg);
    font-size: 18px; font-weight: 700; cursor: pointer;
    width: 100%; text-decoration: none;
}
.btn:active { opacity: .85; }
.btn-sec {
    height: 52px; background: var(--surface); color: var(--muted);
    border-radius: 14px; font-size: 15px; font-weight: 500;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; text-decoration: none; border: none; width: 100%;
}
.btn-accent { color: var(--accent); }
.btn-text { color: var(--text); }

/* ---- tarjetas ---- */
.card {
    background: var(--surface);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--text);
}
.card.click { cursor: pointer; }
.card.click:active { opacity: .9; }
.card .grow { flex: 1; min-width: 0; }
.card .title { font-size: 17px; font-weight: 700; }
.card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- chips ---- */
.chip {
    display: inline-flex; align-items: center;
    font-size: 12px; font-weight: 600;
    padding: 3px 10px; border-radius: 20px; margin-left: 8px;
}
.chip-live { background: var(--accent-soft); color: var(--accent); }
.chip-done { background: var(--surface2); color: var(--muted); }
.chip-fail { background: #3A2222; color: var(--red); margin-left: 8px; }

/* ---- filas de jugadores en setup ---- */
.player-row {
    background: var(--surface); border-radius: 14px;
    padding: 4px 4px 4px 14px; margin-bottom: 8px;
    display: flex; align-items: center; gap: 4px;
}
.num-badge {
    width: 30px; height: 30px; border-radius: 20px;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.player-row .pname { flex: 1; font-size: 17px; }
.icon-btn {
    background: none; border: none; color: var(--muted);
    font-size: 22px; cursor: pointer; padding: 8px; line-height: 1;
    text-decoration: none;
}
.icon-btn.red { color: var(--red); }

/* ---- cabecera de juego ---- */
.header {
    background: var(--surface); border-radius: 18px; padding: 20px;
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.header .bar { width: 5px; height: 46px; background: var(--accent); border-radius: 4px; }
.header .tlabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.header .tname { font-size: 22px; font-weight: 700; }
.header .right { margin-left: auto; text-align: right; }
.header .goal { font-size: 22px; font-weight: 700; color: var(--accent); }

/* ---- tarjeta de jugador en juego ---- */
.pcard {
    background: var(--surface); border-radius: 18px; padding: 18px;
    margin-bottom: 12px; border: 2px solid transparent;
}
.pcard.turn { border-color: var(--accent); }
.pcard .top { display: flex; align-items: center; gap: 8px; }
.pcard .top .name { font-size: 18px; font-weight: 600; }
.pcard.turn .top .name { font-weight: 800; }
.pcard .top .score { margin-left: auto; font-size: 34px; font-weight: 800; }
.pcard.turn .top .score { color: var(--accent); }
.hist { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tira {
    font-size: 13px; font-weight: 600;
    padding: 3px 9px; border-radius: 7px; background: var(--surface2);
}
.tira.pos { color: var(--green); }
.tira.neg { color: var(--red); }
.tira.zero { color: var(--muted); }
.hist .empty { color: var(--muted); font-size: 13px; }

/* ---- botonera de puntos ---- */
.grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-top: 8px;
}
.numbtn {
    border: none; background: var(--surface2); color: var(--text);
    border-radius: 16px; font-size: 26px; font-weight: 700;
    aspect-ratio: 1.35 / 1; cursor: pointer;
}
.numbtn:active { opacity: .8; }
.failbtn {
    width: 100%; height: 58px; margin-top: 10px;
    border: none; background: #2A1E1E; color: var(--red);
    border-radius: 16px; font-size: 18px; font-weight: 700; cursor: pointer;
}

/* ---- podio ---- */
.podium-top { text-align: center; margin: 10px 0; }
.podium-top .trophy { font-size: 52px; }
.podium-top .msg { font-size: 24px; font-weight: 800; margin-top: 6px; }
.podium-top .win { font-size: 16px; color: var(--gold); font-weight: 600; }
.prow {
    background: var(--surface); border-radius: 16px; padding: 16px;
    margin-bottom: 10px; display: flex; align-items: center; gap: 14px;
    border: 2px solid transparent;
}
.prow.first { border-color: var(--gold); }
.prow .medal { font-size: 26px; width: 34px; text-align: center; }
.prow .pos {
    width: 34px; height: 34px; border-radius: 20px; background: var(--surface2);
    color: var(--muted); font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.prow .pname { flex: 1; font-size: 18px; font-weight: 600; }
.prow .pscore { font-size: 24px; font-weight: 800; }

/* ---- utilidades ---- */
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.center { text-align: center; }
.err { color: var(--red); font-size: 14px; margin-top: 10px; }
.add-btn {
    width: 54px; height: 54px; flex-shrink: 0;
    background: var(--accent); border: none; border-radius: 14px;
    color: var(--bg); font-size: 26px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.topbar .back { color: var(--text); font-size: 24px; text-decoration: none; padding: 4px; }
.topbar h2 { font-size: 22px; font-weight: 700; }
.logout { color: var(--muted); font-size: 13px; text-decoration: none; margin-left: auto; }
.inline-form { display: flex; gap: 10px; align-items: stretch; }
.inline-form input { flex: 1; }
