:root {
    --ink: #101418;
    --muted: #5b6572;
    --paper: #f6f2eb;
    --paper-soft: #fbf9f6;
    --panel: #ffffff;
    --border: rgba(16, 20, 24, 0.08);
    --shadow-soft: 0 18px 40px rgba(16, 20, 24, 0.08);
    --shadow-tight: 0 8px 18px rgba(16, 20, 24, 0.08);
}

body.elegant-vote {
    font-family: 'Manrope', sans-serif;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.9) 0%, var(--paper) 45%, rgba(var(--primary-color-rgb), 0.08) 100%);
    color: var(--ink);
    min-height: 100vh;
}

h1, h2, h3, h4 {
    font-family: 'Fraunces', serif;
    letter-spacing: -0.01em;
}

.modern-header {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 1.1rem 0;
}

.modern-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-left h1 {
    font-size: 1.35rem;
    color: var(--ink);
    margin: 0;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.countdown-timer {
    background: var(--ink);
    color: #fff;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.event-switch {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}

.event-switch:hover {
    text-decoration: underline;
}

.hero {
    padding: 4rem 0 3.5rem;
    background: linear-gradient(120deg, rgba(var(--primary-color-rgb), 0.92), rgba(var(--primary-color-rgb), 0.5));
    color: #fff;
    position: relative;
    overflow: hidden;
}

.hero::before,
.hero::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    opacity: 0.18;
    background: #fff;
}

.hero::before {
    width: 260px;
    height: 260px;
    top: -80px;
    right: -40px;
}

.hero::after {
    width: 160px;
    height: 160px;
    bottom: -60px;
    left: -20px;
}

.hero h1 {
    font-size: 2.8rem;
    margin: 0 0 0.75rem;
}

.hero p {
    max-width: 640px;
    font-size: 1.05rem;
    opacity: 0.92;
}

.event-pill {
    display: inline-flex;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
}

.categories-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 1rem;
}

.categories-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.7rem;
}

.categories-header p {
    margin: 0;
    color: var(--muted);
}

.category-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.category-card {
    background: var(--panel);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255, 255, 255, 0.6);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.category-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(16, 20, 24, 0.12);
}

.category-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 12px;
    background: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.candidate-count {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(var(--primary-color-rgb), 0.12);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
}

.modern-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
}

.category-header {
    background: var(--panel);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-tight);
    text-align: left;
    border: 1px solid var(--border);
}

.price-info {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary);
    font-weight: 600;
}

.candidates-grid {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

body.has-summary .candidates-grid {
    padding-bottom: calc(7.5rem + env(safe-area-inset-bottom));
}

.categories-controls {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.categories-search input {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 0.6rem 1.1rem;
    min-width: 220px;
    font-size: 0.95rem;
}

.categories-pagination {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    color: var(--ink);
}

.pagination-btn.active {
    background: var(--ink);
    color: #fff;
}

.category-empty {
    text-align: center;
    padding: 2rem 1.5rem 3rem;
    color: var(--muted);
}

.candidate-card {
    background: var(--panel);
    border-radius: 20px;
    box-shadow: var(--shadow-tight);
    border: 1px solid rgba(16, 20, 24, 0.08);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.candidate-card.selected {
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(var(--primary-color-rgb), 0.2);
}

.candidate-photo {
    position: relative;
}

.candidate-photo img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.selection-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.2s ease;
}

.candidate-card.selected .selection-badge {
    opacity: 1;
    transform: scale(1);
}

.candidate-info {
    padding: 1.25rem;
}

.candidate-name {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.candidate-votes {
    color: var(--muted);
    font-size: 0.85rem;
}

.vote-counter {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(var(--primary-color-rgb), 0.1);
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
}

.candidate-card.selected .vote-counter {
    opacity: 1;
    max-height: 60px;
    pointer-events: auto;
}

.counter-btn {
    border: none;
    background: #fff;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 12px rgba(16, 20, 24, 0.08);
}

.floating-summary {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: #fff;
    border-radius: 999px;
    padding: 0.85rem 1.25rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
    display: none;
    z-index: 100;
}

.floating-summary.show {
    display: block;
}

.summary-content {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.summary-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.summary-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.proceed-btn {
    border: none;
    background: var(--primary);
    color: #fff;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-weight: 600;
}

.preview-container {
    background: var(--panel);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
}

.preview-header {
    text-align: left;
    margin-bottom: 1.5rem;
}

.preview-header h2 {
    margin: 0 0 0.35rem;
    font-size: 1.7rem;
}

.preview-header p {
    color: var(--muted);
    margin: 0;
}

.preview-items {
    display: grid;
    gap: 0.5rem;
}

.preview-item {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.preview-item:last-child {
    border-bottom: none;
}

.preview-photo {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
}

.preview-details h3 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
}

.preview-category {
    font-size: 0.85rem;
    color: var(--muted);
}

.preview-amount {
    text-align: right;
}

.preview-amount .vote-count {
    font-size: 0.85rem;
    color: var(--muted);
}

.preview-amount .amount-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.preview-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.total-amount {
    font-size: 1.6rem;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    border-radius: 999px;
    padding: 0.7rem 1.4rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-secondary {
    background: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary);
}

.text-muted {
    color: var(--muted);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: 16px;
    background: rgba(16, 20, 24, 0.06);
    color: var(--ink);
    margin: 1rem 0;
}

.alert-info {
    background: rgba(var(--primary-color-rgb), 0.12);
    color: var(--ink);
}

.event-card {
    background: var(--panel);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
    border: 1px solid var(--border);
    animation: rise 0.4s ease both;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.events-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
}

.event-meta {
    color: var(--muted);
    font-size: 0.95rem;
    display: grid;
    gap: 0.35rem;
}

.event-actions a {
    background: var(--primary);
    color: #fff;
    padding: 0.6rem 1.3rem;
    border-radius: 999px;
}

.event-actions {
    margin-top: auto;
}

.results-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

.results-header {
    margin-bottom: 2rem;
}

.results-header h2 {
    margin: 0 0 0.35rem;
    font-size: 2rem;
}

.results-header p {
    margin: 0;
    color: var(--muted);
}

.result-category {
    background: var(--panel);
    border-radius: 22px;
    padding: 1.75rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-tight);
    margin-bottom: 1.5rem;
}

.result-category h3 {
    margin: 0 0 1rem;
}

.result-list {
    display: grid;
    gap: 1rem;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    background: var(--paper-soft);
    border: 1px solid var(--border);
}

.result-rank {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(var(--primary-color-rgb), 0.15);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.result-avatar {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.result-name {
    font-weight: 600;
}

.result-votes {
    margin-left: auto;
    font-weight: 700;
    color: var(--ink);
}

.result-meta {
    font-size: 0.85rem;
    color: var(--muted);
}

.success-shell {
    max-width: 900px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 4rem;
}

.success-card {
    background: var(--panel);
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
    text-align: center;
}

.success-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.success-icon {
    width: 74px;
    height: 74px;
    border-radius: 22px;
    background: rgba(var(--primary-color-rgb), 0.18);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon svg {
    width: 40px;
    height: 40px;
}

.success-details {
    background: var(--paper-soft);
    padding: 1.5rem;
    border-radius: 18px;
    margin: 2rem 0 2.5rem;
    text-align: left;
    border: 1px solid var(--border);
}

.success-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.success-details-row:last-child {
    margin-bottom: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.success-actions {
    display: flex;
    gap: 0.85rem;
    flex-wrap: wrap;
    justify-content: center;
}

.share-strip {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

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

@media (max-width: 768px) {
    .modern-header .container {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .categories-header {
        padding: 1.75rem 1.5rem 0.75rem;
    }

    .category-list,
    .modern-container {
        padding: 0 1.5rem 2.5rem;
    }

    .candidates-grid {
        padding-bottom: 5.5rem;
    }

    .categories-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .categories-search input {
        width: 100%;
    }

    .preview-item {
        grid-template-columns: 56px 1fr;
    }

    .preview-amount {
        grid-column: 1 / -1;
        text-align: right;
    }

    .floating-summary {
        width: calc(100% - 2.5rem);
        border-radius: 20px;
        bottom: calc(12px + env(safe-area-inset-bottom));
    }

    body.has-summary .candidates-grid {
        padding-bottom: calc(10rem + env(safe-area-inset-bottom));
    }

    .result-item {
        flex-wrap: wrap;
    }

    .result-votes {
        width: 100%;
        margin-left: 0;
    }

    .success-card {
        padding: 2rem 1.5rem;
        text-align: left;
    }

    .success-actions {
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
