﻿:root {
    --bg: #f4f6fa;
    --surface: rgba(255, 255, 255, 0.84);
    --surface-strong: #ffffff;
    --surface-muted: #eef2f7;
    --line: rgba(15, 23, 42, 0.08);
    --line-strong: rgba(15, 23, 42, 0.14);
    --text: #162033;
    --text-soft: #66758c;
    --text-strong: #0f1728;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.12);
    --accent-strong: #1d4ed8;
    --shadow-lg: 0 22px 50px rgba(15, 23, 42, 0.09);
    --shadow-md: 0 14px 28px rgba(15, 23, 42, 0.07);
    --shadow-sm: 0 8px 18px rgba(15, 23, 42, 0.05);
    --sidebar-width: 288px;
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --book-scale: 1;
    --transition: 0.25s ease;
    --ambient-rgb: 37 99 235;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", sans-serif;
    color: var(--text);
    overflow-x: hidden;
    background:
        radial-gradient(circle at top left, rgba(37, 99, 235, 0.1), transparent 28%),
        radial-gradient(circle at right bottom, rgba(148, 163, 184, 0.14), transparent 22%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

button,
canvas,
a,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    position: relative;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.app-shell::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(140deg, rgba(255, 255, 255, 0.38), transparent 38%),
        radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.58), transparent 18%);
    pointer-events: none;
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 18px;
    height: 100vh;
    padding: 24px 18px 20px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.04);
}

.sidebar__header {
    display: grid;
    gap: 8px;
    padding: 6px 10px 16px;
    border-bottom: 1px solid var(--line);
}

.sidebar__eyebrow,
.topbar__eyebrow,
.thumbnail-rail__eyebrow,
.toc-sheet__eyebrow,
.hotspot-card__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.sidebar__title,
.topbar__title,
.thumbnail-rail__title,
.toc-sheet__title,
.hotspot-card__title {
    margin: 0;
    font-family: "Playfair Display", serif;
    color: var(--text-strong);
    letter-spacing: -0.02em;
}

.sidebar__title {
    font-size: 2rem;
    line-height: 1;
}

.sidebar__caption {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.92rem;
    line-height: 1.5;
}

.search-field {
    min-height: 48px;
    padding: 0 14px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow-sm);
}

.search-field svg {
    width: 18px;
    height: 18px;
    color: var(--text-soft);
}

.search-field input {
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
}

.search-field input::placeholder {
    color: var(--text-soft);
}

.page-nav,
.toc-sheet__nav {
    min-height: 0;
}

.page-nav__list,
.toc-sheet__list {
    list-style: none;
    margin: 0;
    padding: 0 4px 0 0;
    display: grid;
    gap: 8px;
    max-height: 100%;
    overflow: auto;
}

.page-nav__list::-webkit-scrollbar,
.toc-sheet__list::-webkit-scrollbar,
.sidebar-thumbnails__list::-webkit-scrollbar,
.thumbnail-rail__list::-webkit-scrollbar {
    width: 7px;
    height: 8px;
}

.page-nav__list::-webkit-scrollbar-thumb,
.toc-sheet__list::-webkit-scrollbar-thumb,
.sidebar-thumbnails__list::-webkit-scrollbar-thumb,
.thumbnail-rail__list::-webkit-scrollbar-thumb {
    background: rgba(15, 23, 42, 0.12);
    border-radius: 999px;
}

.page-nav__button,
.toc-sheet__button {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    text-align: left;
    color: var(--text);
    background: transparent;
    transition:
        transform var(--transition),
        background var(--transition),
        border-color var(--transition),
        box-shadow var(--transition);
}

.page-nav__button:hover,
.toc-sheet__button:hover {
    transform: translateX(3px);
    background: rgba(255, 255, 255, 0.6);
    border-color: var(--line);
}

.page-nav__button.is-active,
.toc-sheet__button.is-active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.18));
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: var(--shadow-sm);
}

.page-nav__index,
.toc-sheet__index {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 700;
}

.page-nav__button.is-active .page-nav__index,
.toc-sheet__button.is-active .toc-sheet__index {
    background: var(--accent);
    color: #ffffff;
}

.page-nav__button-label,
.toc-sheet__button-label {
    min-width: 0;
}

.page-nav__title,
.toc-sheet__title-text {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.sidebar-thumbnails {
    display: grid;
    gap: 10px;
    padding: 10px;
    border-top: 1px solid var(--line);
}

.sidebar-thumbnails__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-thumbnails__title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-strong);
}

.sidebar-thumbnails__hint {
    color: var(--text-soft);
    font-size: 0.75rem;
    font-weight: 500;
}

.sidebar-thumbnails__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 102px;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.page-nav__button.is-hidden,
.toc-sheet__item.is-hidden {
    display: none;
}

.app-main {
    min-width: 0;
    display: grid;
    grid-template-rows: 70px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
}

.topbar,
.toolbar,
.viewer-panel,
.toc-sheet__panel,
.hotspot-card {
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: var(--surface);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 18px;
}

.topbar__left,
.topbar__right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.topbar__title-block {
    min-width: 0;
}

.topbar__title {
    font-size: clamp(1.8rem, 2vw, 2.2rem);
    line-height: 0.92;
}

.status-pill {
    min-height: 44px;
    padding: 8px 14px;
    border-radius: 14px;
    display: grid;
    gap: 2px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.status-pill--muted {
    background: rgba(247, 249, 252, 0.92);
}

.status-pill__label {
    color: var(--text-soft);
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.status-pill__value {
    color: var(--text-strong);
    font-size: 0.94rem;
    font-weight: 700;
    white-space: nowrap;
}

.workspace {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 14px;
}

.toolbar {
    min-height: 64px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar::-webkit-scrollbar {
    height: 0;
}

.toolbar__group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tool-button,
.icon-button,
.thumbnail-card,
.product-hotspot,
.cta-button {
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        background var(--transition),
        border-color var(--transition),
        color var(--transition),
        opacity var(--transition);
}

.tool-button,
.icon-button {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow-sm);
}

.tool-button:hover:not(:disabled),
.icon-button:hover,
.cta-button:hover,
.product-hotspot:hover {
    transform: translateY(-1px);
    color: var(--accent);
    background: #ffffff;
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: var(--shadow-md);
}

.tool-button.is-active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-color: rgba(37, 99, 235, 0.3);
}

.tool-button:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    box-shadow: none;
}

.toolbar__badge {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 700;
}

.viewer-panel {
    position: relative;
    min-height: 0;
    padding: 10px;
    overflow: hidden;
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
}

.viewer-panel::before,
.viewer-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.viewer-panel::before {
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 20%),
        radial-gradient(circle at left bottom, rgba(148, 163, 184, 0.14), transparent 26%);
}

.viewer-panel:fullscreen {
    padding: 14px;
    background:
        radial-gradient(circle at 20% 20%, rgba(var(--ambient-rgb), 0.22), transparent 30%),
        radial-gradient(circle at 80% 80%, rgba(var(--ambient-rgb), 0.16), transparent 34%),
        linear-gradient(180deg, rgba(8, 13, 24, 0.92), rgba(13, 18, 30, 0.96));
}

.viewer-panel:fullscreen::after {
    background:
        radial-gradient(circle at center, rgba(var(--ambient-rgb), 0.18), transparent 48%);
    mix-blend-mode: screen;
}

.book-viewport {
    position: relative;
    height: 100%;
    min-height: 0;
    overflow: auto;
    padding: 4px;
    border-radius: calc(var(--radius-xl) - 8px);
    background: linear-gradient(180deg, rgba(244, 247, 251, 0.95), rgba(236, 241, 247, 0.95));
    border: 1px solid rgba(15, 23, 42, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.viewer-panel:fullscreen .book-viewport {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.4), rgba(15, 23, 42, 0.38));
    border-color: rgba(255, 255, 255, 0.08);
}

.book-zoom-stage {
    width: 100%;
    height: 100%;
    min-width: min-content;
    min-height: min-content;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(var(--book-scale));
    transform-origin: center center;
    transition: transform var(--transition);
    will-change: transform;
}

.book-frame {
    position: relative;
    width: min(100%, 1760px);
    height: min(100%, calc(100vh - 306px));
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
}

.book-shadow {
    position: absolute;
    inset: 6% 8%;
    border-radius: 34px;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.18), transparent 70%);
    filter: blur(32px);
    transform: translateY(12px);
}

.viewer-panel:fullscreen .book-shadow {
    background: radial-gradient(circle at center, rgba(var(--ambient-rgb), 0.24), transparent 74%);
}

.book {
    position: relative;
    z-index: 1;
    min-width: 240px;
    min-height: 320px;
}

.book .stf__parent {
    box-shadow: 0 28px 56px rgba(15, 23, 42, 0.16);
}

.book .stf__block {
    border-radius: 14px;
    overflow: visible;
}

.flip-hint {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 4;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
    font-weight: 600;
}

.flip-hint.is-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
}

.flip-hint__dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.14);
    animation: pulse 1.8s ease infinite;
}

.thumbnail-rail {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: calc(var(--radius-xl) - 8px);
    background: rgba(255, 255, 255, 0.54);
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.thumbnail-rail__header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
}

.thumbnail-rail__title {
    font-size: 1.25rem;
    line-height: 1;
}

.thumbnail-rail__hint {
    color: var(--text-soft);
    font-size: 0.84rem;
    font-weight: 500;
}

.thumbnail-rail__list {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 120px;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.thumbnail-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    padding: 8px;
    display: grid;
    gap: 8px;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.thumbnail-card:hover {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.18);
    box-shadow: var(--shadow-md);
}

.thumbnail-card.is-active {
    border-color: rgba(37, 99, 235, 0.22);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(255, 255, 255, 0.92));
}

.thumbnail-card__preview {
    aspect-ratio: 0.75;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(238, 243, 248, 1), rgba(249, 251, 253, 1));
    border: 1px solid rgba(15, 23, 42, 0.05);
}

.thumbnail-card__canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #ffffff;
}

.thumbnail-card__meta {
    display: grid;
    gap: 2px;
}

.thumbnail-card__page {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.thumbnail-card__title {
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    color: var(--text);
}

.page::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(15, 23, 42, 0.04);
    pointer-events: none;
}

.page__surface {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.02), transparent 18%),
        linear-gradient(90deg, rgba(15, 23, 42, 0.02), transparent 12%);
}

.page__surface::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(15, 23, 42, 0.03) 0, transparent 16%),
        radial-gradient(circle at 0% 50%, rgba(15, 23, 42, 0.07), transparent 22%);
    opacity: 0.55;
    pointer-events: none;
}

.page__canvas {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    background: #ffffff;
}

.page__annotation-layer,
.page__product-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.page__product-layer {
    z-index: 3;
}

.page__annotation,
.product-hotspot {
    position: absolute;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: transparent;
    font-size: 0;
    overflow: hidden;
    pointer-events: auto;
    cursor: pointer;
}

.page__annotation:hover,
.page__annotation:focus-visible,
.product-hotspot:hover,
.product-hotspot:focus-visible {
    background: rgba(37, 99, 235, 0.12);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.28);
    outline: none;
}

.page__state,
.page__overlay {
    position: absolute;
    left: 14px;
    right: 14px;
    pointer-events: none;
}

.page__state {
    top: 14px;
    min-height: 34px;
    padding: 8px 12px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    max-width: max-content;
    background: rgba(255, 255, 255, 0.86);
    color: var(--text-soft);
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: var(--shadow-sm);
    font-size: 0.86rem;
    font-weight: 600;
}

.page__overlay {
    bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.page__badge,
.page__number {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-strong);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: var(--shadow-sm);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.page__number {
    min-width: 44px;
    justify-content: center;
}

.page.is-rendering .page__surface,
.thumbnail-card.is-loading .thumbnail-card__preview {
    background:
        linear-gradient(110deg, rgba(237, 242, 247, 0.96) 0%, rgba(255, 255, 255, 0.94) 45%, rgba(237, 242, 247, 0.96) 100%);
    background-size: 220% 100%;
    animation: shimmer 1.6s linear infinite;
}

.page.is-rendered .page__state {
    opacity: 0;
}

.book-loading {
    position: absolute;
    inset: 14px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 22px;
    border-radius: calc(var(--radius-xl) - 12px);
    background: rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(10px);
    transition: opacity var(--transition), visibility var(--transition);
}

.book-loading.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.book-loading.is-error {
    background: rgba(127, 29, 29, 0.16);
}

.book-loading__spinner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

.book-loading__content {
    max-width: 420px;
}

.book-loading__content strong {
    display: block;
    margin-bottom: 6px;
    color: #ffffff;
    font-size: 1rem;
}

.book-loading__content p {
    margin: 0;
    color: rgba(255, 255, 255, 0.86);
    line-height: 1.55;
}

.icon-button span {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform var(--transition), opacity var(--transition);
}

.icon-button--nav {
    display: none;
    flex-direction: column;
    gap: 4px;
}

.toc-sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
}

.toc-sheet.is-open {
    opacity: 1;
    pointer-events: auto;
}

.toc-sheet__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.32);
    backdrop-filter: blur(5px);
}

.toc-sheet__panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(540px, calc(100vw - 24px));
    max-height: min(82vh, 760px);
    transform: translate(-50%, -46%);
    padding: 18px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 14px;
    transition: transform var(--transition);
}

.toc-sheet.is-open .toc-sheet__panel {
    transform: translate(-50%, -50%);
}

.toc-sheet__header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.toc-sheet__title {
    font-size: 1.6rem;
}

.search-field--sheet {
    background: rgba(248, 250, 252, 0.92);
}

.hotspot-card {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 70;
    width: min(360px, calc(100vw - 24px));
    padding: 16px;
    display: grid;
    gap: 12px;
}

.hotspot-card__header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 12px;
}

.hotspot-card__close {
    flex-shrink: 0;
}

.hotspot-card__title {
    font-size: 1.45rem;
    line-height: 1;
}

.hotspot-card__body {
    display: grid;
    gap: 8px;
}

.hotspot-card__code {
    width: max-content;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    background: rgba(37, 99, 235, 0.08);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hotspot-card__description {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.55;
}

.hotspot-card__link,
.cta-button {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 700;
}

.hotspot-card__link {
    width: max-content;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.cta-button {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 45;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-strong);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: var(--shadow-lg);
}

.hotspot-card:not([hidden]) ~ .cta-button {
    bottom: 214px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translate(-50%, 16px);
    min-width: 220px;
    max-width: min(90vw, 420px);
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.88);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    text-align: center;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
    z-index: 80;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.app-shell.is-sidebar-open .icon-button span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.app-shell.is-sidebar-open .icon-button span:nth-child(2) {
    opacity: 0;
}

.app-shell.is-sidebar-open .icon-button span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shimmer {
    to {
        background-position: -220% 0;
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.18);
    }
}

@media (min-width: 1920px) {
    .app-main {
        padding: 22px;
    }

    .book-frame {
        width: min(100%, 1860px);
        height: min(100%, calc(100vh - 286px));
    }
}

@media (max-width: 1280px) {
    .topbar {
        height: auto;
        min-height: 70px;
    }

    .topbar,
    .toolbar {
        justify-content: space-between;
    }

    .topbar__right {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(90vw, 340px);
        max-width: 100%;
        transform: translateX(-104%);
        transition: transform var(--transition);
        box-shadow: var(--shadow-lg);
    }

    .app-shell.is-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.is-sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 15;
        background: rgba(15, 23, 42, 0.28);
        backdrop-filter: blur(4px);
    }

    .icon-button--nav {
        display: inline-flex;
    }

    .app-main {
        grid-template-rows: auto minmax(0, 1fr);
        padding: 14px;
    }

    .book-frame {
        width: min(100%, 1500px);
        height: min(100%, calc(100dvh - 292px));
    }
}

@media (max-width: 768px) {
    .app-main {
        gap: 10px;
        padding: 10px;
    }

    .topbar,
    .toolbar,
    .viewer-panel,
    .toc-sheet__panel,
    .hotspot-card {
        border-radius: 22px;
    }

    .topbar {
        position: sticky;
        top: 10px;
        z-index: 12;
        flex-wrap: wrap;
        gap: 12px;
        padding: 10px 12px;
    }

    .topbar__left {
        width: 100%;
        justify-content: space-between;
        gap: 12px;
    }

    .topbar__right {
        width: 100%;
        gap: 10px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .status-pill {
        min-height: 40px;
        padding: 8px 12px;
    }

    .toolbar {
        padding: 8px 10px;
        justify-content: flex-start;
        gap: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .toolbar__group {
        flex-shrink: 0;
        flex-wrap: nowrap;
        justify-content: flex-start;
        scroll-snap-align: start;
    }

    .viewer-panel {
        padding: 8px;
    }

    .book-viewport {
        padding: 2px;
    }

    .book-frame {
        width: 100%;
        min-height: clamp(320px, 58dvh, 520px);
        height: min(100%, calc(100dvh - 228px));
        padding: 2px;
    }

    .book-shadow {
        inset: 7% 7%;
        filter: blur(26px);
    }

    .flip-hint {
        right: 50%;
        bottom: 12px;
        transform: translateX(50%);
        min-height: 38px;
        padding: 0 12px;
        font-size: 0.82rem;
    }

    .book-loading {
        inset: 10px;
        flex-direction: column;
        text-align: center;
    }

    .book-loading__spinner {
        width: 46px;
        height: 46px;
    }

    .book-loading__content strong {
        font-size: 0.95rem;
    }

    .sidebar {
        padding: 18px 14px 16px;
        gap: 14px;
    }

    .sidebar__header {
        padding: 4px 6px 12px;
    }

    .sidebar__title {
        font-size: 1.7rem;
    }

    .page-nav__list,
    .toc-sheet__list {
        gap: 6px;
    }

    .page-nav__button,
    .toc-sheet__button {
        padding: 11px 12px;
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 10px;
    }

    .page-nav__index,
    .toc-sheet__index {
        width: 30px;
        height: 30px;
        border-radius: 9px;
        font-size: 0.78rem;
    }

    .sidebar-thumbnails {
        gap: 8px;
        padding: 8px 0 0;
    }

    .sidebar-thumbnails__header {
        align-items: start;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar-thumbnails__list {
        grid-auto-columns: 88px;
    }

    .hotspot-card {
        left: 10px;
        right: 10px;
        bottom: 70px;
        width: auto;
        padding: 14px;
    }

    .cta-button {
        right: 10px;
        bottom: 10px;
        min-height: 42px;
        padding: 0 14px;
        font-size: 0.88rem;
    }

    .hotspot-card:not([hidden]) ~ .cta-button {
        bottom: 10px;
        opacity: 0;
        pointer-events: none;
    }

    .toast {
        bottom: 64px;
        min-width: 0;
        max-width: calc(100vw - 20px);
    }
}

@media (max-width: 560px) {
    .app-main {
        padding: 8px;
    }

    .topbar__title {
        font-size: 1.26rem;
        line-height: 1;
    }

    .topbar__eyebrow {
        display: none;
    }

    .topbar__right {
        grid-template-columns: 1fr;
    }

    .topbar__eyebrow,
    .sidebar__eyebrow,
    .status-pill__label,
    .thumbnail-rail__eyebrow,
    .toc-sheet__eyebrow,
    .hotspot-card__eyebrow {
        letter-spacing: 0.12em;
    }

    .tool-button,
    .icon-button {
        width: 42px;
        height: 42px;
        border-radius: 12px;
        flex: 0 0 42px;
    }

    .toolbar {
        padding: 8px;
        gap: 8px;
    }

    .toolbar__badge {
        min-height: 42px;
        flex: 0 0 auto;
        padding: 0 12px;
        font-size: 0.86rem;
    }

    .page__state,
    .page__overlay {
        left: 10px;
        right: 10px;
    }

    .page__badge,
    .page__number {
        font-size: 0.72rem;
    }

    .page__state {
        top: 10px;
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .page__overlay {
        bottom: 10px;
        gap: 8px;
    }

    .page__badge,
    .page__number {
        min-height: 28px;
        padding: 0 10px;
    }

    .flip-hint {
        left: 10px;
        right: 10px;
        bottom: 10px;
        transform: none;
        justify-content: center;
        text-align: center;
    }

    .toc-sheet__panel {
        width: calc(100vw - 16px);
        max-height: min(88dvh, 760px);
        padding: 14px;
        border-radius: 20px;
    }

    .hotspot-card__title {
        font-size: 1.2rem;
    }

    .cta-button {
        left: 10px;
        right: 10px;
        width: auto;
    }

    .sidebar-thumbnails__list {
        grid-auto-columns: 80px;
    }
}