:root {
    --bg: #f7f6f3;
    --surface: #ffffff;
    --text: #1f2328;
    --muted: #6a6f76;
    --border: #e4e2dd;
    --accent: #4f46e5;
    --accent-text: #ffffff;
    --flash: #e8f5e9;
    --error: #b42318;
    --film: #c2410c;
    --serie: #7c3aed;
    --album: #0f766e;
    --libro: #1d4ed8;
    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #16181c;
        --surface: #1f2227;
        --text: #e8e6e3;
        --muted: #9aa0a6;
        --border: #30343a;
        --accent: #818cf8;
        --accent-text: #111318;
        --flash: #1f3324;
        --error: #f97066;
        --film: #fb923c;
        --serie: #a78bfa;
        --album: #2dd4bf;
        --libro: #60a5fa;
    }
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; margin: 1.5rem 0 1rem; }
h2 { font-size: 1.25rem; margin: 0 0 .25rem; }

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

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.2rem; color: var(--text); }
.main-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.main-nav a { color: var(--muted); }
.main-nav a.active, .main-nav a:hover { color: var(--text); text-decoration: none; }
.inline { display: inline; margin: 0; }

.site-footer { color: var(--muted); font-size: .85rem; padding-top: 2rem; padding-bottom: 2rem; }

/* Controls */
button, .button {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-text);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: .55rem 1.1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.button:hover { text-decoration: none; }
.button-outline { background: transparent; color: var(--accent); }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 400; cursor: pointer; }
.link-button:hover { color: var(--text); text-decoration: underline; }

input[type=email], input[type=number], input[type=text] {
    font: inherit;
    padding: .5rem .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    width: 100%;
}

.flash { background: var(--flash); padding: .75rem 1rem; border-radius: var(--radius); margin-top: 1rem; }
.error { color: var(--error); margin: .25rem 0 0; font-size: .9rem; }
.empty, .hint { color: var(--muted); }
.hint { font-size: .9rem; margin-top: 0; }

/* Tabs */
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tabs a { padding: .35rem .9rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); }
.tabs a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active:hover { color: var(--bg); }

/* Badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-right: .35rem; }
.badge-film { color: var(--film); }
.badge-serie { color: var(--serie); }
.badge-album { color: var(--album); }
.badge-libro { color: var(--libro); }

/* Covers */
.cover { position: relative; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--border); display: grid; place-items: center; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.cover-fallback { font-size: 1.4rem; font-weight: 700; color: var(--muted); }
.cover-xs { width: 40px; height: 60px; }
.cover-sm { width: 64px; height: 96px; }
.cover-md { width: 120px; height: 180px; }
.cover-lg { width: 200px; height: 300px; }
.cover-album.cover-xs { height: 40px; }
.cover-album.cover-sm { height: 64px; }
.cover-album.cover-md { height: 120px; }
.cover-album.cover-lg { height: 200px; }

/* Diary entries */
.entry { display: flex; gap: 1rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: .75rem; }
.entry-body { flex: 1; min-width: 0; }
.entry h2 a { color: var(--text); }
.meta { color: var(--muted); font-size: .85rem; margin: 0 0 .2rem; }
.creator { color: var(--muted); margin: 0; }
.comment { margin: .5rem 0 0; font-style: italic; }
.review { margin: .5rem 0 0; }
.score { font-weight: 800; font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; margin-bottom: .9rem; }
.narrow { max-width: 440px; margin: 2rem auto; }
.stack { display: grid; gap: .5rem; }
.divider { text-align: center; color: var(--muted); margin: 1rem 0; }
.narrow .button { width: 100%; }

/* Work page */
.work-hero { display: flex; gap: 1.5rem; margin: 1.5rem 0; }
.work-hero h1 { margin-top: .25rem; }
.description { max-width: 60ch; }
.stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0 0; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem; }
.stats dt { color: var(--muted); font-size: .8rem; }
.stats dd { margin: 0; font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.vote-box .row { display: flex; gap: .5rem; margin: .4rem 0; max-width: 320px; }
.vote-box label { color: var(--muted); font-size: .9rem; }

/* Rankings */
.rankings { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.ranking { list-style: none; padding: 0; margin: 0; counter-reset: pos; }
.ranking li { counter-increment: pos; }
.ranking-row { display: flex; align-items: center; gap: .75rem; padding: .5rem .25rem; border-bottom: 1px solid var(--border); color: var(--text); }
.ranking-row::before { content: counter(pos); width: 1.8rem; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking-row:hover { text-decoration: none; background: var(--surface); }
.ranking-title { flex: 1; min-width: 0; }
.ranking-title small { display: block; color: var(--muted); }
.ranking .score { font-size: 1.05rem; }

/* Pagination */
.pagination { display: flex; justify-content: space-between; align-items: center; margin: 1.5rem 0; color: var(--muted); }
.pagination .disabled { opacity: .45; }

@media (max-width: 700px) {
    .rankings { grid-template-columns: 1fr; }
    .work-hero { flex-direction: column; }
    .cover-lg { width: 150px; height: 225px; }
    .cover-album.cover-lg { height: 150px; }
    h1 { font-size: 1.55rem; }
}
