:root {
    --bg: #101010;
    --surface: #1c1c1e;
    --surface-light: #262629;
    --border: #2f2f33;
    --text: #f1f1f1;
    --text-muted: #9a9a9e;
    --accent: #aa5cc3;
    --accent-2: #00a4dc;
    --danger: #e5534b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.75rem;
    background: linear-gradient(180deg, #161618 0%, #0d0d0e 100%);
    border-bottom: 2px solid var(--accent);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-mark {
    color: var(--accent);
    font-size: 1.4rem;
}

.sync-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sync-form {
    margin: 0;
}

.sync-status {
    font-size: 0.85rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sync-status.running {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-2);
    border-color: var(--accent-2);
}

.sync-status.running::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    border: 2px solid var(--accent-2);
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.sync-status.success {
    color: #7fd48a;
    border-color: #7fd48a;
}

.sync-status.error {
    color: var(--danger);
    border-color: var(--danger);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn {
    border: none;
    border-radius: 4px;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

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

.btn-accent:hover {
    background: #bd72d4;
    transform: translateY(-1px);
}

.content {
    flex: 1;
    padding: 1.75rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-heading h1 {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
}

.muted {
    color: var(--text-muted);
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
}

.flash-stack {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash {
    padding: 0.65rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.flash-success {
    background: rgba(170, 92, 195, 0.15);
    border: 1px solid var(--accent);
}

.flash-error {
    background: rgba(229, 83, 75, 0.15);
    border: 1px solid var(--danger);
}

.breadcrumbs {
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumbs a:hover {
    color: var(--accent-2);
}

.breadcrumbs .sep {
    margin: 0 0.4rem;
}

.breadcrumbs .current {
    color: var(--text);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.card {
    display: block;
    color: var(--text);
}

.poster {
    position: relative;
    aspect-ratio: 2 / 3;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover .poster {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    border-color: var(--accent);
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.poster-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-light);
    color: var(--text-muted);
    font-size: 2.5rem;
    font-weight: 700;
}

.poster-placeholder.large {
    font-size: 4rem;
}

.badge {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: rgba(16, 16, 16, 0.8);
    color: #f5c542;
    font-size: 0.75rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.card-title {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    color: var(--text-muted);
    padding: 2rem 0;
    text-align: center;
}

.detail {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.detail-poster {
    width: 260px;
    flex-shrink: 0;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

.detail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-info {
    flex: 1;
    min-width: 280px;
}

.detail-info h1 {
    margin-top: 0;
}

.detail-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.pill {
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.pill.accent {
    border-color: var(--accent);
    color: #f5c542;
}

.overview {
    line-height: 1.6;
    color: #d6d6d8;
    max-width: 65ch;
}

.footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}
