/* cache: v=87 */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #10131a;
    --bg-soft: #181d27;
    --line: #262d3a;
    --text: #e8ecf4;
    --muted: #8e99ad;
    --red: #d64545;
    --red-dark: #a32f2f;
    --blue: #3a72c4;
    --blue-dark: #27528f;
    --neutral: #d8c9a6;
    --neutral-dark: #b3a481;
    --black: #0a0c10;
    --card: #f2ece0;
    --radius: 14px;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body.game {
    height: 100vh;
    overflow: hidden;
    background: #1a1510;
    transition: background-color .7s ease;
}

/* Pozadina se lagano oboji prema timu na potezu. */
body.game::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity .7s ease, background .7s ease;
}
body.game.turn-red::before {
    opacity: 1;
    background: radial-gradient(135% 95% at 50% 0%, rgba(214, 69, 69, .42), rgba(214, 69, 69, .1) 55%, transparent 80%);
}
body.game.turn-blue::before {
    opacity: 1;
    background: radial-gradient(135% 95% at 50% 0%, rgba(58, 114, 196, .46), rgba(58, 114, 196, .12) 55%, transparent 80%);
}
body.game.turn-red { background-color: #241614; }
body.game.turn-blue { background-color: #141a26; }

#app { position: relative; z-index: 1; }

button, input { font-family: inherit; }

/* Bez ovoga display:flex na overlay/sheet gazi HTML hidden i cijeli ekran je "POBJEDA". */
[hidden] {
    display: none !important;
}

/* ---------- Home ---------- */

.home-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 18px 48px;
}

.logo {
    font-family: Cinzel, "Palatino Linotype", Palatino, serif;
    font-size: 34px;
    letter-spacing: 6px;
    text-align: center;
    margin: 8px 0 4px;
    font-weight: 900;
}
.logo span { color: var(--red); }
.logo img {
    display: block;
    width: min(78%, 340px);
    height: auto;
    margin: 0 auto 22px;
}

.tagline {
    text-align: center;
    color: var(--muted);
    margin: 0 0 26px;
    font-size: 14px;
}

.panel {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}
.panel h2 {
    margin: 0 0 16px;
    font-size: 17px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

.field { display: block; margin-bottom: 18px; }
.field > span {
    display: block;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--muted);
}
.field em { font-style: normal; opacity: .7; }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg-btn {
    flex: 1 1 0;
    min-width: 78px;
    padding: 13px 8px;
    border: 1px solid var(--line);
    background: #12161e;
    color: var(--text);
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
}
.seg-btn.is-active { border-color: #6f7d95; background: #232a37; font-weight: 700; }
.seg-btn.seg-red.is-active { background: var(--red-dark); border-color: var(--red); }
.seg-btn.seg-blue.is-active { background: var(--blue-dark); border-color: var(--blue); }

.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #232a37;
    color: var(--text);
    font-size: 15px;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); border-color: var(--red); font-weight: 700; }
.btn-lg { padding: 16px; font-size: 17px; }

.code-input {
    width: 100%;
    padding: 16px;
    font-size: 30px;
    letter-spacing: 10px;
    text-align: center;
    text-transform: uppercase;
    background: #12161e;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: -4px 0 18px;
    font-size: 13.5px;
    color: var(--text);
    cursor: pointer;
}
.check input {
    width: 22px;
    height: 22px;
    margin: 0;
    accent-color: var(--red);
    flex: 0 0 auto;
}
.check em { font-style: normal; color: var(--muted); }
.check-sub { margin-left: 32px; }

.error { color: #ff8080; font-size: 14px; min-height: 18px; margin: 10px 0 0; }
.notice { color: #7fd18b; font-size: 14px; margin: 0 0 14px; }

.last-game {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 14px;
    background: #12161e;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.last-game-text {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}
.last-game b {
    display: block;
    margin-top: 3px;
    color: var(--text);
    letter-spacing: 3px;
    font-size: 20px;
}
.last-game-hint {
    display: block;
    font-size: 13px;
    color: var(--muted);
}
.last-game-hint:empty { display: none; }
.last-game .btn {
    width: auto;
    flex: 0 0 auto;
    padding: 10px 14px;
    font-size: 13px;
}

/* ---------- Postavke na početnoj ---------- */
.settings {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 0 0 16px;
    background: #12161e;
}
.settings > summary {
    padding: 13px 16px;
    font-size: 13.5px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
}
.settings > summary::-webkit-details-marker { display: none; }
.settings > summary::after { content: ' ▾'; }
.settings[open] > summary::after { content: ' ▴'; }
.settings-body { padding: 0 16px 4px; }
.settings-title {
    margin: 0 0 12px;
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
}
.settings-body .check { margin: 0 0 14px; }

/* ---------- Admin ---------- */
.admin-wrap { max-width: 620px; }
.admin-nav { margin-bottom: 16px; }
.admin-lead { text-align: left; margin: 0 0 14px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; }
.admin-actions form { flex: 1 1 140px; margin: 0; }
.admin-actions .btn { width: 100%; padding: 11px 12px; font-size: 13px; }

.game-list { list-style: none; margin: 8px 0 0; padding: 0; }
.game-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}
.game-code {
    font-family: Oswald, "Segoe UI", sans-serif;
    letter-spacing: 3px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
}
.game-meta {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.game-players {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
}
.game-players span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}
.game-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge {
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
}
.badge-live { color: #7fd18b; border-color: #3d6a4a; }
.badge-host { color: #8eb6ff; border-color: #3a5280; }
.badge-dead { color: #ff8080; border-color: #6b2a2a; }
.game-actions { flex: 0 0 auto; }
.game-actions .btn { width: auto; padding: 8px 12px; font-size: 13px; }
.text-input {
    width: 100%;
    padding: 13px 14px;
    font-size: 16px;
    background: #12161e;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
}
.admin-area { resize: vertical; text-transform: uppercase; letter-spacing: 1px; }

.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-tab {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}
.admin-tab b { color: var(--text); margin-left: 4px; }
.admin-tab.is-active { background: var(--red); border-color: var(--red); color: #fff; }
.admin-tab.is-active b { color: #fff; }

/* ---------- Upit (zamjena za confirm) ---------- */
.dialog {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(6, 8, 12, .72);
    backdrop-filter: blur(3px);
}
.dialog-box {
    width: 100%;
    max-width: 360px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-soft);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.dialog-text {
    margin: 0 0 20px;
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}
.dialog .text-input { margin-bottom: 14px; }
.dialog .error { min-height: 0; margin: -6px 0 14px; }
.dialog .error:empty { display: none; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1 1 0; padding: 13px 10px; font-size: 14px; }
.dialog-actions.is-stack { flex-direction: column; }
.dialog-actions.is-stack .btn { flex: 0 0 auto; width: 100%; }

/* Postavke runde u dijalogu */
.setup-box { max-width: 420px; max-height: calc(100dvh - 44px); overflow-y: auto; }
.setup-box .dialog-text {
    margin-bottom: 18px;
    font-size: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
}
.setup-cats .check { margin: 0 0 10px; }
.setup-cats .check:last-child { margin-bottom: 0; }
.setup-minutes { margin-top: 10px; }
.setup-box .error { min-height: 0; margin: 0 0 14px; }
.setup-box .error:empty { display: none; }

.words-hint {
    margin: -8px 0 12px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
    text-align: center;
}
.words-input {
    resize: vertical;
    min-height: 180px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.45;
    font-size: 15px;
    margin-bottom: 8px;
}
.words-count {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--muted);
    text-align: right;
}
.words-count.is-ok { color: #7dca9a; }
.words-count.is-bad { color: var(--red); }
#btn-custom { margin-top: 10px; }

.cat-form { display: flex; gap: 8px; margin: 0 0 18px; }
.cat-form .text-input { flex: 1 1 auto; font-size: 14px; padding: 11px 12px; }
.cat-form .btn { flex: 0 0 auto; width: auto; padding: 11px 14px; font-size: 13px; }

.cat-danger { margin: 22px 0 0; }
.btn-danger { background: #6b1f1f; border-color: #8d2a2a; font-size: 13px; }

.word-list { list-style: none; margin: 20px 0 0; padding: 0; }
.word-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 4px 9px 12px;
    border-top: 1px solid var(--line);
    font-size: 15px;
    letter-spacing: 1px;
}
.word-list form { margin: 0; }
.word-del {
    background: none;
    border: 0;
    color: #ff8080;
    font-size: 22px;
    line-height: 1;
    padding: 2px 10px;
    cursor: pointer;
}
.word-empty { color: var(--muted); letter-spacing: 0; }

.credit a { color: inherit; }

.credit {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #5d6779;
}
.credit b { color: var(--red); letter-spacing: 4px; }

/* ---------- Game ---------- */

#app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    padding: 8px 12px 10px;
    gap: 8px;
}

.topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.score {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    border: 2px solid transparent;
    background: #1b212c;
}
.score-blue { justify-content: flex-end; }
.score-num { font-size: 30px; font-weight: 800; line-height: 1; }
.score-label { font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.score-red .score-num { color: var(--red); }
.score-blue .score-num { color: var(--blue); }
.score.is-turn.score-red { border-color: var(--red); background: rgba(214, 69, 69, .16); }
.score.is-turn.score-blue { border-color: var(--blue); background: rgba(58, 114, 196, .16); }

/* Tim na potezu lagano pulsira. */
.score.is-turn { animation: score-pulse 1.9s ease-in-out infinite; }
.score.is-turn.score-red { --pulse: rgba(214, 69, 69, .55); }
.score.is-turn.score-blue { --pulse: rgba(58, 114, 196, .55); }

@keyframes score-pulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--pulse); opacity: 1; }
    50% { box-shadow: 0 0 14px 3px var(--pulse); opacity: .82; }
}

@media (prefers-reduced-motion: reduce) {
    .score.is-turn { animation: none; }
}

.center-info { text-align: center; }
.timer-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-fs {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #1b212c;
    color: var(--text);
    cursor: pointer;
}
.btn-fs svg { display: block; width: 100%; height: 100%; }
.btn-fs:active { transform: translateY(1px); }
.btn-fs.is-off { color: var(--muted); opacity: .65; }
.turn-pill {
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--muted);
}
.timer {
    font-size: 32px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.timer.is-low { color: #ffb020; }
.timer.is-out { color: var(--red); }
.timer.is-paused { opacity: .45; }
.meta {
    display: flex;
    gap: 10px;
    justify-content: center;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 1px;
}
.code-badge b { color: var(--text); letter-spacing: 2px; }

.board-stage {
    --key-bottom: 10px;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    position: relative;
    container-type: size;
    display: grid;
    place-items: center;
    padding: 4px;
}

.board {
    --board-ar: 1.48;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
    gap: clamp(5px, 1.2cqw, 16px);
    box-sizing: border-box;
    width: min(100cqw, calc(100cqh * var(--board-ar)));
    height: min(100cqh, calc(100cqw / var(--board-ar)));
    padding: clamp(6px, 1.6cqw, 18px);
    background: #161616;
    border-radius: 16px;
    box-shadow: inset 0 0 0 2px #0a0a0a, 0 10px 22px rgba(0, 0, 0, .4);
}

/* ---------- Polja za voditelje (kvadrat preko ploče; veličinu postavlja JS) ---------- */

.keycard {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body.is-spymaster .keycard {
    position: absolute;
    z-index: 40;
    left: 50%;
    bottom: var(--key-bottom, 10px);
    transform: translateX(-50%);
}

@media (orientation: landscape) {
    body.is-spymaster .keycard {
        left: 8px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
    }

    body.game #app {
        padding: 3px 10px 6px;
        gap: 4px;
    }
    body.game .turn-pill { display: none; }
    body.game .topbar { gap: 6px; }

    body.game .btn-menu:not([hidden]) {
        display: none;
        align-items: center;
        justify-content: center;
        position: absolute;
        left: 8px;
        top: 56px;
        z-index: 46;
        width: 40px;
        min-width: 40px;
        height: 40px;
        padding: 9px 8px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #1b212c;
        color: var(--text);
        box-shadow: none;
        font-size: 0;
    }
    body.game.menu-compact .btn-menu:not([hidden]) { display: flex; }
    body.game .btn-menu .burger {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 100%;
        height: 100%;
    }
    body.game .btn-menu .burger i {
        display: block;
        height: 2px;
        background: currentColor;
        border-radius: 1px;
    }
    body.game.menu-open .btn-menu { background: #232a37; }
    body.game .btn-end-turn:not([hidden]) {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        right: 10px;
        bottom: 12px;
        z-index: 46;
        width: auto;
        min-width: 160px;
        min-height: 48px;
        padding: 12px 16px;
        font-size: 15px;
        font-weight: 700;
        letter-spacing: 0;
        background: #232a37;
        border: 1px solid var(--line);
        border-radius: 10px;
        box-shadow: none;
        color: var(--text);
    }
    body.game .controls {
        position: absolute;
        left: 8px;
        top: 56px;
        z-index: 45;
        display: flex;
        flex-direction: column;
        width: auto;
        min-width: 0;
        max-height: calc(100% - 64px);
        overflow-x: hidden;
        overflow-y: auto;
        gap: 7px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }
    body.game.menu-compact .controls {
        display: none;
        top: 102px;
        max-height: calc(100% - 120px);
    }
    body.game.menu-compact.menu-open .controls:not([hidden]) { display: flex; }
    body.game .controls .ctrl-end-turn { display: none; }
    body.game .controls .ctrl {
        width: auto;
        min-width: 148px;
        flex: 0 0 auto;
        padding: 12px 10px;
        font-size: 13.5px;
    }
    body.game .spy-controls {
        position: absolute;
        left: 8px;
        top: 56px;
        z-index: 45;
        flex-direction: column;
        gap: 7px;
        background: none;
        border: 0;
        box-shadow: none;
    }

    /* Kartica polja na hostu: meni opet dolje, kao prije. */
    body.game.is-spymaster:not(.is-viewer) .btn-menu,
    body.game.is-spymaster:not(.is-viewer) .btn-end-turn {
        display: none !important;
    }
    body.game.is-spymaster:not(.is-viewer) .controls {
        position: static;
        left: auto;
        top: auto;
        z-index: auto;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        width: auto;
        max-height: none;
        overflow: visible;
        gap: 7px;
    }
    body.game.is-spymaster:not(.is-viewer) .controls .ctrl-end-turn { display: block; }
    body.game.is-spymaster:not(.is-viewer) .controls .ctrl {
        width: auto;
        min-width: 0;
        flex: 1 1 0;
        padding: 12px 6px;
        font-size: 13.5px;
    }
    body.game .score {
        padding: 3px 10px;
        gap: 5px;
        border-radius: 9px;
        border-width: 1px;
    }
    body.game .score-num { font-size: 20px; }
    body.game .score-label { font-size: 9.5px; letter-spacing: 1.4px; }
    body.game .timer { font-size: 22px; }
    body.game .btn-fs { width: 28px; height: 28px; }
    body.game .meta { font-size: 10px; margin-top: 1px; }
    body.game .card-word-bottom { font-size: 12.6cqw; }
    body.game .card-word-top { font-size: 9.4cqw; }
}

@media (orientation: landscape) and (min-width: 1100px) {
    body.game:not(.is-spymaster) .controls .ctrl { min-width: 168px; }
    body.game .btn-end-turn:not([hidden]) {
        min-width: 180px;
        min-height: 52px;
        font-size: 15px;
        padding: 12px 18px;
    }
}

.keycard-frame {
    position: relative;
    width: 100%;
    height: 100%;
    background: url('../img/polja_voditelji.png') center / 100% 100% no-repeat;
    transition: filter .18s ease;
}
.keycard.is-black .keycard-frame {
    filter: brightness(0.08);
}

.key-grid {
    position: absolute;
    left: 16.3%;
    top: 16.93%;
    width: 67.15%;
    height: 67.13%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 2.45%;
    z-index: 2;
}

.kf { border-radius: 12%; }
.kf-tile { background-position: center; background-size: 100% 100%; background-repeat: no-repeat; }
.kf.is-done { opacity: .42; }

.key-arrow {
    position: absolute;
    width: 4.88%;
    height: 8.73%;
    pointer-events: none;
}
.ka-left { left: 5.65%; top: 50%; transform: translate(-50%, -50%) rotate(180deg); }
.ka-right { left: 94.23%; top: 50%; transform: translate(-50%, -50%); }
.ka-top { left: 50%; top: 5.91%; transform: translate(-50%, -50%) rotate(-90deg); }
.ka-bottom { left: 50%; top: 94.09%; transform: translate(-50%, -50%) rotate(90deg); }

.requests,
.viewer-actions {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    z-index: 50;
    width: min(94%, 460px);
    display: grid;
    gap: 8px;
    pointer-events: auto;
}
.viewer-actions .btn {
    width: 100%;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.viewer-actions .btn:disabled { opacity: .55; }
.request {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 12px 12px;
    background: rgba(28, 34, 46, .96);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 14px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
.request .btn { width: auto; padding: 8px 14px; }
.req-yes { background: #2e7d4f; border-color: #2e7d4f; font-weight: 700; }

/* ---------- Spojeni uređaji (tablet) ---------- */
/* Ploča ostaje na sredini – popis lebdi uz desni rub. */
.stage-row {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    display: flex;
}

.clients {
    position: absolute;
    right: 0;
    top: 0;
    z-index: 30;
    max-height: 100%;
    width: 190px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 6px 8px 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(24, 29, 39, .93);
    backdrop-filter: blur(2px);
}
.clients.is-collapsed { width: auto; }
.clients.is-collapsed .clients-list { display: none; }

.clients-head {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 3px 2px;
    margin: 0 0 4px;
    background: none;
    border: 0;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
}
.clients.is-collapsed .clients-head { margin: 0; }
.clients-head b { color: var(--text); }
.clients-caret {
    margin-left: auto;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid var(--muted);
}
.clients.is-collapsed .clients-caret {
    border-bottom: 0;
    border-top: 5px solid var(--muted);
}

.clients-list { overflow-y: auto; min-height: 0; }

.client {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 6px 8px 4px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: none;
    color: inherit;
    font-family: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.client:first-child { border-top: 0; }
.client-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client.is-key .client-name { color: #f0c674; }
.client-empty { margin: 0; padding: 8px 4px; font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
    .clients { width: 148px; padding: 6px 7px 4px; }
    .client { font-size: 12px; gap: 4px; }
    .client-tag { font-size: 8.5px; padding: 2px 4px; }
}

.spy-controls {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}
.spy-controls .btn { width: auto; padding: 10px 16px; font-size: 13px; }

.card {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    overflow: visible;
    container-type: size;
    transition: transform .12s ease;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.card:active:not(.is-done):not(.is-blank) { transform: scale(.97); }
.card.is-done { cursor: default; }

.card-face {
    position: absolute;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: 14px;
    background-color: #e6c9a8;
    background-image: url('../img/rijec.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
}

.card-word {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Arial Black", "Arial Bold", Oswald, Impact, sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    text-align: center;
    line-height: .92;
    letter-spacing: -0.03em;
    white-space: nowrap;
    padding: 0 2%;
    overflow: hidden;
}
.card-word-in { display: inline-block; white-space: nowrap; }

/* Bijelo polje na rijec.png: ~9%–90% x, ~57%–86% y */
.card-word-bottom {
    left: 10%;
    right: 10%;
    top: 57.5%;
    height: 27%;
    font-size: clamp(9px, 1.7vw, 22px);
    font-size: 11.2cqw;
    color: #111;
}

/* Manja naopaka riječ u gornjem bež polju, lijevo od siluete */
.card-word-top {
    left: 10%;
    right: 34%;
    top: 14%;
    height: 28%;
    font-size: clamp(8px, 1.32vw, 17px);
    font-size: 8.4cqw;
    color: #6a5340;
    transform: rotate(180deg);
}

/* Pokrivač je veličine kartice s riječju, samo malo prelazi preko ruba.
   Bez explicitne širine img bi se raširio na svojih 1200px. */
.card-cover {
    position: absolute;
    z-index: 2;
    top: -2.5%;
    left: -2%;
    width: 104%;
    height: 105%;
    max-width: none;
    object-fit: fill;
    display: block;
    border: none;
    outline: none;
    box-shadow: none;
    border-radius: 13px;
    pointer-events: none;
    transition: opacity .12s ease;
}

/* Otkrivena kartica – pokrov ostaje blago vidljiv. */
.card.is-peek .card-cover {
    opacity: .22;
    transition: opacity .2s ease;
}

.card.is-blank {
    cursor: default;
    background: #0c0c0c;
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px #222;
}

.card.is-last .card-cover {
    box-shadow: none;
    filter: brightness(1.06);
}

.controls {
    flex: 0 0 auto;
    display: flex;
    gap: 7px;
}
.ctrl { padding: 12px 6px; font-size: 13.5px; }
.ctrl-end { background: #6b1f1f; border-color: #8d2a2a; }
.ctrl-end-turn, .btn-end-turn { font-weight: 700; }
.btn-menu, .btn-end-turn { display: none; }

/* ---------- Sheet (odabir boje) ---------- */

.sheet {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 12, .78);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 80;
}
.sheet-inner {
    width: 100%;
    max-width: 720px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 18px 18px 0 0;
    padding: 20px 18px 22px;
}
.sheet-word {
    margin: 0 0 4px;
    text-align: center;
    font-family: "Arial Black", Oswald, Impact, sans-serif;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sheet-hint {
    margin: 0 0 16px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}
.sheet-colors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.pick {
    position: relative;
    height: 92px;
    padding: 0;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.pick span {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px;
    background: linear-gradient(transparent, rgba(0,0,0,.75));
    font-family: Oswald, sans-serif;
}
.pick:active { transform: translateY(1px); }
.pick-red { background-image: url('../img/crvena1.png'); }
.pick-blue { background-image: url('../img/plava1.png'); }
.pick-neutral { background-image: url('../img/neutralna1.png'); color: #fff; }
.pick-black { background-image: url('../img/crna.png'); }
.pick.is-suggested { outline: 3px solid #ffd166; outline-offset: 2px; }
.pick.is-out { filter: grayscale(1) brightness(.5); cursor: not-allowed; }
.pick-left {
    display: inline-block;
    min-width: 22px;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 20px;
    background: rgba(0, 0, 0, .55);
    font-size: 13px;
}
.sheet-cancel { max-width: 240px; margin: 0 auto; }

/* ---------- Winner overlay ---------- */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 8, 12, .9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 40;
    padding: 24px;
}
.overlay-inner { text-align: center; max-width: 420px; width: 100%; }
.overlay-title {
    font-size: 40px;
    font-weight: 900;
    letter-spacing: 3px;
    margin: 0 0 8px;
}
.overlay.win-red .overlay-title { color: var(--red); }
.overlay.win-blue .overlay-title { color: var(--blue); }
.overlay-sub { color: var(--muted); margin: 0 0 10px; font-size: 15px; }
.overlay-stats {
    margin: 0 0 22px;
    color: var(--text);
    font-size: 14px;
    letter-spacing: .4px;
    line-height: 1.4;
}
.overlay-actions { display: grid; gap: 10px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%);
    background: #2a3140;
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    z-index: 50;
    max-width: 90vw;
    text-align: center;
}

/* ---------- Manji ekrani (mobitel) ---------- */

@media (max-width: 620px) {
    #app { padding: 6px 6px 8px; gap: 6px; }
    .timer { font-size: 22px; }
    .score-num { font-size: 20px; }
    .score { padding: 5px 8px; }
    .score-label { font-size: 10px; letter-spacing: 1px; }
    .board { border-radius: 12px; }
    .card-face, .card.is-blank { border-radius: 10px; }
    .card-cover { border-radius: 8px; }
    .controls { flex-wrap: wrap; }
    .ctrl { flex: 1 1 30%; font-size: 12.5px; padding: 10px 4px; }
    .sheet-colors { grid-template-columns: 1fr 1fr; }
    .pick { height: 72px; }
    .request {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .request .btn { width: 100%; }
}

@media (orientation: portrait) and (max-width: 620px) {
    #app { padding-left: 2px; padding-right: 2px; }
    .board-stage { --key-bottom: 20px; padding-left: 2px; padding-right: 2px; }
}

/* Gledatelj, mobitel položeno: tanji vrh, veća ploča */
@media (orientation: landscape) and (max-height: 540px) {
    body.is-viewer #app {
        padding: 4px 10px 5px;
        gap: 3px;
    }
    body.is-viewer .turn-pill,
    body.is-viewer .meta {
        display: none;
    }
    body.is-viewer .topbar { gap: 8px; align-items: center; }

    body.is-viewer .score {
        align-items: center;
        gap: 7px;
        padding: 3px 12px;
        border-radius: 999px;
        border-width: 1px;
    }
    body.is-viewer .score-red { justify-self: start; }
    body.is-viewer .score-blue { justify-self: end; }
    body.is-viewer .score-num { font-size: 17px; }
    body.is-viewer .score-label { font-size: 8.5px; letter-spacing: 1.5px; }

    body.is-viewer .timer-row { gap: 7px; }
    body.is-viewer .timer { font-size: 20px; line-height: 1; }
    body.is-viewer .btn-fs {
        width: 26px;
        height: 26px;
        padding: 3px;
        border-radius: 7px;
    }
}
