:root {
    --bg: #060b1f;
    --bg-soft: #0b1230;
    --surface: #0f1738;
    --surface-2: #101b43;
    --stroke: rgba(218, 184, 98, 0.26);
    --text: #edf1ff;
    --muted: #9ea8c8;
    --gold: #d9b15d;
    --gold-strong: #f0c76d;
    --danger: #d14c4c;
    --danger-soft: rgba(209, 76, 76, 0.2);
    --ok: #3eb67c;
}

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

html,
body {
    min-height: 100%;
}

body {
    font-family: "DM Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 15% -5%, rgba(91, 115, 215, 0.15), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(217, 177, 93, 0.08), transparent 45%),
        linear-gradient(120deg, #040915 0%, #070d24 45%, #07102b 100%);
    display: flex;
    flex-direction: column;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
    background: rgba(4, 8, 22, 0.85);
    border-bottom: 1px solid rgba(217, 177, 93, 0.16);
}

.top-bar {
    width: min(1120px, 92vw);
    margin: 0 auto;
    min-height: 68px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 999px;
    padding: 8px 14px;
    border: 1px solid rgba(217, 177, 93, 0.35);
    color: #f0c76d;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.ranking-link:hover {
    border-color: rgba(217, 177, 93, 0.65);
    background: rgba(217, 177, 93, 0.14);
    transform: translateY(-1px);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-placeholder {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #ad8735, #f0c76d);
    color: #121212;
    font-size: 0.88rem;
    font-weight: 700;
}

.logo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.site-title {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.65rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: #f6e2b5;
}

.session-badge {
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: #acb5d2;
    border: 1px solid rgba(157, 170, 209, 0.35);
    padding: 8px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

main {
    width: min(1120px, 92vw);
    margin: 0 auto;
    padding: 78px 0 160px;
}

#description-vote {
    text-align: center;
    padding: 0 0 72px;
}

.hero-eyebrow {
    display: inline-block;
    border-radius: 999px;
    border: 1px solid rgba(217, 177, 93, 0.45);
    color: var(--gold-strong);
    font-size: 0.77rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    padding: 11px 18px;
    margin-bottom: 30px;
}

#description-vote h1 {
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 500;
    line-height: 1.08;
    margin-bottom: 22px;
}

#description-vote h1 em {
    color: var(--gold);
    font-style: italic;
    font-weight: 600;
}

#description-vote p {
    width: min(790px, 100%);
    margin: 0 auto;
    color: var(--muted);
    line-height: 1.7;
    font-size: clamp(1rem, 1.8vw, 1.38rem);
}

#description-vote p strong {
    color: var(--text);
    font-weight: 600;
}

.ranking-link-hero {
    margin-top: 24px;
}

.divider {
    width: 70px;
    height: 1px;
    margin: 42px auto 0;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.candidate {
    margin-top: 20px;
}

.section-label {
    color: var(--gold-strong);
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.25em;
    margin-bottom: 18px;
}

.candidate h2 {
    font-family: "Cormorant Garamond", serif;
    font-weight: 500;
    font-size: clamp(1.9rem, 4vw, 3rem);
    margin-bottom: 28px;
}

.candidates-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 22px;
}

.candidate-card {
    background: linear-gradient(165deg, rgba(16, 27, 67, 0.94), rgba(8, 15, 38, 0.96));
    border: 1px solid rgba(168, 140, 65, 0.22);
    border-radius: 18px;
    overflow: hidden;
    transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.candidate-info {
    position: relative;
}

.candidate-card:hover {
    transform: translateY(-6px);
    border-color: rgba(217, 177, 93, 0.42);
    box-shadow: 0 20px 34px rgba(1, 3, 10, 0.45);
}

.candidate-number {
    font-size: 0.74rem;
    letter-spacing: 0.17em;
    text-transform: uppercase;
    color: #f3e9cb;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(8, 14, 33, 0.72);
    border: 1px solid rgba(217, 177, 93, 0.45);
    backdrop-filter: blur(4px);
}

.candidate-photo {
    width: 100%;
    height: 270px;
    object-fit: cover;
    object-position: top center;
    border-radius: 0;
    margin: 0;
    display: block;
}

.candidate-details {
    padding: 14px 16px 16px;
}

.candidate-details h3 {
    font-family: "Cormorant Garamond", serif;
    color: #f6e6c2;
    font-size: 1.52rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.candidate-details p {
    color: #a8b3d5;
    font-size: 0.95rem;
    line-height: 1.5;
    min-height: 72px;
}

.candidate-total-votes {
    margin-top: 12px;
    min-height: auto;
    color: #d7dff9;
    font-size: 0.88rem;
}

.candidate-total-votes strong {
    color: #f0c76d;
}

.vote-section {
    border-top: 1px solid rgba(206, 170, 84, 0.14);
    padding: 14px 16px 18px;
}

.vote-controls {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 8px;
}

.vote-btn {
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    font-size: 1.2rem;
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.vote-btn:hover {
    transform: translateY(-1px);
}

.vote-minus {
    border-color: rgba(209, 76, 76, 0.4);
    color: #ffc5c5;
}

.vote-minus:hover {
    background: var(--danger-soft);
}

.vote-plus {
    border-color: rgba(62, 182, 124, 0.4);
    color: #c8ffe2;
}

.vote-plus:hover {
    background: rgba(62, 182, 124, 0.2);
}

.vote-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(206, 214, 239, 0.25);
    background: rgba(5, 11, 31, 0.65);
    color: var(--text);
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    padding: 0 8px;
    outline: none;
}

.vote-input:focus {
    border-color: rgba(217, 177, 93, 0.7);
}

.vote-input::-webkit-inner-spin-button,
.vote-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 14px 12px;
    background: rgba(4, 8, 22, 0.92);
    border-top: 1px solid rgba(217, 177, 93, 0.3);
    backdrop-filter: blur(10px);
    transform: translateY(120%);
    opacity: 0;
    transition: transform 240ms ease, opacity 240ms ease;
    z-index: 18;
}

.cart-bar.visible {
    transform: translateY(0);
    opacity: 1;
}

.cart-inner {
    width: min(1120px, 92vw);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.cart-summary {
    color: #ccd4ef;
    font-size: 0.98rem;
}

.cart-btn {
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #c39a4a, #f0c76d);
    color: #16110a;
    font-weight: 700;
    padding: 11px 18px;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
}

.cart-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 19, 0.7);
    display: none;
    place-items: center;
    z-index: 30;
    padding: 18px;
}

.modal-overlay.visible {
    display: grid;
}

.modal {
    width: min(560px, 100%);
    background: linear-gradient(165deg, rgba(17, 28, 67, 0.98), rgba(9, 16, 41, 0.98));
    border: 1px solid rgba(210, 173, 88, 0.35);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 24px 40px rgba(2, 4, 12, 0.55);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.8rem;
    color: #f3e5c0;
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(220, 186, 102, 0.35);
    background: transparent;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(217, 177, 93, 0.6), transparent);
    margin: 14px 0 16px;
}

.votes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.votes-header h4 {
    font-size: 1rem;
    color: #d9e1fa;
}

.toggle-btn {
    border: 1px solid rgba(217, 177, 93, 0.35);
    border-radius: 8px;
    background: transparent;
    color: #f0c76d;
    width: 34px;
    height: 30px;
    cursor: pointer;
}

#voteCounts {
    display: none;
    margin-top: 12px;
    border-radius: 12px;
    background: rgba(8, 15, 38, 0.7);
    border: 1px solid rgba(171, 185, 227, 0.18);
    max-height: 230px;
    overflow-y: auto;
}

#voteCounts .no-votes {
    padding: 14px;
    color: #9eabcf;
}

.votes-list {
    list-style: none;
}

.vote-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(171, 185, 227, 0.13);
    padding: 12px 14px;
}

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

.candidate-vote-name {
    flex: 1;
    color: #dde5fd;
    font-size: 0.95rem;
}

.vote-quantity {
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.78rem;
    border: 1px solid rgba(62, 182, 124, 0.4);
    color: #caf9e2;
    background: rgba(62, 182, 124, 0.14);
}

.remove-vote {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid rgba(209, 76, 76, 0.5);
    color: #ffc5c5;
    background: transparent;
    cursor: pointer;
}

.summary-total-row {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #dbe4ff;
}

.total-label {
    font-weight: 500;
}

.total-amount {
    color: #f0c76d;
    font-size: 1.2rem;
    font-weight: 700;
}

.Attentions {
    margin-top: 16px;
    border: 1px solid rgba(217, 177, 93, 0.26);
    background: rgba(217, 177, 93, 0.08);
    color: #d7def8;
    border-radius: 12px;
    padding: 12px;
    line-height: 1.5;
    font-size: 0.88rem;
}

.btn-confirm,
.btn-cancel {
    width: 100%;
    margin-top: 12px;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
}

.btn-confirm {
    border: none;
    color: #16110a;
    background: linear-gradient(135deg, #c39a4a, #f0c76d);
}

.btn-cancel {
    border: 1px solid rgba(189, 198, 229, 0.32);
    color: #dbe2fb;
    background: rgba(255, 255, 255, 0.03);
}

.access-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 19, 0.78);
    display: none;
    place-items: center;
    z-index: 40;
    padding: 18px;
}

.access-modal-overlay.visible {
    display: grid;
}

.access-modal {
    width: min(430px, 100%);
    border-radius: 16px;
    border: 1px solid rgba(217, 177, 93, 0.32);
    background: linear-gradient(165deg, rgba(17, 28, 67, 0.98), rgba(9, 16, 41, 0.98));
    box-shadow: 0 24px 40px rgba(2, 4, 12, 0.55);
    padding: 18px;
}

.access-modal h3 {
    font-family: "Cormorant Garamond", serif;
    font-size: 1.7rem;
    color: #f3e5c0;
}

.access-modal-subtitle {
    margin-top: 8px;
    color: #b6c2e6;
    font-size: 0.92rem;
}

.access-code-form {
    margin-top: 14px;
}

.access-code-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid rgba(206, 214, 239, 0.3);
    background: rgba(5, 11, 31, 0.7);
    color: var(--text);
    font-size: 1rem;
    padding: 11px 12px;
    outline: none;
}

.access-code-input:focus {
    border-color: rgba(217, 177, 93, 0.7);
}

.access-code-error {
    min-height: 20px;
    margin-top: 8px;
    color: #ffc5c5;
    font-size: 0.85rem;
}

.access-code-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
    gap: 9px;
}

.access-btn {
    border-radius: 9px;
    padding: 9px 14px;
    font-weight: 700;
    cursor: pointer;
}

.access-btn-primary {
    border: none;
    color: #16110a;
    background: linear-gradient(135deg, #c39a4a, #f0c76d);
}

.access-btn-secondary {
    border: 1px solid rgba(189, 198, 229, 0.32);
    color: #dbe2fb;
    background: rgba(255, 255, 255, 0.03);
}

.auto-reply-toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: min(360px, calc(100vw - 32px));
    border-radius: 12px;
    border: 1px solid rgba(217, 177, 93, 0.42);
    background: linear-gradient(160deg, rgba(17, 28, 67, 0.97), rgba(9, 16, 41, 0.97));
    color: #e7edff;
    box-shadow: 0 18px 30px rgba(1, 3, 12, 0.55);
    padding: 12px 14px;
    line-height: 1.45;
    z-index: 60;
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
}

.auto-reply-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.auto-reply-toast p {
    margin: 0;
    font-size: 0.9rem;
}

.auto-reply-toast p + p {
    margin-top: 6px;
}

footer {
    margin-top: auto;
    border-top: 1px solid rgba(217, 177, 93, 0.16);
    padding: 18px 12px 24px;
    text-align: center;
    color: #95a2c9;
    font-size: 0.84rem;
}

@media (max-width: 680px) {
    .session-badge {
        display: none;
    }

    .header-actions {
        gap: 0;
    }

    .ranking-link {
        font-size: 0.7rem;
        padding: 6px 10px;
    }

    main {
        padding-top: 54px;
    }

    .candidate-details p {
        min-height: auto;
    }

    .cart-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .cart-summary {
        text-align: center;
    }

    .cart-btn {
        width: 100%;
    }
}
