/*
 * Final Immersive CSS - Zero-Base Rebuild
 */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=Shippori+Mincho:wght@400;600&display=swap');

:root {
    --gold: #c5a059;
    --gold-dk: #8b6914;
    --paper: #fdfaf3;
    --bg-dark: #0f0a08;
    --text-ink: #2a1b15;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    font-family: 'Shippori Mincho', serif;
    color: var(--text-ink);
    height: 100vh;
    overflow: hidden;
}

/* Background Layers */
.custom-bg {
    position: fixed;
    inset: 0;
    z-index: -50;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.custom-bg.active {
    opacity: 1;
}

.main-stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 3D Book Layout */
.book-shell {
    position: relative;
    width: 1000px;
    height: 720px;
    z-index: 10;
}

.book-perspective {
    width: 100%;
    height: 100%;
    perspective: 3500px;
}

.book {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.book::before {
    content: '';
    position: absolute;
    inset: -15px;
    background: #150f0d;
    border: 3px solid var(--gold-dk);
    border-radius: 8px;
    z-index: -100;
    transform: translateZ(-20px);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.85);
}

/* Dynamic Thickness */
.book::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: calc(var(--book-thickness, 0) * 1px);
    height: 100%;
    background: linear-gradient(to right, #ddd, #fff 20%, #ddd 40%, #fff 60%, #ddd 80%, #eee);
    background-size: 4px 100%;
    transform: rotateY(90deg) translateZ(250px) translateX(-50%);
    z-index: -5;
    border-radius: 2px;
    opacity: 0.8;
}

/* Page Geometry */
.page {
    position: absolute;
    top: 0;
    left: 50%;
    width: 500px;
    height: 100%;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), z-index 0s linear 0.6s;
    pointer-events: none;
    /* 荳倶ｽ阪・page-face縺ｧ蛟句挨縺ｫ險ｱ蜿ｯ縺吶ｋ */
}

.page-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    background-color: var(--paper);
    padding: 40px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    pointer-events: auto;
    /* 縺薙％縺ｧ繧ｯ繝ｪ繝・け繧堤｢ｺ螳溘↓蜿励￠繧・*/
    background-image: linear-gradient(rgba(197, 160, 89, 0.15) 1px, transparent 1px);
    background-size: 100% 2.3rem;
    background-position: 0 4.5rem;
}

.page-front {
    z-index: 2;
    border-radius: 0 8px 8px 0;
    box-shadow: inset 20px 0 40px rgba(0, 0, 0, 0.04);
}

.page-back {
    transform: rotateY(180deg);
    z-index: 1;
    border-radius: 8px 0 0 8px;
    box-shadow: inset -20px 0 40px rgba(0, 0, 0, 0.04);
}

.page-inner-border {
    position: absolute;
    inset: 20px;
    border: 1.5px solid var(--gold);
    pointer-events: none;
    z-index: 5;
}

.page-inner-border::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(197, 160, 89, 0.25);
}

/* Content Elements */
.page-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 10;
    cursor: default;
}

.center-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.title-display {
    font-size: 3.2rem;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1.1;
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, var(--gold-dk) 0%, var(--gold) 50%, var(--gold-dk) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.series-badge {
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: #7a5a1f;
    /* より濃いゴールド/ブラウン系 */
    letter-spacing: 0.12em;
    margin-top: -20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.title-line {
    width: 100px;
    height: 1px;
    background: var(--gold);
    margin: 0 auto 30px;
    position: relative;
}

.title-line::before {
    content: '笨･';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--paper);
    padding: 0 10px;
    color: var(--gold);
    font-size: 1.1rem;
}

/* .drop-cap is removed */

.text-body {
    font-size: 1.25rem;
    line-height: 2.3rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-section,
.thought-section {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
}

.content-section {
    margin-bottom: 40px;
}

.section-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    color: var(--gold);
    letter-spacing: 0.15em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(197, 160, 89, 0.15);
}

.thought-section {
    position: relative;
    padding-top: 20px;
}

.text-content {
    line-height: 1.8;
    color: #444;
    white-space: pre-wrap;
    text-align: justify;
    min-height: 1.5em;
    /* 遨ｺ縺ｧ繧ゅけ繝ｪ繝・け蜿ｯ閭ｽ縺ｫ縺吶ｋ */
    position: relative;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.text-content[contenteditable="true"]:hover {
    background: rgba(197, 160, 89, 0.05);
}

.text-content[contenteditable="true"]:focus {
    outline: none;
    background: rgba(197, 160, 89, 0.1);
}

/* Image Zoom */
.image-holder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: zoom-in;
    transition: transform 0.3s;
}

.image-holder img:hover {
    transform: scale(1.02);
}

.zoom-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.zoom-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.zoom-modal img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.zoom-modal.active img {
    transform: scale(1);
}

.visit-link {
    display: block;
    color: var(--gold-dk);
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    padding: 8px 16px;
    border: 1px solid rgba(197, 160, 89, 0.4);
    transition: 0.3s;
    width: fit-content;
    border-radius: 4px;
    position: absolute;
    bottom: -30px;
    left: -30px;
    /* 蟾ｦ荳九↓驟咲ｽｮ */
    z-index: 50;
    line-height: 1.2;
}

.visit-link:hover {
    background: rgba(197, 160, 89, 0.1);
}

.page-num {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-size: 0.95rem;
    color: var(--gold-dk);
    opacity: 0.8;
}

/* Interactive UI */
.page-btns {
    position: absolute;
    top: -30px;
    /* 蠅・阜邱壹ぐ繝ｪ繧ｮ繝ｪ縺ｾ縺ｧ荳翫￡繧・*/
    left: -30px;
    /* 蠅・阜邱壹ぐ繝ｪ繧ｮ繝ｪ縺ｾ縺ｧ蟾ｦ縺ｸ */
    display: flex;
    gap: 8px;
    z-index: 50;
    /* 莉悶・隕∫ｴ繧医ｊ荳翫↓ */
}

.small-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1.5px solid var(--gold);
    background: #fff;
    cursor: pointer;
    color: var(--gold-dk);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: 0.2s;
    font-size: 1rem;
}

.small-btn:hover {
    transform: scale(1.1);
    background: var(--paper);
}

.small-btn.del {
    color: #d32f2f;
    border-color: #d32f2f;
}



.status-row {
    position: absolute;
    top: -30px;
    right: -30px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 60;
}

.status-tag {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    user-select: none;
    height: 28px;
    display: flex;
    align-items: center;
}

.ns-trigger-btn {
    background: rgba(197, 160, 89, 0.2);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    transition: 0.3s;
    height: 28px;
    display: flex;
    align-items: center;
    letter-spacing: 0.05em;
}

.ns-trigger-btn:hover {
    background: var(--gold);
    color: #000;
}

.prev-season-btn {
    background: #444 !important;
    border-color: #555 !important;
}

.prev-season-btn:hover {
    background: #666 !important;
    color: #fff !important;
}

.next-season-btn {
    background: rgba(197, 160, 89, 0.2);
}

.other-season-btn {
    background: rgba(139, 92, 246, 0.2) !important;
    border-color: #8b5cf6 !important;
    color: #a78bfa !important;
}

.other-season-btn:hover {
    background: #8b5cf6 !important;
    color: #fff !important;
}

.st-completed {
    background: #4caf50;
}

.st-watching {
    background: #2196f3;
}

.st-not_started {
    background: #757575;
}

/* Add (+) Button (蜈・・繝・じ繧､繝ｳ) */
.add-big-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: pointer !important;
    position: relative;
    z-index: 100;
}

.circle-btn-inner {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--gold);
    transition: 0.3s;
    background: rgba(0, 0, 0, 0.02);
}

.add-big-btn:hover .circle-btn-inner {
    transform: scale(1.08);
    background: rgba(197, 160, 89, 0.1);
    border-style: solid;
}

.add-label {
    font-size: 1.2rem;
    color: var(--gold);
    letter-spacing: 0.2em;
}

/* Image Page */
.image-holder {
    width: 92%;
    height: 88%;
    margin: auto;
    padding: 8px;
    background: #000;
    position: relative;
}

.image-holder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Lock Layer */
.lock-layer {
    position: absolute;
    inset: 0;
    background: var(--paper);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.lock-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.pass-input {
    width: 220px;
    padding: 12px;
    border: 2px solid var(--gold);
    text-align: center;
    border-radius: 8px;
    font-size: 1.2rem;
    background: #fff;
}

/* Modals (Topmost) */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: #161616;
    padding: 40px;
    border-radius: 20px;
    color: #eee;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

/* Scrollbar style */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #111;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--gold-dk);
    border-radius: 3px;
}

.modal-title {
    text-align: center;
    color: var(--gold);
    margin-bottom: 25px;
    font-size: 1.6rem;
    letter-spacing: 0.1em;
}

.modal-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: #888;
    cursor: pointer;
    padding: 15px;
    /* 蛻､螳壹ｒ蠎・￡繧・*/
    z-index: 100;
    line-height: 1;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: #888;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid #333;
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
}

.row-group {
    display: flex;
    gap: 15px;
}

.field-item {
    flex: 1;
}

.flex-row {
    display: flex;
    align-items: center;
}

.save-btn {
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 12px;
    background: #6200ea;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 10px;
}

.save-btn:hover {
    background: #3700b3;
    box-shadow: 0 0 30px rgba(98, 0, 234, 0.3);
}

/* Sidebar */
.sidebar-trigger {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 40px;
    z-index: 2000;
}

.immersive-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 320px;
    background: #0a0a0a;
    border-right: 1.5px solid var(--gold);
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 2001;
    display: flex;
    flex-direction: column;
    padding: 40px 15px;
}

.sidebar-trigger:hover+.immersive-sidebar,
.immersive-sidebar:hover {
    transform: translateX(0);
}

.sidebar-h.title-display {
    font-family: 'Cinzel', serif;
    font-size: 2.8rem;
    color: var(--gold-dk);
    text-align: center;
    margin: 80px 0 20px 0;
    /* 驥阪↑繧企亟豁｢縺ｮ縺溘ａ繝槭・繧ｸ繝ｳ繧貞｢励ｄ縺・*/
    letter-spacing: 0.1em;
    font-weight: 700;
}

.sidebar-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 0.2em;
}

.sidebar-search input {
    width: 100%;
    padding: 10px;
    background: #1a1a1a;
    border: none;
    border-radius: 6px;
    color: #fff;
    margin-bottom: 25px;
}

.sidebar-tag-list {
    list-style: none;
    flex: 1;
    overflow-y: auto;
}

/* 繝帙・繝繝懊ち繝ｳ */
.sidebar-home-container {
    padding: 0 15px 20px;
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    margin-bottom: 20px;
}

.home-btn {
    width: 100%;
    padding: 12px;
    background: rgba(197, 160, 89, 0.1);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: 0.3s;
}

.home-btn:hover {
    background: var(--gold);
    color: #000;
}

.sidebar-tag-item {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    color: #999;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-tag-item:hover {
    background: rgba(197, 160, 89, 0.1);
    color: #fff;
}

.sidebar-tag-item.active {
    background: rgba(197, 160, 89, 0.2);
    color: var(--gold);
    border: 1px solid var(--gold);
}

.tag-ctrls {
    display: flex;
    gap: 10px;
    opacity: 0;
}

.sidebar-tag-item:hover .tag-ctrls {
    opacity: 1;
}

.tag-mini-btn {
    background: none;
    border: none;
    color: var(--gold);
    cursor: pointer;
    font-size: 1rem;
}

.add-chapter-btn {
    margin-top: 20px;
    padding: 12px;
    background: transparent;
    border: 1.5px dashed var(--gold);
    color: var(--gold);
    font-family: 'Cinzel', serif;
    cursor: pointer;
    border-radius: 8px;
    width: 100%;
}

.add-chapter-btn:hover {
    background: rgba(197, 160, 89, 1.0);
    color: #000;
    border-style: solid;
}

/* Navigation */
.book-nav {
    display: flex;
    align-items: center;
    gap: 50px;
    margin-top: 50px;
}

/* Next Season 邱ｨ髮・畑 UI */
/* 左ページ画像操作用 */
.image-ops-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.image-holder:hover .image-ops-overlay {
    opacity: 1;
}

.img-add-btn,
.img-edit-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--gold);
    color: var(--gold-dk);
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.img-add-btn:hover,
.img-edit-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

.img-edit-btn {
    font-size: 1.2rem;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
}

.empty-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    gap: 15px;
}

.ns-url-field {
    margin-bottom: 10px;
}

.ns-url-field label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 4px;
    display: block;
}

.ns-url-field input {
    width: 100%;
    background: #000;
    border: 1px solid #333;
    padding: 8px;
    color: #fff;
    border-radius: 4px;
}

background: rgba(197, 160, 89, 0.1);
border: 1px solid var(--gold);
color: var(--gold);
padding: 5px 12px;
border-radius: 4px;
font-size: 0.8rem;
cursor: pointer;
transition: 0.3s;
font-family: 'Shippori Mincho',
serif;
}

.ns-mini-edit:hover {
    background: var(--gold);
    color: #000;
}

.ns-url-edit-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.ns-img-holder {
    cursor: pointer;
    position: relative;
    transition: 0.3s;
}

.ns-img-holder:hover::after {
    content: 'Click to Change Image';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    backdrop-filter: blur(2px);
}

.no-link-msg {
    color: #888;
    font-style: italic;
    font-size: 0.9rem;
}

background: none;
border: 2.5px solid var(--gold);
color: var(--gold);
width: 60px;
height: 60px;
border-radius: 50%;
cursor: pointer;
transition: 0.3s;
display: flex;
align-items: center;
justify-content: center;
}

.nav-btn:hover:not(:disabled) {
    transform: scale(1.15);
    background: rgba(197, 160, 89, 0.15);
}

.nav-btn:disabled {
    opacity: 0.15;
    cursor: default;
}

.nav-indicator {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.5rem;
    letter-spacing: 0.15em;
}

.top-controls {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 3000;
}

.setting-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.3s;
}

.setting-btn:hover {
    background: var(--gold);
    color: #000;
}

/* Next Season Overlay */
.ns-overlay {
    position: fixed;
    inset: 0;
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ns-close-trigger {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
}

.ns-container {
    position: relative;
    width: 600px;
    height: 800px;
    z-index: 10;
}

.ns-page-paper {
    width: 100%;
    height: 100%;
    background: var(--paper);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow-y: auto;
    border: 1.5px solid var(--gold);
}

.ns-header {
    text-align: center;
    margin-bottom: 30px;
}

.ns-badge {
    font-family: 'Cinzel', serif;
    color: var(--gold-dk);
    font-size: 0.9rem;
    margin: 10px 0;
}

.ns-img-holder {
    width: 100%;
    max-height: 300px;
    background: #000;
    margin-bottom: 30px;
    border: 1px solid var(--gold);
}

.ns-img-holder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ns-footer {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-bottom: 40px;
}

.ns-link {
    position: static !important;
}

.ns-next-btn {
    background: var(--gold);
    color: #000;
    border: none;
    padding: 12px 30px;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.3s;
}

.ns-next-btn:hover {
    background: var(--gold-dk);
    color: #fff;
    transform: scale(1.05);
}

.no-link-msg {
    color: #888;
    font-style: italic;
    font-size: 0.9rem;
}

.ns-close-btn {
    top: 10px;
    right: 10px;
    font-size: 2.5rem;
    color: var(--gold-dk);
}

/* 本の中央固定の徹底 */
.book-shell {
    margin-left: auto;
    margin-right: auto;
    left: 0;
    right: 0;
}

.memo-container {
    position: relative;
    width: 600px;
    height: 800px;
    z-index: 10;
}

.memo-paper {
    width: 100%;
    height: 100%;
    background: #f4e4bc url('https://www.transparenttextures.com/patterns/old-map.png');
    /* 古い紙の質感 */
    padding: 60px 50px;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3),
        10px 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 0 50px rgba(139, 69, 19, 0.2);
    border-radius: 2px;
    position: relative;
    display: flex;
    flex-direction: column;
    transform: rotateX(2deg) rotateY(-1deg);
    border: 1px solid #dcd1af;
}

.memo-paper::before {
    content: '';
    position: absolute;
    inset: 15px;
    border: 1px solid rgba(139, 69, 19, 0.15);
    pointer-events: none;
}

.memo-title {
    font-family: 'Cinzel', serif;
    color: #5d4037;
    font-size: 2.2rem;
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px double rgba(139, 69, 19, 0.3);
    padding-bottom: 15px;
}

.memo-content-area {
    flex: 1;
    display: flex;
}

#memo-textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.35rem;
    line-height: 1.8;
    color: #3e2723;
    padding: 10px;
    resize: none;
    outline: none;
    background-image: linear-gradient(rgba(139, 69, 19, 0.1) 1px, transparent 1px);
    background-size: 100% 2.43rem;
    /* 陦檎ｷ・*/
}

.memo-footer {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.memo-save-btn {
    background: #5d4037;
    color: #f4e4bc;
    border: none;
    padding: 12px 40px;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.memo-save-btn:hover {
    background: #3e2723;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.memo-close {
    top: 20px !important;
    right: 25px !important;
    color: #5d4037 !important;
}

.memo-decoration {
    position: absolute;
    width: 40px;
    height: 40px;
    border-color: #5d4037;
    border-style: solid;
    opacity: 0.6;
}

.top-left {
    top: 30px;
    left: 30px;
    border-width: 2px 0 0 2px;
}

.top-right {
    top: 30px;
    right: 30px;
    border-width: 2px 2px 0 0;
}

.bottom-left {
    bottom: 30px;
    left: 30px;
    border-width: 0 0 2px 2px;
}

.bottom-right {
    bottom: 30px;
    right: 30px;
    border-width: 0 2px 2px 0;
}

/* 陦ｨ邏吶・陬剰｡ｨ邏咏畑縺ｮ迚ｹ蛻･繧ｹ繧ｿ繧､繝ｫ (蟾ｮ縺玲綾縺励・縺溘ａ邁｡逡･蛹・ */
.page-cover-front,
.page-cover-back {
    /* 蠢・ｦ√↓蠢懊§縺ｦ霑ｽ蜉 */
}

.page-cover-front {
    background: #3e2723 !important;
    /* 豺ｱ縺・幻濶ｲ */
    color: var(--gold) !important;
}

.page-cover-front .page-inner-border {
    border-color: var(--gold) !important;
}

.page-cover-front .title-display {
    color: var(--gold) !important;
    font-size: 3.5rem;
    margin-top: 100px;
}

.page-cover-back {
    background: #3e2723 !important;
}

/* Visit Link 蜻ｨ繧・(蛟句挨縺ｮ菴咲ｽｮ縺ｸ) */
.page-actions-row {
    display: contents;
    /* 繧ｳ繝ｳ繝・リ繧帝乗・蛹悶＠縺ｦ蟄占ｦ∫ｴ縺ｫ菴咲ｽｮ豎ｺ繧√ｒ莉ｻ縺帙ｋ */
}

.memo-trigger-btn {
    background: none;
    border: 1px solid var(--gold);
    color: var(--gold-dk);
    padding: 8px 16px;
    /* 繝ｪ繝ｳ繧ｯ繝懊ち繝ｳ縺ｨ鬮倥＆繧貞粋繧上○繧・*/
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 4px;
    position: absolute;
    bottom: -30px;
    right: -30px;
    /* 蜿ｳ荳九↓驟咲ｽｮ */
    z-index: 50;
    line-height: 1.2;
}

.memo-trigger-btn:hover {
    background: rgba(197, 160, 89, 0.1);
}

@keyframes fadeIn {
    from {
        opacity:

        /* ===================================
   レスポンシブ (極小モバイル最適化)
   =================================== */
        @media (max-width: 768px) {
            .book-shell {
                width: 100vw;
                height: auto;
                min-height: 80vh;
                transform: scale(0.85);
            }

            .page {
                width: 100%;
                left: 0;
                /* スマホでは1ページ表示のように見せる調整が必要な場合があるが、まずはスケールで対応 */
            }

            .title-display {
                font-size: 2.2rem;
            }

            .text-body {
                font-size: 1.1rem;
                line-height: 1.8rem;
            }

            .page-face {
                padding: 20px;
            }

            .small-btn {
                width: 28px;
                height: 28px;
                font-size: 0.85rem;
            }

            .status-tag,
            .ns-trigger-btn {
                font-size: 0.75rem;
                height: 24px;
                padding: 0 8px;
            }
        }

        @media (max-width: 480px) {
            .book-shell {
                transform: scale(0.7);
                margin-top: -50px;
            }

            .title-display {
                font-size: 1.8rem;
            }

            .series-badge {
                font-size: 0.8rem;
            }

            .page-num {
                font-size: 0.8rem;
            }

            .modal-content {
                width: 95%;
                padding: 20px;
            }
        }

        to {
            opacity: 1;
        }
    }

    .origin-chapter {
        text-align: center;
        font-family: 'Cinzel', serif;
        font-size: 0.9rem;
        color: var(--gold-dk);
        opacity: 0.7;
        margin-top: -15px;
        margin-bottom: 10px;
        font-style: italic;
    }
