/* ============================================================
   Quiz Buzzer - Polytron Theme (merah / hitam / putih)
   ============================================================ */

:root {
    --pt-red: #E4002B;
    --pt-red-dark: #A8001F;
    --pt-red-glow: rgba(228, 0, 43, 0.55);
    --pt-black: #0D0D0D;
    --pt-black-soft: #1A1A1A;
    --pt-panel: #191919;
    --pt-white: #FFFFFF;
    --pt-gray: #8A8D91;
    --pt-gray-light: #C7C9CC;
    --pt-green: #1FAA59;
    --pt-green-glow: rgba(31, 170, 89, 0.55);
    --pt-radius: 14px;
    --pt-font: 'Poppins', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--pt-black);
    color: var(--pt-white);
    font-family: var(--pt-font);
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

button {
    font-family: var(--pt-font);
    cursor: pointer;
    border: none;
}

/* ---------- Top brand bar (shared) ---------- */
.pt-brandbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(180deg, var(--pt-black-soft), var(--pt-black));
    border-bottom: 3px solid var(--pt-red);
}

.pt-logo {
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 2px;
    color: var(--pt-white);
}
.pt-logo span { color: var(--pt-red); }

.pt-logo-img { max-height: 40px; }

/* ============================================================
   Landing page
   ============================================================ */
.landing-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 24px;
    text-align: center;
}

.landing-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.landing-title span { color: var(--pt-red); }

.landing-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
}

.landing-links a {
    padding: 18px 32px;
    background: var(--pt-panel);
    border: 2px solid var(--pt-red);
    border-radius: var(--pt-radius);
    font-weight: 700;
    letter-spacing: 0.5px;
    transition: transform .15s ease, background .15s ease;
}
.landing-links a:hover { background: var(--pt-red); transform: translateY(-2px); }

/* ============================================================
   A. MOBILE WEBAPP
   ============================================================ */
.mobile-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mobile-clock {
    text-align: center;
    padding: 14px 10px 4px;
}
.mobile-clock .tanggal {
    font-size: 0.95rem;
    color: var(--pt-gray-light);
    font-weight: 500;
}
.mobile-clock .jam {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

/* --- Pemilihan meja --- */
.meja-select-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 20px;
}
.meja-select-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--pt-gray-light);
}
.meja-grid-select {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 420px;
    width: 100%;
}
.meja-grid-select button {
    aspect-ratio: 1;
    border-radius: 12px;
    background: var(--pt-panel);
    border: 2px solid #333;
    color: var(--pt-white);
    font-size: 1.2rem;
    font-weight: 700;
}
.meja-grid-select button:active { background: var(--pt-red); border-color: var(--pt-red); }

/* --- Layar buzzer utama --- */
.buzzer-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    gap: 16px;
}

.buzzer-meja-label {
    text-align: center;
}
.buzzer-meja-label .kecil { font-size: 0.9rem; color: var(--pt-gray-light); font-weight: 500; }
.buzzer-meja-label .besar { font-size: 1.8rem; font-weight: 800; }
.buzzer-ganti-meja {
    font-size: 0.85rem;
    color: var(--pt-gray-light);
    text-decoration: underline;
    background: none;
    padding: 6px;
}

.buzzer-status-text {
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    min-height: 1.4em;
}
.buzzer-status-text.status-menunggu { color: var(--pt-gray-light); }
.buzzer-status-text.status-siap { color: var(--pt-green); }
.buzzer-status-text.status-tertekan { color: var(--pt-gray); }

#btnBuzzer {
    width: min(72vw, 300px);
    height: min(72vw, 300px);
    border-radius: 50%;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--pt-white);
    background: var(--pt-gray);
    border: 6px solid #555;
    transition: all .15s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
}

#btnBuzzer.aktif {
    background: radial-gradient(circle at 35% 30%, #2bd876, var(--pt-green));
    border-color: #16813f;
    box-shadow: 0 0 40px var(--pt-green-glow);
}
#btnBuzzer.aktif:active { transform: scale(0.96); }

#btnBuzzer.tertekan {
    background: var(--pt-gray);
    border-color: #555;
    box-shadow: none;
    opacity: 0.7;
}

#btnBuzzer.terkunci {
    background: #333;
    border-color: #444;
    color: var(--pt-gray-light);
    opacity: 0.6;
}

.buzzer-rank-badge {
    text-align: center;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--pt-red);
    min-height: 1.6em;
}

.buzzer-score {
    text-align: center;
    color: var(--pt-gray-light);
    font-size: 0.95rem;
    padding-bottom: 10px;
}
.buzzer-score b { color: var(--pt-white); font-size: 1.3rem; }

/* ============================================================
   B. ADMIN BACKEND
   ============================================================ */
.admin-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--pt-black-soft);
    border-bottom: 3px solid var(--pt-red);
    flex-wrap: wrap;
    gap: 10px;
}

.admin-round-info {
    font-size: 0.9rem;
    color: var(--pt-gray-light);
}
.admin-round-info b { color: var(--pt-white); }

.btn-primary {
    background: var(--pt-red);
    color: var(--pt-white);
    padding: 12px 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 1rem;
}
.btn-primary:hover { background: var(--pt-red-dark); }

.btn-secondary {
    background: var(--pt-panel);
    color: var(--pt-white);
    border: 1px solid #444;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
}
.btn-secondary:hover { border-color: var(--pt-red); }

.btn-logout {
    background: none;
    color: var(--pt-gray-light);
    font-size: 0.85rem;
    text-decoration: underline;
}

.admin-tabs {
    display: flex;
    gap: 6px;
    padding: 10px 20px 0;
    background: var(--pt-black-soft);
    flex-wrap: wrap;
}
.admin-tab-btn {
    background: transparent;
    color: var(--pt-gray-light);
    padding: 10px 18px;
    border-radius: 10px 10px 0 0;
    font-weight: 700;
}
.admin-tab-btn.active {
    background: var(--pt-panel);
    color: var(--pt-white);
    border-bottom: 3px solid var(--pt-red);
}

.admin-content {
    flex: 1;
    padding: 20px;
    background: var(--pt-panel);
}

.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; }

.admin-columns {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .admin-columns { grid-template-columns: 1fr; }
}

.admin-card {
    background: var(--pt-black-soft);
    border-radius: var(--pt-radius);
    padding: 16px;
    border: 1px solid #2a2a2a;
}
.admin-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
    color: var(--pt-gray-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Ranked press list */
.press-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.press-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--pt-panel);
    border-radius: 10px;
    padding: 10px 14px;
    border-left: 5px solid var(--pt-gray);
}
.press-list li.rank-1 { border-left-color: var(--pt-red); background: linear-gradient(90deg, rgba(228,0,43,0.18), var(--pt-panel)); }
.press-rank {
    font-weight: 800;
    font-size: 1.1rem;
    width: 28px;
    text-align: center;
    color: var(--pt-gray-light);
}
.press-list li.rank-1 .press-rank { color: var(--pt-red); }
.press-meja { font-weight: 700; font-size: 1.05rem; flex: 1; }
.press-time { color: var(--pt-gray); font-size: 0.85rem; }
.press-toggle-btn {
    background: var(--pt-panel);
    border: 1px solid #444;
    color: var(--pt-gray-light);
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
}
.press-toggle-btn.active { background: var(--pt-green); color: var(--pt-black); border-color: var(--pt-green); }
.press-empty { color: var(--pt-gray); text-align: center; padding: 20px; font-size: 0.9rem; }

/* Meja status grid (admin) */
.meja-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
}
.meja-status-cell {
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: var(--pt-gray);
    color: var(--pt-black);
    font-size: 0.95rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .1s ease, border-color .15s ease;
    user-select: none;
}
.meja-status-cell:hover { transform: scale(1.06); }
.meja-status-cell.pressed { background: var(--pt-green); }
.meja-status-cell.inactive { background: #333; color: #666; }
.meja-status-cell.on-display { border-color: var(--pt-white); box-shadow: 0 0 12px var(--pt-red-glow); }

/* Score table */
table.score-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
table.score-table th, table.score-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #2a2a2a;
    text-align: left;
}
table.score-table th { color: var(--pt-gray-light); font-weight: 700; text-transform: uppercase; font-size: 0.78rem; }
table.score-table input[type="number"], table.score-table input[type="text"] {
    width: 90px;
    background: var(--pt-panel);
    border: 1px solid #444;
    color: var(--pt-white);
    padding: 6px 8px;
    border-radius: 6px;
    font-family: var(--pt-font);
}
table.score-table input[type="text"] { width: 140px; }
.score-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.score-actions button {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--pt-panel);
    border: 1px solid #444;
    color: var(--pt-white);
}
.score-actions button.plus { border-color: var(--pt-green); color: var(--pt-green); }
.score-actions button.minus { border-color: var(--pt-red); color: var(--pt-red); }
.score-actions button:hover { background: #2a2a2a; }
.badge-inactive { color: var(--pt-gray); font-size: 0.75rem; margin-left: 6px; }

/* Settings form */
.settings-form { display: flex; flex-direction: column; gap: 14px; max-width: 360px; }
.settings-form label { font-size: 0.85rem; color: var(--pt-gray-light); font-weight: 600; }
.settings-form input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--pt-panel);
    border: 1px solid #444;
    color: var(--pt-white);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--pt-font);
}
.settings-hint { color: var(--pt-gray); font-size: 0.8rem; }

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--pt-red);
    color: var(--pt-white);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 999;
}
.toast.show { opacity: 1; }

/* Modal overlay (konfirmasi password reset ronde) */
.pt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

/* Login page */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: var(--pt-panel);
    border: 1px solid #2a2a2a;
    border-radius: var(--pt-radius);
    padding: 32px;
    width: 100%;
    max-width: 340px;
    text-align: center;
}
.login-card h2 { margin: 0 0 20px; font-size: 1.2rem; }
.login-card input {
    width: 100%;
    padding: 12px 14px;
    background: var(--pt-black-soft);
    border: 1px solid #444;
    color: var(--pt-white);
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 1rem;
    font-family: var(--pt-font);
}
.login-card button {
    width: 100%;
    padding: 12px;
    background: var(--pt-red);
    color: var(--pt-white);
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
}
.login-error { color: var(--pt-red); font-size: 0.85rem; min-height: 1.4em; margin-bottom: 8px; }

/* ============================================================
   C. DISPLAY (landscape desktop)
   ============================================================ */
.display-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 28px 28px;
    background:
        radial-gradient(ellipse at center top, rgba(228,0,43,0.14), transparent 55%),
        var(--pt-black);
}

.display-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 6px;
}
.display-logo {
    font-weight: 800;
    font-size: 2rem;
    letter-spacing: 4px;
}
.display-logo span { color: var(--pt-red); }
.display-logo-img { max-height: 64px; }

.display-active-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 18px;
    min-height: 168px;
    justify-content: center;
}
.display-active-label {
    font-size: 1.1rem;
    letter-spacing: 3px;
    color: var(--pt-gray-light);
    font-weight: 700;
    text-transform: uppercase;
}
.display-active-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ff2f57, var(--pt-red));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.4rem;
    font-weight: 800;
    box-shadow: 0 0 55px var(--pt-red-glow);
    border: 6px solid #ffffff22;
    animation: pt-pulse 1.6s ease-in-out infinite;
}
.display-active-circle.kosong {
    background: var(--pt-panel);
    box-shadow: none;
    border-color: #333;
    color: var(--pt-gray);
    font-size: 1.3rem;
    animation: none;
}

@keyframes pt-pulse {
    0%, 100% { box-shadow: 0 0 35px var(--pt-red-glow); }
    50% { box-shadow: 0 0 70px var(--pt-red-glow); }
}

.display-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 1fr;
    gap: 14px;
    width: 100%;
    max-width: 1180px;
    flex: 1;
}

.display-cell {
    background: var(--pt-panel);
    border: 2px solid #2a2a2a;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    min-height: 110px;
    transition: all .2s ease;
}
.display-cell .num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--pt-white);
}
.display-cell .score {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--pt-red);
    background: var(--pt-black);
    border: 2px solid var(--pt-white);
    border-radius: 8px;
    padding: 2px 12px;
    margin-top: 6px;
    min-width: 2.4em;
    text-align: center;
}
.display-cell.inactive { opacity: 0.25; }
.display-cell.empty { background: transparent; border-style: dashed; border-color: #222; opacity: 0.3; }

.display-cell.active-toggle {
    border-color: var(--pt-red);
    background: linear-gradient(180deg, rgba(228,0,43,0.22), var(--pt-panel));
    box-shadow: 0 0 25px rgba(228,0,43,0.35);
}
.display-cell.active-toggle .num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--pt-red);
    color: var(--pt-white);
}

.display-clock {
    margin-top: 14px;
    color: var(--pt-gray-light);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
}
