:root {
    --bg: #050705;
    --fg: #f4f7f2;
    --muted: #8d9788;
    --line: #1c241c;
    --lime: #d6ff4a;
    --gold: #f0c14b;
    --silver: #c5c9c0;
    --bronze: #c47a3a;
    --flash: #2a3d12;
}

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

html, body {
    height: 100%;
    height: 100dvh;
    background: var(--bg);
    color: var(--fg);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

#app {
    height: 100%;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
}

.top, .foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1vh 1.8vw;
    border-bottom: 1px solid var(--line);
    gap: 1.2vw;
}

.foot {
    border-bottom: 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 1.35vh;
    align-items: stretch;
    min-height: 6.2vh;
}

.event {
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 2vh;
}

#clock {
    font-variant-numeric: tabular-nums;
    font-size: 2.2vh;
    font-weight: 650;
}

#meta {
    color: var(--muted);
    margin-right: 1.2vw;
    font-size: 1.45vh;
}

.board {
    min-height: 0;
    overflow: hidden;
    padding: 0.7vh 1.2vw 0.5vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    gap: 0.7vh 1vw;
    align-content: start;
    font-size: 1.55vh;
}

.cat-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 0.4vh;
    padding: 0.45vh 0.7vw 0.35vh;
    background: #080a08;
}

.cat-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.6vw;
    margin-bottom: 0.25vh;
    padding-bottom: 0.2vh;
    border-bottom: 1px solid var(--line);
}

.cat-head h2 {
    font-size: 1.15em;
    font-weight: 750;
    letter-spacing: 0.03em;
    line-height: 1.15;
}

.cat-count {
    color: var(--muted);
    font-size: 0.78em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.cat-empty {
    color: var(--muted);
    font-size: 0.85em;
    padding: 0.45vh 0.2vw;
}

.board table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.board col.col-rank { width: 9%; }
.board col.col-num { width: 13%; }
.board col.col-name { width: 54%; }
.board col.col-time { width: 24%; }

.board th {
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.68em;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.15vh 0.28vw 0.25vh;
    border-bottom: 1px solid var(--line);
}

.board th:last-child { text-align: right; }

.board td {
    padding: 0.18vh 0.28vw;
    border-bottom: 1px solid #121812;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    line-height: 1.2;
}

.board td.name {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 650;
}

.board .rank { width: 9%; color: var(--muted); }
.board td.num { width: 12%; color: var(--muted); }
.board td.time {
    width: 22%;
    text-align: right;
    font-weight: 750;
}

.board tr.r1 .rank { color: var(--gold); font-weight: 800; }
.board tr.r1 td.time { color: var(--lime); }
.board tr.r2 .rank { color: var(--silver); font-weight: 700; }
.board tr.r3 .rank { color: var(--bronze); font-weight: 700; }
.board tr.fresh { background: var(--flash); }

.empty {
    grid-column: 1 / -1;
    height: 70%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 2.4vh;
}

.foot-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.15vh;
    min-width: 0;
    flex: 1;
}

.foot-brand { letter-spacing: 0.06em; text-transform: uppercase; }
#latest strong { color: var(--fg); }
#latest {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ad-strip {
    flex: 0 0 28vw;
    max-width: 34vw;
    display: grid;
    place-items: center;
    border-left: 1px solid var(--line);
    padding-left: 1vw;
}

.ad-strip.hidden { display: none; }
.ad-strip img {
    max-width: 100%;
    max-height: 5.2vh;
    object-fit: contain;
}
.ad-strip .ad-slide {
    text-align: right;
}
.ad-strip .brand {
    font-size: 1.5vh;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--lime);
}

@media (orientation: landscape) {
    .board {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: repeat(3, auto);
    }
}
