:root {
    --ink: #1f2933;
    --muted: #667085;
    --line: #e6e1d8;
    --paper: #fbf7ef;
    --white: #ffffff;
    --teal: #2f6f5e;
    --coral: #b84a3b;
    --gold: #a8752a;
    --shadow: 0 18px 48px rgba(55, 45, 35, .13);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Inter, system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.6;
}
html[lang="vi"] body,
html[lang="vi"] input,
html[lang="vi"] select,
html[lang="vi"] textarea,
html[lang="vi"] button {
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(20px, 5vw, 72px);
    background: rgba(251, 247, 239, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; }
.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--teal);
    border-radius: 8px;
}
.site-nav { display: flex; align-items: center; gap: 24px; font-weight: 700; color: #4b5563; }
.site-nav a:hover { color: var(--teal); }
.admin-link { color: var(--teal); }
.nav-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 8px; }

.hero { position: relative; min-height: 620px; overflow: hidden; background: #1f2933; }
.hero-slider, .slide { min-height: 620px; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
.slide.active { opacity: 1; z-index: 1; }
.slide-media { position: absolute; inset: 0; background-size: cover; background-position: center; }
.media-one { background-image: linear-gradient(90deg, rgba(31,41,51,.9), rgba(31,41,51,.22)), url("https://images.unsplash.com/photo-1519682337058-a94d519337bc?auto=format&fit=crop&w=1800&q=80"); }
.media-two { background-image: linear-gradient(90deg, rgba(31,41,51,.9), rgba(31,41,51,.2)), url("https://images.unsplash.com/photo-1455885666463-9b3c80f8e9b5?auto=format&fit=crop&w=1800&q=80"); }
.media-three { background-image: linear-gradient(90deg, rgba(31,41,51,.88), rgba(31,41,51,.2)), url("https://images.unsplash.com/photo-1524995997946-a1c2e315a42f?auto=format&fit=crop&w=1800&q=80"); }
.slide-copy {
    position: relative;
    z-index: 2;
    max-width: 760px;
    padding: 120px clamp(24px, 7vw, 96px) 90px;
    color: #fff;
}
.eyebrow, .section-kicker { color: var(--gold); font-weight: 800; text-transform: uppercase; letter-spacing: 0; font-size: 13px; }
.slide-copy h1, .slide-copy h2 { margin: 10px 0 18px; font-size: clamp(48px, 9vw, 116px); line-height: .95; letter-spacing: 0; }
.slide-copy h2 { font-size: clamp(42px, 7vw, 84px); }
.slide-copy p { max-width: 620px; font-size: clamp(18px, 2vw, 24px); color: #e2e8f0; }
.slider-controls { position: absolute; z-index: 3; left: clamp(24px, 7vw, 96px); bottom: 42px; display: flex; gap: 10px; }
.slider-controls button, .icon-btn {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 8px;
    color: #fff;
    background: rgba(255,255,255,.12);
    cursor: pointer;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
}
.primary { color: #fff; background: var(--coral); }
.secondary { color: var(--ink); background: #e2e8f0; }
.danger { color: #fff; background: #b91c1c; }
.text-link { color: var(--teal); font-weight: 800; }

.intro-band, .stories, .post-detail, .admin-shell, .genre-section {
    max-width: 1160px;
    margin: 0 auto;
    padding: 72px clamp(20px, 4vw, 40px);
}
.intro-band { display: grid; grid-template-columns: 1fr 1.15fr; gap: 42px; align-items: end; border-bottom: 1px solid var(--line); }
.intro-band h2, .section-heading h2, .detail-header h1 { margin: 8px 0 0; font-size: clamp(32px, 5vw, 56px); line-height: 1.04; }
.intro-band p { font-size: 20px; color: var(--muted); }
.section-heading { margin-bottom: 24px; }
.genre-marquee {
    overflow: hidden;
    border-top: 1px solid rgba(255,255,255,.12);
    border-bottom: 1px solid var(--line);
    background: #fffdf8;
}
.marquee-track {
    width: max-content;
    display: flex;
    gap: 14px;
    padding: 16px 0;
    animation: genre-marquee 34s linear infinite;
}
.marquee-track span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 18px;
    color: #27372f;
    background: #f3eadc;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-weight: 800;
    white-space: nowrap;
}
.marquee-track i { color: var(--coral); }
@keyframes genre-marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
.genre-section {
    border-bottom: 1px solid var(--line);
}
.genre-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.genre-card {
    min-height: 168px;
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 22px;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(55, 45, 35, .05);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.genre-card:hover {
    transform: translateY(-3px);
    border-color: rgba(184, 74, 59, .42);
    box-shadow: 0 16px 38px rgba(55, 45, 35, .09);
}
.genre-card.active {
    border-color: var(--coral);
    background: #fff8f2;
}
.genre-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--teal);
    border-radius: 8px;
}
.genre-card strong { font-size: 20px; }
.genre-card small { color: var(--muted); font-size: 14px; line-height: 1.55; }

.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.post-card {
    overflow: hidden;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(55, 45, 35, .06);
}
.post-image { display: block; aspect-ratio: 4 / 3; background: #dbe4ee; overflow: hidden; }
.post-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.post-card:hover img { transform: scale(1.04); }
.post-card-body { padding: 20px; }
.post-card time, .detail-header time { display: inline-flex; gap: 8px; color: var(--muted); font-size: 14px; }
.genre-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    margin: 10px 0 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: #ecfeff;
    color: var(--teal);
    border: 1px solid #bae6fd;
    font-size: 13px;
    font-weight: 800;
}
.post-card h3 { margin: 10px 0; font-size: 22px; line-height: 1.2; }
.post-card p { color: var(--muted); margin-bottom: 18px; }
.author-line { margin: -2px 0 10px; font-weight: 800; color: var(--teal) !important; }

.detail-header { max-width: 900px; margin-bottom: 32px; }
.detail-author { color: var(--teal); font-weight: 800; margin: 0 0 6px; }
.detail-content { max-width: 860px; font-size: 20px; color: #394150; background: #fffdf8; border: 1px solid var(--line); border-radius: 8px; padding: clamp(24px, 5vw, 52px); line-height: 1.95; }
.gallery { margin-top: 32px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.gallery-item { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1 / 1; cursor: zoom-in; background: #dbe4ee; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 28px; background: rgba(2, 6, 23, .86); }
.lightbox[hidden] { display: none; }
.lightbox img { max-height: 86vh; border-radius: 8px; box-shadow: var(--shadow); }
.lightbox button { position: fixed; top: 18px; right: 18px; width: 44px; height: 44px; border: 0; border-radius: 8px; }
.empty-state { min-height: 60vh; display: grid; place-items: center; text-align: center; padding: 40px; }

.site-footer {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 24px;
    align-items: center;
    padding: 36px clamp(20px, 5vw, 72px);
    color: #f9fafb;
    background: #27372f;
}
.site-footer p { margin: 4px 0 0; color: #94a3b8; }
.socials { display: flex; gap: 10px; }
.socials a { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #334155; border-radius: 8px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #27372f; }
.auth-card, .admin-panel {
    width: min(100%, 440px);
    padding: 28px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.field { display: grid; gap: 7px; margin-bottom: 16px; font-weight: 800; }
.field input, .field textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 13px;
    font: inherit;
}
.field textarea { min-height: 260px; resize: vertical; }
.field select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px 13px;
    font: inherit;
    background: #fff;
}
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; background: #fee2e2; color: #991b1b; }
.success { background: #dcfce7; color: #166534; }

.admin-topbar { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 24px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.admin-table th, .admin-table td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.thumb { width: 78px; height: 56px; object-fit: cover; border-radius: 8px; background: #e2e8f0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dropzone { border: 2px dashed #94a3b8; border-radius: 8px; padding: 22px; text-align: center; background: #f8fafc; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 14px; }
.preview-grid img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px; }
.existing-image { position: relative; }
.existing-image label { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-weight: 700; color: #991b1b; }
.author-band {
    max-width: 1160px;
    margin: 0 auto 72px;
    padding: 42px clamp(20px, 4vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    background: #fffdf8;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.author-band h2 { margin: 6px 0 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.1; }
.author-form { margin-bottom: 24px; }
.story-profile, .reader-page {
    max-width: 1160px;
    margin: 0 auto;
    padding: 56px clamp(20px, 4vw, 40px) 72px;
}
.story-hero {
    display: grid;
    grid-template-columns: minmax(240px, 360px) 1fr;
    gap: clamp(28px, 6vw, 64px);
    align-items: start;
    margin-top: 28px;
}
.story-cover {
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    background: #fffdf8;
    padding: 0;
    cursor: zoom-in;
}
.story-cover img {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
    background: #f3eadc;
}
.story-meta h1 { margin: 8px 0 10px; font-size: clamp(38px, 6vw, 72px); line-height: 1.02; }
.story-summary { margin: 22px 0; max-width: none; }
.story-album {
    margin-top: 58px;
    padding-top: 42px;
    border-top: 1px solid var(--line);
}
.story-album .section-heading {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 520px);
    gap: 28px;
    align-items: end;
}
.story-album .section-heading p { margin: 0; }
.album-feature {
    margin-bottom: 18px;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}
.album-feature button,
.album-thumb {
    width: 100%;
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.album-feature img {
    width: 100%;
    max-height: 620px;
    object-fit: contain;
    background: #f3eadc;
}
.album-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.album-thumb {
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fffdf8;
}
.album-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}
.album-thumb:hover img { transform: scale(1.04); }
.episode-list { margin-top: 56px; }
.episode-row {
    display: grid;
    grid-template-columns: 92px 1fr 210px 22px;
    gap: 18px;
    align-items: center;
    padding: 18px 0;
    border-top: 1px solid var(--line);
}
.episode-row:last-child { border-bottom: 1px solid var(--line); }
.episode-row span { color: var(--gold); font-weight: 800; }
.episode-row strong { font-size: 20px; }
.episode-row time { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); }
.manga-reader {
    max-width: 880px;
    margin: 0 auto;
    display: grid;
    gap: 0;
    background: #111827;
}
.manga-reader img { width: 100%; margin: 0 auto; }
.reader-text { margin: 0 auto; }

@media (max-width: 900px) {
    .nav-toggle { display: grid; place-items: center; }
    .site-nav {
        position: absolute;
        left: 16px;
        right: 16px;
        top: 72px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 18px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 8px;
        box-shadow: var(--shadow);
    }
    .site-nav.open { display: flex; }
    .intro-band, .site-footer { grid-template-columns: 1fr; }
    .genre-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .story-hero { grid-template-columns: 1fr; }
    .story-album .section-heading { grid-template-columns: 1fr; }
    .album-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .episode-row { grid-template-columns: 76px 1fr 18px; }
    .episode-row time { grid-column: 2 / 3; }
    .post-grid, .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .hero, .hero-slider, .slide { min-height: 560px; }
    .slide-copy { padding-top: 84px; }
    .post-grid, .gallery { grid-template-columns: 1fr; }
    .genre-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .admin-topbar { align-items: stretch; flex-direction: column; }
    .admin-table { display: block; overflow-x: auto; }
}
