/* ── Reset & base ─────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --purple:  #aa44ff;
    --purple2: #7722cc;
    --dark: #0d0d0d;
}

html.bbg-loading .pas-header,
html.bbg-loading .pas-main {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
html.bbg-ready .pas-header,
html.bbg-ready .pas-main {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease;
}

body {
    font-family: 'Oswald', sans-serif;
    background: var(--dark);
    color: #fff;
    min-height: 100vh;
    padding: 10px 14px 24px;
    font-size: 17px;
}

/* ── Header ───────────────────────────────────────────────── */
.pas-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #222;
}
.pas-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0.1em;
    color: #fff;
    flex-shrink: 0;
}
.pas-participants {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-width: 0;
}
.pas-participants::-webkit-scrollbar { display: none; }
.pas-participants img {
    width: 53px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid #333;
    flex-shrink: 0;
}
.pas-participants img.p-eliminated {
    border-color: #880000;
    filter: grayscale(80%) brightness(0.45);
    opacity: 0.5;
}
.pas-participants img.p-nominated {
    border-color: #fff;
}
.pas-nav {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.pas-nav-btn {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    padding: 8px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.15s, box-shadow 0.15s;
}
.pas-nav-back {
    background: #222;
    color: #aaa;
    border: 1px solid #444;
}
.pas-nav-back:hover { color: #fff; border-color: #888; }
.pas-nav-menu {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #111;
    box-shadow: 0 0 12px rgba(255,180,0,0.4);
}
.pas-nav-menu:hover { transform: scale(1.05); box-shadow: 0 0 22px rgba(255,180,0,0.7); }
.pas-nav-shuffle {
    background: linear-gradient(135deg, #00c8ff, #0066cc);
    color: #fff;
    box-shadow: 0 0 12px rgba(0,180,255,0.4);
}
.pas-nav-shuffle:hover { transform: scale(1.05); box-shadow: 0 0 22px rgba(0,180,255,0.7); }

/* ── Main 2-column ────────────────────────────────────────── */
.pas-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}
@media (max-width: 900px) { .pas-main { grid-template-columns: 1fr; } }

/* ── Grid panel ───────────────────────────────────────────── */
.pas-grid-wrap {
    background: rgba(0,0,0,0.4);
    border: 2px solid #2a2a2a;
    border-radius: 10px;
    padding: 14px;
}
.pas-grid-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    color: #fff;
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 12px;
}

/* 4 columns × 3 rows = 12 boxes */
.pas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.pas-box {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border: 2px solid var(--purple2);
    border-radius: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.3rem, 2.5vw, 1.9rem);
    color: #888;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.2s;
    user-select: none;
}
.pas-box:hover {
    border-color: var(--purple);
    color: var(--purple);
    transform: scale(1.06);
    box-shadow: 0 0 14px rgba(170,68,255,0.35);
}
.pas-box.selected {
    border-color: #fff;
    color: #fff;
    background: rgba(255,255,255,0.08);
    box-shadow: 0 0 22px rgba(255,255,255,0.55);
    animation: pasBoxPulse 1s ease-in-out infinite;
}
@keyframes pasBoxPulse { 50% { transform: scale(1.05); } }

.pas-box.used {
    background: rgba(119,34,204,0.45);
    color: #fff;
    border-color: var(--purple2);
    opacity: 0.65;
    cursor: default;
}
.pas-box.used:hover { transform: none; box-shadow: none; }

.pas-box.has-assign::after {
    display: none !important;
    content: none !important;
}

.pas-box-tick {
    display: none;
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 20;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1db954;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.65);
    pointer-events: none;
    border: 2px solid #fff;
}

.pas-box.is-viewed .pas-box-tick {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Image inside box (cycling / assigned states) */
.pas-box-num  { display: block; }
.pas-box-img  { display: none; width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; border-radius: 6px; }
.pas-box-name { display: none; position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.65); font-family: 'Bebas Neue', sans-serif; font-size: clamp(0.65rem, 1vw, 0.9rem); color: #fff; text-align: center; padding: 2px 4px; border-radius: 0 0 6px 6px; }

.pas-box.cycling .pas-box-num  { display: none; }
.pas-box.cycling .pas-box-img  { display: block; opacity: 0.85; }

.pas-box.assigned .pas-box-num  { display: none; }
.pas-box.assigned .pas-box-img  { display: block; }
.pas-box.assigned .pas-box-name { display: block; }
.pas-box.assigned { border-color: var(--purple); cursor: pointer; box-shadow: 0 0 12px rgba(170,68,255,0.5); color: #fff; }
.pas-box.assigned:hover { transform: scale(1.06); box-shadow: 0 0 22px rgba(170,68,255,0.8); }

@keyframes pasBoxReveal {
    from { transform: scale(1.15); opacity: 0.4; }
    to   { transform: scale(1);    opacity: 1; }
}
.pas-box.assigned { animation: pasBoxReveal 0.35s ease forwards; }

/* Roll button */
.pas-roll-btn {
    width: 100%;
    padding: 12px 0;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.3rem;
    letter-spacing: 0.12em;
    background: linear-gradient(135deg, var(--purple2), #550099);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 18px rgba(170,68,255,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
}
.pas-roll-btn:not(:disabled):not([disabled]):hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 28px rgba(170,68,255,0.65);
}
.pas-roll-btn:disabled,
.pas-roll-btn[disabled] {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    transform: none !important;
    box-shadow: none !important;
    background: #444 !important;
    color: #666 !important;
    filter: grayscale(100%) !important;
}

.pas-roll-btn--pulse {
    animation: pasRollPulse 0.55s ease-in-out 2;
    box-shadow: 0 0 22px rgba(255, 215, 0, 0.85);
}

@keyframes pasRollPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.pas-music-btn {
    border-radius: 50%;
    min-width: 36px;
    border: 2px solid rgba(37, 99, 235, 0.85);
    background: radial-gradient(circle at 35% 30%, #60a5fa, #2563eb 55%, #1d4ed8);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.45);
}

.pas-music-btn.is-muted {
    border-color: rgba(239, 68, 68, 0.85);
    background: radial-gradient(circle at 35% 30%, #9ca3af, #6b7280 55%, #4b5563);
    color: #fee2e2;
}

/* ── Result panel ─────────────────────────────────────────── */
.pas-result-wrap {
    background: rgba(0,0,0,0.5);
    border: 2px solid var(--purple);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 0 28px rgba(170,68,255,0.12);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.35s, transform 0.35s;
}
.pas-result-wrap.visible { opacity: 1; transform: translateY(0); }
.pas-result-wrap.pop-in  { animation: pasPopIn 0.4s ease; }
@keyframes pasPopIn {
    0%   { opacity: 0; transform: scale(0.93) translateY(12px); }
    70%  { transform: scale(1.02) translateY(-3px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.pas-result-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a2a2a;
}
.pas-result-head h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    color: #fff;
    letter-spacing: 0.04em;
    -webkit-font-smoothing: antialiased;
}

/* TTS */
.pas-tts { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.pas-tts-btn {
    width: 38px; height: 38px;
    border: none; border-radius: 7px;
    cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s;
}
.pas-tts-btn:hover { transform: scale(1.12); }
.tts-play  { background: #22c55e; color: #fff; }
.tts-pause { background: #f59e0b; color: #fff; }
.tts-stop  { background: #ef4444; color: #fff; }
.tts-speed { background: #444; color: #fff; font-weight: bold; font-size: 18px; }
.pas-tts-speed { min-width: 34px; text-align: center; font-size: 0.95rem; color: #aaa; }

.pas-result-body { line-height: 1.65; }
.pas-result-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    color: #fff;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
    -webkit-font-smoothing: antialiased;
}
.pas-result-assigned {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.pas-result-assigned img {
    width: 40px; height: 53px;
    object-fit: cover;
    border-radius: 5px;
    border: 2px solid var(--purple);
    box-shadow: 0 0 8px rgba(170,68,255,0.4);
}
.pas-result-text {
    font-family: 'Oswald', sans-serif;
    font-size: clamp(2rem, 3.6vw, 2.4rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: #ccc;
    line-height: 1.35;
    margin-top: 4px;
    white-space: pre-line;
}

/* ── Context menu ─────────────────────────────────────────── */
.pas-ctx-menu {
    position: fixed;
    background: #1e1e1e;
    border: 2px solid var(--purple2);
    border-radius: 8px;
    padding: 4px 0;
    display: none;
    z-index: 3000;
    min-width: 170px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.pas-ctx-menu.active { display: block; }
.pas-ctx-menu div {
    padding: 14px 24px;
    cursor: pointer;
    font-size: 1.3rem;
    color: #ddd;
    transition: background 0.15s;
}
.pas-ctx-menu div:hover { background: var(--purple2); color: #fff; }

/* ── Assign overlay ───────────────────────────────────────── */
.pas-assign-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.82);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}
.pas-assign-overlay.active { display: flex; }
.pas-assign-panel {
    background: #1a1a1a;
    border: 3px solid var(--purple);
    border-radius: 14px;
    padding: 22px;
    max-width: 820px;
    width: 95%;
    box-shadow: 0 0 50px rgba(170,68,255,0.4);
}
.pas-assign-panel h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.4rem;
    color: var(--purple);
    letter-spacing: 0.1em;
    text-align: center;
    margin-bottom: 8px;
}
.assign-counter {
    text-align: center;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
    transition: background 0.2s, color 0.2s;
    background: rgba(255,255,255,0.06);
    color: #aaa;
}
.assign-counter.ac-ok      { background: rgba(34,197,94,0.18);  color: #22c55e; }
.assign-counter.ac-over    { background: rgba(239,68,68,0.18);  color: #ef4444; }
.assign-counter.ac-under   { background: rgba(245,158,11,0.18); color: #f59e0b; }
.pas-assign-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.pas-assign-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border-radius: 9px;
    padding: 8px 6px;
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.2s;
}
.pas-assign-item:hover { background: #2a2a2a; }
.pas-assign-item.selected { border-color: var(--purple); background: rgba(170,68,255,0.12); }
.pas-assign-item.elim { opacity: 0.35; cursor: default; filter: grayscale(80%); }
.pas-assign-item img {
    width: 100%;
    aspect-ratio: 80/110;
    object-fit: cover;
    border-radius: 7px;
    border: 2px solid #333;
}
.pas-assign-item.selected img { border-color: var(--purple); }
.pas-assign-item .assign-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-top: 5px;
    text-align: center;
}
.pas-assign-close {
    display: block;
    width: 100%;
    padding: 10px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    background: #333;
    color: #aaa;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.pas-assign-close:hover { background: #444; color: #fff; }

/* ── Tooltip ──────────────────────────────────────────────── */
.pas-tooltip {
    position: fixed;
    background: rgba(0,0,0,0.88);
    border: 1px solid var(--purple2);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 0.9rem;
    color: #eee;
    pointer-events: none;
    z-index: 5000;
    display: none;
    max-width: 200px;
}

/* highlight during roulette */
.pas-box.highlight-roulette {
    border-color: #cc88ff !important;
    background: rgba(180,100,255,0.22) !important;
    color: #eeccff !important;
    box-shadow: 0 0 24px rgba(180,80,255,0.85) !important;
}

/* -- No-participants prompt ----------------------------------- */
.mod-no-p {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 12px 0;
    text-align: center;
}
.mod-no-p-label {
    font-family: 'Oswald', sans-serif;
    font-size: 1.3rem;
    font-weight: 400;
    color: #888;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.mod-no-p-label strong {
    color: #fff;
    font-size: 2rem;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.1em;
}
.mod-no-p-btn {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    letter-spacing: 5px;
    padding: 14px 52px;
    background: #000;
    color: #fff;
    border: 3px solid #00ff55;
    border-radius: 10px;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    box-shadow: 0 0 12px rgba(0,255,85,0.7), 0 0 30px rgba(0,255,85,0.3);
    animation: mod-btn-glow 2s ease-in-out infinite alternate;
    transition: transform 0.15s;
}
@keyframes mod-btn-glow {
    from { box-shadow: 0 0 10px rgba(0,255,85,0.6), 0 0 25px rgba(0,255,85,0.25); }
    to   { box-shadow: 0 0 22px rgba(0,255,85,1),   0 0 55px rgba(0,255,85,0.5); }
}
.mod-no-p-btn:hover  { transform: scale(1.06); }
.mod-no-p-btn:active { transform: scale(0.97); }
