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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: #c0392b;
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.logo {
    text-decoration: none;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon { font-size: 2rem; }
.logo-text { font-size: 1.8rem; font-weight: 700; }

.tagline {
    margin-top: 0.3rem;
    font-size: 0.95rem;
    opacity: 0.85;
}

/* Main */
main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: #888;
}

footer a { color: #c0392b; text-decoration: none; }

/* Search */
.search-section { margin-bottom: 2rem; }

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.search-form input:focus { border-color: #c0392b; }

.search-form button {
    padding: 0.75rem 1.5rem;
    background: #c0392b;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.search-form button:hover { background: #a93226; }

.error { color: #c0392b; margin-top: 0.5rem; }
.no-results { color: #888; }

/* Results */
.results-section h2 {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1rem;
}

.results-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.results-list li {
    background: white;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.results-list li:hover {
    border-color: #c0392b;
    box-shadow: 0 2px 8px rgba(192,57,43,0.1);
}

.results-list a {
    display: block;
    padding: 0.85rem 1.2rem;
    text-decoration: none;
    color: #333;
}

.movie-title { font-weight: 500; }

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #c0392b;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover { text-decoration: underline; }

/* Movie header */
.movie-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.movie-poster {
    width: 160px;
    min-width: 160px;
    border-radius: 6px;
    object-fit: cover;
}

.movie-info h1 { font-size: 1.6rem; margin-bottom: 0.5rem; }
.movie-info .year { font-weight: 400; color: #888; font-size: 1.2rem; }
.synopsis { color: #555; line-height: 1.6; margin-top: 0.5rem; }

/* Cards grid */
.movie-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.advisory-card { grid-column: 1 / -1; }

.card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.card h2 {
    font-size: 1.1rem;
    color: #c0392b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

/* RT scores */
.rt-scores {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.score { display: flex; flex-direction: column; align-items: center; }
.score-number { font-size: 2.2rem; font-weight: 700; color: #c0392b; }
.score-label { font-size: 0.8rem; color: #888; }

.rt-link { font-size: 0.85rem; color: #c0392b; text-decoration: none; }
.rt-link:hover { text-decoration: underline; }

/* Certificates */
.certs-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 300px;
    overflow-y: auto;
}

.certs-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.9rem;
}

.country { color: #666; }
.rating { font-weight: 600; }

/* Advisory */
.advisory-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.advisory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.advisory-category { color: #444; }
.advisory-level { font-weight: 700; font-size: 0.8rem; }

.level-none     { background: #e8f5e9; }
.level-mild     { background: #fff8e1; }
.level-moderate { background: #fff3e0; }
.level-severe   { background: #fce4ec; }

.level-none     .advisory-level { color: #388e3c; }
.level-mild     .advisory-level { color: #f9a825; }
.level-moderate .advisory-level { color: #e65100; }
.level-severe   .advisory-level { color: #c62828; }

.no-data { color: #aaa; font-size: 0.9rem; }

/* Genres line */
.genres { color: #888; font-size: 0.9rem; margin-bottom: 0.5rem; }

/* Responsive */
@media (max-width: 600px) {
    .movie-header { flex-direction: column; }
    .movie-poster { width: 100%; min-width: unset; }
    .movie-details { grid-template-columns: 1fr; }
    .advisory-card { grid-column: unset; }
}

/* ── Anime promo link ── */
.anime-promo {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #666;
}
.anime-promo a { color: #c0392b; text-decoration: none; }
.anime-promo a:hover { text-decoration: underline; }

/* ── Search result thumbnails ── */
.result-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: #333;
}
.result-thumb {
    width: 40px;
    height: 58px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}
.result-thumb-placeholder {
    width: 40px;
    height: 58px;
    background: #ddd;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #999;
    flex-shrink: 0;
}
.result-year {
    font-size: 0.8rem;
    color: #999;
    margin-left: auto;
}
.source-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    flex-shrink: 0;
}
.badge-anime { background: #e3f2fd; color: #1565c0; }
.badge-movie { background: #f3e5f5; color: #6a1b9a; }

/* ── No poster ── */
.no-poster {
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.85rem;
    padding: 0.5rem;
    border-radius: 6px;
}
.no-poster-lg {
    width: 160px;
    min-width: 160px;
    height: 240px;
}

/* ── Anime grid ── */
.anime-section h1 { margin-bottom: 0.4rem; }

/* Year selector */
.year-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.year-btn {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 2px solid #ddd;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.year-btn:hover { border-color: #c0392b; color: #c0392b; }
.year-btn.active { background: #c0392b; border-color: #c0392b; color: #fff; }

/* Prefetch bar */
.prefetch-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.prefetch-btn {
    padding: 0.35rem 0.9rem;
    background: #fff8e1;
    border: 1px solid #f9a825;
    color: #e65100;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}
.prefetch-btn:hover { background: #fff3e0; }
.prefetch-note { font-size: 0.8rem; color: #999; }

/* Rating badge on card */
.anime-poster-wrap { position: relative; }
.anime-poster-wrap img { width: 100%; display: block; aspect-ratio: 2/3; object-fit: cover; }
.anime-poster-wrap .no-poster { height: 225px; border-radius: 0; }
.card-rating-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    opacity: 0.92;
}
.section-desc { color: #666; font-size: 0.9rem; margin-bottom: 1.5rem; }

.anime-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.25rem;
}
.anime-card {
    text-decoration: none;
    color: inherit;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    transition: transform 0.15s;
    display: block;
}
.anime-card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
/* img handled by .anime-poster-wrap img */
.anime-card .no-poster { height: 225px; border-radius: 0; }
.anime-card-info { padding: 0.5rem 0.75rem; }
.anime-title { display: block; font-weight: 600; font-size: 0.83rem; line-height: 1.3; }
.anime-year  { display: block; font-size: 0.75rem; color: #888; margin-top: 0.2rem; }

/* ── 18+ gate ── */
.gate-card { border: 2px solid #c62828 !important; }
.gate-banner {
    background: #c62828;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}
.gate-reason { color: #555; margin-bottom: 1.25rem; line-height: 1.6; }
.gate-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.gate-links a { color: #1565c0; text-decoration: underline; font-size: 0.9rem; }

/* ── Age recommendation badge ── */
.age-badge {
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 1rem;
}
.age-G      { background: #e8f5e9; color: #388e3c; }
.age-PG     { background: #fff8e1; color: #f9a825; }
.age-PG-13  { background: #fff3e0; color: #e65100; }
.age-16plus { background: #fce4ec; color: #c62828; }
.age-18plus { background: #c62828; color: #fff; }

/* ── Disturbing themes ── */
.themes-block { margin: 1rem 0; font-size: 0.9rem; color: #444; }
.themes-block ul { padding-left: 1.25rem; margin-top: 0.4rem; }
.themes-block li { margin-bottom: 0.25rem; }

/* ── Parent summary ── */
.parent-summary {
    color: #555;
    font-style: italic;
    margin-top: 0.75rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ── Tags card ── */
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
    background: #f0f0f0;
    color: #555;
    font-size: 0.78rem;
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
}

/* ── Responsive additions ── */
@media (max-width: 600px) {
    .anime-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
    .no-poster-lg { width: 100%; min-width: unset; height: 180px; }
    .gate-links { flex-direction: column; }
}
