:root {
    --gold-1: #fcf6ba;
    --gold-2: #d4af37;
    --gold-3: #b8860b;
    --gold-4: #8b6914;
    --gold-gradient: linear-gradient(135deg, #fcf6ba 0%, #d4af37 30%, #b8860b 60%, #d4af37 80%, #fcf6ba 100%);
    --gold-text-gradient: linear-gradient(180deg, #fff8dc 0%, #f5d060 30%, #c8941a 70%, #a07010 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { width: 100%; height: 100%; overflow: hidden; }

body {
    font-family: 'Montserrat', sans-serif;
    background: url('https://ramenya-public.s3.ap-southeast-3.amazonaws.com/Background+Invitation-02.png') no-repeat center center / cover;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
}

/* Subtle vignette overlay — very light so background is visible */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.0) 0%, rgba(0,0,0,0.22) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ======================== PARTICLE CANVAS ======================== */
#particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* ======================== MAIN CARD ======================== */
.card {
    position: relative;
    z-index: 10;
    width: min(900px, 95vw);
    padding: 64px 72px;
    background: rgba(180, 20, 20, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.35);
    box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.1),
    0 24px 60px rgba(0,0,0,0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

/* Corner ornaments */
.card::before, .card::after {
    content: '';
    position: absolute;
    width: 48px; height: 48px;
    border-color: rgba(212, 175, 55, 0.5);
    border-style: solid;
}
.card::before { top: 16px; left: 16px; border-width: 1px 0 0 1px; }
.card::after  { bottom: 16px; right: 16px; border-width: 0 1px 1px 0; }

/* Extra corner overlays via wrapper */
.card-corners::before, .card-corners::after {
    content: '';
    position: absolute;
    width: 48px; height: 48px;
    border-color: rgba(212, 175, 55, 0.5);
    border-style: solid;
}
.card-corners::before { top: 16px; right: 16px; border-width: 1px 1px 0 0; }
.card-corners::after  { bottom: 16px; left: 16px; border-width: 0 0 1px 1px; }

/* ======================== HEADER ======================== */
.event-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 6px;
    color: rgba(212, 175, 55, 0.8);
    text-transform: uppercase;
    margin-bottom: 20px;
}

.divider {
    width: 200px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(212, 175, 55, 0.6), transparent);
    margin-bottom: 20px;
}
.divider.short {
    width: 80px;
    margin: 0 auto;
}

/* Decorative ornament */
.ornament {
    font-size: 22px;
    color: rgba(212, 175, 55, 0.7);
    margin-bottom: 6px;
    letter-spacing: 8px;
}

.title-grand {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 600;
    letter-spacing: 10px;
    color: rgba(212, 175, 55, 0.7);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.title-prize {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(52px, 8vw, 88px);
    font-weight: 900;
    letter-spacing: -1px;
    background: var(--gold-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 8px;
    text-transform: uppercase;
    filter: drop-shadow(0 4px 20px rgba(212, 175, 55, 0.35));
}

.title-sub {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(13px, 2vw, 16px);
    font-weight: 400;
    font-style: italic;
    letter-spacing: 4px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-bottom: 40px;
}

/* ======================== SLOT MACHINE ======================== */
.slot-wrapper {
    width: 100%;
    height: 260px;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(100, 5, 5, 0.45);
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow:
    inset 0 0 40px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06);
    margin-bottom: 40px;
    /* GPU layer promotion */
    transform: translateZ(0);
    contain: layout style paint;
}

.slot-highlight {
    position: absolute;
    inset: auto 0;
    top: 50%;
    transform: translateY(-50%);
    height: 88px;
    z-index: 4;
    pointer-events: none;
    border-top: 1px solid rgba(212, 175, 55, 0.4);
    border-bottom: 1px solid rgba(212, 175, 55, 0.4);
    background: linear-gradient(180deg,
    rgba(212,175,55,0.07) 0%,
    rgba(212,175,55,0.03) 50%,
    rgba(212,175,55,0.07) 100%
    );
}
.slot-highlight::before, .slot-highlight::after {
    content: '◆';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 8px;
    color: rgba(212, 175, 55, 0.5);
}
.slot-highlight::before { left: 24px; }
.slot-highlight::after  { right: 24px; }

.slot-fade-top {
    position: absolute; top: 0; left: 0; right: 0; height: 80px;
    background: linear-gradient(180deg, rgba(120, 10, 10, 0.6), transparent);
    z-index: 5; pointer-events: none;
}
.slot-fade-bottom {
    position: absolute; bottom: 0; left: 0; right: 0; height: 80px;
    background: linear-gradient(0deg, rgba(120, 10, 10, 0.6), transparent);
    z-index: 5; pointer-events: none;
}

.names {
    position: absolute;
    left: 0; right: 0; top: 0;
    will-change: transform;
    /* Force GPU composite layer */
    transform: translate3d(0, 0, 0);
}

.name-row {
    height: 88px;
    line-height: 88px;
    text-align: center;
    font-family: 'Gotham Ultra', 'Montserrat', sans-serif;
    font-size: clamp(24px, 4vw, 42px);
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.08);
    /* No transition on color during fast spin — handled by JS */
    user-select: none;
    position: relative;
    z-index: 3;
}

.name-row.active {
    color: #fff;
    filter: drop-shadow(0 0 16px rgba(212, 175, 55, 0.7));
}

/* ======================== BUTTON ======================== */
.btn-draw {
    position: relative;
    min-width: 280px;
    padding: 18px 56px;
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.6);
    border-radius: 2px;
    color: rgba(212, 175, 55, 0.9);
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 8px;
    text-transform: uppercase;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s ease;
    outline: none;
}

.btn-draw::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gold-gradient);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.btn-draw .btn-label {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: color 0.4s ease;
}

.btn-draw .btn-diamond {
    font-size: 8px;
    opacity: 0.7;
}

.btn-draw:hover::before { opacity: 1; }
.btn-draw:hover {
    color: #1a0a00;
    border-color: transparent;
    box-shadow: 0 12px 40px rgba(212, 175, 55, 0.45);
    transform: translateY(-2px);
}
.btn-draw:hover .btn-label { color: #1a0a00; }

.btn-draw:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-draw:disabled::before { opacity: 0; }

/* ======================== WINNER MODAL ======================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(80, 5, 5, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}
.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    position: relative;
    width: min(640px, 90vw);
    padding: 72px 64px 56px;
    background: rgba(160, 15, 15, 0.55);
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 4px;
    box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.15),
    0 40px 80px rgba(0,0,0,0.4),
    0 0 60px rgba(212, 175, 55, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transform: scale(0.88) translateY(30px);
    transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-backdrop.show .modal-card {
    transform: scale(1) translateY(0);
}

/* Modal corner ornaments */
.modal-card::before, .modal-card::after {
    content: '';
    position: absolute;
    width: 40px; height: 40px;
    border-color: rgba(212, 175, 55, 0.45);
    border-style: solid;
}
.modal-card::before { top: 14px; left: 14px; border-width: 1px 0 0 1px; }
.modal-card::after  { top: 14px; right: 14px; border-width: 1px 1px 0 0; }

.modal-card-bottom::before, .modal-card-bottom::after {
    content: '';
    position: absolute;
    width: 40px; height: 40px;
    border-color: rgba(212, 175, 55, 0.45);
    border-style: solid;
}
.modal-card-bottom::before { bottom: 14px; left: 14px; border-width: 0 0 1px 1px; }
.modal-card-bottom::after  { bottom: 14px; right: 14px; border-width: 0 1px 1px 0; }

.modal-eyebrow {
    font-family: 'Cormorant Garamond', serif;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 6px;
    color: rgba(212, 175, 55, 0.6);
    text-transform: uppercase;
    margin-bottom: 16px;
}

.modal-ornament {
    font-size: 18px;
    letter-spacing: 10px;
    color: rgba(212, 175, 55, 0.5);
    margin-bottom: 24px;
}

.modal-winner-name {
    font-family: 'Montserrat', sans-serif;
    font-size: clamp(44px, 8vw, 72px);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: var(--gold-text-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 24px rgba(212, 175, 55, 0.4));
    line-height: 1.1;
    margin-bottom: 24px;
}

.modal-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-size: 16px;
    font-style: italic;
    color: rgba(252, 246, 186, 0.9);
    letter-spacing: 4px;
    margin-bottom: 48px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.4);
}

.btn-close {
    padding: 14px 48px;
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 2px;
    color: rgba(212, 175, 55, 0.7);
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 7px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-close:hover {
    background: rgba(212, 175, 55, 0.12);
    color: rgba(212, 175, 55, 1);
    border-color: rgba(212, 175, 55, 0.7);
    box-shadow: 0 0 24px rgba(212, 175, 55, 0.2);
}

/* ======================== FOOTER ======================== */
.card-footer {
    margin-top: 32px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 12px;
    letter-spacing: 4px;
    color: rgba(255,255,255,0.2);
    text-transform: uppercase;
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 640px) {
    .card { padding: 40px 28px; }
    .slot-wrapper { height: 210px; }
    .name-row { height: 70px; line-height: 70px; }
    .slot-highlight { height: 70px; }
    .modal-card { padding: 52px 32px 40px; }
}

/* ======================== SETTINGS BUTTON ======================== */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 300;
    width: 42px;
    height: 42px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    color: rgba(212, 175, 55, 0.7);
    font-size: 16px;
}
.settings-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.8);
    color: rgba(212, 175, 55, 1);
    transform: rotate(30deg);
}

/* ======================== SETTINGS MODAL ======================== */
.settings-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.settings-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.settings-card {
    width: min(580px, 94vw);
    max-height: 90vh;
    overflow-y: auto;
    background: rgba(12, 4, 0, 0.92);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 6px;
    padding: 44px 48px 40px;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.45s cubic-bezier(0.22,1,0.36,1);
    scrollbar-width: thin;
    scrollbar-color: rgba(212,175,55,0.3) transparent;
}
.settings-card::-webkit-scrollbar { width: 4px; }
.settings-card::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.3); border-radius: 4px; }
.settings-backdrop.show .settings-card {
    transform: scale(1) translateY(0);
}

.settings-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 8px;
    color: rgba(212, 175, 55, 0.7);
    text-transform: uppercase;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(212,175,55,0.15);
}

.settings-label {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 4px;
    color: rgba(252, 246, 186, 0.75);
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.settings-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 3px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
    outline: none;
    transition: border-color 0.3s ease;
    margin-bottom: 20px;
}
.settings-input:focus {
    border-color: rgba(212, 175, 55, 0.7);
    background: rgba(255,255,255,0.07);
}
.settings-input::placeholder { color: rgba(255,255,255,0.25); }

.settings-textarea {
    width: 100%;
    height: 140px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 3px;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    line-height: 1.7;
    outline: none;
    resize: vertical;
    transition: border-color 0.3s ease;
    margin-bottom: 10px;
}
.settings-textarea:focus {
    border-color: rgba(212, 175, 55, 0.7);
    background: rgba(255,255,255,0.07);
}
.settings-textarea::placeholder { color: rgba(255,255,255,0.25); }

.settings-hint {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    color: rgba(255,255,255,0.35);
    letter-spacing: 1px;
    margin-bottom: 28px;
    font-style: italic;
}

.participant-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    min-height: 32px;
}

.participant-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 2px;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(252, 246, 186, 0.9);
    transition: all 0.2s ease;
}
.participant-tag:hover { border-color: rgba(212, 175, 55, 0.7); }

.tag-remove {
    background: none;
    border: none;
    color: rgba(212, 175, 55, 0.5);
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    transition: color 0.2s ease;
}
.tag-remove:hover { color: #ff6b6b; }

.settings-row {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
}
.settings-row .settings-input { margin-bottom: 0; flex: 1; }

.btn-settings-add {
    padding: 12px 20px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.45);
    border-radius: 3px;
    color: rgba(212, 175, 55, 0.9);
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.btn-settings-add:hover {
    background: rgba(212, 175, 55, 0.3);
    border-color: rgba(212, 175, 55, 0.8);
}

.settings-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid rgba(212,175,55,0.15);
}

.btn-settings-save {
    padding: 12px 36px;
    background: var(--gold-gradient);
    border: none;
    border-radius: 3px;
    color: #1a0a00;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-settings-save:hover {
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.btn-settings-cancel {
    padding: 12px 28px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 3px;
    color: rgba(255,255,255,0.4);
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-settings-cancel:hover {
    border-color: rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.7);
}

.settings-counter {
    font-family: 'Cormorant Garamond', serif;
    font-size: 13px;
    color: rgba(212, 175, 55, 0.5);
    font-style: italic;
    margin-bottom: 12px;
}