* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    font-family: Inter, system-ui, sans-serif;
    background: #0b1120;
    color: #e2e8f0;
}
button, input { font: inherit; }
.top {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.7rem 0.8rem;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
}
.top-row { display: flex; align-items: center; gap: 0.75rem; }
.score { margin: 0; font-size: 0.9rem; font-weight: 700; }
.score .ok { color: #4ade80; }
.score .bad { color: #f87171; }
.score b { color: #93c5fd; }
.timer {
    position: relative;
    flex: 1;
    height: 2.6rem;
    border-radius: 999px;
    background: #1e293b;
    overflow: hidden;
}
.timer-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    background: #2563eb;
}
.timer-fill.low { background: #dc2626; }
#timer-label {
    position: relative;
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}
.top-side { display: flex; align-items: center; gap: 0.4rem; }
.who { font-size: 0.8rem; color: #94a3b8; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost, #btn-next, form button {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 0.7rem;
    padding: 0.45rem 0.7rem;
    font-weight: 800;
}
main { padding: 1rem; max-width: 1180px; margin: 0 auto; }
.card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 1rem;
    padding: 1.1rem;
}
h1, h2 { margin: 0 0 0.4rem; }
p { color: #94a3b8; line-height: 1.45; }
form { display: flex; gap: 0.5rem; margin-top: 1rem; }
input {
    flex: 1;
    background: #020617;
    border: 1px solid #334155;
    color: white;
    border-radius: 0.7rem;
    padding: 0.7rem 0.8rem;
}
form button { background: #2563eb; border-color: #2563eb; }
.error { color: #fca5a5; }
.patch { margin: 0 0 0.6rem; font-size: 0.85rem; }
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.side {
    text-align: left;
    border-radius: 1rem;
    padding: 0.7rem;
    color: inherit;
    min-height: 18rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.side.blue { background: #172554; border: 2px solid #1d4ed8; }
.side.red { background: #450a0a; border: 2px solid #b91c1c; }
.side-name, .side-go { font-weight: 800; text-align: center; }
.side-go { margin-top: auto; background: rgba(0,0,0,.25); border-radius: 0.7rem; padding: 0.55rem; }
.team { display: flex; flex-direction: column; gap: 0.45rem; }
.champ {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 0.55rem;
    align-items: center;
    min-width: 0;
    padding: 0.35rem 0.2rem;
    border-radius: 0.75rem;
    background: rgba(2, 6, 23, 0.28);
}
.face { width: 58px; height: 58px; border-radius: 12px; background: #0f172a; }
.line { display: flex; align-items: baseline; gap: 0.45rem; min-width: 0; margin-bottom: 0.28rem; }
.line b { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line em { color: #cbd5e1; font-size: 0.72rem; font-style: normal; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; flex: none; }
.loadout { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.spells, .runes { display: flex; align-items: center; gap: 0.28rem; }
.loadout img { width: 32px; height: 32px; background: #020617; flex: none; }
.spells img { border-radius: 7px; }
.runes img { border-radius: 50%; }
#flash {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.62);
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 800;
}
#flash.ok { color: #4ade80; }
#flash.bad { color: #f87171; }
[hidden] { display: none !important; }
.sheet {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    z-index: 20;
    display: flex;
    justify-content: flex-end;
}
.sheet-card {
    width: min(28rem, 100%);
    height: 100%;
    overflow: auto;
    background: #0f172a;
    padding: 1rem;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 1rem 0; }
.scores div { background: #020617; border-radius: 0.8rem; padding: 0.7rem; text-align: center; }
.scores b { display: block; font-size: 1.4rem; }
.scores span, .note { color: #94a3b8; font-size: 0.75rem; }
#history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
#history li { background: #020617; border-radius: 0.7rem; padding: 0.55rem 0.65rem; font-size: 0.78rem; }
.hit { color: #4ade80; }
.miss { color: #f87171; }
@media (max-width: 860px) {
    main { padding: 0.55rem 0.55rem 0.8rem; }
    .board { grid-template-columns: 1fr; }
    .side { min-height: 0; padding: 0.6rem; }
    .face { width: 52px; height: 52px; }
    .champ { grid-template-columns: 52px minmax(0, 1fr); }
    .loadout img { width: 30px; height: 30px; }
    .side-go { font-size: 0.85rem; }
}
