#magar-voting-app {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    max-width: 1400px;
    margin: 30px 20px 40px;
    padding: 32px 28px 40px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    background: #ffffff;
}

/* Loading overlay (submit vote) */
.msv-loading-overlay {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 10;
}
.msv-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #2D3748;
    border-radius: 50%;
    animation: msv-spin 0.9s linear infinite;
}
.msv-loading-text {
    color: #2D3748;
    font-size: 16px;
    font-weight: 600;
}
@keyframes msv-spin {
    to { transform: rotate(360deg); }
}

/* Mobile: keep block fully on screen (no right-side clipping) */
@media (max-width: 767px) {
    #magar-voting-app {
        margin-left: 12px;
        margin-right: 40px;
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media (min-width: 768px) {
    #magar-voting-app {
        margin-left: auto;
        margin-right: auto;
    }
}


/* ===============================
   POSITION BLOCK
   =============================== */
.msv-position-box {
    margin-bottom: 36px;
}

.msv-position-box h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 16px;
}

/* ===============================
   GRID — STABLE (NO AUTO COLLAPSE)
   =============================== */
.msv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 240px);
    gap: 20px;

    justify-content: center;   /* centers the whole row */
    justify-items: center;    /* centers cards inside cells */
}

.msv-card {
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
    width: 240px;        /* FIXED WIDTH */
    height: 210px;
}




/* ===============================
   CARD
   =============================== */
.msv-card {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 14px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    transition: transform .2s ease, box-shadow .2s ease;

    display: flex;
    flex-direction: column;
    align-items: center;

    height: 210px;
    cursor: pointer;
}

.msv-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

.msv-card.selected {
    background: #edf2f7;
    outline: 2px solid #2D3748;
}

/* HIDE RADIO */
.msv-card input[type="radio"] {
    display: none;
}

/* ===============================
   IMAGE
   =============================== */
.msv-avatar {
    width: 76px !important;
    height: 76px !important;
    max-width: 76px !important;
    max-height: 76px !important;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
    margin-bottom: 8px;
}

/* ===============================
   NAME
   =============================== */
.msv-name {
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
    height: 36px;
    margin: 6px 0;
}

/* ===============================
   VOTE BUTTON
   =============================== */
.msv-vote-btn {
    margin-top: auto;
    background: #2D3748;
    color: #ffffff;
    border: none;
    padding: 6px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.msv-vote-btn:hover {
    opacity: 0.9;
}

/* ===============================
   CHECK ICON
   =============================== */
.msv-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 22px;
    height: 22px;
    background: #2D3748;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0;
}

.msv-card.selected .msv-check {
    opacity: 1;
}

/* ===============================
   SUBMIT BUTTON
   =============================== */
.msv-submit {
    background: #2D3748;
    color: #ffffff;
    padding: 14px 36px;
    border-radius: 18px;
    border: none;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}

.msv-submit:hover {
    opacity: 0.95;
}

/* CENTER SUBMIT BUTTON */
.msv-submit-wrapper {
    text-align: center;
    margin-top: 48px;
}

/* ===============================
   VOTING INFO PANEL (NEW)
   =============================== */
.msv-voting-info {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 36px;
}

.msv-voting-info h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}

.msv-voting-info p {
    color: #374151;
    margin-bottom: 12px;
}

.msv-voting-info ul {
    padding-left: 18px;
    color: #374151;
}

.msv-voting-info li {
    margin-bottom: 6px;
}
/* ===============================
   POSITION SECTION (NEW)
   =============================== */
.msv-position-section {
    background: #ffffff;
    border-radius: 20px;
    padding: 26px 22px 30px;
    margin-bottom: 50px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}
/* White text on dark blocks */
.msv-position-section:nth-of-type(even) .msv-position-title {
    color: #ffffff;
}

.msv-position-section:nth-of-type(even) .msv-position-title::after {
    background: #ffffff;
}
/* Cards stay white even on dark sections */
.msv-position-section:nth-of-type(even) .msv-card {
    background: #ffffff;
}
.msv-position-section:nth-of-type(even):hover {
    transform: translateY(-2px);
    transition: transform 0.25s ease;
}

/* ===============================
   ALTERNATING POSITION BACKGROUNDS
   =============================== */

/* EVEN blocks → dark */
.msv-position-section:nth-of-type(even) {
    background: #2D3748;
    box-shadow:
        0 12px 32px rgba(0,0,0,0.35),
        inset 0 0 0 1px rgba(255,255,255,0.06);
}
/* White text on dark blocks */
.msv-position-section:nth-of-type(even) .msv-position-title {
    color: #ffffff;
}

.msv-position-section:nth-of-type(even) .msv-position-title::after {
    background: #ffffff;
}


.msv-position-title {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 26px;
    position: relative;
}

.msv-position-title::after {
    content: "";
    width: 70px;
    height: 4px;
    background: #2D3748;
    display: block;
    margin: 10px auto 0;
    border-radius: 2px;
}
#magar-voting-message {
    margin-bottom: 28px;
}
/* ===============================
   HARD FORCE CENTER VERIFY FORM
   =============================== */

#magar-voting-app #msv-step-verify {
    width: 100% !important;
    text-align: center !important;
}

#magar-voting-app #magar-verify-form {
    display: inline-block !important;
    width: auto !important;
    margin: 0 auto !important;
    float: none !important;
}

#magar-voting-app #magar-verify-form label {
    display: block !important;
    text-align: center !important;
}

#magar-voting-app #magar-verify-form input,
#magar-voting-app #magar-verify-form button {
    display: inline-block !important;
    float: none !important;
    margin: 6px !important;
}
/* ===============================
   FINAL CENTERING FIX (ONE GO)
   =============================== */

/* Center passport + OTP */
#msv-step-verify,
#msv-step-otp {
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Voting area must be wide and centered */
#msv-step-vote {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Center voting info panel */
.msv-voting-info {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

/* Center each position block */
.msv-position-section {
    margin-left: auto;
    margin-right: auto;
}

/* Ensure grid rows are centered */
.msv-grid {
    justify-content: center;
}
/* ==================================================
   HARD OVERRIDE – CENTER PASSPORT & OTP (FINAL)
   ================================================== */

/* Force the verify + otp blocks to center */
#magar-voting-app #msv-step-verify,
#magar-voting-app #msv-step-otp {
    width: 100%;
    max-width: 520px;
    margin: 0 auto !important;
}

/* Force the form itself to center */
#magar-voting-app #magar-verify-form,
#magar-voting-app #msv-otp-box {
    display: table !important;
    margin: 0 auto !important;
}

/* Force inputs & buttons to stay inline and centered */
#magar-voting-app #magar-verify-form input,
#magar-voting-app #magar-verify-form button,
#magar-voting-app #msv-otp-box input,
#magar-voting-app #msv-otp-box button {
    display: inline-block !important;
    float: none !important;
}
/* ===============================
   CENTER STATUS / OTP MESSAGES
   =============================== */

#magar-voting-message {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 520px;
}
