:root {
    --bg: #f6f4ef;
    --surface: #ffffff;
    --text: #1f1d1a;
    --muted: #6d6860;
    --accent: #d1452f;
    --accent-dark: #a8331f;
    --border: #e2ddd3;
    --nav-bg: #1f1d1a;
    --nav-text: #f6f4ef;
    --radius: 8px;
    --max: 1000px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--muted); font-size: .9em; }
.center { text-align: center; }

/* ---------- Top menu ---------- */
.site-header {
    background: var(--nav-bg);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.topnav {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}
.brand {
    color: var(--nav-text);
    font-weight: 800;
    font-size: 1.25rem;
    text-decoration: none;
    letter-spacing: .02em;
}
.brand:hover { color: #fff; }

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: .25rem;
}
.nav-links > li > a,
.dropdown-toggle {
    display: block;
    padding: .5rem .9rem;
    color: var(--nav-text);
    text-decoration: none;
    border-radius: var(--radius);
    font: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}
.nav-links > li > a:hover,
.dropdown-toggle:hover,
.nav-links .active { background: rgba(255,255,255,.12); color: #fff; }

.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 240px;
    max-height: 70vh;
    overflow-y: auto;
    list-style: none;
    margin: .25rem 0 0;
    padding: .4rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.dropdown:hover .dropdown-menu,
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a,
.dropdown-menu > li > span.muted {
    display: block;
    padding: .45rem .7rem;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
}
.dropdown-menu a:hover { background: var(--bg); }
.dropdown-menu a.active { background: var(--accent); color: #fff; }
.dropdown-menu a.active .muted { color: #fff; }

.menu-toggle {
    display: none;
    background: none;
    border: 0;
    color: var(--nav-text);
    font-size: 1.6rem;
    cursor: pointer;
}

/* ---------- Layout ---------- */
.container {
    flex: 1;
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: .85rem;
    border-top: 1px solid var(--border);
}
.panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    border: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.disabled { opacity: .35; pointer-events: none; }

/* ---------- Home ---------- */
.hero {
    text-align: center;
    padding: 2rem 1rem 1rem;
}
.hero h1 { font-size: 2.5rem; margin: 0 0 .25rem; }
.hero p { color: var(--muted); margin: 0; }

.comic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}
.comic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform .15s, box-shadow .15s;
}
.comic-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,.12);
    color: var(--text);
}
.comic-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    background: var(--border);
}
.comic-card-body { padding: .75rem 1rem 1rem; }
.comic-card h3 { margin: 0 0 .25rem; }
.comic-card p { margin: 0 0 .4rem; font-size: .9rem; }

/* ---------- Comic reader ---------- */
.comic-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.comic-head h1 { margin: 0; }
.comic-head p { margin: .25rem 0 0; }
.view-switch { display: flex; gap: .4rem; }

.pager {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: .4rem;
    margin: 1rem 0;
}
.page-jump { margin: 0 .25rem; }
.page-jump select {
    font: inherit;
    padding: .45rem .6rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface);
}

.comic-page img,
.all-pages img {
    margin: 0 auto;
    background: var(--surface);
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
.all-pages figure { margin: 0 0 2rem; }
.all-pages figcaption {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    margin-top: .5rem;
}

/* ---------- News & About ---------- */
.news-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}
.news-item time { color: var(--muted); font-size: .85rem; }
.news-item h2, .news-item h3 { margin: .2rem 0 .5rem; }
.news-item p:last-child { margin-bottom: 0; }

.about .avatar {
    float: right;
    width: 160px;
    border-radius: 50%;
    margin: 0 0 1rem 1.5rem;
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
    .menu-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        left: 0; right: 0; top: 56px;
        flex-direction: column;
        background: var(--nav-bg);
        padding: .5rem;
    }
    .nav-links.open { display: flex; }
    .dropdown:hover .dropdown-menu { display: none; }
    .dropdown.open .dropdown-menu { display: block; }
    .dropdown-menu { position: static; box-shadow: none; margin: .25rem 0; }
    .pager .btn { padding: .45rem .7rem; }
    .panel { padding: 1.25rem; }
    .about .avatar { float: none; margin: 0 auto 1rem; }
}
