:root {
    --bg: #edf3f8;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --line: rgba(15, 23, 42, 0.08);
    --text: #103b5c;
    --muted: #61748a;
    --accent: #11789e;
    --accent-dark: #0c3e60;
    --footer: #0d3551;
    --shadow: 0 24px 55px rgba(16, 59, 92, 0.1);
    --radius: 26px;
    --font: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(17, 120, 158, 0.12), transparent 28%),
        linear-gradient(180deg, #f9fbfd 0%, #ebf2f7 100%);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font: inherit;
}

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header,
.admin-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(16px);
    background: rgba(249, 251, 253, 0.94);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
}

.brand strong,
h1,
h2,
h3 {
    letter-spacing: -0.03em;
}

.brand small,
.meta,
.detail-meta,
.reader-note,
.header-links a,
.admin-user {
    color: var(--muted);
}

.brand-mark {
    width: 16px;
    height: 44px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffb347 0%, var(--accent) 100%);
    box-shadow: 0 10px 26px rgba(17, 120, 158, 0.28);
}

.header-links {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.header-links a {
    font-weight: 600;
}

.hero-stage {
    padding: 34px 0 26px;
}

.hero-grid,
.detail-card,
.reader-topbar,
.table-card-head {
    display: grid;
    gap: 24px;
}

.hero-slider,
.book-card,
.detail-card,
.install-card,
.form-card,
.table-card,
.stat-card,
.empty-state,
.showcase-card,
.author-card,
.category-card,
.footer-contact-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-slider {
    overflow: hidden;
    position: relative;
    min-height: 620px;
    background:
        radial-gradient(circle at right top, rgba(17, 120, 158, 0.1), transparent 28%),
        linear-gradient(135deg, #dbeaf1 0%, #edf4f8 48%, #dcecf4 100%);
}

.hero-slides {
    position: relative;
}

.hero-slide {
    display: none;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 32px;
    padding: 54px;
    min-height: 620px;
}

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

.hero-copy h1 {
    font-size: clamp(2.7rem, 5vw, 5.2rem);
    line-height: 1.02;
    margin: 18px 0 18px;
    max-width: 10ch;
}

.hero-copy p,
.detail-description,
.book-card-body p,
.showcase-body p,
.section-head p {
    color: var(--muted);
    line-height: 1.65;
}

.eyebrow {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(17, 120, 158, 0.12);
    color: var(--accent-dark);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero-actions,
.social-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-actions {
    margin-top: 28px;
}

.hero-meta-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 30px;
}

.hero-meta-strip div {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(16, 59, 92, 0.08);
}

.hero-meta-strip strong,
.stat-card strong {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.hero-visual {
    position: relative;
    min-height: 420px;
    display: grid;
    place-items: center;
}

.hero-book-frame {
    width: min(380px, 100%);
    border-radius: 38px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(16, 59, 92, 0.08);
    position: relative;
    z-index: 2;
}

.hero-book-frame img,
.hero-book-frame .cover-placeholder {
    border-radius: 26px;
    aspect-ratio: 4 / 5;
}

.hero-badge-card {
    position: absolute;
    right: 0;
    bottom: 18px;
    z-index: 3;
    padding: 20px 22px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(16, 59, 92, 0.08);
    min-width: 220px;
}

.hero-badge-card span,
.hero-badge-card small {
    color: var(--muted);
}

.hero-badge-card strong {
    display: block;
    margin: 6px 0;
}

.hero-ornament {
    position: absolute;
    border-radius: 999px;
    background: rgba(17, 120, 158, 0.12);
}

.hero-ornament-a {
    width: 130px;
    height: 130px;
    top: 10px;
    left: 22px;
}

.hero-ornament-b {
    width: 220px;
    height: 220px;
    right: 26px;
    top: 16px;
}

.slider-dots {
    position: absolute;
    left: 54px;
    bottom: 34px;
    display: flex;
    gap: 10px;
    z-index: 4;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 0;
    background: rgba(16, 59, 92, 0.18);
    cursor: pointer;
}

.slider-dot.is-active {
    background: var(--accent);
}

.content-section,
.admin-layout,
.detail-layout {
    padding-bottom: 64px;
}

.spotlight-section {
    padding: 18px 0 60px;
}

.filter-bar,
.grid-form {
    display: grid;
    gap: 16px;
}

.filter-bar {
    grid-template-columns: 1.6fr 0.7fr auto;
    margin: 28px 0 28px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.section-head {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: end;
    margin-bottom: 26px;
}

.section-head.centered {
    grid-template-columns: 1fr;
    text-align: center;
}

.section-head h2 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin: 12px 0 10px;
}

.section-head p {
    max-width: 60ch;
}

.carousel-shell {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 34px;
}

.page-slider-shell {
    margin-bottom: 34px;
}

.page-slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-slider-viewport {
    position: relative;
}

.books-grid-page {
    display: none;
}

.books-grid-page.is-active {
    display: block;
}

.books-grid-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px;
}

.carousel-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 240px;
    gap: 22px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 8px 2px 12px;
    scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.books-carousel {
    grid-auto-columns: 220px;
    align-items: start;
}

.author-carousel {
    grid-auto-columns: 260px;
}

.category-carousel {
    grid-auto-columns: 250px;
}

.carousel-arrow {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: 0;
    cursor: pointer;
    font-size: 1.9rem;
    line-height: 1;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, #1b5f87 100%);
    box-shadow: 0 14px 30px rgba(17, 120, 158, 0.22);
}

.showcase-card,
.author-card,
.category-card {
    scroll-snap-align: start;
}

.showcase-card,
.book-card {
    overflow: hidden;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.showcase-card {
    width: 100%;
}

.showcase-card:hover,
.book-card:hover,
.detail-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 26px 52px rgba(15, 23, 42, 0.12);
}

.showcase-cover img,
.showcase-cover .cover-placeholder,
.cover-link img,
.detail-cover img,
.cover-placeholder {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}

.showcase-cover img,
.showcase-cover .cover-placeholder {
    aspect-ratio: 4 / 5.7;
}

.showcase-body,
.book-card-body,
.install-card,
.form-card,
.table-card,
.stat-card,
.detail-content {
    padding: 24px;
}

.showcase-body {
    padding: 18px;
}

.showcase-body h3,
.book-card-body h2,
.detail-content h1,
.table-card-head h1,
.install-card h1,
.author-card-body h3,
.category-card h3 {
    margin: 12px 0 10px;
}

.showcase-body h3 {
    font-size: 1.05rem;
    line-height: 1.25;
}

.showcase-body p {
    font-size: 0.92rem;
}

.showcase-body .button {
    min-height: 42px;
}

.inline-dots {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cover-placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, #d7e5e3 0%, #b7d8d5 100%);
    color: var(--accent-dark);
    font-size: 1.15rem;
    font-weight: 700;
}

.cover-placeholder.large {
    border-radius: 18px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(17, 120, 158, 0.12);
    color: var(--accent-dark);
    font-size: 0.78rem;
}

.pill-active {
    background: rgba(17, 120, 158, 0.12);
}

.pill-muted {
    background: rgba(90, 103, 123, 0.16);
    color: var(--muted);
}

.button,
.text-link,
.actions-cell a,
.actions-cell button {
    transition: all 180ms ease;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 14px;
    border: 1px solid transparent;
    cursor: pointer;
}

.button.primary {
    background: linear-gradient(135deg, var(--accent) 0%, #1d95bb 100%);
    color: white;
}

.button.primary:hover {
    transform: translateY(-1px);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--line);
}

.text-link {
    color: var(--accent-dark);
    font-weight: 600;
}

.wide {
    width: 100%;
}

.author-card {
    padding: 26px 20px;
    text-align: center;
}

.author-badge-ring {
    width: 140px;
    height: 140px;
    margin: 0 auto 22px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 3px dashed rgba(242, 181, 73, 0.8);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(233, 244, 249, 0.95));
}

.author-avatar {
    width: 88px;
    height: 88px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent) 0%, #95cce0 100%);
    color: white;
    font-size: 1.7rem;
    font-weight: 700;
}

.author-card-body {
    border: 1px dashed rgba(17, 120, 158, 0.4);
    border-radius: 18px;
    padding: 18px;
}

.author-card-body p,
.author-card-body small,
.category-card p {
    color: var(--muted);
}

.category-card {
    padding: 26px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(236, 244, 248, 0.9));
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(17, 120, 158, 0.14);
    color: var(--accent-dark);
    font-weight: 800;
}

.detail-card {
    grid-template-columns: 320px 1fr;
    padding: 28px;
    margin-top: 44px;
}

.detail-data {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 22px 0;
}

.detail-data div {
    padding: 16px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.03);
}

.detail-data dt {
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.reader-body {
    background: #0d141d;
    color: #edf2f7;
}

.reader-shell {
    width: min(1380px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0;
}

.reader-topbar {
    grid-template-columns: 1fr auto;
    align-items: end;
    margin-bottom: 18px;
}

.reader-frame {
    background: #111927;
    border-radius: 22px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.reader-frame iframe {
    width: 100%;
    height: calc(100vh - 210px);
    border: 0;
    border-radius: 12px;
    background: white;
}

.reader-note {
    margin-top: 16px;
    font-size: 0.9rem;
}

.install-body,
.install-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.install-card {
    width: min(820px, 100%);
}

.grid-form label,
.checkbox-field {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.95rem;
}

.grid-form input,
.grid-form select,
.grid-form textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: rgba(255, 255, 255, 0.88);
}

.grid-form.compact {
    max-width: 420px;
}

.grid-form.admin-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
    grid-column: 1 / -1;
}

.checkbox-field {
    grid-column: 1 / -1;
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
}

.checkbox-field input {
    width: auto;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 32px 0 22px;
}

.table-card-head {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 16px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.actions-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.actions-cell form {
    margin: 0;
}

.actions-cell button {
    border: 0;
    background: transparent;
    color: #b42318;
    cursor: pointer;
    padding: 0;
}

.flash {
    padding: 14px 18px;
    border-radius: 16px;
    margin-bottom: 18px;
}

.flash-success {
    background: rgba(17, 120, 158, 0.12);
    color: var(--accent-dark);
}

.flash-error {
    background: rgba(180, 35, 24, 0.12);
    color: #8b1e16;
}

.empty-state {
    padding: 40px 24px;
    text-align: center;
    margin-top: 28px;
}

.public-footer {
    margin-top: 40px;
    padding: 34px 0 56px;
    color: rgba(255, 255, 255, 0.9);
    background:
        radial-gradient(circle at left bottom, rgba(255, 255, 255, 0.08), transparent 18%),
        linear-gradient(180deg, #123f61 0%, var(--footer) 100%);
}

.footer-top,
.footer-main {
    display: grid;
    gap: 22px;
}

.footer-top {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.footer-contact-card {
    padding: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.footer-contact-card span,
.footer-contact-card small,
.footer-brand-block p,
.footer-links-block p,
.footer-brand small,
.social-row a,
.footer-note {
    color: rgba(255, 255, 255, 0.72);
}

.footer-contact-card strong,
.footer-links-block h3,
.footer-brand strong {
    color: white;
}

.footer-main {
    grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr;
    padding-top: 30px;
}

.footer-brand-block,
.footer-links-block {
    display: grid;
    gap: 14px;
}

.footer-links-block a {
    color: white;
}

.social-row a {
    display: inline-flex;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.fade-up {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms ease, transform 400ms ease;
}

.enhanced-motion .fade-up {
    opacity: 0;
    transform: translateY(18px);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 {
    transition-delay: 100ms;
}

@media (max-width: 900px) {
    .detail-card,
    .reader-topbar,
    .table-card-head,
    .filter-bar,
    .grid-form.admin-form,
    .stats-grid,
    .hero-slide,
    .section-head,
    .footer-top,
    .footer-main,
    .hero-meta-strip {
        grid-template-columns: 1fr;
    }

    .detail-card {
        margin-top: 28px;
    }

    .detail-cover {
        max-width: 320px;
    }

    .hero-slider {
        min-height: auto;
    }

    .hero-slide {
        min-height: auto;
        padding: 32px 24px 80px;
    }

    .hero-badge-card {
        position: static;
        margin-top: 16px;
        width: 100%;
    }

    .books-grid-board {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .nav-shell,
    .header-links,
    .detail-actions,
    .reader-actions,
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .reader-frame iframe {
        height: 72vh;
    }

    .container {
        width: min(100% - 20px, 1160px);
    }

    .carousel-shell {
        grid-template-columns: 1fr;
    }

    .carousel-arrow {
        display: none;
    }

    .carousel-track,
    .books-carousel,
    .author-carousel,
    .category-carousel {
        grid-auto-columns: 78%;
    }

    .page-slider-head {
        flex-wrap: wrap;
        justify-content: center;
    }

    .books-grid-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
    }

    .slider-dots {
        left: 24px;
        bottom: 20px;
    }
}
