:root {
    /* Midnight Aurora Palette - High End Dark Mode (Default) */
    --bg-deep: #020617;
    --bg-slate: #0f172a;
    --accent-indigo: #6366f1;
    --accent-electric: #8b5cf6;
    
    /* Text - Fluid Sizing */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #8899a6;
    --font-heading: clamp(2rem, 5vw, 3.5rem);
    --font-subheading: clamp(1rem, 2vw, 1.25rem);
    
    /* Party Colors (Reference only) */
    --ldf-color: #f43f5e;
    --udf-color: #3b82f6;
    --nda-color: #fb923c;
    
    /* Premium Shadows & Effects */
    --premium-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* EVM Skeuomorphism - Realistic Materials */
    --evm-aluminum: linear-gradient(180deg, #334155 0%, #1e293b 100%);
    --evm-plastic: #1e293b;
    --evm-border: #475569;
    --evm-shadow: 
        0 20px 50px -10px rgba(0, 0, 0, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.5);
    
    --lamp-maroon: #f43f5e;
    --lamp-ready: #10b981;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #0f172a;
    background: radial-gradient(circle at center, #1e293b 0%, #020617 100%);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Aurora Backdrop Animation */
body::before, body::after {
    content: '';
    position: fixed;
    width: 60vw;
    height: 60vw;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.15;
    animation: auroraMove 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
}

body::before {
    background: radial-gradient(circle, var(--accent-indigo), transparent);
    top: -10%;
    left: -10%;
}

body::after {
    background: radial-gradient(circle, var(--accent-electric), transparent);
    bottom: -10%;
    right: -10%;
    animation-delay: -10s;
}

@keyframes auroraMove {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 10%) scale(1.1); }
}

#app {
    width: 100%;
    max-width: 1100px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 0.25rem;
}

header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1;
    background: linear-gradient(to bottom, #fff 0%, #c7d2fe 50%, #6366f1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.75rem;
}

header p#sub-header-text {
    color: var(--text-secondary);
    font-size: var(--font-subheading);
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
}

.ml-header {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 0;
}

.ml-sub {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: -1.5rem;
    margin-bottom: 2rem;
}

.ml-sub-header {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    margin-bottom: 2rem;
    opacity: 0.7;
}

.constituency-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-indigo);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.constituency-display .ml-name {
    font-size: 0.95rem;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-secondary);
    font-weight: 400;
}

main {
    display: flex;
    gap: 3rem;
    justify-content: center;
    align-items: flex-start;
    min-height: 400px;
    padding: 1rem 2rem;
    transition: all 0.5s ease;
}

/* Screen transition system */
.screen-fade {
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    transform: translateY(12px);
    pointer-events: none;
}
.screen-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Hidden Utility */
.hidden { display: none !important; }

/* Selection Screen Card */
.selection-container {
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
}

.selection-card {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    padding: 3.5rem;
    border-radius: 32px;
    box-shadow: var(--glass-shadow);
    text-align: center;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.selection-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--glass-shadow), 0 0 30px rgba(99, 102, 241, 0.1);
}

.selection-card h2 {
    font-size: 1.5rem;
    margin-bottom: 2.5rem;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-primary);
    font-weight: 600;
}

.selection-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 3rem;
}

.selection-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
}

.selection-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 0.5rem;
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper.loading select {
    opacity: 0;
    pointer-events: none;
}

.select-wrapper.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    z-index: 5;
    overflow: hidden;
}

.select-wrapper.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.06) 40%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.06) 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 12px;
    z-index: 6;
}

.selection-group select {
    width: 100%;
    padding: 1.1rem;
    background: rgba(2, 6, 23, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    background-size: 1.25rem;
}

.selection-group select:focus {
    outline: none;
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background-color: rgba(2, 6, 23, 0.6);
}

.primary-btn {
    width: 100%;
    padding: 1.25rem;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-electric) 100%);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.primary-btn.loading {
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.primary-btn.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.2) 40%,
        rgba(255,255,255,0.4) 50%,
        rgba(255,255,255,0.2) 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

.primary-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 20px 30px -10px rgba(99, 102, 241, 0.5);
}

.primary-btn:disabled {
    background: #1e293b;
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.6;
}

/* EVM Container Redesign */
.evm-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    perspective: 1000px;
}

.evm-container {
    background: var(--evm-plastic);
    background-image: var(--evm-aluminum);
    width: 100%;
    max-width: 540px;
    border-radius: 28px;
    padding: 1.75rem;
    box-shadow: var(--evm-shadow);
    border: 1px solid var(--evm-border);
    position: relative;
    color: var(--text-primary);
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.evm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.5rem;
}

.ready-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.3);
    border-radius: 99px;
    border: 1px solid rgba(255,255,255,0.05);
}

.lamp-ready-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #064e3b;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lamp-ready-circle.active {
    background: var(--lamp-ready);
    box-shadow: 0 0 15px var(--lamp-ready), 0 0 5px #fff, inset 0 1px 2px rgba(255,255,255,0.5);
    animation: lampBreath 2s ease-in-out infinite;
}

@keyframes lampBreath {
    0%, 100% { box-shadow: 0 0 10px var(--lamp-ready), inset 0 1px 2px rgba(255,255,255,0.5); }
    50%       { box-shadow: 0 0 24px var(--lamp-ready), 0 0 8px #fff, inset 0 1px 2px rgba(255,255,255,0.5); }
}

.lamp-ready-circle.busy {
    background: var(--lamp-maroon);
    box-shadow: 0 0 15px var(--lamp-maroon), 0 0 5px #fff, inset 0 1px 2px rgba(255,255,255,0.5);
}

.ballot-unit-label {
    font-size: 0.75rem;
    font-weight: 800;
    font-family: 'Space Grotesk', sans-serif;
    color: var(--text-secondary);
}


/* Balloting Unit Interior */
.balloting-unit {
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border: 1px solid var(--evm-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.candidate-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    border-bottom: 1px solid var(--evm-border);
    background: rgba(0,0,0,0.1);
}

.ballot-paper-side {
    background: #f8fafc;
    background-image: radial-gradient(#e2e8f0 0.5px, transparent 0.5px);
    background-size: 4px 4px; /* Subtle paper texture */
    padding: 10px 15px 10px 35px;
    display: grid;
    grid-template-columns: 35px 1fr 48px 48px;
    align-items: center;
    gap: 15px;
    position: relative;
    color: #1e293b;
    box-shadow: inset -5px 0 10px rgba(0,0,0,0.05);
}

.ballot-paper-side::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 5px;
    bottom: 5px;
    width: 12px;
    background: #cbd5e1;
    border-radius: 4px;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.2);
}

.name-en {
    font-weight: 800; 
    font-size: 0.85rem; 
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #0f172a;
}

.sl-no {
    font-weight: 800;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    text-align: center;
    color: var(--text-muted);
}

/* Hidden serial number — preserves grid layout */
.sl-no--hidden {
    visibility: hidden;
    min-width: 35px;
}

/* Indicative / Provisional Notice Banner - Collapsible */
.indicative-notice {
    display: flex;
    flex-direction: column;
    margin: 0.6rem;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(245, 158, 11, 0.04));
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInDown 0.4s ease forwards;
}

.indicative-notice:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.06));
    border-color: rgba(251, 191, 36, 0.4);
}

.indicative-notice__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    user-select: none;
}

.indicative-notice__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.indicative-notice__title {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.indicative-notice__title .en {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.indicative-notice__title .ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.8rem;
    color: #fde68a;
    font-weight: 500;
}

.indicative-notice__toggle-hint {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
    margin-right: 0.5rem;
}

.indicative-notice__chevron {
    width: 12px;
    height: 12px;
    border-right: 2px solid #fbbf24;
    border-bottom: 2px solid #fbbf24;
    transform: rotate(-135deg);
    transition: transform 0.3s ease;
    margin-right: 0.25rem;
}

.indicative-notice:not(.collapsed) .indicative-notice__chevron {
    transform: rotate(45deg);
    margin-bottom: 4px;
}

.indicative-notice:not(.collapsed) .indicative-notice__toggle-hint {
    display: none;
}

.indicative-notice__content {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.indicative-notice.collapsed .indicative-notice__content {
    grid-template-rows: 0fr;
    opacity: 0;
    pointer-events: none;
}

.indicative-notice__body {
    overflow: hidden;
    padding: 0 1rem 1rem 2.95rem; /* Aligns with text under icon */
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.indicative-notice__en, .indicative-notice__ml {
    font-size: 0.75rem;
    line-height: 1.5;
    margin: 0;
}

.indicative-notice__en {
    color: #fef3c7;
}

.indicative-notice__ml {
    font-family: 'Noto Sans Malayalam', sans-serif;
    color: #fde68a;
}


@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.candidate-photo, .candidate-symbol {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    padding: 2px;
}

.candidate-photo img, .candidate-symbol img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: grayscale(1);
    mix-blend-mode: multiply; /* Helps symbols look printed on paper */
}

.interactive-side {
    background: rgba(0,0,0,0.2);
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    justify-items: center;
    border-left: 1px solid var(--evm-border);
}

/* Button and Lamp Physics */
.pill-button {
    width: 50px;
    height: 28px;
    background: linear-gradient(to bottom, #4f46e5, #3730a3);
    border-radius: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 0 #1e1b4b, 0 8px 12px rgba(0,0,0,0.5);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.pill-button:focus-visible {
    outline: 3px solid #818cf8;
    outline-offset: 3px;
    box-shadow: 0 6px 0 #1e1b4b, 0 0 0 5px rgba(99,102,241,0.35);
}

.control-btn:disabled {
    background: #64748b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.pill-button:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #1e1b4b, 0 4px 6px rgba(0,0,0,0.3);
}

.pill-button:disabled {
    background: linear-gradient(to bottom, #374151, #1f2937);
    box-shadow: 0 2px 0 #111827, inset 0 2px 4px rgba(0,0,0,0.4);
    cursor: not-allowed;
    opacity: 0.5;
    transform: translateY(2px); /* Sunken look */
}

.maroon-lamp {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #450a0a;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.8);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.candidate-row.voted .maroon-lamp {
    background: #f43f5e;
    box-shadow: 0 0 20px #f43f5e, 0 0 5px #fff, inset 0 1px 2px rgba(255,255,255,0.5);
    animation: lampConfirm 0.4s ease-out forwards;
}

@keyframes lampConfirm {
    0%   { transform: scale(0.6); opacity: 0.5; }
    25%  { transform: scale(1.4); opacity: 1; }
    50%  { transform: scale(0.8); opacity: 0.8; }
    75%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1.0); opacity: 1; }
}



/* VVPAT Modal Popup - Pro Simulator Component */
.vvpat-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 95%;
    max-width: 380px;
    height: auto;
    background: var(--evm-plastic);
    background-image: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid var(--evm-border);
    border-bottom: 15px solid #000;
    border-radius: 28px;
    padding: 1.5rem 1.5rem 2rem 1.5rem;
    box-shadow: 0 0 0 100vw rgba(2, 6, 23, 0.9), var(--premium-shadow);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem; /* Consistent spacing */
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
}


#vvpat.active { 
    display: flex;
    pointer-events: auto;
    animation: popupIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.vvpat-window {
    width: 100%;
    height: 320px;
    background: #010409;
    border: 2px solid #334155;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    box-shadow: inset 0 4px 12px rgba(0,0,0,0.8);
}

/* Scanline overlay for CRT/government display realism */
.vvpat-window::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.12) 2px,
        rgba(0,0,0,0.12) 4px
    );
    pointer-events: none;
    z-index: 5;
    border-radius: 10px;
}

.vvpat-slip {
    width: 200px;
    height: auto;
    min-height: 280px;
    background: #fff;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    transform: translateY(-110%);
    transition: transform 1.8s cubic-bezier(0.2, 0, 0.2, 1);
    gap: 1rem;
    border: 1px solid #e2e8f0;
}

.vvpat-slip.show { transform: translateY(10px); }

.slip-symbol { width: 100px; height: 100px; }
.slip-symbol img { width: 100%; height: 100%; object-fit: contain; }

.slip-info {
    text-align: center;
    border-top: 1px dashed #94a3b8;
    padding-top: 1.5rem; /* Matches the gap */
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slip-num { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.25rem; }
.slip-name { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; color: #1e293b; }
.slip-name.ml-name { 
    font-size: 1.1rem; 
    text-transform: none; 
    color: #475569; 
    font-family: 'Noto Sans Malayalam', sans-serif;
}

.vvpat-label {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.vvpat-label span {
    display: block;
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    opacity: 0.6;
    margin-top: 2px;
}

/* Footer / Control Buttons */
#reset-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.reset-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.reset-layout__buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* EVM Progress Indicator */
.evm-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    background: rgba(0,0,0,0.25);
    border-radius: 99px;
    border: 1px solid rgba(255,255,255,0.05);
    margin-left: auto;
}

.evm-progress-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.4s ease, box-shadow 0.4s ease;
}

.evm-progress-dot.voted {
    background: var(--lamp-ready);
    box-shadow: 0 0 6px var(--lamp-ready);
}

/* Skeleton Loading System */
.skeleton-box, .skeleton-text, .skeleton-row {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.skeleton-box::after, .skeleton-text::after, .skeleton-row::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.06) 40%,
        rgba(255,255,255,0.12) 50%,
        rgba(255,255,255,0.06) 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
}

.skeleton-box {
    width: 100%;
    height: 54px;
    border-radius: 16px;
    margin-bottom: 1rem;
}

.skeleton-text {
    width: 80%;
    height: 1rem;
    border-radius: 4px;
    margin: 0.5rem 0;
}

.skeleton-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    border-bottom: 1px solid var(--evm-border);
    height: 70px;
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

#reset-btn, .secondary-btn, .share-btn {
    padding: 0.85rem 2rem;
    border-radius: 99px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.85rem;
}

/* Social Share Group */
.social-share-section {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Social Share section separator */
.share-separator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem 0 0.5rem;
    width: 100%;
    opacity: 0.5;
}
.share-separator::before,
.share-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}
.share-separator span {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.share-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.social-share-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.social-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.social-btn svg {
    width: 24px;
    height: 24px;
}

.social-btn:hover {
    transform: translateY(-4px) scale(1.1);
}

.social-btn:active {
    transform: translateY(0) scale(0.95);
}

.social-btn.whatsapp { background: #25D366; box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3); }
.social-btn.facebook { background: #1877F2; box-shadow: 0 4px 12px rgba(24, 119, 242, 0.3); }
.social-btn.x-twitter { background: #000000; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
.social-btn.instagram { 
    background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); 
    box-shadow: 0 4px 12px rgba(214, 36, 159, 0.3); 
}



#reset-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
}

#reset-btn:hover { background: rgba(255,255,255,0.1); }

.secondary-btn {
    background: transparent;
    border: 1px solid var(--accent-indigo);
    color: var(--accent-indigo);
}

.secondary-btn:hover {
    background: var(--accent-indigo);
    color: white;
}

/* Transitions */
.fade-in {
    animation: fadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Desktop: VVPAT next to BU */
@media (min-width: 901px) {
    .evm-wrapper {
        display: flex;
        flex-direction: row;
        gap: 4rem;
        align-items: flex-start;
        justify-content: center;
    }
}

@media (max-width: 900px) {
    main { flex-direction: column; gap: 2rem; align-items: center; }
    .evm-wrapper { flex-direction: column; align-items: center; gap: 2rem; }
}

@media (max-width: 600px) {
    /* Premium Mobile Overhaul */
    #app { padding: 0.75rem; gap: 1rem; }
    header h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
    .ml-header { font-size: 1.1rem; margin-bottom: 0.5rem; }
    header p#sub-header-text { font-size: 0.7rem; letter-spacing: 0.05em; }

    main { padding: 0.5rem; gap: 1.5rem; min-height: unset; }

    /* Sticky Control Header for Mobile */
    .evm-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--evm-plastic);
        padding: 0.75rem 1rem;
        margin: -1rem -1rem 1rem -1rem;
        border-bottom: 1px solid var(--evm-border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }

    /* Mobile Overlay Mode for VVPAT (Center Screen Popup) */
    .vvpat-display {
        width: 92%;
        max-width: 360px;
        min-height: 480px;
        padding: 1.25rem;
    }
    
    .vvpat-display.active { 
        display: flex !important; 
    }

    .vvpat-window { height: 280px; }
    .vvpat-slip { min-height: 240px; padding: 1rem; width: 200px; }

    .evm-container { padding: 0.75rem; border-radius: 20px; }
    
    /* Compact Premium Candidate Rows */
    .candidate-row { 
        margin-bottom: 8px; 
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 16px;
        overflow: hidden;
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        display: grid;
        grid-template-columns: 1fr 70px; /* Crucial fix for button visibility */
    }

    .ballot-paper-side { 
        padding: 10px 4px 10px 10px;
        grid-template-columns: 20px 1fr 36px 38px;
        gap: 6px;
        background: linear-gradient(to right, #ffffff 0%, #f8fafc 100%);
        border-right: 1px solid rgba(0,0,0,0.1);
    }

    .ballot-paper-side::before { display: none; } /* Remove side strip on mobile for space */

    .sl-no { font-size: 1rem; font-weight: 800; color: #475569; }
    .name-en { font-size: 0.75rem; font-weight: 800; color: #0f172a; line-height: 1.2; word-break: break-word; }
    .name-ml { font-size: 0.85rem; font-weight: 600; color: #334155; margin-top: 2px; }
    
    .candidate-photo { 
        width: 38px; 
        height: 38px; 
        border-radius: 6px;
        border: 1px solid #cbd5e1;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .candidate-symbol {
        width: 38px;
        height: 38px;
        border: none;
        background: transparent;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .candidate-symbol img {
        max-width: 90%;
        max-height: 90%;
        object-fit: contain;
    }

    .interactive-side { 
        background: transparent; 
        padding-right: 8px; 
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
    .pill-button { 
        width: 40px; 
        height: 24px; 
        box-shadow: 0 4px 0 #1e1b4b, 0 4px 8px rgba(0,0,0,0.5); 
        border-radius: 12px;
    }
    .maroon-lamp { width: 10px; height: 10px; }

    /* Centered stacking for reset & social buttons on mobile */
    .reset-layout__buttons {
        flex-direction: column;
        width: 100%;
        gap: 1.25rem;
    }

    #reset-btn {
        width: 100%;
        max-width: 320px;
    }

    #reset-container .social-share-group {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

@keyframes slideIn {
    from { transform: translate(-50%, -40%) scale(0.8); opacity: 0; }
    to { transform: translate(-50%, -50%) scale(0.9); opacity: 1; }
}

@keyframes popupIn {
    0% { transform: translate(-50%, -40%) scale(0.8); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
/* Educational Footer */
.app-footer {
    margin-top: 5rem;
    padding: 4rem 1.5rem;
    background: rgba(2, 6, 23, 0.4);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    color: #94a3b8;
}

.foot.evm-container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 15px;
    flex: 1; /* Allow container to grow and push footer down */
}
.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mission-text-en {
    font-size: 1rem;
    line-height: 1.7;
    font-weight: 300;
}

.mission-text-ml {
    font-size: 1.1rem;
    line-height: 1.9;
    font-family: 'Noto Sans Malayalam', sans-serif;
    color: #cbd5e1;
    font-weight: 300;
}

.footer-tag {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #475569;
    margin-top: 1rem;
    opacity: 0.8;
}

@media (max-width: 768px) {
    .app-footer {
        margin-top: 3rem;
        padding: 3rem 1.5rem;
    }
    .mission-text-en { font-size: 0.9rem; }
    .mission-text-ml { font-size: 1rem; }
}

.footer-email {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-top: 5px;
    display: inline-block;
    text-transform: none; /* Ensures lowercase remains lowercase */
}

.footer-email:hover {
    color: #cbd5e1;
}

.copyright-text {
    font-size: 0.7rem;
    color: #475569;
    margin-top: 1.5rem;
    letter-spacing: 1px;
    font-weight: 500;
}

/* Cooldown hint */
.cooldown-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cooldown-note.visible {
    opacity: 1;
}

/* Toast Notification */
#toast-container {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    color: #f8fafc;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: toastIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
    line-height: 1.4;
}

.toast.success { border-color: rgba(16, 185, 129, 0.5); }
.toast.info    { border-color: rgba(99, 102, 241, 0.5); }
.toast.exit    { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0)   scale(1); }
    to   { opacity: 0; transform: translateY(8px)  scale(0.95); }
}

/* Error Overlay */
.connection-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 20px;
}

.error-content {
    background: rgba(255,255,255,0.1);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    max-width: 400px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

.error-content p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.error-en {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f8fafc;
}

.error-ml {
    font-size: 1.2rem;
    font-family: 'Noto Sans Malayalam', sans-serif;
    color: #cbd5e1;
    font-weight: 400;
}

.error-content button {
    margin-top: 25px;
    padding: 12px 30px;
    background: var(--primary-accent);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.error-content button:hover {
    transform: scale(1.05);
    background: #4338ca;
}
/* Post-Vote Viral Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(2,6,23,0.6) 0%, rgba(2,6,23,0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
}

.modal-content {
    background: var(--bg-slate);
    padding: 3rem;
    border-radius: 32px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--glass-border);
    box-shadow: var(--premium-shadow);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.visible .modal-content {
    transform: translateY(0);
}

.modal-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.modal-content h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-indigo) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ml-modal-title {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.modal-content p#modal-subtitle {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
    font-weight: 500;
}

.ml-modal-subtitle {
    font-family: 'Noto Sans Malayalam', sans-serif;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.5;
}

.modal-share-options {
    margin-bottom: 2rem;
}

.secondary-link {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.secondary-link:hover {
    color: var(--text-primary);
}

/* Viral text enhancement in social buttons */
.modal-share-options .social-btn {
    width: auto;
    padding: 0 1.5rem;
    height: 54px;
    border-radius: 16px;
    font-weight: 600;
    gap: 0.75rem;
}

@media (max-width: 600px) {
    .modal-content {
        padding: 2rem;
    }
    
    .modal-content h2 {
        font-size: 1.5rem;
    }
    
    .modal-share-options .social-share-group {
        flex-direction: column;
        width: 100%;
    }
    
    .modal-share-options .social-btn {
        width: 100%;
    }
}
