/* ===================== Flat dark theme (#111 bg, orange accents) ===================== */
:root {
    --bg: #111;
    --ink: #eee;
    --muted: #b5b5b5;
    --line: #222;
    --accent: #ff8a00; /* orange */
    --accent-2: #ffb000;
    --danger: #ff5c5c;
    --radius: 10px;
}

body[data-page="index"] main {
    display: block;
}

.hero {
    padding: 24px 20px;
    background: transparent;
    margin-bottom: 18px;
}

.hero-title {
    margin: 0 0 8px 0;
    font-size: 26px;
    font-weight: 800;
}

.hero-lead {
    max-width: 720px;
    margin-inline: auto;
    margin: 0 auto;
    padding: 10px 0 35px;
}

.list-block {
    padding: 0;
    max-width: 400px;
    margin: 0 auto;
}

.list-block > .row {
    margin-bottom: 8px;
}

/* Ensure “no rooms” text spacing looks good */
#noRooms {
    margin: 10px 2px 0;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.overlay-active {
    overflow: hidden
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px
}

.top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px
}

.between {
    justify-content: space-between
}

.center {
    text-align: center
}

.row {
    display: flex;
    align-items: center
}

.gap {
    gap: 12px
}

.self-end {
    align-self: end
}

.muted {
    color: var(--muted)
}

.small {
    font-size: 12px
}

.top h1, .brand-title {
    margin: 0;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: .2px
}

.logo {
    width: 32px;
    height: 32px;
    display: block;
    opacity: .95
}

.logo.small {
    width: 22px;
    height: 22px
}

.badge {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--muted)
}

.pill {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 4px 8px;
    color: var(--muted);
    font-size: 12px
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 18px 0;
    opacity: .75
}

/* Flat layout (no shadows) */
.card {
    background: transparent;
    border: none;
    box-shadow: none
}

.p2 {
    padding: 0
}

/* Grids: homepage & room */
.grid {
    display: grid;
    gap: 20px
}

body[data-page="index"] .grid {
    grid-template-columns:1.2fr .4fr
}

@media (max-width: 960px) {
    body[data-page="index"] .grid {
        grid-template-columns:1fr
    }
}

body[data-page="room"] .grid {
    grid-template-columns:0.4fr 1.2fr;
}

@media (max-width: 960px) {
    body[data-page="room"] .grid {
        grid-template-columns:1fr
    }
}

/* Buttons & inputs */
.btn {
    appearance: none;
    background: var(--accent);
    color: #111;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .04s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}

.btn:hover {
    filter: brightness(1.06)
}

.btn:active {
    transform: translateY(1px)
}

.btn.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line)
}

.btn.tiny {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 7px
}

.btn.big {
    padding: 12px 18px
}

input {
    background: #161616;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    outline: none;
    min-width: 220px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input::placeholder {
    color: #8c8c8c
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 138, 0, .22)
}

/* Public rooms (index) */
.rooms {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    gap: 10px;
    grid-template-columns:repeat(auto-fill, minmax(220px, 1fr))
}

.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    transition: border-color .15s ease, transform .08s ease
}

.room-item:hover {
    border-color: #2b2b2b;
    transform: translateY(-1px)
}

.room-item .left {
    display: flex;
    align-items: center;
    gap: 10px
}

/* Players list */
.players {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px
}

.players li {
    display: grid;
    grid-template-columns:16px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent
}

.players .name {
    font-weight: 600
}

.players .tag {
    color: var(--muted);
    font-size: 12px;
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #555
}

.dot.ready {
    background: var(--accent)
}

.host {
    font-size: 12px;
    color: var(--muted);
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 999px
}

/* Countdown (in-page backup) */
.timer-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 8px auto 14px
}

.timer-ring::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(var(--accent) 0 var(--progress, 0%), #222 var(--progress, 0%) 100%);
}

.timer-ring::after {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    background: #161616;
    border: 1px solid var(--line)
}

.timer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 54px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #fff
}

/* Choices */
.choices {
    margin-top: 8px;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    display: flex
}

.choice {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: transform .1s ease, border-color .15s ease, background .15s ease
}

.choice:hover {
    transform: translateY(-1px);
    border-color: #2b2b2b
}

.choice.selected {
    background: #1a1a1a;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 138, 0, .22) inset;
    animation: pop .18s ease-out
}

@keyframes pop {
    from {
        transform: scale(.96)
    }
    to {
        transform: scale(1)
    }
}

/* Results */
.results {
    display: grid;
    grid-template-columns:repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px
}

.result-card {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    background: transparent;
    opacity: 0;
    transform: translateY(6px);
    animation: fadeUp .22s ease forwards
}

.result-card.win {
    border-color: var(--accent);
    background: linear-gradient(to top right, rgba(255, 138, 0, .08), transparent)
}

.result-card .name {
    font-weight: 700
}

.result-card .choice {
    color: var(--muted);
    font-size: 14px
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0)
    }
}

/* Visibility switch */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    user-select: none
}

.switch input {
    display: none
}

.slider {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #1e1e1e;
    border: 1px solid var(--line);
    position: relative;
    transition: background .15s ease, border-color .15s ease
}

.slider::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #777;
    transition: left .15s ease, background .15s ease
}

.switch input:checked + .slider {
    background: #2a2a2a;
    border-color: #2b2b2b
}

.switch input:checked + .slider::after {
    left: 21px;
    background: var(--accent)
}

.switch .switch-text {
    color: var(--muted);
    font-size: 13px
}

.switch.disabled {
    opacity: .6;
    pointer-events: none
}

/* ===================== FULLSCREEN OVERLAY TIMER ===================== */
#timerOverlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 17, 17, .62);
    opacity: 0;
    transition: opacity .18s ease;
    pointer-events: auto;
}

#timerOverlay.show {
    opacity: 1
}

#timerOverlay .panel {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 8px 16px;
}

/* Digit area has a fixed height so buttons are ALWAYS BELOW the number */
#timerOverlay .digit-wrap {
    position: relative;
    width: 100%;
    height: clamp(140px, 22vw, 260px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#timerOverlay .digit {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: min(22vw, 240px);
    font-weight: 1000;
    line-height: 1;
    color: #fff;
    letter-spacing: .02em;
    text-shadow: 0 10px 50px rgba(0, 0, 0, .55);
    filter: drop-shadow(0 8px 40px rgba(0, 0, 0, .35));
    will-change: transform, opacity;
    opacity: 0
}

@keyframes digitIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.9)
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
}

@keyframes digitOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1)
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(.92)
    }
}

#timerOverlay .digit.in {
    animation: digitIn .22s ease-out forwards
}

#timerOverlay .digit.out {
    animation: digitOut .18s ease-in forwards
}

/* Overlay choices strictly BELOW the digit area */
#timerOverlay .overlay-choices {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

#timerOverlay .overlay-choices .choice {
    background: transparent;
    border: 1px solid var(--line);
    padding: 14px 16px;
    border-radius: 10px
}

#timerOverlay .overlay-choices .choice.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 138, 0, .22)
}

/* When overlay is visible, de-emphasize the backup in-page choices */
body.overlay-active #countdown .choices {
    opacity: .25;
    pointer-events: none
}

/* Links & helpers */
a {
    color: var(--accent);
    text-decoration: none
}

a:hover {
    text-decoration: underline
}

.row.gap input {
    min-width: 260px
}

.hidden {
    display: none !important;
}
