:root {
    --font-ui: "Be Vietnam Pro", sans-serif;
    --font-reader: "Literata", serif;

    --color-bg: #fffaf1;
    --color-bg-soft: #f6f7fb;
    --color-surface: rgba(255, 255, 255, 0.9);
    --color-surface-strong: rgba(255, 255, 255, 0.96);
    --color-surface-soft: rgba(255, 255, 255, 0.78);
    --color-surface-dark: #101827;
    --color-surface-inverse: #0f172a;

    --color-text: #18212f;
    --color-text-muted: #667085;
    --color-text-soft: #94a3b8;
    --color-text-on-dark: #ffffff;
    --color-text-on-dark-muted: rgba(255, 255, 255, 0.88);

    --color-border: rgba(24, 33, 47, 0.12);
    --color-border-strong: rgba(24, 33, 47, 0.18);

    --color-brand: #1f6feb;
    --color-brand-strong: #174ea6;
    --color-accent: #ffbf47;
    --color-accent-strong: #f4ad24;
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;
    --color-info: #0ea5e9;

    --radius-xs: 12px;
    --radius-sm: 16px;
    --radius-md: 22px;
    --radius-lg: 28px;
    --radius-xl: 34px;
    --radius-pill: 999px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    --shadow-sm: 0 10px 24px rgba(24, 33, 47, 0.08);
    --shadow-md: 0 18px 60px rgba(24, 33, 47, 0.12);
    --shadow-lg: 0 26px 80px rgba(18, 28, 45, 0.18);

    --motion-fast: 160ms ease;
    --motion-base: 180ms ease;
    --motion-slow: 220ms ease;

    --ink: var(--color-text);
    --muted: var(--color-text-muted);
    --paper: var(--color-bg);
    --panel: var(--color-surface);
    --line: var(--color-border);
    --brand: var(--color-brand);
    --brand-dark: var(--color-brand-strong);
    --warm: var(--color-accent);
    --shadow: var(--shadow-md);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body,
button,
input,
select,
textarea {
    font-family: var(--font-ui);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--color-text);
}

::selection {
    background: rgba(31, 111, 235, 0.16);
    color: var(--color-text);
}

.public-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 10%, rgba(255, 191, 71, 0.28), transparent 26rem),
        radial-gradient(circle at 90% 0%, rgba(31, 111, 235, 0.18), transparent 22rem),
        linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-soft) 55%, #ffffff 100%);
}

.site-navbar {
    background: rgba(19, 27, 39, 0.94);
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(12, 18, 31, 0.16);
}

.hero-panel,
.section-panel,
.story-card,
.reader-side-card {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-panel,
.section-panel {
    padding: clamp(var(--space-5), 2vw, var(--space-8));
}

.hero-panel {
    background: linear-gradient(180deg, var(--color-surface-strong), var(--color-surface));
}

.story-card {
    padding: 1.35rem;
    transition: transform var(--motion-base), box-shadow var(--motion-base);
}

.story-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hero-slider {
    position: relative;
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.hero-slider-track {
    position: relative;
    min-height: 100%;
    flex: 1 1 auto;
}

.hero-slide {
    display: none;
    position: relative;
    min-height: 560px;
    overflow: hidden;
    border-radius: var(--radius-xl);
    align-items: end;
    box-shadow: var(--shadow-lg);
}

.hero-slide.is-active {
    display: grid;
}

.hero-slide-backdrop {
    position: absolute;
    inset: 0;
}

.hero-slide-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.03);
    background: #fff;
    filter: saturate(0.96) contrast(1.02);
}

.hero-slide-cover--placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at top right, rgba(255, 191, 71, 0.7), transparent 35%),
        linear-gradient(145deg, #172135 0%, #223453 100%);
    color: var(--color-text-on-dark);
    font-size: 5rem;
    font-weight: 800;
}

.hero-slide-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 78% 18%, rgba(255, 191, 71, 0.28), transparent 26%),
        linear-gradient(90deg, rgba(11, 17, 29, 0.92) 0%, rgba(11, 17, 29, 0.8) 38%, rgba(11, 17, 29, 0.46) 70%, rgba(11, 17, 29, 0.2) 100%),
        linear-gradient(180deg, rgba(255, 191, 71, 0.06), rgba(255, 255, 255, 0));
}

.hero-slide-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.7rem, 2.8vw, 2.8rem);
    max-width: 760px;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    margin-bottom: 1rem;
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-pill);
    background: linear-gradient(135deg, #ffcb45, #f4ad24);
    color: #1a1a1a;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 14px 28px rgba(255, 191, 71, 0.22);
}

.hero-slide-title {
    font-size: clamp(2.35rem, 4.5vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
    margin-bottom: 1rem;
    color: #fff;
}

.hero-slide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1.1rem;
}

.hero-meta-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.92rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.hero-slide-summary {
    font-size: clamp(1rem, 1.32vw, 1.22rem);
    color: rgba(255, 255, 255, 0.92);
    line-height: 1.75;
    margin-bottom: 1.8rem;
    max-width: 58ch;
    text-wrap: pretty;
}

.hero-slide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
}

.hero-btn-primary,
.hero-btn-secondary {
    min-width: 170px;
    min-height: 56px;
    border-radius: 18px;
    font-weight: 700;
    box-shadow: none;
}

.hero-btn-primary {
    background: linear-gradient(135deg, #2c7df6, #1558d6);
    border: 0;
}

.hero-btn-primary:hover {
    background: linear-gradient(135deg, #3b88fb, #1b63e7);
}

.hero-btn-secondary {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    backdrop-filter: blur(8px);
}

.hero-btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.hero-slider-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.4rem;
}

.hero-slider-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.hero-slider-dot {
    width: 10px;
    height: 10px;
    border: 0;
    border-radius: var(--radius-pill);
    background: rgba(24, 33, 47, 0.18);
    transition: transform var(--motion-fast), background var(--motion-fast);
}

.hero-slider-dot.is-active {
    transform: scale(1.3);
    background: var(--brand);
}

.hero-slider-arrow {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(24, 33, 47, 0.1);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font-size: 1.85rem;
    line-height: 1;
    backdrop-filter: blur(10px);
}

.hero-slider-arrow:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.story-meta-top {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.stats-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    height: 100%;
}

.stats-card {
    position: relative;
    padding: 1.4rem 1.5rem;
    border-radius: 28px;
    background: #132033;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stats-card:nth-child(2),
.stats-card:nth-child(4) {
    background: #f5b642;
    color: #1b1b1b;
}

.stats-card-glow {
    position: absolute;
    width: 160px;
    height: 160px;
    top: -74px;
    right: -58px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.stats-card:nth-child(2) .stats-card-glow,
.stats-card:nth-child(4) .stats-card-glow {
    background: rgba(255, 255, 255, 0.2);
}

.stats-label {
    position: relative;
    font-size: 0.95rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.stats-value {
    position: relative;
    font-size: 2.9rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}

.chip-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.92rem;
}

.chip-link:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.share-social-btn {
    width: 2.9rem;
    height: 2.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    color: #fff;
    font-weight: 800;
    line-height: 1;
    box-shadow:
        0 12px 24px rgba(24, 33, 47, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    transition:
        transform var(--motion-base),
        box-shadow var(--motion-base),
        filter var(--motion-base),
        border-color var(--motion-base);
}

.share-social-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow:
        0 16px 30px rgba(24, 33, 47, 0.19),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    filter: brightness(1.03) saturate(1.06);
}

.share-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.18rem;
    height: 1.18rem;
    line-height: 1;
    color: currentColor;
    flex: 0 0 auto;
}

.share-social-icon svg,
.share-icon-svg {
    width: 100%;
    height: 100%;
    display: block;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-icon-svg--outline {
    fill: none;
}

.share-social-icon--stack {
    position: relative;
}

.share-social-icon-layer {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.82);
    transition: opacity 160ms ease, transform 160ms ease;
}

.share-social-btn:not(.is-copy-success):not(.is-copy-error) .share-social-icon-default,
.share-social-btn.is-copy-success .share-social-icon-success,
.share-social-btn.is-copy-error .share-social-icon-error {
    opacity: 1;
    transform: scale(1);
}

.share-social-btn.is-copy-success .share-social-icon-default,
.share-social-btn.is-copy-success .share-social-icon-error,
.share-social-btn.is-copy-error .share-social-icon-default,
.share-social-btn.is-copy-error .share-social-icon-success {
    opacity: 0;
    transform: scale(0.82);
}

.share-facebook {
    border-color: rgba(24, 119, 242, 0.15);
    background: linear-gradient(145deg, #2d88ff 0%, #1863d6 100%);
}

.share-zalo {
    border-color: rgba(0, 104, 255, 0.15);
    background: linear-gradient(145deg, #1097ff 0%, #0068ff 100%);
}

.share-telegram {
    border-color: rgba(34, 158, 217, 0.15);
    background: linear-gradient(145deg, #42c0ff 0%, #229ed9 100%);
}

.share-x {
    border-color: rgba(17, 24, 39, 0.12);
    background: linear-gradient(145deg, #20242a 0%, #0a0a0c 100%);
}

.share-copy {
    border-color: rgba(71, 84, 103, 0.14);
    background: linear-gradient(145deg, #667085 0%, #475467 100%);
}

.share-native {
    border-color: rgba(29, 78, 216, 0.14);
    background: linear-gradient(145deg, #4f46e5 0%, #2563eb 100%);
}

.share-social-btn.is-copy-success {
    border-color: rgba(22, 163, 74, 0.14);
    background: linear-gradient(145deg, #2fbf71 0%, #15803d 100%);
}

.share-social-btn.is-copy-error {
    border-color: rgba(220, 38, 38, 0.14);
    background: linear-gradient(145deg, #ef4444 0%, #b91c1c 100%);
}

.history-panel {
    max-width: min(1080px, calc(100vw - 2rem));
    margin-inline: auto;
}

.history-list {
    display: grid;
    gap: 1rem;
}

.history-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1.15rem;
    border: 1px solid rgba(24, 33, 47, 0.1);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.78);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.history-card:hover {
    border-color: rgba(31, 111, 235, 0.28);
    box-shadow: 0 18px 42px rgba(31, 111, 235, 0.1);
    transform: translateY(-1px);
}

.history-card-main {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 1rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.history-card-thumb {
    width: 84px;
    height: 118px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(24, 33, 47, 0.06);
    box-shadow: 0 10px 24px rgba(24, 33, 47, 0.08);
}

.history-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.history-card-copy {
    min-width: 0;
}

.history-card-kicker {
    display: inline-flex;
    margin-bottom: 0.45rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.1);
    color: #1d4ed8;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.history-card-title {
    margin: 0 0 0.25rem;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--ink);
}

.history-card-chapter,
.history-card-time {
    color: var(--muted);
    font-size: 0.92rem;
}

.history-listen-status,
.history-read-status {
    display: inline-flex;
    margin-top: 0.7rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
}

.history-listen-status {
    background: rgba(245, 182, 66, 0.18);
    color: #8a4b04;
}

.history-read-status {
    background: rgba(31, 111, 235, 0.09);
    color: #1d4ed8;
}

.history-card-actions {
    display: grid;
    justify-items: end;
    gap: 0.75rem;
}

.story-audio-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid rgba(31, 111, 235, 0.16);
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(255, 191, 71, 0.16), transparent 28%),
        linear-gradient(135deg, rgba(31, 111, 235, 0.08), rgba(255, 255, 255, 0.84));
}

.story-audio-player-main {
    min-width: 0;
}

.story-audio-eyebrow {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1d4ed8;
}

.story-audio-title {
    font-size: 1.02rem;
    font-weight: 800;
    color: var(--ink);
}

.story-audio-tools {
    display: grid;
    justify-items: end;
    gap: 0.65rem;
}

.story-audio-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--muted);
    white-space: nowrap;
}

.chapter-list-pro {
    display: grid;
    gap: 0.65rem;
}

.chapter-row-pro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(24, 33, 47, 0.1);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.chapter-row-pro:hover {
    border-color: rgba(31, 111, 235, 0.28);
    box-shadow: 0 14px 32px rgba(31, 111, 235, 0.08);
    transform: translateY(-1px);
}

.chapter-row-main {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.chapter-row-number {
    flex-shrink: 0;
    color: #1d4ed8;
    font-size: 0.88rem;
    font-weight: 800;
}

.chapter-row-title {
    overflow: hidden;
    color: var(--ink);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
}

.chapter-row-type,
.chapter-audio-missing {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.chapter-audio-missing {
    opacity: 0.72;
}

.category-choice {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.72);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.category-choice:hover,
.category-choice:has(.form-check-input:checked) {
    border-color: rgba(31, 111, 235, 0.55) !important;
    box-shadow: 0 12px 34px rgba(31, 111, 235, 0.12);
    transform: translateY(-1px);
}

.search-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

.avatar-circle {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #101827);
    color: #fff;
    font-weight: 800;
    font-size: 2rem;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 16px 38px rgba(24, 33, 47, 0.18);
}

.site-footer {
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
}

.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}

.comment-item:last-child {
    border-bottom: 0;
}

.comment-item--reply {
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
}

.comment-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.comment-replies {
    display: grid;
    gap: 0.75rem;
}

.comment-reply-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.7rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.08);
    color: var(--brand);
    font-size: 0.9rem;
}

.comment-reply-badge {
    display: inline-flex;
    margin-left: 0.4rem;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    background: rgba(31, 111, 235, 0.12);
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 700;
    vertical-align: middle;
}

@media (max-width: 767.98px) {
    .stats-card-grid,
    .search-box {
        grid-template-columns: 1fr;
    }

    .stats-card-grid {
        grid-template-rows: none;
        height: auto;
    }

    .hero-slide {
        min-height: 440px;
    }

    .hero-slide-cover {
        min-height: 100%;
    }

    .hero-slide-summary {
        max-width: none;
    }

    .hero-slider-controls {
        justify-content: center;
    }

    .hero-btn-primary,
    .hero-btn-secondary {
        min-width: 0;
        width: 100%;
    }

    .history-card {
        grid-template-columns: 1fr;
    }

    .history-card-main {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .history-card-thumb {
        width: 72px;
        height: 100px;
    }

    .history-card-actions {
        justify-items: start;
    }

    .history-card-actions .d-flex {
        justify-content: flex-start !important;
    }

    .story-audio-player,
    .chapter-row-pro {
        grid-template-columns: 1fr;
    }

    .story-audio-tools,
    .chapter-row-actions {
        justify-items: start;
        justify-content: flex-start;
    }

    .chapter-row-main {
        display: grid;
    }
}
