@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --accent-color: #00ff41;
    --danger-color: #ff003c;
    --border-color: #30363d;
    --font-family: 'VT323', Courier, monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

h1, h2, h3 {
    text-transform: uppercase;
    letter-spacing: 2px;
}

.container {
    width: 100%;
    max-width: 600px;
    background: #161b22;
    border: 1px solid var(--border-color);
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.1);
}

.hidden {
    display: none !important;
}

input, select, button {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: #0d1117;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-family: var(--font-family);
    font-size: 1.1em;
    box-sizing: border-box;
}

button {
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
}

button:hover {
    background: var(--accent-color);
    color: #000;
}

.danger-btn {
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.danger-btn:hover {
    background: var(--danger-color);
    color: #fff;
}

.log-entry {
    border-bottom: 1px solid var(--border-color);
    padding: 5px 0;
    font-size: 0.9em;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-columns {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.log-column {
    flex: 1;
    min-width: 0;
}

.log-column h3 {
    font-size: 1.1em;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-active { background-color: var(--accent-color); }
.status-hacked { background-color: var(--danger-color); }

.hacked-banner {
    width: 100%;
    max-width: 600px;
    background: rgba(255, 0, 60, 0.7);
    color: white;
    text-align: center;
    padding: 20px 0;
    font-weight: bold;
    border: 2px solid var(--danger-color);
    box-shadow: 0 5px 20px rgba(255, 0, 60, 0.5);
    text-transform: uppercase;
    letter-spacing: 5px;
    margin-bottom: 20px;
}

.hacked-banner pre {
    font-size: 8px;
    line-height: 8px;
    margin: 0 auto 10px;
    display: inline-block;
    text-align: left;
}

/* Guess History Styles (Match Projector) */
.guess-history {
    flex-grow: 1;
    margin-top: 10px;
    font-family: monospace;
    font-size: 0.9em;
    text-align: left;
    overflow: hidden;
}

.history-label {
    color: #666;
    font-size: 0.8em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
    border-bottom: 1px solid #222;
}

.guess-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #1a1a1a;
    padding: 6px 0;
    font-size: 1.1em;
}

.guess-row .val { font-weight: bold; font-size: 1.2em; }
.guess-row .res { font-size: 0.9em; opacity: 0.9; }

/* Color Coding */
.guess-red { color: #ff003c; }    /* Hacked */
.guess-orange { color: #ffa500; } /* Positional matches */
.guess-yellow { color: #ffff00; } /* Digit matches */
.guess-grey { color: #555; }      /* No matches */


.feedback-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
}

.feedback-score {
    font-weight: bold;
}

/* Target Grid */
.target-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0;
    padding: 10px;
    background: #0d1117;
    border: 1px solid var(--border-color);
    min-height: 48px;
    align-items: center;
}

.target-btn {
    width: auto;
    padding: 6px 14px;
    margin: 0;
    font-size: 0.95em;
    border-color: var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.15s;
}

.target-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: transparent;
}

.target-btn.selected {
    border-color: var(--accent-color);
    color: #000;
    background: var(--accent-color);
}

.target-btn.hint-orange { color: #ffa500; border-color: #ffa500; }
.target-btn.hint-orange:hover,
.target-btn.hint-orange.selected { background: #ffa500; color: #000; border-color: #ffa500; }

.target-btn.hint-yellow { color: #ffff00; border-color: #ffff00; }
.target-btn.hint-yellow:hover,
.target-btn.hint-yellow.selected { background: #ffff00; color: #000; border-color: #ffff00; }

/* PIN Entry Widget */
.pin-display {
    display: flex;
    gap: 14px;
    justify-content: center;
    padding: 10px;
    margin: 10px 0;
    background: #0d1117;
    border: 1px solid var(--accent-color);
    cursor: text;
    outline: none;
    box-sizing: border-box;
    width: 100%;
}

.pin-display:focus {
    box-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
}

.pin-slot {
    font-size: 1.8em;
    color: var(--border-color);
    font-family: var(--font-family);
    min-width: 1ch;
    text-align: center;
    line-height: 1;
    transition: color 0.1s;
}

.pin-slot.filled {
    color: var(--accent-color);
}

/* ── Pending-card button row (always, not just mobile) ───────────── */
/* APPROVE / REJECT buttons sit side-by-side inside the card */
.card.pending_approval > div {
    display: flex;
    gap: 6px;
}

.card.pending_approval > div button {
    flex: 1;
    width: auto;
    margin: 0;
}

/* ── Admin mobile responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .log-columns {
        flex-direction: column;
    }
    
    /* Stack pending / active columns vertically */
    #game-panel > div:first-child {
        flex-direction: column !important;
    }

    /* Stack chaos protocol row */
    div:has(> #chaos-target) {
        flex-wrap: wrap !important;
    }

    #chaos-target {
        width: 100% !important;
        box-sizing: border-box;
    }

    #chaos-result {
        width: 100%;
        margin-top: 4px;
    }

    /* Shrink card grid columns so they don't overflow */
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 540px) {
    /* Wrap the admin header row */
    #admin-panel > div:first-child {
        flex-wrap: wrap !important;
        gap: 8px;
    }

    /* Full-width card grid on very small screens */
    .grid {
        grid-template-columns: 1fr;
    }

    /* Ensure buttons inside cards don't overflow */
    .toggle-switch {
        flex: 1 1 auto;
        min-width: 0;
    }
}
