@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #100d18;
    --bg-2: #171321;
    --surface: rgba(30, 24, 43, .78);
    --surface-strong: rgba(38, 30, 53, .94);
    --surface-soft: rgba(255,255,255,.055);
    --border: rgba(255,255,255,.10);
    --border-strong: rgba(255,255,255,.18);
    --text: #f8f5fb;
    --muted: #b7afc4;
    --muted-2: #8f879b;
    --primary: #ef8fb2;
    --primary-2: #b58bdb;
    --accent: #78c7be;
    --warning: #f1c76b;
    --danger: #f06f7e;
    --success: #61c88a;
    --shadow: 0 24px 70px rgba(0,0,0,.30);
    --shadow-sm: 0 10px 30px rgba(0,0,0,.20);
    --radius: 22px;
    --radius-sm: 14px;
    --container: 1180px;
    --nav-h: 74px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Be Vietnam Pro', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 8%, rgba(239,143,178,.15), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(181,139,219,.13), transparent 30%),
        radial-gradient(circle at 50% 90%, rgba(120,199,190,.08), transparent 28%),
        linear-gradient(160deg, #0e0b15 0%, #151020 46%, #0f0d17 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 70%);
}
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
img { max-width: 100%; }
::selection { background: rgba(239,143,178,.32); color: #fff; }

.site-main { min-height: 68vh; padding-top: 108px; }
.container { width: min(var(--container), calc(100% - 32px)); margin-inline: auto; }

/* Header */
.site-header {
    position: fixed;
    inset: 14px 0 auto 0;
    z-index: 5000;
    transition: transform .28s ease, inset .28s ease;
}
.site-header.hidden { transform: translateY(-130%); }
.navbar {
    width: min(var(--container), calc(100% - 28px));
    min-height: var(--nav-h);
    margin: 0 auto;
    padding: 10px 14px 10px 18px;
    display: flex;
    align-items: center;
    gap: 18px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: rgba(20,16,29,.76);
    box-shadow: 0 14px 45px rgba(0,0,0,.24);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
    transition: background .25s, border-color .25s, box-shadow .25s;
}
.site-header.scrolled .navbar { background: rgba(16,13,24,.93); border-color: rgba(255,255,255,.13); box-shadow: 0 18px 52px rgba(0,0,0,.34); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.4px; white-space: nowrap; }
.brand-mark { width: 38px; height: 38px; border-radius: 13px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(239,143,178,.23), rgba(181,139,219,.22)); border: 1px solid rgba(239,143,178,.26); color: #ffd7e4; box-shadow: inset 0 1px 0 rgba(255,255,255,.13); }
.brand-text { font-size: 1.15rem; }
.brand-text span { color: var(--primary); }
.vip-crown { color: var(--warning); font-size: .72rem; transform: translateY(-8px) translateX(-6px); filter: drop-shadow(0 0 8px rgba(241,199,107,.55)); }

.nav-panel { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; }
.nav-links { display: flex; align-items: center; gap: 3px; }
.nav-links > a, .dropbtn {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 10px 11px;
    border-radius: 12px;
    font-size: .88rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: .2s ease;
}
.nav-links > a:hover, .dropbtn:hover, .nav-links > a.active, .shop-link.active { color: #fff; background: rgba(255,255,255,.07); }
.dropbtn.active { color:#fff; background:rgba(255,255,255,.07); box-shadow:inset 0 0 0 1px rgba(255,255,255,.05); }
.nav-links > a.active { box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.shop-link { color: #edd49b !important; }
.dropbtn i { font-size: .7rem; margin-left: 5px; transition: transform .2s; }
.dropdown { position: relative; }
.dropdown.open .dropbtn i { transform: rotate(180deg); }
.dropdown-content {
    position: absolute;
    top: calc(100% + 13px);
    left: 50%;
    width: 430px;
    max-height: 410px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -8px);
    transition: .2s ease;
    overflow-y: auto;
    border-radius: 18px;
    background: rgba(27,22,38,.98);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}
.dropdown.open .dropdown-content { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%,0); }
@media (hover:hover) and (min-width:981px) {
    .dropdown:hover .dropdown-content { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%,0); }
}
.dropdown-content a { padding: 10px 12px; border-radius: 11px; color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-content a:hover { color: #fff; background: rgba(255,255,255,.07); }
.dropdown-empty { grid-column: 1/-1; padding: 16px; text-align: center; color: var(--muted-2); }

.nav-search { margin-left: auto; min-width: 230px; max-width: 315px; flex: 1; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 14px; padding: 5px 6px 5px 12px; transition: .2s; }
.nav-search:focus-within { border-color: rgba(239,143,178,.50); background: rgba(255,255,255,.07); box-shadow: 0 0 0 4px rgba(239,143,178,.08); }
.nav-search i { color: var(--muted-2); font-size: .86rem; }
.nav-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: .84rem; }
.nav-search input::placeholder { color: #81798c; }
.nav-search button { border: 0; cursor: pointer; padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.07); font-size: .78rem; font-weight: 700; }
.user-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); border: 1px solid transparent; }
.icon-btn:hover { color: #fff; background: rgba(255,255,255,.06); border-color: var(--border); }
.icon-btn.danger:hover { color: #ff9eaa; }
.profile-pill { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 48px; padding: 5px 11px 5px 6px; border: 1px solid transparent; border-radius: 15px; }
.profile-pill:hover, .profile-pill.active { background: rgba(255,255,255,.06); border-color: var(--border); }
.mini-avatar { width: 38px; height: 38px; position: relative; flex: 0 0 38px; display:grid; place-items:center; overflow:visible; }
.mini-avatar-img { width:32px; height:32px; object-fit:cover; object-position:center; border-radius:50%; border:1px solid rgba(255,255,255,.16); box-shadow:0 4px 12px rgba(0,0,0,.24); z-index:1; }
.mini-avatar.has-frame .mini-avatar-img { position:absolute; width:26px; height:26px; left:50%; top:50%; transform:translate(-50%,-50%); border:0; box-shadow:none; }
.mini-frame { position:absolute; width:38px; height:38px; left:50%; top:50%; transform:translate(-50%,-50%); object-fit:contain; object-position:center; pointer-events:none; z-index:2; filter:drop-shadow(0 3px 7px rgba(0,0,0,.22)); }
.profile-name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: .82rem; line-height:1; }
.nav-toggle { display: none; margin-left: auto; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.05); cursor: pointer; place-items: center; padding: 10px; }
.nav-toggle span { display: block; width: 19px; height: 2px; background: #fff; border-radius: 2px; transition: .2s; margin: 2px 0; }
.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Buttons */
.btn, .btn-action, .btn-buy, .btn-read, .btn-submit {
    border: 0;
    min-height: 42px;
    padding: 10px 17px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, background .2s, border-color .2s, opacity .2s;
}
.btn:hover, .btn-action:hover, .btn-buy:hover, .btn-read:hover, .btn-submit:hover { transform: translateY(-2px); }
.btn-sm { min-height: 36px; padding: 8px 12px; font-size: .8rem; }
.btn-primary, .btn-read, .btn-submit { color: #24121b; background: linear-gradient(135deg, #f3a1be, #c89ce5); box-shadow: 0 9px 22px rgba(239,143,178,.18); }
.btn-primary:hover, .btn-read:hover, .btn-submit:hover { box-shadow: 0 12px 30px rgba(239,143,178,.27); }
.btn-secondary, .btn-ghost { color: #fff; background: rgba(255,255,255,.065); border: 1px solid var(--border); }
.btn-secondary:hover, .btn-ghost:hover { background: rgba(255,255,255,.10); border-color: var(--border-strong); }
.btn-danger { color: #fff; background: rgba(240,111,126,.16); border: 1px solid rgba(240,111,126,.25); }
.btn-admin { color: #231a0b; background: linear-gradient(135deg, #f4d176, #f0a86b); }
.disabled, [aria-disabled="true"] { opacity: .42 !important; pointer-events: none !important; }

/* Notice + flash */
.site-notice { width: min(var(--container), calc(100% - 32px)); margin: 0 auto 20px; display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,.035); color: var(--muted); font-size: .82rem; }
.site-notice > span:first-child { color: #f0d49b; font-weight: 700; }
.site-notice .notice-text { flex: 1; }
.site-notice a { color: #ffd5e3; font-weight: 700; white-space: nowrap; }
.flash-stack { width: min(680px, calc(100% - 32px)); margin: 0 auto 18px; display: grid; gap: 9px; }
.flash { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(31,25,43,.94); box-shadow: var(--shadow-sm); animation: flashIn .25s ease both; }
.flash-success { border-color: rgba(97,200,138,.3); }
.flash-error { border-color: rgba(240,111,126,.34); }
.flash-warning { border-color: rgba(241,199,107,.34); }
.flash button { background: transparent; border: 0; cursor: pointer; color: var(--muted); }
.flash.closing { animation: flashOut .25s ease forwards; }
@keyframes flashIn { from { opacity:0; transform: translateY(-8px); } }
@keyframes flashOut { to { opacity:0; transform: translateY(-8px); height:0; padding-block:0; margin:0; overflow:hidden; } }

/* Shared surfaces */
.glass-panel, .form-wrapper, .table-wrapper {
    background: linear-gradient(180deg, rgba(35,28,48,.78), rgba(25,20,36,.78));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.glass-panel { width: min(1100px, calc(100% - 32px)); margin: 0 auto 26px; padding: 26px; }
.form-wrapper { width: min(860px, calc(100% - 32px)); margin: 10px auto 34px; padding: 30px; }
.table-wrapper { overflow-x: auto; }
.section-title { width: min(var(--container), calc(100% - 32px)); margin: 34px auto 16px; padding: 0; font-size: clamp(1.25rem, 2vw, 1.65rem); letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.section-title i { color: var(--primary); }

/* Home */
.hero { width: min(var(--container), calc(100% - 32px)); margin: 8px auto 34px; display: grid; grid-template-columns: 1.1fr .75fr; gap: 28px; align-items: stretch; min-height: 430px; }
.hero-glass { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px,4vw,52px); border: 1px solid var(--border); border-radius: 28px; background: linear-gradient(135deg, rgba(42,32,56,.88), rgba(28,23,39,.72)); box-shadow: var(--shadow-sm); overflow: hidden; position: relative; }
.hero-glass::before { content:''; position:absolute; width:280px; height:280px; border-radius:50%; top:-130px; right:-80px; background: radial-gradient(circle, rgba(239,143,178,.18), transparent 70%); }
.hero-title { margin: 0 0 14px; font-size: clamp(2rem, 4.4vw, 3.65rem); line-height: 1.06; letter-spacing: -.045em; max-width: 760px; }
.hero-desc { margin: 0 0 20px; color: var(--muted); line-height: 1.75; max-width: 680px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hero-img { border-radius: 28px; min-height: 430px; background-position: center; background-size: cover; border: 1px solid var(--border); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.hero-img::after { content:''; position:absolute; inset:0; background: linear-gradient(to top, rgba(10,8,15,.18), transparent 45%); }

.scroll-container { display: flex; gap: 16px; overflow-x: auto; padding: 4px 4px 14px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; scroll-snap-type: x proximity; }
.scroll-card { min-width: 174px; width: 174px; scroll-snap-align: start; }
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 18px; padding: 0; }
.card { position: relative; overflow: hidden; border-radius: 17px; background: rgba(255,255,255,.045); border: 1px solid var(--border); transition: transform .22s ease, border-color .22s, box-shadow .22s, background .22s; }
.card:hover { transform: translateY(-5px); border-color: rgba(239,143,178,.28); background: rgba(255,255,255,.065); box-shadow: 0 14px 32px rgba(0,0,0,.20); }
.card-img { width: 100%; aspect-ratio: 2/3; height: auto; object-fit: cover; display: block; background: #211a2d; transition: transform .3s ease; }
.card:hover .card-img { transform: scale(1.025); }
.card-info { padding: 12px 13px 14px; }
.card-title { display: block; font-size: .93rem; font-weight: 700; line-height: 1.42; margin-bottom: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted-2); font-size: .72rem; }
.card-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-tag { position:absolute; top:10px; right:10px; padding:5px 8px; border-radius:9px; background:rgba(18,14,26,.84); border:1px solid var(--border); font-size:.68rem; font-weight:700; }

.pagination { display:flex; justify-content:center; align-items:center; gap:7px; padding-top:26px; flex-wrap:wrap; }
.page-link { min-width: 39px; height: 39px; padding: 0 12px; display:grid; place-items:center; border-radius: 11px; color: var(--muted); background: rgba(255,255,255,.045); border:1px solid var(--border); font-size:.83rem; font-weight:700; }
.page-link:hover, .page-link.active { color:#20131c; background:linear-gradient(135deg,#f3a1be,#c89ce5); border-color:transparent; }

/* Forms */
.form-header { margin: 0 auto 24px; text-align: left; }
.form-header h2 { margin:0 0 7px; font-size: clamp(1.5rem,3vw,2.1rem); color:#fff; }
.form-header p { margin:0; color:var(--muted); }
.form-row { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:18px; }
.form-group { margin-bottom:18px; }
.form-group label, form > label { display:block; margin-bottom:8px; font-size:.82rem; color:#d8d2df; font-weight:650; }
.required { color: #ff9aaa; }
.glass-input, .glass-select, .custom-input, textarea.custom-input, input.custom-input, select.custom-input {
    width:100%;
    min-height:46px;
    padding:11px 13px;
    border-radius:13px;
    border:1px solid var(--border);
    outline:0;
    color:#fff;
    background:rgba(255,255,255,.045);
    transition:.2s;
    margin-bottom: 14px;
}
textarea.glass-input, textarea.custom-input { resize:vertical; line-height:1.65; min-height:110px; }
.glass-input:focus, .glass-select:focus, .custom-input:focus { border-color:rgba(239,143,178,.48); background:rgba(255,255,255,.065); box-shadow:0 0 0 4px rgba(239,143,178,.07); }
.glass-select option { color:#fff; background:#211a2d; }
input[type="file"].glass-input { padding: 8px; }
input[type="file"]::file-selector-button { border:0; border-radius:9px; padding:8px 11px; margin-right:10px; background:rgba(255,255,255,.10); color:#fff; cursor:pointer; }
.upload-box { position:relative; padding:26px 18px; border:1.5px dashed rgba(255,255,255,.19); border-radius:15px; background:rgba(255,255,255,.025); text-align:center; color:var(--muted); transition:.2s; overflow:hidden; }
.upload-box:hover { border-color:rgba(239,143,178,.45); background:rgba(239,143,178,.04); color:#fff; }
.upload-box input[type=file] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.type-selector { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; padding:6px; border-radius:14px; background:rgba(255,255,255,.04); border:1px solid var(--border); }
.type-option { padding:11px; text-align:center; border-radius:10px; color:var(--muted); cursor:pointer; font-weight:650; }
.type-option.active { color:#fff; background:rgba(255,255,255,.10); box-shadow: inset 0 0 0 1px rgba(239,143,178,.20); }
.checkbox-container { max-height:260px; overflow:auto; padding:14px; border:1px solid var(--border); border-radius:14px; background:rgba(255,255,255,.025); }
.checkbox-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(145px,1fr)); gap:8px; }
.checkbox-item { display:flex; align-items:center; gap:7px; padding:8px 9px; border-radius:9px; color:var(--muted); font-size:.81rem; cursor:pointer; }
.checkbox-item:hover { background:rgba(255,255,255,.05); color:#fff; }
.checkbox-item input { accent-color:var(--primary); }
.btn-submit { width:100%; }

/* Story detail */
.main-col { min-width:0; flex:1; }
.sidebar-col { width:300px; flex:0 0 300px; }
.container:has(.main-col) { display:flex; gap:22px; align-items:flex-start; }
.story-header, .profile-header { display:flex; align-items:flex-start; gap:26px; }
.story-cover { width:220px; aspect-ratio:2/3; height:auto; object-fit:cover; border-radius:16px; border:1px solid var(--border); box-shadow:0 18px 38px rgba(0,0,0,.27); }
.story-info { flex:1; min-width:0; }
.story-title { margin:0 0 14px; font-size:clamp(1.8rem,4vw,2.75rem); line-height:1.15; letter-spacing:-.035em; }
.meta-row { display:flex; flex-wrap:wrap; gap:8px; color:var(--muted); font-size:.81rem; margin-bottom:14px; }
.meta-row span { display:inline-flex; align-items:center; gap:6px; padding:6px 9px; border-radius:9px; border:1px solid var(--border); background:rgba(255,255,255,.035); }
.meta-row i { color:var(--primary); }
.chapter-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:9px; max-height:560px; overflow:auto; padding-right:3px; }
.chapter-item { min-width:0; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 13px; border:1px solid var(--border); border-radius:12px; background:rgba(255,255,255,.035); transition:.2s; }
.chapter-item:hover { border-color:rgba(239,143,178,.3); background:rgba(255,255,255,.06); }
.chapter-item.read { opacity:.56; }
.chapter-main-link { flex:1; min-width:0; }
.chapter-actions { display:flex; align-items:center; gap:6px; flex:0 0 auto; }
.chapter-actions form { margin:0; }
.icon-action { width:30px; height:30px; display:grid; place-items:center; border:0; border-radius:9px; background:rgba(255,255,255,.05); color:var(--muted); cursor:pointer; }
.icon-action:hover { color:#fff; background:rgba(255,255,255,.10); }
.icon-action.danger:hover { color:#ff9ca8; }
.top-item { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--border); }
.top-item:last-child { border-bottom:0; }
.top-rank { width:28px; font-size:1.25rem; font-weight:800; color:#6f6878; }
.top-item:nth-child(1) .top-rank { color:#f1c76b; }
.top-item:nth-child(2) .top-rank { color:#cfd2db; }
.top-item:nth-child(3) .top-rank { color:#c89776; }
.cmt-input { width:100%; min-height:78px; resize:vertical; padding:12px 13px; border-radius:13px; border:1px solid var(--border); outline:0; background:rgba(255,255,255,.04); color:#fff; line-height:1.55; }
.cmt-input:focus { border-color:rgba(239,143,178,.45); }
.comment-item { display:flex; gap:12px; margin-bottom:15px; }
.cmt-avatar { width:42px; height:42px; border-radius:50%; object-fit:cover; flex:0 0 auto; display:grid; place-items:center; background:#d9d3df; color:#33293d; font-weight:800; }
.cmt-content { flex:1; padding:11px 13px; border-radius:13px; border:1px solid var(--border); background:rgba(255,255,255,.035); }

/* Reader */
.reader-toolbar { width:min(900px,calc(100% - 32px)); margin:0 auto 14px; display:flex; align-items:center; flex-wrap:wrap; gap:8px; padding:10px; border:1px solid var(--border); border-radius:15px; background:rgba(30,24,43,.85); backdrop-filter:blur(14px); }
.reader-toolbar .spacer { flex:1; }
.reader-tool { min-height:36px; padding:8px 10px; border-radius:10px; border:1px solid var(--border); background:rgba(255,255,255,.045); color:var(--muted); cursor:pointer; }
.reader-tool:hover { color:#fff; background:rgba(255,255,255,.08); }
.chapter-content { max-width:780px; margin:0 auto; font-size:1.08rem; line-height:1.9; color:#f3eef6; overflow-wrap:anywhere; }
.chapter-content img { width:auto; max-width:100%; height:auto; display:block; margin:0 auto 10px; border-radius:8px; }
.read-progress { position:fixed; left:0; top:0; height:3px; width:0; background:linear-gradient(90deg,var(--primary),var(--primary-2)); z-index:6000; }
body.reader-sepia { --text:#33291f; --muted:#65584d; background:#ede0ca !important; }
body.reader-sepia .glass-panel, body.reader-sepia .reader-toolbar { background:rgba(251,244,230,.92); color:#33291f; border-color:rgba(51,41,31,.12); }
body.reader-sepia .chapter-content { color:#33291f; }
body.reader-sepia .reader-tool, body.reader-sepia .btn-secondary { color:#493c31; background:rgba(51,41,31,.06); border-color:rgba(51,41,31,.12); }

/* Profile / shop */
.avatar-container { position:relative; width:150px; height:150px; flex:0 0 auto; }
.user-avatar-img { width:100%; height:100%; border-radius:50%; object-fit:cover; border:3px solid rgba(255,255,255,.14); }
.user-frame-overlay { position:absolute; inset:-15%; width:130%; height:130%; object-fit:contain; pointer-events:none; z-index:4; }
.donation-box { display:flex; align-items:center; gap:16px; margin-top:18px; padding:14px; border-radius:15px; border:1px solid var(--border); background:rgba(255,255,255,.035); }
.profile-tabs { display:flex; gap:6px; margin:24px 0 18px; padding-bottom:8px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.tab-link { padding:8px 11px; border-radius:10px; color:var(--muted); font-size:.84rem; font-weight:700; cursor:pointer; }
.tab-link.active, .tab-link:hover { color:#fff; background:rgba(255,255,255,.07); }
.tab-content { display:none; }
.tab-content.active { display:block; }
.shop-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:15px; }
.shop-item { position:relative; overflow:hidden; text-align:center; padding:18px; border:1px solid var(--border); border-radius:16px; background:rgba(255,255,255,.035); transition:.2s; }
.shop-item:hover { transform:translateY(-4px); border-color:rgba(239,143,178,.28); background:rgba(255,255,255,.055); }
.shop-img-box { width:108px; height:108px; margin:0 auto 13px; display:grid; place-items:center; position:relative; }
.item-price { color:#f1d390; font-weight:800; margin:10px 0 13px; }
.inventory-item.equipped { border-color:rgba(97,200,138,.42); box-shadow:inset 0 0 0 1px rgba(97,200,138,.16); }
.inventory-item.equipped::after { content:'Đang dùng'; position:absolute; top:8px; right:8px; padding:3px 6px; border-radius:7px; background:rgba(97,200,138,.18); color:#9ce8b8; font-size:.62rem; font-weight:800; }
.qr-thumb { border-radius:11px; border:1px solid var(--border); cursor:zoom-in; background:#fff; }
.qr-modal-overlay { position:fixed; inset:0; z-index:9000; display:flex; align-items:center; justify-content:center; flex-direction:column; background:rgba(8,6,12,.78); backdrop-filter:blur(12px); opacity:0; visibility:hidden; transition:.2s; }
.qr-modal-overlay.active { opacity:1; visibility:visible; }
.qr-modal-img { max-width:min(90vw,620px); max-height:78vh; border-radius:16px; background:#fff; padding:6px; transform:scale(.94); transition:.2s; }
.qr-modal-overlay.active .qr-modal-img { transform:scale(1); }
.qr-close-hint { margin-top:14px; color:var(--muted); }

/* Tables */
.glass-table, .custom-table { width:100%; border-collapse:collapse; min-width:720px; }
.glass-table th, .custom-table th { padding:13px 14px; text-align:left; color:#d8d1df; font-size:.75rem; text-transform:uppercase; letter-spacing:.045em; border-bottom:1px solid var(--border); background:rgba(255,255,255,.025); }
.glass-table td, .custom-table td { padding:13px 14px; border-bottom:1px solid rgba(255,255,255,.065); color:#e9e5ed; vertical-align:middle; }
.glass-table tr:hover td, .custom-table tr:hover td { background:rgba(255,255,255,.025); }
.action-links { display:flex; flex-wrap:wrap; gap:8px; }
.action-links a, .action-links button { font-size:.76rem; border:0; background:transparent; cursor:pointer; font-weight:700; padding:5px 0; }
.text-success { color:#88d9a6 !important; }
.text-primary { color:#d8b2ec !important; }
.text-danger { color:#ff9da9 !important; }

/* Footer */
.site-footer { margin-top:70px; border-top:1px solid var(--border); background:rgba(10,8,15,.48); }
.footer-inner { width:min(var(--container),calc(100% - 32px)); margin:auto; padding:34px 0 24px; display:grid; grid-template-columns:1.3fr 1fr; gap:30px; }
.footer-brand { display:inline-flex; align-items:center; gap:8px; font-weight:800; font-size:1.05rem; margin-bottom:8px; }
.footer-inner p { margin:0; color:var(--muted-2); max-width:560px; font-size:.82rem; line-height:1.65; }
.footer-links { display:flex; align-items:flex-start; justify-content:flex-end; gap:18px; flex-wrap:wrap; color:var(--muted); font-size:.8rem; }
.footer-links a:hover { color:#fff; }
.footer-bottom { width:min(var(--container),calc(100% - 32px)); margin:auto; padding:15px 0 22px; border-top:1px solid rgba(255,255,255,.06); color:#6f6878; font-size:.72rem; }

@media (max-width: 1100px) {
    .nav-links > a, .dropbtn { padding-inline:8px; }
    .nav-search { min-width:180px; }
    .profile-name { display:none; }
}

@media (max-width: 980px) {
    .site-header { inset:10px 0 auto; }
    .navbar { width:calc(100% - 20px); border-radius:19px; padding:9px 10px 9px 14px; min-height:64px; }
    .nav-toggle { display:block; }
    .nav-panel { position:fixed; top:82px; left:10px; right:10px; max-height:calc(100vh - 96px); overflow:auto; display:none; flex-direction:column; align-items:stretch; gap:12px; padding:14px; border-radius:18px; border:1px solid var(--border-strong); background:rgba(21,17,30,.98); box-shadow:var(--shadow); }
    .nav-panel.open { display:flex; animation:panelIn .18s ease both; }
    @keyframes panelIn { from { opacity:0; transform:translateY(-7px); } }
    .nav-links { display:grid; grid-template-columns:repeat(2,1fr); gap:6px; }
    .nav-links > a, .dropbtn { width:100%; text-align:left; background:rgba(255,255,255,.035); }
    .dropdown { grid-column:1/-1; }
    .dropdown-content { position:static; width:100%; max-height:280px; margin-top:6px; transform:none !important; display:none; opacity:1; visibility:visible; pointer-events:auto; box-shadow:none; background:rgba(255,255,255,.03); grid-template-columns:repeat(2,1fr); }
    .dropdown.open .dropdown-content { display:grid; }
    .nav-search { max-width:none; min-width:0; width:100%; margin:0; }
    .user-actions { justify-content:flex-start; flex-wrap:wrap; }
    .profile-name { display:inline; max-width:140px; }
    .site-main { padding-top:88px; }
    .hero { grid-template-columns:1fr .65fr; min-height:360px; }
    .hero-img { min-height:360px; }
    .container:has(.main-col) { display:block; }
    .sidebar-col { width:auto; }
    .sidebar-col .glass-panel { position:static !important; }
}

@media (max-width: 720px) {
    .site-notice { align-items:flex-start; flex-wrap:wrap; }
    .site-notice .notice-text { flex-basis:100%; order:3; }
    .hero { grid-template-columns:1fr; gap:12px; }
    .hero-img { order:-1; min-height:330px; max-height:58vh; border-radius:22px; }
    .hero-glass { border-radius:22px; padding:24px 20px; }
    .hero-title { font-size:clamp(1.8rem,9vw,2.5rem); }
    .glass-panel, .form-wrapper { width:calc(100% - 20px); padding:18px; border-radius:18px; }
    .form-row { grid-template-columns:1fr; gap:0; }
    .story-header, .profile-header, .donation-box { flex-direction:column; align-items:center; text-align:center; }
    .story-cover { width:min(210px,62vw); }
    .meta-row { justify-content:center; }
    .chapter-list { grid-template-columns:1fr; }
    .grid-container { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .scroll-card { min-width:145px; width:145px; }
    .card-info { padding:10px; }
    .card-title { font-size:.82rem; }
    .card-meta { font-size:.64rem; flex-direction:column; }
    .shop-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
    .shop-item { padding:13px 10px; }
    .shop-img-box { width:90px; height:90px; }
    .footer-inner { grid-template-columns:1fr; gap:18px; }
    .footer-links { justify-content:flex-start; }
    .reader-toolbar { width:calc(100% - 20px); }
}

@media (max-width: 440px) {
    .nav-links { grid-template-columns:1fr; }
    .dropdown { grid-column:auto; }
    .dropdown-content { grid-template-columns:1fr; }
    .user-actions .btn { flex:1; }
    .section-title { width:calc(100% - 20px); }
    .shop-grid { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.001ms !important; transition-duration:.001ms !important; }
}

/* V9: compact utility navigation + lightweight loading feedback. */
.utility-menu { width:390px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.utility-dropdown .dropbtn { display:inline-flex; align-items:center; gap:7px; }
.utility-dropdown .dropbtn > span { font-weight:750; }
.utility-dropdown .dropbtn .utility-main-icon { display:grid; place-items:center; width:23px; height:23px; margin:0; border-radius:8px; color:#ffd7e6; background:linear-gradient(145deg,rgba(239,143,178,.15),rgba(193,140,226,.10)); font-size:.69rem; }
.utility-dropdown .dropbtn .utility-chevron { margin:0 0 0 1px; color:var(--muted-2); font-size:.62rem; }
.utility-dropdown.open .dropbtn .utility-main-icon { transform:none; }
.utility-menu-head { grid-column:1/-1; display:flex; align-items:flex-end; justify-content:space-between; gap:12px; padding:3px 6px 9px; border-bottom:1px solid rgba(255,255,255,.065); }
.utility-menu-head span { color:#f8f5fb; font-size:.69rem; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.utility-menu-head small { color:var(--muted-2); font-size:.61rem; }
.dropdown-content .utility-item { display:flex; align-items:center; gap:10px; white-space:normal; min-height:58px; }
.utility-item > i { width:30px; height:30px; flex:0 0 30px; display:grid; place-items:center; border-radius:10px; color:#ffd4e3; background:rgba(239,143,178,.10); }
.utility-item span { min-width:0; display:grid; gap:2px; }
.utility-item strong { color:#f8f5fb; font-size:.82rem; line-height:1.2; }
.utility-item small { color:var(--muted-2); font-size:.68rem; line-height:1.3; }

.site-loader { position:fixed; inset:0; z-index:100000; display:grid; place-content:center; justify-items:center; gap:12px; opacity:0; visibility:hidden; pointer-events:none; background:rgba(12,9,18,.46); transition:opacity .14s ease,visibility 0s linear .14s; }
.js .site-loader.is-active { opacity:1; visibility:visible; pointer-events:auto; transition:opacity .12s ease; }
.site-loader-ring { width:44px; height:44px; border-radius:50%; border:3px solid rgba(255,255,255,.15); border-top-color:var(--primary); border-right-color:var(--primary-2); animation:siteLoaderSpin .72s linear infinite; box-shadow:0 0 24px rgba(239,143,178,.16); }
.site-loader-text { color:#f8f5fb; font-size:.76rem; font-weight:700; letter-spacing:.02em; }
@keyframes siteLoaderSpin { to { transform:rotate(360deg); } }

@supports (content-visibility:auto) {
    .grid-container .card, .shop-grid-v2 .shop-card { content-visibility:auto; contain-intrinsic-size:280px 430px; }
}

@media (max-width:980px) {
    .utility-menu { width:100%; }
    .utility-dropdown .dropbtn { justify-content:flex-start; }
}

@media (max-width:720px) {
    body { background-attachment:scroll; }
    body::before { position:absolute; }
    .navbar, .glass-panel, .form-wrapper, .table-wrapper, .reader-toolbar { backdrop-filter:none; -webkit-backdrop-filter:none; }
    .navbar { background:rgba(20,16,29,.96); }
    .glass-panel, .form-wrapper, .table-wrapper { background:linear-gradient(180deg,rgba(35,28,48,.94),rgba(25,20,36,.94)); }
    .card:hover, .shop-item:hover, .btn:hover, .btn-action:hover, .btn-buy:hover, .btn-read:hover, .btn-submit:hover { transform:none; }
    .site-loader { background:rgba(12,9,18,.66); }
    .site-loader-ring { width:38px; height:38px; }
}

@media (prefers-reduced-motion:reduce) {
    .site-loader-ring { animation:none; border-color:var(--primary); }
}

/* Wallet / top-up navigation v2.1 */
.topup-link { color:#9de7d2 !important; }
.topup-link.active { background:rgba(97,200,138,.07) !important; box-shadow:inset 0 0 0 1px rgba(97,200,138,.12); }
.header-wallet { display:inline-flex;align-items:center;gap:6px;min-height:38px;padding:6px 9px;border:1px solid rgba(241,199,107,.16);border-radius:12px;background:rgba(241,199,107,.055);color:#ffe0a0;font-size:.68rem;font-weight:800;white-space:nowrap; }
.header-wallet:hover { background:rgba(241,199,107,.09);border-color:rgba(241,199,107,.25); }
.header-wallet i { font-size:.78rem; }
@media(max-width:1050px){.header-wallet span{display:none}.header-wallet{width:38px;justify-content:center;padding:0}}
@media(max-width:820px){.header-wallet span{display:inline}.header-wallet{width:auto;padding:6px 9px}}

/* V8 Admin Center */
.admin-nav-pill{display:inline-flex;align-items:center;gap:7px;height:38px;padding:0 11px;border:1px solid rgba(241,199,107,.22);border-radius:12px;background:linear-gradient(145deg,rgba(241,199,107,.09),rgba(181,139,219,.05));color:#ffe0a0;font-size:.68rem;font-weight:850;transition:transform .18s ease,border-color .18s ease,background .18s ease,box-shadow .18s ease}.admin-nav-pill:hover,.admin-nav-pill.active{transform:translateY(-1px);border-color:rgba(241,199,107,.38);background:linear-gradient(145deg,rgba(241,199,107,.15),rgba(181,139,219,.08));box-shadow:0 8px 22px rgba(0,0,0,.16)}.admin-nav-pill i{font-size:.76rem}@media(max-width:860px){.admin-nav-pill{width:100%;justify-content:center}}
