/* 
 * WATCH THE POPULAR OPINION
 * DESIGN SYSTEM 2.2: "VOID GRID" (Restored Full)
 */

:root {
    /* --- PALETTE --- */
    --void-bg: #050507;
    --void-card: rgba(10, 10, 12, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    
    /* Dynamic Accents */
    --neon-a: #00f2ff; /* Electric Cyan */
    --neon-b: #ff0055; /* Hyper Pink */
    --grid-color: rgba(255, 255, 255, 0.03);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.3);
    
    /* State */
    --success: #00ff9d;
    --error: #ff3333;
    
    /* Dimensions */
    --max-width: 720px; /* Widened for desktop */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 4px;
    
    /* Animation */
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-smooth: cubic-bezier(0.23, 1, 0.32, 1);
}

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--void-bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    font-size: 16px;
    display: flex;
    flex-direction: column;
}

/* --- BACKGROUND: INFINITE GRID --- */
.ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: var(--void-bg);
    perspective: 1000px;
}

.grid-plane {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: rotateX(60deg);
    animation: gridMove 20s linear infinite;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,1) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 40%, rgba(0,0,0,1) 100%);
}

.vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, var(--void-bg) 90%);
    pointer-events: none;
}

@keyframes gridMove {
    0% { transform: rotateX(60deg) translateY(0); }
    100% { transform: rotateX(60deg) translateY(50px); }
}

/* --- LAYOUT --- */
.app-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

/* --- HEADER --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 0 60px;
}

.site-logo {
    height: 32px;
    width: auto;
    display: block;
    opacity: 0.9;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-muted);
}

.pulsing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

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

/* --- QUESTION --- */
.question-section {
    margin-bottom: 60px;
    text-align: left; /* Explicitly left align */
}

.meta-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 32px;
}

.timer-pill {
    display: inline-block;
    border: 1px solid var(--glass-border);
    padding: 6px 16px;
    border-radius: 100px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    background: rgba(0,0,0,0.3);
}

.timer-pill span {
    color: var(--text-secondary);
    font-weight: 600;
}

.glitch-text {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin: 0;
    color: var(--text-primary);
}

/* --- LIVE PERCENTAGE INDICATOR (Redesigned) --- */
.live-percentage {
    margin: 40px 0;
    padding: 0;
    border: none;
}

.pct-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.pct-item {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.pct-item.left { align-items: flex-start; }
.pct-item.right { align-items: flex-end; }

.pct-val {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
    text-shadow: 0 0 30px rgba(0,0,0,0.5);
}

.color-a { color: var(--neon-a); text-shadow: 0 0 20px rgba(0, 242, 255, 0.3); }
.color-b { color: var(--neon-b); text-shadow: 0 0 20px rgba(255, 0, 85, 0.3); }

.pct-lbl {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 8px;
}

.pct-divider {
    font-size: 1.5rem;
    color: var(--glass-border);
    font-weight: 300;
    margin: 0 20px;
}

/* --- VOTE COUNT DISPLAY (10k+ only) --- */
.vote-count-display {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
    letter-spacing: 0.05em;
}

.vote-count-display span {
    color: var(--text-primary);
    font-weight: 700;
}

/* --- CARDS & GLASS --- */
.glass-card {
    background: var(--void-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.error-card {
    text-align: center;
    border-color: rgba(255, 51, 51, 0.2);
}

.error-message {
    color: var(--error);
    margin-bottom: 16px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.error-details {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
}

.retry-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.retry-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* --- VOTING FORM --- */
.vote-form-container {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.slider-mechanism {
    position: relative;
}

.option-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.opt-label {
    transition: all 0.4s ease;
    opacity: 0.3;
}

.opt-label.active {
    opacity: 1;
    text-shadow: 0 0 15px currentColor;
}

.opt-label.left { color: var(--neon-a); }
.opt-label.right { color: var(--neon-b); }

/* Track - BRIGHTER & MORE VISIBLE */
.slider-track-container {
    position: relative;
    height: 48px;
    background: rgba(255,255,255,0.08); /* Brighter bg */
    border: 1px solid rgba(255,255,255,0.2); /* Brighter border */
    border-radius: 100px;
    display: flex;
    align-items: center;
    padding: 0 4px;
    box-shadow: 0 0 15px rgba(0,0,0,0.5) inset;
}

.slider-glow-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, var(--neon-a), transparent 50%, var(--neon-b));
    opacity: 0.4; /* Much brighter glow (was 0.1) */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.slider-mechanism:hover .slider-glow-track {
    opacity: 0.6;
}

/* Slider Input */
.cyber-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 100%;
    background: transparent;
    outline: none;
    z-index: 2;
    cursor: grab;
}

.cyber-slider:active { cursor: grabbing; }

/* Thumb */
.cyber-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    cursor: grab;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cyber-slider:active::-webkit-slider-thumb {
    transform: scale(0.9);
}

.cyber-slider::-moz-range-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    cursor: grab;
}

/* Feedback */
.slider-feedback-text {
    text-align: center;
    margin-top: 24px;
    min-height: 20px;
}

#slider-feedback {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    font-weight: 600;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

#slider-feedback.active {
    color: var(--text-primary);
}

/* --- EMAIL --- */
.email-gate {
    margin-top: 8px;
}

.input-group {
    position: relative;
}

.cyber-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 100px; /* Roundy! */
    padding: 14px 20px; /* Top/bottom + nice left padding */
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.3s ease;
}

.cyber-input:focus {
    outline: none;
    border-color: var(--text-secondary);
    background: rgba(255,255,255,0.08);
}

.cyber-input::placeholder {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.micro-copy {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-family: 'Courier New', monospace;
}

/* --- BUTTON --- */
.cyber-button {
    width: 100%;
    padding: 16px;
    background: var(--text-primary);
    color: #000;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.3;
    pointer-events: none;
}

.cyber-button:not(:disabled) {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.cyber-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(255,255,255,0.2);
}

/* --- RESULTS --- */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

.result-row {
    width: 100%;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.res-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.res-percent {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.bar-bg {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.05);
    border-radius: 100px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    transition: width 1s cubic-bezier(0.23, 1, 0.32, 1);
}

.fill-a { background: var(--neon-a); box-shadow: 0 0 10px var(--neon-a); }
.fill-b { background: var(--neon-b); box-shadow: 0 0 10px var(--neon-b); }
.res-a { color: var(--neon-a); }
.res-b { color: var(--neon-b); }

.total-stats {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 32px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}

/* --- FOOTER --- */
.footer {
    text-align: center;
    padding: 24px 0;
    margin-top: auto;
}

.minimal-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.minimal-link:hover { opacity: 1; }

/* --- HELPERS --- */
.hidden { display: none !important; }
.loading-view { min-height: 200px; display: flex; justify-content: center; align-items: center; }
.loader { width: 24px; height: 24px; border: 2px solid var(--text-muted); border-top-color: var(--text-primary); border-radius: 50%; animation: spin 1s infinite linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- RESPONSIVE --- */
@media (min-width: 768px) {
    .glitch-text { font-size: 3.5rem; }
}
