:root {
    --bg: #f4efe6;
    --surface: rgba(255, 251, 245, 0.92);
    --surface-strong: #fffdf8;
    --line: rgba(110, 89, 58, 0.14);
    --text: #16130f;
    --muted: #6e6255;
    --accent: #c9a56a;
    --accent-dark: #8d6a3b;
    --footer: #0a0a0d;
    --shadow: 0 24px 55px rgba(22, 19, 15, 0.1);
    --radius: 26px;
    --font: "Segoe UI", "Helvetica Neue", 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(201, 165, 106, 0.1), transparent 24%),
        radial-gradient(circle at top right, rgba(12, 10, 8, 0.04), transparent 26%),
        linear-gradient(180deg, #faf6ef 0%, #f2ebdf 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(10, 10, 13, 0.96);
    border-bottom: 1px solid rgba(201, 165, 106, 0.18);
}

.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-logo {
    width: 66px;
    height: 66px;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(22, 19, 15, 0.12));
}

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

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

.site-header .brand strong,
.site-header .brand small,
.site-header .header-links a,
.admin-header .brand strong,
.admin-header .brand small,
.admin-header .header-links a,
.admin-header .admin-user {
    color: #e6c791;
}

.site-header .header-links a,
.admin-header .header-links a {
    position: relative;
}

.site-header .header-links a::after,
.admin-header .header-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 100%;
    height: 1px;
    background: rgba(201, 165, 106, 0.48);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 180ms ease;
}

.site-header .header-links a:hover::after,
.site-header .header-links a:focus-visible::after,
.admin-header .header-links a:hover::after,
.admin-header .header-links a:focus-visible::after {
    transform: scaleX(1);
}

.admin-user {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(201, 165, 106, 0.18);
    background: rgba(201, 165, 106, 0.08);
    font-weight: 600;
}

.brand-mark {
    width: 16px;
    height: 44px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f0d7a6 0%, var(--accent) 100%);
    box-shadow: 0 10px 26px rgba(141, 106, 59, 0.2);
}

.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: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.book-card,
.showcase-card {
    border-radius: 0;
}

.hero-slider {
    overflow: hidden;
    position: relative;
    min-height: 620px;
    background:
        radial-gradient(circle at right top, rgba(201, 165, 106, 0.18), transparent 28%),
        radial-gradient(circle at left bottom, rgba(22, 19, 15, 0.06), transparent 26%),
        linear-gradient(135deg, #f6efe4 0%, #fbf7f0 52%, #efe3d1 100%);
}

.hero-slides {
    position: relative;
    min-height: 620px;
}

.hero-slide {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    align-items: center;
    gap: 32px;
    padding: 54px;
    min-height: 620px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(24px) scale(0.985);
    transition:
        opacity 560ms ease,
        transform 560ms ease,
        visibility 0s linear 560ms;
}

.hero-slide.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    transition:
        opacity 560ms ease,
        transform 560ms ease,
        visibility 0s linear 0s;
}

.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(201, 165, 106, 0.16);
    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, 252, 247, 0.72);
    border: 1px solid rgba(141, 106, 59, 0.12);
}

.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, 251, 245, 0.75);
    border: 1px solid rgba(141, 106, 59, 0.12);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 430px;
}

.hero-book-frame img,
.hero-book-frame .cover-placeholder {
    border-radius: 26px;
}

.hero-book-frame img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    object-position: center;
    box-shadow: 0 18px 34px rgba(22, 19, 15, 0.12);
}

.hero-book-frame .cover-placeholder {
    width: 100%;
    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, 252, 248, 0.9);
    border: 1px solid rgba(141, 106, 59, 0.12);
    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(201, 165, 106, 0.14);
}

.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(141, 106, 59, 0.24);
    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(190px, 1fr));
    gap: 18px;
}

.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, #b98e54 0%, #7a5a32 100%);
    box-shadow: 0 14px 30px rgba(122, 90, 50, 0.24);
}

.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;
}

.cover-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 18px 0;
    margin: 10px 10px 0;
    border-radius: 0;
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.88), rgba(246, 238, 226, 0.52));
    min-height: 340px;
}

.cover-link img,
.cover-link .cover-placeholder {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 300px;
    aspect-ratio: auto;
    object-fit: contain;
    object-position: center top;
    border-radius: 0;
}

.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;
}

.book-card-body {
    padding: 16px 18px 20px;
}

.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;
}

.book-card-body h2 {
    font-size: 1.08rem;
    line-height: 1.25;
}

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

.book-card .text-link {
    display: inline-flex;
    margin-top: 6px;
}

.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, #ead9bf 0%, #ceb084 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(201, 165, 106, 0.16);
    color: var(--accent-dark);
    font-size: 0.78rem;
}

.pill-active {
    background: rgba(201, 165, 106, 0.16);
}

.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, #cba569 0%, #926b3e 100%);
    color: #fffdf8;
}

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

.button.ghost {
    background: rgba(255, 252, 247, 0.9);
    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(201, 165, 106, 0.9);
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.92), rgba(244, 236, 222, 0.95));
}

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

.author-card-body {
    border: 1px dashed rgba(141, 106, 59, 0.35);
    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, 252, 247, 0.96), rgba(243, 234, 220, 0.92));
}

.category-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(201, 165, 106, 0.18);
    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));
}

.cover-preview-card {
    display: grid;
    gap: 10px;
}

.preview-label {
    color: var(--muted);
    font-size: 0.95rem;
}

.cover-preview-frame {
    min-height: 280px;
    border-radius: 22px;
    border: 1px dashed rgba(141, 106, 59, 0.28);
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(243, 234, 220, 0.76));
    display: grid;
    place-items: center;
    padding: 18px;
}

.cover-preview-image {
    max-width: 100%;
    max-height: 340px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 16px 28px rgba(22, 19, 15, 0.12);
}

.cover-preview-empty {
    color: var(--muted);
    text-align: center;
    max-width: 26ch;
}

.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(201, 165, 106, 0.16);
    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(201, 165, 106, 0.12), transparent 18%),
        linear-gradient(180deg, #121214 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, 248, 236, 0.04);
    border-color: rgba(201, 165, 106, 0.14);
    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(201, 165, 106, 0.18);
}

.footer-logo {
    width: 82px;
    height: 82px;
}

.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-slides {
        min-height: auto;
    }

    .hero-slide {
        position: relative;
        inset: auto;
        display: none;
        min-height: auto;
        padding: 32px 24px 80px;
        transform: translateY(12px);
    }

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

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

    .hero-book-frame {
        min-height: 0;
    }

    .hero-book-frame img {
        max-height: 320px;
    }

    .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;
    }

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

    .cover-link img,
    .cover-link .cover-placeholder {
        max-height: 220px;
    }

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