.glass-panel {
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.message-bubble {
    animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.heart-pulse {
    animation: pulse 1.8s infinite;
}

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

/* Oprava výšky pro mobilní prohlížeče (iOS Safari) */
.h-dynamic {
    height: 100vh;
    height: 100dvh;
}

/* =====================================================================
   HONBA ZA POKLADEM
   ===================================================================== */

/* ---------- pozadí: noční knihovna se svíčkou a hvězdičkami ---------- */
.book-bg {
    margin: 0;
    padding: 12px;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #130e22;
    background-image:
        radial-gradient(1.5px 1.5px at 20px 30px, rgba(255, 255, 255, 0.55) 50%, transparent 51%),
        radial-gradient(1px 1px at 90px 80px, rgba(255, 255, 255, 0.4) 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 140px 20px, rgba(255, 230, 170, 0.5) 50%, transparent 51%),
        radial-gradient(ellipse at 50% 0%, rgba(255, 196, 110, 0.20), transparent 62%),
        linear-gradient(180deg, #1f1636 0%, #130e22 70%);
    background-size: 170px 110px, 170px 110px, 170px 110px, 100% 100%, 100% 100%;
}
@supports (height: 100dvh) { .book-bg { min-height: 100dvh; } }
@media (min-width: 640px) { .book-bg { padding: 24px; } }

/* stránka s knihou nezávisí na Tailwindu (ten se z CDN načítá se zpožděním a stránka by "blikla") */
.book-bg, .book-bg *, .book-bg *::before, .book-bg *::after { box-sizing: border-box; }
:where(.book-bg) button { cursor: pointer; border: 0; background: none; font: inherit; color: inherit; padding: 0; margin: 0; }
:where(.book-bg) input  { font: inherit; margin: 0; }
.bk-off { display: none !important; }

/* horní lišta (Zpět / testovací pruh) */
.book-top { margin-bottom: 12px; }
.book-back { display: inline-block; color: rgba(254, 243, 199, 0.9); font-size: 14px; font-weight: 500; text-decoration: none; padding: 4px 0; }
.book-back:active { opacity: 0.6; }
.book-testbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    font-size: 12px; line-height: 1.35; padding: 10px;
    background: #fef3c7; color: #78350f; border: 1px solid #fcd34d; border-radius: 12px;
}
.book-testbar .btns { display: flex; gap: 8px; flex-shrink: 0; }
.book-testbtn {
    padding: 4px 10px; font-weight: 600; text-decoration: none; color: #78350f;
    background: #fff; border: 1px solid #fcd34d !important; border-radius: 8px;
}
.book-row  { display: flex; gap: 8px; }
.book-row .book-input { flex: 1; min-width: 0; }
.book-msg  { font-size: 12px; margin: 8px 0 0; min-height: 16px; color: #8a3a1a; }

/* výška knihy je napevno (text se v ní jen posouvá). Bez proměnných, ať to nejde rozbít. */
.book { height: clamp(470px, calc(100vh - 120px), 700px); }
@supports (height: 100dvh) { .book { height: clamp(470px, calc(100dvh - 120px), 700px); } }
.book-test .book { height: clamp(470px, calc(100vh - 195px), 700px); }
@supports (height: 100dvh) { .book-test .book { height: clamp(470px, calc(100dvh - 195px), 700px); } }

/* velká obrazovka (PC): o něco větší kniha a písmo */
@media (min-width: 900px) and (min-height: 760px) {
    .book { height: clamp(560px, calc(100vh - 130px), 780px); }
    .book-test .book { height: clamp(560px, calc(100vh - 205px), 780px); }
}
@supports (height: 100dvh) {
    @media (min-width: 900px) and (min-height: 760px) {
        .book { height: clamp(560px, calc(100dvh - 130px), 780px); }
        .book-test .book { height: clamp(560px, calc(100dvh - 205px), 780px); }
    }
}

/* ---------- kniha ---------- */
.book-wrap {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

/* kožená obálka + hřbet vlevo */
.book {
    position: relative;
    display: flex;
    box-sizing: border-box;
    padding: 12px 12px 14px 26px;
    isolation: isolate;
}

/* kožená základna knihy (samostatná vrstva, aby se dala při otevírání jen plynule zobrazit, nehýbe se ani neroztahuje) */
.book-base {
    position: absolute; top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    border-radius: 12px 18px 18px 12px;
    background: linear-gradient(135deg, #6a4424 0%, #4d2f16 100%);
    box-shadow:
        0 26px 50px rgba(0, 0, 0, 0.65),
        inset 0 0 0 2px #35200f,
        inset 0 0 22px rgba(0, 0, 0, 0.45);
}
.book-base-r { display: none; }      /* pravá polovina základny se používá jen u dvojstrany */

.book::before {            /* hřbet */
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 18px;
    border-radius: 12px 0 0 12px;
    background: linear-gradient(90deg, #2a170a 0%, #6b4526 55%, #3f2512 100%);
    box-shadow: inset -2px 0 5px rgba(0, 0, 0, 0.45);
}

.book::after {             /* zlatý proužek na hřbetě */
    content: '';
    position: absolute;
    left: 7px; top: 14px; bottom: 14px;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(180deg, #e8c46a, #b88a2c, #e8c46a);
    opacity: 0.8;
}

/* papírová stránka */
.book-page {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    padding: 24px 22px 16px 30px;
    color: #3a2810;
    border-radius: 3px 9px 9px 3px;
    background:
        linear-gradient(90deg, rgba(120, 80, 30, 0.30), rgba(120, 80, 30, 0) 9%),
        radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.5), transparent 55%),
        repeating-linear-gradient(0deg, rgba(120, 90, 40, 0.03) 0 1px, transparent 1px 3px),
        #f6ebd0;
    box-shadow:
        inset 0 0 34px rgba(150, 100, 40, 0.20),
        3px 3px 0 #e9d8ad,
        5px 5px 0 #d9c38f,
        7px 7px 0 #c8b078;       /* "hromádka" dalších stran */
    transform-origin: left center;
}

.side-single::after, .side-right::after {        /* červená záložka */
    content: '';
    position: absolute;
    top: -8px; right: 30px;
    width: 18px; height: 52px;
    background: linear-gradient(180deg, #c0392b, #96281e);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.book-title {
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-weight: 700;
    font-size: 1.45rem;
    line-height: 1.2;
    text-align: center;
    color: #4a2c12;
    overflow-wrap: anywhere;
}
.side-single .book-title, .side-right .book-title { padding-right: 26px; }   /* ať nelezeme pod záložku */
.side-single .book-text:first-child, .side-right .book-text:first-child { padding-right: 34px; }   /* strana bez nadpisu: text nezajíždí pod záložku */

.book-orn {                /* ozdobný oddělovač */
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 14px;
    color: #a47a3a;
    font-size: 0.8rem;
}
.book-orn::before, .book-orn::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(138, 96, 40, 0.65), transparent);
}

.book-text {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    font-size: 1.08rem;
    line-height: 1.7;
    user-select: text;
    padding-right: 4px;
    scrollbar-width: thin;
    scrollbar-color: #c8a96a transparent;
}
.book-text.more {          /* text pokračuje níž -> dole se jemně vytratí */
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent);
            mask-image: linear-gradient(180deg, #000 calc(100% - 34px), transparent);
}

/* spodní lišta: ◀  — 3 —  ▶ */
.book-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.book-pageno {
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-size: 1rem;
    color: #8a6a3c;
    letter-spacing: 0.08em;
}

.book-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ead7a6;
    border: 1px solid #b99556;
    box-shadow: 0 3px 0 #b99556;
    color: #5a3a1b;
    font-size: 1.05rem;
    transition: transform 0.1s, box-shadow 0.1s, opacity 0.15s;
}
.book-arrow:disabled { opacity: 0.28; box-shadow: none; }
.book-arrow:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 #b99556; }

/* zapečetěná stránka = zadání kódu */
.book-seal {
    margin-top: 12px;
    padding: 12px;
    border: 2px dashed #b08a4a;
    border-radius: 12px;
    background: rgba(176, 138, 74, 0.10);
}
.book-seal-title {
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-size: 0.95rem;
    color: #7a4a14;
    margin-bottom: 8px;
}

.book-input {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #b08a4a;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 16px;            /* 16 px = iOS při psaní nezoomuje */
    font-family: 'Lora', Georgia, serif;
    color: #3a2810;
    outline: none;
}
.book-input:focus { border-color: #8a5a22; box-shadow: 0 0 0 3px rgba(138, 90, 34, 0.25); }

.book-btn {
    background: linear-gradient(180deg, #7a4a22, #5a3416);
    color: #fbefd0;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    box-shadow: 0 3px 0 #3a200c;
    transition: transform 0.1s, box-shadow 0.1s;
}
.book-btn:disabled { opacity: 0.5; }
.book-btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 0 0 #3a200c; }

.book-end {
    margin-top: 12px;
    padding: 12px;
    text-align: center;
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-size: 1.05rem;
    color: #7a4a14;
    border-top: 1px solid rgba(138, 96, 40, 0.35);
}

/* ---------- rozložení: jedna strana (telefon) / dvě strany vedle sebe (PC) ---------- */
.spread { position: relative; display: flex; flex: 1; min-width: 0; min-height: 0; }

.book-slot { flex: none; }                       /* sem se vkládá zadání kódu / "Konec knihy" */
.book-arrow-gap { display: block; width: 44px; height: 44px; }

.book-page.blank { justify-content: space-between; }
.blank-body {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; text-align: center; color: #9a7a48; opacity: 0.55;
}
.blank-mark { font-size: 2.4rem; }
.blank-text { font-family: 'Lora', Georgia, serif; font-style: italic; font-size: 0.95rem; max-width: 14rem; }

/* levá strana (jen u dvojstrany): hřbet je vpravo */
.side-left {
    border-radius: 9px 3px 3px 9px;
    padding: 24px 26px 16px 24px;
    transform-origin: right center;
    background:
        linear-gradient(270deg, rgba(120, 80, 30, 0.30), rgba(120, 80, 30, 0) 9%),
        radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.5), transparent 55%),
        repeating-linear-gradient(0deg, rgba(120, 90, 40, 0.03) 0 1px, transparent 1px 3px),
        #f6ebd0;
    box-shadow:
        inset 0 0 34px rgba(150, 100, 40, 0.20),
        -3px 3px 0 #e9d8ad,
        -5px 5px 0 #d9c38f,
        -7px 7px 0 #c8b078;
}
.side-right { padding: 24px 24px 16px 28px; }

@media (min-width: 800px) {
    .book-wrap { max-width: 1040px; }
    .book.is-spread { padding: 12px 18px 14px 18px; }
    /* základna ve dvou polovinách; přechod barev na sebe plynule navazuje */
    .book-base-l {
        right: 50%; border-radius: 16px 0 0 16px;
        background-size: 200% 100%; background-position: 0 0;
        box-shadow: 0 26px 50px rgba(0, 0, 0, 0.65), inset 2px 0 0 #35200f, inset 0 2px 0 #35200f, inset 0 -2px 0 #35200f, inset 0 0 22px rgba(0, 0, 0, 0.45);
        transition: opacity 0.35s ease;
    }
    .book-base-r {
        display: block; left: 50%; border-radius: 0 16px 16px 0;
        background-size: 200% 100%; background-position: 100% 0;
        box-shadow: 0 26px 50px rgba(0, 0, 0, 0.65), inset -2px 0 0 #35200f, inset 0 2px 0 #35200f, inset 0 -2px 0 #35200f, inset 0 0 22px rgba(0, 0, 0, 0.45);
    }
    /* zavřená kniha je jen pravá polovina uprostřed obrazovky; při otevření se celá kniha plynule posune na střed
       a levá strana se objeví jako zadní strana obálky (nic se neroztahuje ani nevybarvuje) */
    .book { transition: translate 1.35s cubic-bezier(0.55, 0, 0.25, 1); }
    .book-closed { translate: -25% 0; }
    .hide-left .spread .side-left { visibility: hidden; }   /* jen skutečná levá strana, ne kopie na zadní straně obálky */
    .hide-left .book-base-l { opacity: 0; }
    .hide-left .spread.two::after { opacity: 0; }
    .book.is-spread::before, .book.is-spread::after { display: none; }   /* hřbet vlevo jen u jedné strany */
    .spread.two::after {                                                 /* stín uprostřed (hřbet) */
        content: ''; position: absolute; top: 0; bottom: 0; left: 50%;
        width: 14px; margin-left: -7px; z-index: 3; pointer-events: none;
        transition: opacity 0.35s ease;
        background: linear-gradient(90deg, rgba(60, 35, 10, 0), rgba(60, 35, 10, 0.38), rgba(60, 35, 10, 0));
    }
}

/* ---------- otevření obálky ---------- */
.book-cover {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 20;
    transform-origin: left center;
    transform-style: preserve-3d;
    pointer-events: none;
    will-change: transform;
}
.book-cover.open { animation: coverOpen 1.25s cubic-bezier(0.55, 0, 0.25, 1) forwards; }

.cover-front, .cover-back {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 12px 18px 18px 12px;
}

.cover-front {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 0 38px 0 44px;
    text-align: center;
    background:
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.07) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
        radial-gradient(circle at 35% 25%, rgba(255, 220, 160, 0.16), transparent 60%),
        linear-gradient(135deg, #6f4727 0%, #4a2c14 100%);
    box-shadow: inset 0 0 0 2px #35200f, inset 0 0 26px rgba(0, 0, 0, 0.5), 0 26px 50px rgba(0, 0, 0, 0.55);
}
.cover-front::before {      /* zlatý rámeček */
    content: '';
    position: absolute;
    top: 16px; right: 14px; bottom: 16px; left: 30px;
    border: 2px solid #d9b25c;
    border-radius: 8px;
    opacity: 0.75;
    box-shadow: inset 0 0 0 4px rgba(217, 178, 92, 0.18);
}
.cover-front::after {       /* hřbet vlevo */
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 18px;
    border-radius: 12px 0 0 12px;
    background: linear-gradient(90deg, #2a170a, #6b4526 55%, #3f2512);
}
.cover-orn   { color: #e6c26e; font-size: 1.5rem; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5); }
.cover-title {
    position: relative;
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-weight: 700;
    font-size: 1.7rem;
    line-height: 1.2;
    color: #f0d58a;
    text-shadow: 0 2px 0 #7a5418, 0 4px 8px rgba(0, 0, 0, 0.55);
    overflow-wrap: anywhere;
}

.cover-back {               /* vnitřek obálky, když se otevře */
    transform: rotateY(180deg);
    background: linear-gradient(90deg, #3f2512, #6a4424 60%, #4d2f16);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

@keyframes coverOpen {
    0%   { transform: perspective(3000px) rotateY(0); opacity: 1; filter: brightness(1); }
    85%  { opacity: 1; }
    100% { transform: perspective(3000px) rotateY(-90deg); opacity: 0; filter: brightness(0.55); }
}

/* větší monitor: strany mají o něco víc vzduchu (musí být až za .side-*, aby to přebilo) */
@media (min-width: 900px) and (min-height: 760px) {
    .side-single, .side-right { padding: 30px 30px 20px 40px; }
    .side-left { padding: 30px 40px 20px 30px; }
    .book-text { font-size: 1.18rem; }
    .book-title { font-size: 1.7rem; }
}

/* obálka u dvojstrany: zavřená kniha = jen pravá polovina uprostřed obrazovky,
   po otevření se obálka přehodí doleva a kniha se rozevře na obě strany */
@media (min-width: 800px) {
    .book-cover { left: 50%; }
    .book-cover.open { animation: coverOpenSpread 1.35s cubic-bezier(0.55, 0, 0.25, 1) forwards; }
    .cover-front { padding: 0 34px 0 40px; border-radius: 0 16px 16px 0; }
    /* zadní strana obálky JE levá strana knihy (kůže + papír), takže po přistání nic nepřeskakuje */
    .cover-back {
        border-radius: 16px 0 0 16px;
        background: linear-gradient(135deg, #6a4424 0%, #4d2f16 100%);
        background-size: 200% 100%; background-position: 0 0;
        box-shadow: inset 2px 0 0 #35200f, inset 0 2px 0 #35200f, inset 0 -2px 0 #35200f, inset 0 0 22px rgba(0, 0, 0, 0.45);
    }
    .cb-page { position: absolute; top: 12px; bottom: 14px; left: 18px; right: 0; display: flex; }
    .cb-page > .book-page { flex: 1; }
}
@keyframes coverOpenSpread {
    0%   { transform: perspective(5000px) rotateY(0); }
    100% { transform: perspective(5000px) rotateY(-180deg); }
}

/* ---------- otáčení listů ---------- */
/* společné: "strana" uvnitř listu */
.sface { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex;
         backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.sface > .book-page { flex: 1; }
.sface::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; border-radius: inherit; }

/* --- jedna strana (telefon): list se otočí kolem hřbetu vlevo --- */
.leaf {
    position: absolute !important;
    top: 12px; bottom: 14px; left: 26px; right: 12px;
    z-index: 15;
    pointer-events: none;
    transform-origin: left center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform;
}
.leaf-next { animation: leafNext 0.75s cubic-bezier(0.45, 0.05, 0.3, 1) forwards; }
.leaf-next .sface::after { background: linear-gradient(90deg, rgba(40, 20, 0, 0.55), rgba(40, 20, 0, 0)); opacity: 0; animation: leafShade 0.75s ease-in forwards; }
/* zpět: předchozí strana se "přiklopí" zpátky přes aktuální */
.leaf-prev { animation: leafPrev 0.75s cubic-bezier(0.3, 0.1, 0.3, 1) forwards; }
.leaf-prev .sface::after { background: linear-gradient(90deg, rgba(40, 20, 0, 0.55), rgba(40, 20, 0, 0)); opacity: 1; animation: leafShadeOut 0.75s ease-out forwards; }

@keyframes leafNext {
    0%   { transform: perspective(3000px) rotateY(0); opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: perspective(3000px) rotateY(-90deg); opacity: 0; }
}
@keyframes leafPrev {
    0%   { transform: perspective(3000px) rotateY(-90deg); opacity: 0; }
    20%  { opacity: 1; }
    100% { transform: perspective(3000px) rotateY(0); opacity: 1; }
}
@keyframes leafShade    { to { opacity: 1; } }
@keyframes leafShadeOut { to { opacity: 0; } }

/* --- dvě strany (PC): pravý list se přehodí doleva, nebo levý doprava; na zadní straně je nová strana --- */
.sleaf {
    position: absolute;
    top: 12px; bottom: 14px;
    z-index: 15;
    pointer-events: none;
    transform-style: preserve-3d;
    will-change: transform;
}
.sleaf-next { left: 50%; right: 18px; transform-origin: left center;  animation: sleafNext 1s cubic-bezier(0.55, 0.04, 0.25, 1) forwards; }
.sleaf-prev { left: 18px; right: 50%; transform-origin: right center; animation: sleafPrev 1s cubic-bezier(0.55, 0.04, 0.25, 1) forwards; }
.sback { transform: rotateY(180deg); }
.sleaf .sface::after { background: rgba(30, 15, 0, 0); }
.sleaf .sface:not(.sback)::after { animation: sShadeFront 1s linear forwards; }
.sleaf .sback::after             { animation: sShadeBack 1s linear forwards; }

@keyframes sleafNext {
    0%   { transform: perspective(3200px) rotateY(0); }
    100% { transform: perspective(3200px) rotateY(-180deg); }
}
@keyframes sleafPrev {
    0%   { transform: perspective(3200px) rotateY(0); }
    100% { transform: perspective(3200px) rotateY(180deg); }
}
@keyframes sShadeFront { 0% { background: rgba(30, 15, 0, 0); } 50%, 100% { background: rgba(30, 15, 0, 0.5); } }
@keyframes sShadeBack  { 0%, 50% { background: rgba(30, 15, 0, 0.5); } 100% { background: rgba(30, 15, 0, 0); } }

/* odemčená strana na stejné dvojstraně: text se na papíře plynule objeví (bez otáčení stránky) */
.reveal-in > .book-title, .reveal-in > .book-orn, .reveal-in > .book-text, .reveal-in > .book-slot {
    animation: inkIn 0.9s ease-out both;
}
.reveal-in > .book-orn  { animation-delay: 0.1s; }
.reveal-in > .book-text { animation-delay: 0.2s; }
@keyframes inkIn {
    0%   { opacity: 0; transform: translateY(8px); filter: blur(3px); }
    100% { opacity: 1; transform: none; filter: blur(0); }
}

/* (starší varianta, už se nepoužívá) pravá strana se rozevře od hřbetu */
.page-in { animation: pageIn 0.8s cubic-bezier(0.3, 0.1, 0.25, 1); transform-origin: left center; }
@keyframes pageIn {
    0%   { transform: perspective(3200px) rotateY(-80deg); opacity: 0.2; }
    100% { transform: perspective(3200px) rotateY(0); opacity: 1; }
}

/* nová stránka pod listem se jemně "vynoří" */
.page-reveal { animation: pageReveal 0.6s ease-out; }
@keyframes pageReveal {
    0%   { filter: brightness(0.82); }
    100% { filter: brightness(1); }
}

/* ---------- ozdoby: obálka, pečeť, iniciála, atmosféra ---------- */
.cc { position: absolute; font-size: 12px; color: #e0b85a; opacity: 0.9; text-shadow: 0 1px 0 #7a5418; pointer-events: none; }
.cc-tl { top: 21px; left: 36px; }
.cc-tr { top: 21px; right: 22px; }
.cc-bl { bottom: 21px; left: 36px; }
.cc-br { bottom: 21px; right: 22px; }

.dropcap {
    float: left;
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-weight: 700;
    font-size: 3.4em;
    line-height: 0.8;
    padding: 0.08em 0.1em 0 0;
    color: #8a4b12;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5), 2px 2px 0 rgba(120, 70, 20, 0.25);
}

/* pečeť s červeným voskem */
.book-seal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.book-seal-head .book-seal-title { margin: 0; }
.book-seal-label { display: block; font-size: 13px; line-height: 1.4; color: #5c3d16; margin: 0 0 8px; }
.book-seal-label .kno {
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-weight: 700; font-size: 15px; color: #9a2d1f; white-space: nowrap;
    padding: 1px 7px; border-radius: 6px; background: rgba(154, 45, 31, 0.1);
}
.wax {
    flex: none;
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50% 46% 52% 48% / 48% 52% 46% 50%;
    font-family: 'Pixelify Sans', 'Lora', Georgia, serif;
    font-weight: 700;
    font-size: 20px;
    line-height: 1;
    color: #ffd9cf;
    background: radial-gradient(circle at 35% 30%, #e25b4b, #a52a1f 60%, #7d1a12);
    box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.35), inset 0 2px 3px rgba(255, 255, 255, 0.3), 0 2px 4px rgba(60, 10, 0, 0.4);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    transform: rotate(-8deg);
}

/* jiskry při odemčení */
.spark {
    position: fixed; z-index: 9999; pointer-events: none;
    font-size: 18px; color: #f2c14e;
    text-shadow: 0 0 8px rgba(255, 200, 80, 0.9);
    animation: sparkFly 1s ease-out forwards;
}
@keyframes sparkFly {
    0%   { transform: translate(-50%, -50%) scale(0.4) rotate(0); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.3) rotate(var(--rot)); opacity: 0; }
}

/* světlo svíčky a poletující prach */
.book-wrap { position: relative; z-index: 1; }
.book-bg::before {
    content: ''; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(ellipse at 50% 30%, rgba(255, 190, 100, 0.17), transparent 62%);
    animation: candle 6s ease-in-out infinite;
}
@keyframes candle { 0%, 100% { opacity: 0.8; } 20% { opacity: 1; } 45% { opacity: 0.62; } 70% { opacity: 0.95; } }
.motes { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.mote {
    position: absolute; bottom: -10px; border-radius: 50%; opacity: 0;
    background: rgba(255, 215, 150, 0.75); box-shadow: 0 0 6px rgba(255, 200, 120, 0.8);
    animation: moteUp linear infinite;
}
@keyframes moteUp {
    0%   { transform: translate(0, 0); opacity: 0; }
    10%  { opacity: 0.85; }
    90%  { opacity: 0.5; }
    100% { transform: translate(34px, -105vh); opacity: 0; }
}

/* při otevírání obálky se obsah stran (text, nadpis, šipky) objeví až když se obálka odklopí,
   takže při rozjíždění knihy není vidět žádné posouvání textu */
@media (max-width: 799px) {      /* telefon: základna a papír plynule naběhnou pod odklápějící se obálkou */
    .book-closed .book-base-l, .book-closed .spread { opacity: 0; }
    .book-opening .book-base-l, .book-opening .spread { transition: opacity 0.7s ease 0.2s; }
}
.book-closed .spread .book-page > * { opacity: 0; }
.book-opening .spread .book-page > * { transition: opacity 0.5s ease 0.5s; }

@media (prefers-reduced-motion: reduce) {
    .book-cover, .leaf, .sleaf, .motes, .spark { display: none !important; }
    .book-bg::before { animation: none; }
    .book-closed .spread .book-page > * { opacity: 1; }
    .page-reveal, .page-in { animation: none; }
    .book { transition: none; }
}

.shake { animation: shake 0.35s; }
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ---------- admin (karty a tlačítka) ---------- */
.pcard {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 1.25rem;
    padding: 1rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}
.ptitle  { font-size: 0.95rem; font-weight: 700; color: #111827; }
.plabel  { display: block; font-size: 0.75rem; font-weight: 600; color: #4b5563; margin: 0.5rem 0 0.25rem; }
.pgroup  { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; margin: 1rem 0 0.4rem; }
.phint   { font-size: 11px; color: #6b7280; line-height: 1.35; margin-top: 0.4rem; }

.pfield {
    width: 100%;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    padding: 0.55rem 0.75rem;
    font-size: 16px; /* iOS nezoomuje */
    color: #111827;
    outline: none;
}
.pfield:focus { border-color: #ec4899; box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.2); }
textarea.pfield { resize: vertical; line-height: 1.45; }

.pbtn {
    border-radius: 0.75rem;
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform 0.1s, opacity 0.1s;
}
.pbtn:not(:disabled):active { transform: scale(0.96); }
.pbtn:disabled { opacity: 0.4; }
.pbtn-primary { background: #ec4899; color: #fff; box-shadow: 0 3px 8px rgba(236, 72, 153, 0.3); }
.pbtn-ghost   { background: #fff; color: #374151; border-color: #d1d5db; }
.pbtn-danger  { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* záložky honeb v adminu */
.ptab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    transition: transform 0.1s;
}
.ptab span.pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 11rem; }
.ptab:active { transform: scale(0.96); }
.ptab-active { background: #ec4899; border-color: #ec4899; color: #fff; box-shadow: 0 3px 8px rgba(236, 72, 153, 0.35); }
.ptab-new { background: rgba(255, 255, 255, 0.6); border-style: dashed; }
