﻿:root {
    --table-dark: #6b4a2b;
    --table-light: #8a6237;
    --paper: #fff8e8;
    --paper-edge: #f1e3c5;
    --ink: #2b2b2b;
    --muted: #6a5c49;
    --accent: #b0893f;
    --accent-deep: #8a6a2c;
    --leaf: #c4a15e;
    --shadow-strong: rgba(26, 17, 9, 0.35);
    --shadow-soft: rgba(26, 17, 9, 0.16);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 50% -10%, rgba(255, 255, 255, 0.18), transparent 60%),
        radial-gradient(800px 400px at 10% 10%, rgba(255, 255, 255, 0.08), transparent 60%),
        radial-gradient(1000px 500px at 50% 0%, rgba(255, 255, 255, 0.25), transparent 60%),
        linear-gradient(180deg, var(--table-light), var(--table-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.scene {
    width: min(1200px, 100%);
    position: relative;
}

.scene::before {
    content: "";
    position: absolute;
    inset: -12px;
    background: radial-gradient(closest-side, transparent 70%, rgba(0, 0, 0, 0.12));
    pointer-events: none;
}

.book {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--paper-edge);
    border-radius: 18px;
    box-shadow:
        0 30px 80px var(--shadow-strong),
        0 10px 20px var(--shadow-soft);
    overflow: hidden;
    min-height: 640px;
    perspective: 1200px;
}

.book::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 18px;
    transform: translateX(-50%);
    background: linear-gradient(180deg, #c7b28a, #a88c5f);
    box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.book::after {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(154, 120, 54, 0.25);
    border-radius: 14px;
    pointer-events: none;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.bookmark {
    position: absolute;
    top: -6px;
    right: 18%;
    width: 36px;
    height: 140px;
    background: linear-gradient(180deg, #c13b3b, #8f2323);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
    z-index: 3;
}

.bookmark::after {
    content: "";
    position: absolute;
    bottom: -14px;
    left: 0;
    right: 0;
    margin: auto;
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 14px solid #7a1a1a;
}

.wax-seal {
    position: absolute;
    bottom: 26px;
    right: 28px;
    width: 54px;
    height: 54px;
    background: radial-gradient(circle at 30% 30%, #e07a7a, #8a1f1f 70%);
    border-radius: 50%;
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.25), 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 3;
}

.wax-seal::after {
    content: "";
}

.page {
    position: relative;
    padding: 36px 40px;
    background: var(--paper);
    min-height: 640px;
    display: flex;
}

.page.left {
    background: linear-gradient(90deg, var(--paper-edge), var(--paper) 12%);
    border-right: 1px solid #e5d7b8;
}

.page.right {
    background: linear-gradient(270deg, var(--paper-edge), var(--paper) 12%);
    border-left: 1px solid #e5d7b8;
    transform-origin: left center;
}

.page::before {
    content: "";
    position: absolute;
    inset: 10px;
    background:
        repeating-linear-gradient(transparent 0 22px, rgba(176, 137, 63, 0.06) 22px 23px),
        radial-gradient(1px 1px at 20% 30%, rgba(0, 0, 0, 0.06) 40%, transparent 45%),
        radial-gradient(1px 1px at 70% 60%, rgba(0, 0, 0, 0.05) 40%, transparent 45%),
        radial-gradient(1px 1px at 35% 75%, rgba(0, 0, 0, 0.04) 40%, transparent 45%);
    border-radius: 12px;
    opacity: 0.45;
    pointer-events: none;
}

.page::after {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(176, 137, 63, 0.18);
    border-radius: 10px;
    pointer-events: none;
}

.page-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 26px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
    position: relative;
    padding-bottom: 10px;
}

.page-title::after {
    content: "✦ ✧ ✦";
    display: block;
    font-size: 12px;
    letter-spacing: 0.3em;
    color: var(--accent-deep);
    margin-top: 8px;
}

.intro-text {
    font-size: 16px;
    line-height: 1.6;
    color: #3a2f20;
}

.prompt-note {
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted);
    background: linear-gradient(180deg, #fff7e7, #fff1d7);
    border: 1px solid #e5d4ae;
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 0 12px rgba(176, 137, 63, 0.08);
}

.label {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.question-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-box {
    width: 100%;
    min-height: 130px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid #dbcaa2;
    background:
        repeating-linear-gradient(transparent 0 26px, rgba(176, 137, 63, 0.08) 26px 27px),
        #fffdf6;
    font-size: 16px;
    color: var(--ink);
    outline: none;
}

.question-box:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(176, 137, 63, 0.18);
}

.ask-btn {
    align-self: flex-start;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid #c8ad72;
    background: linear-gradient(180deg, #d7bd82, #b0893f);
    color: #2b1f10;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(176, 137, 63, 0.28);
}

.ask-btn:hover {
    filter: brightness(1.05);
}

.question-display {
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px dashed #d2c4a2;
    background:
        repeating-linear-gradient(transparent 0 24px, rgba(176, 137, 63, 0.08) 24px 25px),
        #fffdf8;
    min-height: 80px;
    color: #3a2f20;
}

.answer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

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

.page-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #d1bf97;
    background: #fff8ea;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-count {
    font-size: 13px;
    color: var(--muted);
    min-width: 64px;
    text-align: center;
}

.answer-box {
    flex: 1;
    background:
        repeating-linear-gradient(transparent 0 26px, rgba(176, 137, 63, 0.08) 26px 27px),
        #fffefb;
    border-radius: 14px;
    border: 1px solid #dbcaa2;
    padding: 16px;
    line-height: 1.55;
    overflow: auto;
    box-shadow: inset 0 0 18px rgba(176, 137, 63, 0.12);
}

blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 10px;
    margin: 6px 0;
    color: var(--muted);
}

.page.right.flip-left {
    animation: flipLeft 0.45s ease;
}

.page.right.flip-right {
    animation: flipRight 0.45s ease;
}

@keyframes flipLeft {
    0% {
        transform: rotateY(0deg);
    }

    45% {
        transform: rotateY(-6deg);
    }

    100% {
        transform: rotateY(0deg);
    }
}

@keyframes flipRight {
    0% {
        transform: rotateY(0deg);
    }

    45% {
        transform: rotateY(6deg);
    }

    100% {
        transform: rotateY(0deg);
    }
}

@media (max-width: 980px) {
    .book {
        grid-template-columns: 1fr;
    }

    .book::before {
        display: none;
    }

    .page {
        min-height: 520px;
    }

    .bookmark,
    .wax-seal {
        display: none;
    }
}

@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .page {
        padding: 24px;
    }

    .page-title {
        font-size: 20px;
    }
}
