:root {
    --bg-color: #0a0a0f;
    --text-primary: #ffffff;
    --text-secondary: #b8b8cc;

    --deck-normal: #00f0ff;
    /* Neon Blue */
    --deck-normal-bg: linear-gradient(135deg, rgba(0, 240, 255, 0.85), rgba(10, 10, 15, 0.95));
    --deck-normal-glow: rgba(0, 240, 255, 0.6);

    --deck-naughty: #ff007f;
    /* Neon Pink/Magenta */
    --deck-naughty-bg: linear-gradient(135deg, rgba(255, 0, 127, 0.85), rgba(10, 10, 15, 0.95));
    --deck-naughty-glow: rgba(255, 0, 127, 0.6);

    --deck-cringe: #ffaa00;
    /* Electric Orange */
    --deck-cringe-bg: linear-gradient(135deg, rgba(255, 170, 0, 0.85), rgba(10, 10, 15, 0.95));
    --deck-cringe-glow: rgba(255, 170, 0, 0.6);

    --glass-bg: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.15);

    --like-color: #00ffcc;
    /* Bright mint green */
    --dislike-color: #ff3366;
    /* Bright neon red */
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: linear-gradient(-45deg, #0f0c29, #302b63, #240b36, #0f0c29);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-primary);
    overflow: hidden;
    /* Prevent native scroll to enforce app-like feel */
    height: 100vh;
    height: 100dvh;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    padding: 16px;
}

@media (max-width: 400px) {
    .app-container {
        padding: 12px;
    }
}

.hidden {
    display: none !important;
}

/* Top Nav */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    z-index: 10;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
    background: linear-gradient(45deg, #fff, #a0a0b0);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: font-size 0.3s ease;
}

@media (max-width: 370px) {
    .logo {
        font-size: 20px;
    }
}

.controls {
    display: flex;
    gap: 8px;
}

/* Glass UI Elements */
.glass-select,
.glass-btn {
    appearance: none;
    -webkit-appearance: none;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.glass-select:hover,
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

.glass-select option {
    background: var(--bg-color);
    /* Fallback for select options */
}

/* Card Area */
.card-area {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 10px;
    min-height: 0;
    padding-bottom: 8px;
}

/* The actual Card */
.swipe-card {
    position: absolute;
    width: 100%;
    inset: 0;
    height: auto;
    min-height: 240px;
    border-radius: 30px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 32px 24px 78px;
    text-align: center;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform-origin: 50% 100%;
    will-change: transform;
    border: 2px solid var(--glass-border);
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

@media (max-height: 740px) {
    .swipe-card {
        padding: 24px 20px 72px;
        border-radius: 24px;
    }
}

@media (max-width: 380px) {
    .swipe-card {
        padding: 20px 16px 68px;
    }
}

.swipe-card:active {
    cursor: grabbing;
}

.swipe-card.deck-normal {
    background: var(--deck-normal-bg);
    box-shadow: 0 0 40px var(--deck-normal-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-color: rgba(0, 240, 255, 0.4);
}

.swipe-card.deck-naughty {
    background: var(--deck-naughty-bg);
    box-shadow: 0 0 40px var(--deck-naughty-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 0, 127, 0.4);
}

.swipe-card.deck-cringe {
    background: var(--deck-cringe-bg);
    box-shadow: 0 0 40px var(--deck-cringe-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 170, 0, 0.4);
}

.card-text {
    font-size: clamp(18px, 6.5vw, 26px);
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    letter-spacing: -0.2px;
    z-index: 2;
    padding: 0 5px;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    max-height: 100%;
    overflow-y: auto;
}

.card-author {
    position: absolute;
    bottom: 25px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
    backdrop-filter: blur(5px);
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-metrics {
    position: absolute;
    bottom: 20px;
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

/* Action Bar */
.action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px 0 30px 0;
    z-index: 10;
    flex-shrink: 0;
}

@media (max-height: 700px) {
    .action-bar {
        padding: 10px 0 20px 0;
        gap: 12px;
    }
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: white;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn.circle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
}

@media (max-height: 700px) {
    .action-btn.circle {
        width: 58px;
        height: 58px;
    }
}

.action-btn.circle svg {
    width: 32px;
    height: 32px;
}

.action-btn.pill {
    padding: 0 28px;
    height: 56px;
    border-radius: 28px;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    letter-spacing: 0.5px;
}

#btn-like {
    color: var(--like-color);
    border-color: rgba(0, 255, 204, 0.4);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.2);
}

#btn-like:hover {
    box-shadow: 0 0 30px rgba(0, 255, 204, 0.5);
    background: rgba(0, 255, 204, 0.1);
}

#btn-dislike {
    color: var(--dislike-color);
    border-color: rgba(255, 51, 102, 0.4);
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.2);
}

#btn-dislike:hover {
    box-shadow: 0 0 30px rgba(255, 51, 102, 0.5);
    background: rgba(255, 51, 102, 0.1);
}

#btn-share {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

#btn-share:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
}

/* Animation classes assigned by JS */
.animate-slide {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.swipe-left {
    transform: translateX(-150%) rotate(-30deg) !important;
    opacity: 0;
    transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}

.swipe-right {
    transform: translateX(150%) rotate(30deg) !important;
    opacity: 0;
    transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}

.swipe-up {
    transform: translateY(-150%) !important;
    opacity: 0;
    transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}

/* States */
.loading-state,
.empty-state {
    text-align: center;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--glass-border);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px auto;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Toast */
.toast {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.undo-bar {
    position: absolute;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: min(420px, calc(100% - 32px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(8, 15, 29, 0.92);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(14px);
    z-index: 1500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.undo-bar span {
    font-size: 14px;
    color: white;
}

/* Suggestion Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 16px;
    z-index: 2000;
}

.modal-content.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    text-align: center;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-weight: 800;
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.onboarding-panel {
    text-align: left;
}

.onboarding-list {
    display: grid;
    gap: 10px;
    margin-bottom: 20px;
}

.onboarding-item {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 14px;
}

.onboarding-close {
    width: 100%;
    justify-content: center;
}

.modal-content textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    resize: none;
    outline: none;
}

.modal-content textarea:focus {
    border-color: var(--deck-normal);
}

/* Global Stats Overlay */
.global-stats {
    position: absolute;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(0, 0, 0, 0.85);
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    color: white;
}

.global-stats.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.global-stats span {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Center Actions Vertical Stack */
.center-actions.vertical-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.action-btn.pill.small {
    height: 36px;
    width: 110px;
    padding: 0 15px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    justify-content: flex-start;
}

.suggest-btn {
    border-color: rgba(0, 240, 255, 0.4) !important;
    color: var(--deck-normal);
}

@media (max-width: 420px) {
    .top-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .glass-select {
        flex: 1 1 0;
        min-width: 0;
    }

    .modal {
        align-items: flex-start;
    }

    .modal-content.glass-panel {
        width: 100%;
        margin: auto 0;
        padding: 22px 18px;
    }

    .undo-bar {
        bottom: 16px;
        width: calc(100% - 24px);
        padding: 10px 12px;
    }
}

@media (max-height: 780px) {
    body {
        overflow-y: auto;
    }

    .app-container {
        min-height: 100dvh;
    }
}