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

:root {
    --primary-color: #e50914;
    --keep-color: #4caf50;
    --reject-color: #f44336;
    --bg-color: #141414;
    --card-bg: #1f1f1f;
    --text-color: #ffffff;
    --text-muted: #b3b3b3;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    touch-action: pan-y;
    -webkit-user-select: none;
    user-select: none;
}

#app {
    height: 100%;
    width: 100%;
    position: relative;
}

.view {
    display: none;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Swipe View */
#swipe-view {
    padding: 20px;
    padding-bottom: 0;
}

#card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card {
    width: 100%;
    max-width: 350px;
    height: 85%;
    max-height: 550px;
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: grab;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.card:active {
    cursor: grabbing;
}

.card.swiping {
    transition: none;
}

.card.animating {
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

#movie-poster {
    width: 100%;
    height: 70%;
    object-fit: cover;
    pointer-events: none;
}

.card-info {
    padding: 16px;
    background: linear-gradient(transparent, var(--card-bg) 20%);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}

#movie-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

#movie-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

#movie-genres {
    font-size: 0.85rem;
    color: var(--primary-color);
}

.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) rotate(-20deg);
    font-size: 2.5rem;
    font-weight: 800;
    padding: 10px 20px;
    border: 4px solid;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.1s;
    pointer-events: none;
}

.swipe-indicator.left {
    left: 20px;
    color: var(--reject-color);
    border-color: var(--reject-color);
}

.swipe-indicator.right {
    right: 20px;
    color: var(--keep-color);
    border-color: var(--keep-color);
    transform: translateY(-50%) rotate(20deg);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid;
    background: transparent;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn.reject {
    color: var(--reject-color);
    border-color: var(--reject-color);
}

.control-btn.reject:hover,
.control-btn.reject:active {
    background: var(--reject-color);
    color: white;
}

.control-btn.keep {
    color: var(--keep-color);
    border-color: var(--keep-color);
}

.control-btn.keep:hover,
.control-btn.keep:active {
    background: var(--keep-color);
    color: white;
}

.control-btn.shortlist {
    width: 50px;
    height: 50px;
    color: var(--text-muted);
    border-color: var(--text-muted);
    font-size: 1.2rem;
}

.control-btn.shortlist:hover,
.control-btn.shortlist:active {
    background: var(--text-muted);
    color: var(--bg-color);
}

/* Progress Bar */
.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    width: 100%;
}

#progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s;
}

/* Credit Footer */
.credit {
    text-align: center;
    padding: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.credit a {
    color: var(--primary-color);
    text-decoration: none;
}

.credit a:hover {
    text-decoration: underline;
}

/* Shortlist View */
#shortlist-view {
    background: var(--bg-color);
    flex-direction: column;
}

.shortlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shortlist-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
}

.back-btn,
.restart-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
}

#shortlist-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    align-content: start;
}

.shortlist-item {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.shortlist-item img {
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
}

.shortlist-item .item-title {
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shortlist-item .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.shortlist-item:hover .remove-btn,
.shortlist-item:active .remove-btn {
    opacity: 1;
}

.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.empty-state p {
    margin-bottom: 8px;
}

#shortlist-container:empty + .empty-state {
    display: flex;
}

/* Responsive */
@media (min-width: 768px) {
    .card {
        max-width: 400px;
        max-height: 600px;
    }

    #movie-title {
        font-size: 1.6rem;
    }

    .control-btn {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }

    .control-btn.shortlist {
        width: 60px;
        height: 60px;
    }
}

/* Loading state */
.card.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.card.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--text-muted);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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