/* ========================================
   SPY GAME — Tactical Dark Theme (Scaled UI)
   ======================================== */

:root {
    --bg: #242a27;
    --accent: #a0ed3c;
    --accent-dim: #7ab82e;
    --surface: rgba(36, 42, 39, 0.88);
    --border: rgba(255, 255, 255, 0.12);
    --text: #e8e8e8;
    --font-mono: "Courier New", Courier, monospace;
    --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
    --scale: 1.15;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    overflow-x: hidden;
    font-size: calc(0.875rem * var(--scale));
    line-height: 1.5;
}

/* ---- Hacker Grid Background ---- */
.hacker-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(160, 237, 60, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(160, 237, 60, 0.04) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* ---- Scan Line ---- */
.scan-line {
    position: fixed;
    left: 0;
    right: 0;
    height: 5px;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(160, 237, 60, 0.18),
        transparent
    );
    animation: scan 4s ease-in-out infinite;
}
@keyframes scan {
    0% {
        top: 0;
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        top: 100%;
        opacity: 0;
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(160, 237, 60, 0.3);
    border-radius: 3px;
}

/* ---- Typography ---- */
h1,
h2,
h3 {
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- Utility ---- */
.neon-glow {
    box-shadow:
        0 0 12px rgba(160, 237, 60, 0.35),
        0 0 24px rgba(160, 237, 60, 0.12);
}
.neon-text {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(160, 237, 60, 0.5);
}
.pulse-border {
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {
    0%,
    100% {
        border-color: rgba(160, 237, 60, 0.3);
    }
    50% {
        border-color: rgba(160, 237, 60, 0.85);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes scanReveal {
    0% {
        clip-path: inset(100% 0 0 0);
    }
    100% {
        clip-path: inset(0 0 0 0);
    }
}
.scan-reveal {
    animation: scanReveal 0.8s ease-out forwards;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    border: 1.5px solid var(--border);
    background: transparent;
    color: var(--text);
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover {
    border-color: rgba(255, 255, 255, 0.35);
}
.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #1a1f1c;
    border-color: var(--accent);
    font-weight: 900;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    box-shadow:
        0 0 12px rgba(160, 237, 60, 0.35),
        0 0 24px rgba(160, 237, 60, 0.12);
}

.btn-danger {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.3);
}
.btn-danger:hover:not(:disabled) {
    border-color: rgba(248, 113, 113, 0.6);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.75rem;
}

/* ---- Inputs ---- */
.input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1.5px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.2s;
}
.input:focus {
    border-color: rgba(160, 237, 60, 0.55);
}
.input::placeholder {
    color: rgba(255, 255, 255, 0.18);
}

.select {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1.5px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: auto;
}
.select:focus {
    border-color: rgba(160, 237, 60, 0.55);
}
.select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="range"] {
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    outline: none;
    width: 100%;
    accent-color: var(--accent);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent) !important;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(160, 237, 60, 0.4);
    border: none;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 8px rgba(160, 237, 60, 0.4);
}

/* ---- Panels ---- */
.panel {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 0.625rem;
    padding: 1.25rem;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.panel-header .label {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.panel-header .line {
    flex: 1;
    height: 1px;
    background: var(--border);
}
.panel-header .badge {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: var(--accent);
}

/* ---- Layout ---- */
.page {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}
.page-center {
    justify-content: center;
}
.container {
    width: 100%;
    max-width: 56rem;
}
.container-sm {
    max-width: 30rem;
}

/* ---- Brand Logo ---- */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.625rem;
    border: 1.5px solid rgba(160, 237, 60, 0.3);
    background: rgba(36, 42, 39, 0.8);
    box-shadow:
        0 0 12px rgba(160, 237, 60, 0.35),
        0 0 24px rgba(160, 237, 60, 0.12);
}
.brand-icon svg {
    transform: rotate(-12deg);
    color: var(--accent);
}
.brand-title {
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 12px rgba(160, 237, 60, 0.5);
}
.brand-subtitle {
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--font-mono);
    letter-spacing: 0.1em;
    font-size: 0.7rem;
}

/* ---- Role Card ---- */
.role-card {
    perspective: 1000px;
    width: 100%;
    max-width: 20rem;
    margin: 0 auto;
    cursor: pointer;
    user-select: none;
}
.role-card-inner {
    position: relative;
    width: 100%;
    height: 18rem;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    border-radius: 0.75rem;
    border: 2px solid var(--border);
}
.role-card-inner.flipped {
    transform: rotateY(180deg);
}
.role-card-inner.pulse-border {
    animation: pulse-border 2s ease-in-out infinite;
}

.role-card-front,
.role-card-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.role-card-front {
    background: rgba(36, 42, 39, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.role-card-back {
    transform: rotateY(180deg);
    background: rgba(36, 42, 39, 0.96);
    border: 1px solid rgba(160, 237, 60, 0.3);
}

.role-card-label {
    position: absolute;
    top: 0.75rem;
    font-size: 0.7rem;
    font-family: var(--font-mono);
    letter-spacing: 0.15em;
    padding: 0.2rem 0.9rem;
    border-radius: 999px;
    text-transform: uppercase;
}
.role-card-label.spy {
    background: rgba(127, 29, 29, 0.5);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}
.role-card-label.agent {
    background: rgba(160, 237, 60, 0.1);
    color: var(--accent);
    border: 1px solid rgba(160, 237, 60, 0.3);
}

.role-card-back .info-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}
.role-card-back .info-value {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ---- Timer ---- */
.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.timer-label {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}
.timer-value {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    font-variant-numeric: tabular-nums;
}
.timer-value.active {
    padding: 0.35rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow:
        0 0 12px rgba(160, 237, 60, 0.35),
        0 0 24px rgba(160, 237, 60, 0.12);
}
.timer-value.normal {
    color: var(--accent);
}
.timer-value.low {
    color: #facc15;
}
.timer-value.critical {
    color: #f87171;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.timer-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.timer-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
}
.timer-dot.critical {
    background: #f87171;
    animation: pulse 1s ease-in-out infinite;
}
.timer-dot.low {
    background: #facc15;
}
.timer-dot.active-dot {
    background: var(--accent);
}
.timer-status-text {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 0.15em;
}

/* ---- Location Board ---- */
.location-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.location-btn {
    text-align: left;
    padding: 0.6rem 0.85rem;
    border-radius: 0.375rem;
    border: 1.5px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.location-btn:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}
.location-btn.selected {
    border-color: rgba(160, 237, 60, 0.5);
    background: rgba(160, 237, 60, 0.1);
    color: var(--accent);
    cursor: default;
}
.location-btn.eliminated {
    border-color: rgba(127, 29, 29, 0.5);
    background: rgba(127, 29, 29, 0.25);
    color: rgba(248, 113, 113, 0.55);
    text-decoration: line-through;
    cursor: pointer;
}

.location-btn .check {
    color: var(--accent);
    font-size: 0.75rem;
}
.location-btn .cross {
    color: #f87171;
    font-size: 0.75rem;
}

/* ---- Room Code Display ---- */
.room-code-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1.5px solid rgba(160, 237, 60, 0.3);
    border-radius: 0.625rem;
    padding: 1rem 2rem;
    box-shadow:
        0 0 12px rgba(160, 237, 60, 0.35),
        0 0 24px rgba(160, 237, 60, 0.12);
}
.room-code-label {
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 0.15em;
}
.room-code-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: var(--accent);
}

/* ---- Player Item ---- */
.player-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 0.375rem;
    border: 1.5px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}
.player-item.host {
    border-color: rgba(160, 237, 60, 0.3);
    background: rgba(160, 237, 60, 0.07);
}

.player-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    flex-shrink: 0;
}
.player-dot.online {
    background: var(--accent);
}
.player-dot.offline {
    background: #f87171;
}
.player-dot.revealed {
    background: var(--accent);
}
.player-dot.pending {
    background: #facc15;
}

.player-name {
    font-size: 0.875rem;
    font-family: var(--font-mono);
    color: rgba(255, 255, 255, 0.8);
}

.player-tag {
    margin-left: auto;
    font-size: 0.6875rem;
    font-family: var(--font-mono);
    letter-spacing: 0.15em;
}
.player-tag.host {
    color: var(--accent);
}
.player-tag.you {
    color: var(--accent);
}
.player-tag.classified {
    color: rgba(255, 255, 255, 0.15);
}
.player-tag.open {
    color: var(--accent);
}

/* ---- Voting ---- */
.vote-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
    max-width: 32rem;
}
.vote-card {
    position: relative;
    padding: 1.5rem 1rem;
    border-radius: 0.625rem;
    border: 1.5px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-mono);
}
.vote-card:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.35);
}
.vote-card.selected {
    border-color: rgba(248, 113, 113, 0.5);
    background: rgba(127, 29, 29, 0.25);
    color: #f87171;
}
.vote-card:disabled {
    cursor: default;
    opacity: 0.7;
}
.vote-card-name {
    font-size: 0.9375rem;
    font-weight: 700;
}
.vote-card-count {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.25);
    margin-top: 0.25rem;
}
.vote-badge {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 50%;
    background: #f87171;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 900;
    color: white;
}

/* ---- Progress Bar ---- */
.progress-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.progress-track {
    height: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    flex: 1;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 999px;
    transition: width 0.3s;
}
.progress-text {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--accent);
}

/* ---- Loading Dots ---- */
.loading-dots {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
.loading-dot {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse-dot 1.4s ease-in-out infinite;
}
.loading-dot:nth-child(2) {
    animation-delay: 0.3s;
}
.loading-dot:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes pulse-dot {
    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---- Misc ---- */
.mb-1 {
    margin-bottom: 0.25rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.mb-3 {
    margin-bottom: 0.75rem;
}
.mb-4 {
    margin-bottom: 1rem;
}
.mb-6 {
    margin-bottom: 1.5rem;
}
.mb-8 {
    margin-bottom: 2rem;
}
.mt-1 {
    margin-top: 0.25rem;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mt-3 {
    margin-top: 0.75rem;
}
.mt-4 {
    margin-top: 1rem;
}
.mt-6 {
    margin-top: 1.5rem;
}
.mt-8 {
    margin-top: 2rem;
}
.mt-12 {
    margin-top: 3rem;
}
.gap-1 {
    gap: 0.25rem;
}
.gap-2 {
    gap: 0.5rem;
}
.gap-3 {
    gap: 0.75rem;
}
.gap-4 {
    gap: 1rem;
}
.gap-6 {
    gap: 1.5rem;
}
.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.flex-wrap {
    flex-wrap: wrap;
}
.items-center {
    align-items: center;
}
.justify-center {
    justify-content: center;
}
.justify-between {
    justify-content: space-between;
}
.text-center {
    text-align: center;
}
.w-full {
    width: 100%;
}
.hidden {
    display: none;
}
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
