:root {
    --bg: #0f1117;
    --panel: #181b24;
    --panel-2: #212533;
    --text: #e8eaf0;
    --muted: #9aa0b2;
    --accent: #7c5cff;
    --accent-2: #22d3ee;
    --radius: 14px;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }
code { background: var(--panel-2); padding: .1em .35em; border-radius: 4px; font-size: .9em; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top {
    padding: 48px 0 32px;
    background: radial-gradient(1200px 300px at 20% -50%, rgba(124, 92, 255, .35), transparent),
                radial-gradient(800px 260px at 90% -60%, rgba(34, 211, 238, .25), transparent);
}
.logo { margin: 0; font-size: clamp(28px, 5vw, 44px); letter-spacing: -.02em; }
.logo span { color: var(--accent-2); }
.tagline { margin: 6px 0 0; color: var(--muted); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 24px; }
#search {
    flex: 1 1 260px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--panel-2);
    background: var(--panel);
    color: var(--text);
    font-size: 16px;
    outline: none;
}
#search:focus { border-color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--panel-2);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
}
.tag:hover { color: var(--text); }
.tag.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Grid */
.grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}
.card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    background: var(--panel);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid transparent;
    transition: transform .15s ease, border-color .15s ease;
}
.card a:hover, .card a:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }

.cover {
    position: relative;
    aspect-ratio: 16 / 10;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, hsl(var(--h) 70% 45%), hsl(calc(var(--h) + 60) 70% 30%));
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover span { font-size: 64px; font-weight: 800; color: rgba(255, 255, 255, .85); }
.cover .play {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .6);
    font-style: normal;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity .15s;
}
.card a:hover .play, .card a:focus-visible .play { opacity: 1; }

.info { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.info h2 { margin: 0; font-size: 18px; }
.info p { margin: 0; color: var(--muted); font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.author { font-size: 12px; color: var(--muted); margin-left: auto; }

.empty, .no-results { text-align: center; color: var(--muted); padding: 48px 0; }
.empty h2 { color: var(--text); }
main.wrap { padding-bottom: 48px; }

/* Player page */
body.player { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-2);
}
.bar h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar a, .bar button {
    color: var(--muted);
    text-decoration: none;
    font: inherit;
    font-size: 14px;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 4px 0;
}
.bar a:hover, .bar button:hover { color: var(--text); }
.bar .back { color: var(--accent-2); }
.actions { display: flex; gap: 16px; }
#frame { flex: 1; width: 100%; border: 0; background: #000; }

@media (max-width: 560px) {
    .actions a { display: none; }
}
