

:root {
    --bg: #11161d;
    --panel: #19202a;
    --edge: #2b3644;
    --ink: #e8eef5;
    --soft: #93a3b5;
    --accent: #4aa3df;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    
    padding-bottom: env(safe-area-inset-bottom);
}

.wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}


[hidden] { display: none !important; }

h1 { font-size: 1.6rem; margin: 4px 0 2px; }
h2 { font-size: 1rem; margin: 0 0 10px; color: var(--soft); font-weight: 700; letter-spacing: .02em; }
.sub { color: var(--soft); margin: 0 0 18px; font-size: .95rem; }
.hint { color: var(--soft); font-size: .82rem; margin: 10px 0 0; }

.card {
    background: var(--panel);
    border: 1px solid var(--edge);
    border-radius: 12px;
    padding: 14px;
    margin: 0 0 14px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }


button {
    min-height: 46px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: #222c38;
    color: var(--ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #06121c; font-weight: 800; }
button.ghost { background: transparent; color: var(--soft); }
button.big { width: 100%; font-size: 1.05rem; min-height: 54px; }

button[disabled] {
    background: var(--panel);
    border-color: var(--edge);
    color: var(--soft);
    font-weight: 600;
    cursor: default;
}


.players { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.player { display: flex; align-items: center; gap: 10px; }
.swatch { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto; }
.player input {
    flex: 1 1 auto;
    min-height: 46px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: #0e141b;
    color: var(--ink);
    font: inherit;
    text-transform: uppercase;
}


.levels { display: flex; flex-direction: column; gap: 8px; }
.levels .level { width: 100%; text-align: left; }
.levels .level strong { font-weight: 700; }
.levels .level[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #06121c; }


.note {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid #8a5a00;
    background: #2a1f08;
    color: #ffd98a;
    font-size: .86rem;
    font-weight: 600;
}


.card h3 { font-size: .84rem; color: var(--soft); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .04em; }


#yourName {
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: #0e141b;
    color: var(--ink);
    font: inherit;
    box-sizing: border-box;
}


.check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    margin-top: 12px;
    cursor: pointer;
}
.check input { width: 24px; height: 24px; flex: 0 0 auto; accent-color: var(--accent); }


.tally { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

.tallyRow {
    display: grid;
    grid-template-columns: 22px 1fr auto auto;
    align-items: center;
    gap: 7px;
    padding: 8px 9px;
    border-radius: 9px;
    background: #141c25;
    border: 1px solid transparent;
}
.tallyRow.leading { border-color: var(--accent); background: #16222e; }
.tallyRow .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tallyRow .wins { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tallyRow .bx { color: var(--soft); font-size: .76rem; font-variant-numeric: tabular-nums; min-width: 54px; text-align: right; white-space: nowrap; }
.tallyRow .dot { width: 18px; height: 18px; }
.tallyFoot { color: var(--soft); font-size: .8rem; padding: 2px 10px; }


button.armed { background: #5a1f1f; border-color: #a33; color: #ffd7d7; }


.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.sizes button { min-width: 78px; }
.sizes button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #06121c; }


.board {
    display: block;
    width: 100%;
    height: auto;
    margin: 10px 0 6px;
    
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.scores { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.score {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 11px;
    border-radius: 999px;
    border: 1px solid var(--edge);
    background: var(--panel);
    font-size: .9rem;
    font-weight: 700;
}

.score.turn { outline: 2px solid var(--accent); outline-offset: 1px; }
.score .dot { width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto; }

.say { min-height: 1.4em; margin: 2px 0 12px; font-weight: 700; }
.say.win { font-size: 1.15rem; }

.say .who { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.say .dot { width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }



@media (orientation: landscape) and (max-height: 540px) {
    .wrap { max-width: none; padding-top: 8px; }
    h1 { font-size: 1.2rem; }

    
    
    #game {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto 1fr;
        column-gap: 18px;
    }
    
    #gameTop    { grid-column: 1; grid-row: 1; align-self: start; justify-self: center; }
    #gameBottom { grid-column: 1; grid-row: 2; align-self: end;   justify-self: center; }
    #game > .board {
        grid-column: 2;
        grid-row: 1 / -1;
        align-self: center;
        margin: 0;
        
        height: calc(100vh - 54px);
        height: calc(100dvh - 54px);
        width: auto;
        
        max-width: 68vw;
    }
}


.onlineBar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #16222e;
    border: 1px solid var(--edge);
    font-size: .86rem;
    color: var(--soft);
}

.onlineBar .code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: .12em;
    color: var(--ink);
    user-select: all;
}

#onlineInvite { margin: 0 0 12px; text-align: center; }
#onlineInvite .hint { margin-top: 6px; }
.qr img {
    width: 150px; height: 150px;
    display: block; margin: 0 auto;
    background: #fff; border-radius: 8px;
    image-rendering: pixelated;      
}

@media (orientation: landscape) and (max-height: 540px) {
    .qr img { width: 104px; height: 104px; }
    #onlineInvite .hint { display: none; }
}


.waitFor {
    font-variant-numeric: tabular-nums;   
    color: var(--soft);
    font-size: .82rem;
}


button.small { min-height: 44px; padding: 8px 12px; font-size: .82rem; }
#joinCode {
    flex: 1 1 140px;
    min-height: 46px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: #0e141b;
    color: var(--ink);
    font: inherit;
    text-transform: uppercase;
    letter-spacing: .08em;
    box-sizing: border-box;
}
#onlineName {
    width: 100%;
    min-height: 46px;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 10px;
    border: 1px solid var(--edge);
    background: #0e141b;
    color: var(--ink);
    font: inherit;
    box-sizing: border-box;
}


#lvhProbe {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 100vh;
    height: 100lvh;
    visibility: hidden;
    pointer-events: none;
}



@media (hover: hover) and (pointer: fine) {

    
    button,
    select,
    summary,
    [role="button"] {
        transition: filter 0.12s ease;
    }

    button:not(:disabled):hover,
    select:not(:disabled):hover,
    summary:hover,
    [role="button"]:not([aria-disabled="true"]):hover {
        filter: brightness(1.25);
        cursor: pointer;
    }

    
    button:not(:disabled):active,
    select:not(:disabled):active,
    [role="button"]:not([aria-disabled="true"]):active {
        filter: brightness(0.95);
    }
}

