* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0d1a3f;
    font-family: 'Zen Maru Gothic', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', sans-serif;
    color: #fff;
    touch-action: none;
}

/* Canvas */
#stage {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 10;
}
.screen.show {
    pointer-events: auto;
    opacity: 1;
}

/* Title Screen */
#title {
    background: radial-gradient(circle at center, rgba(13, 26, 63, 0.35) 0%, rgba(8, 12, 30, 0.88) 100%);
    z-index: 20;
    justify-content: flex-start;
    padding-top: 8vh;
    padding-bottom: 4vh;
    overflow-y: auto;
}
.title-ring svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vh;
    height: 60vh;
    max-width: 600px;
    max-height: 600px;
    animation: rotate 60s linear infinite;
    opacity: 0.15;
}
@keyframes rotate { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }

.title-copy {
    text-align: center;
    z-index: 2;
    margin-bottom: 1.8rem;
}
#title-h1 {
    font-family: 'Shippori Mincho', serif;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 500;
    letter-spacing: 0.15em;
    text-shadow: 0 4px 20px rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
}
#title-h1 .n9, #title-h1 .n0 {
    font-family: 'Zen Maru Gothic', sans-serif;
    color: #ffd6e6;
    text-shadow: 0 0 15px rgba(255, 214, 230, 0.6);
}
.spark {
    color: #ffeba0;
    font-size: 0.5em;
    vertical-align: super;
}
.catch {
    margin-top: 0.6rem;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: rgba(255,255,255,0.8);
    letter-spacing: 0.2em;
}

.title-bottom {
    position: relative;
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    z-index: 2;
}

button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-family: inherit;
    border-radius: 30px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
button:active:not(:disabled) {
    transform: translateY(1px);
}
#start-btn {
    background: linear-gradient(135deg, rgba(255, 214, 230, 0.25), rgba(90, 120, 200, 0.45));
    border: 1.5px solid rgba(255, 255, 255, 0.6);
    padding: 1.1rem 3.8rem;
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    border-radius: 40px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.4), 0 0 20px rgba(255, 214, 230, 0.3);
    animation: startPulse 2.5s infinite alternate;
}
@keyframes startPulse {
    0% { box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 15px rgba(255, 214, 230, 0.2); }
    100% { box-shadow: 0 6px 25px rgba(0,0,0,0.5), 0 0 25px rgba(255, 214, 230, 0.5); transform: translateY(-2px); }
}
#start-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(255, 214, 230, 0.4), rgba(110, 140, 230, 0.6));
    border-color: #fff;
    transform: translateY(-3px) scale(1.03);
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

.howto {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    display: flex;
    gap: 2rem;
}
kbd {
    background: rgba(255,255,255,0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.rotate-note {
    font-size: 0.8rem;
    color: rgba(255,200,200,0.8);
}

/* Intro Screen */
#intro {
    background: #000;
    z-index: 15;
}
#intro-text {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    line-height: 2;
    text-align: center;
    letter-spacing: 0.15em;
    opacity: 0;
    transform: translateY(20px);
    transition: all 1.5s ease;
}
#intro-text.in {
    opacity: 1;
    transform: translateY(0);
}
#intro-text.out {
    opacity: 0;
    transform: translateY(-20px);
}
#intro-text b {
    color: #ffd6e6;
    font-weight: 500;
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    opacity: 1;
    transition: opacity 0.5s;
}
#hud.hidden {
    opacity: 0;
}

#scene-tag {
    position: absolute;
    top: 5.4rem;
    left: 1.8rem;
    display: flex;
    flex-direction: column;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
    z-index: 10;
}
#scene-tag.show {
    animation: slideIn 4s forwards;
}
@keyframes slideIn {
    0% { opacity: 0; transform: translateX(-20px); }
    10% { opacity: 1; transform: translateX(0); }
    90% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(-20px); }
}
#scene-name { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.1em; }
#scene-sub { font-size: 0.9rem; color: rgba(255,255,255,0.8); }

#clock {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    backdrop-filter: blur(4px);
    transition: all 0.3s;
}
#clock svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}
.clock-track {
    fill: none;
    stroke: rgba(255,255,255,0.1);
    stroke-width: 4;
}
#clock-arc {
    fill: none;
    stroke: url(#arcGrad);
    stroke-width: 4;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}
#clock-num {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}
#clock-unit { font-size: 0.7rem; opacity: 0.7; }
#clock.late { color: #ffeb99; }
#clock.urgent { color: #ff9999; animation: pulseClock 1s infinite; }
@keyframes pulseClock { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }

/* 会話中・調査中の一時停止スタイル */
.clock-pause-badge {
    position: absolute;
    bottom: -6px;
    right: -4px;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(18, 28, 54, 0.88);
    border: 1px solid rgba(180, 220, 255, 0.55);
    border-radius: 50%;
    color: #bfe0ff;
    font-size: 0.65rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 8px rgba(180, 220, 255, 0.3);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 2;
}
#clock.timer-paused {
    box-shadow: 0 0 14px rgba(180, 220, 255, 0.35);
    animation: none !important; /* 会話中は緊迫の点滅を静止 */
}
#clock.timer-paused .clock-pause-badge {
    opacity: 0.95;
    transform: scale(1);
}
#clock.timer-paused #clock-arc {
    stroke: #bfe0ff !important;
    filter: drop-shadow(0 0 4px rgba(180, 220, 255, 0.5));
}


#status {
    position: absolute;
    top: 2.2rem;
    left: 1.8rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
    pointer-events: auto;
    z-index: 10;
}
#items {
    display: flex;
    gap: 0.4rem;
}
.item {
    font-size: 1.25rem;
    background: rgba(13, 26, 63, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
#mem-btn {
    font-size: 0.9rem;
    background: rgba(13, 26, 63, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.35);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    pointer-events: auto;
}
#mem-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 220, 150, 0.8);
    box-shadow: 0 4px 16px rgba(255, 220, 150, 0.3);
    transform: translateY(-1px);
}
#mem-btn:active {
    transform: scale(0.96);
}
.gem { color: #ffd6e6; margin-right: 0.3em; }

.capsule-hud-badge {
    font-size: 0.84rem;
    background: rgba(35, 20, 12, 0.82);
    border: 1px solid rgba(255, 210, 140, 0.6);
    padding: 0.35rem 0.8rem;
    border-radius: 18px;
    backdrop-filter: blur(8px);
    color: #ffe8cc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    pointer-events: auto;
    transition: all 0.25s ease;
}
.capsule-hud-badge .capsule-icon { font-size: 0.95rem; }
.capsule-hud-badge b { color: #ffd599; }


#menu-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    background: rgba(13, 26, 63, 0.85);
    border: 1px solid rgba(255, 224, 130, 0.6);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    color: #fff8e1;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 224, 130, 0.15);
    pointer-events: auto !important;
    touch-action: manipulation;
    z-index: 101;
}
#menu-btn:hover {
    background: rgba(25, 45, 95, 0.95);
    border-color: rgba(255, 224, 130, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 224, 130, 0.35);
}
#menu-btn:active {
    transform: scale(0.96);
}

#audio-panel {
    position: absolute;
    top: 2.2rem;
    right: 115px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    pointer-events: auto !important;
    z-index: 100 !important;
}

#bgm-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: rgba(13, 26, 63, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#bgm-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

#bgm-btn:active {
    transform: scale(0.96);
}

.bgm-icon {
    font-size: 0.95rem;
}

#bgm-name {
    font-weight: 500;
    letter-spacing: 0.03em;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#mute {
    position: static;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: rgba(13, 26, 63, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(8px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.25s ease;
}

#mute:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

#mute.off {
    opacity: 0.5;
    background: rgba(0, 0, 0, 0.4);
}

.title-bgm {
    margin: 0.6rem 0;
}

#title-bgm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(6px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

#title-bgm-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-1px);
}

#hint {
    position: absolute;
    bottom: 6.2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 15, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.6rem 1.6rem;
    border-radius: 25px;
    font-size: 0.95rem;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}
#hint.on { opacity: 1; }

#toast {
    position: absolute;
    top: 5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
    pointer-events: none;
}
.toast-item {
    background: rgba(20, 30, 60, 0.9);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s;
}
.toast-item.in { opacity: 1; transform: translateY(0); }
.toast-item.out { opacity: 0; transform: translateY(-10px); }

/* Dialogue */
#dialog {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    display: flex;
    gap: 1rem;
    pointer-events: auto;
    z-index: 8;
    opacity: 0;
    transition: opacity 0.3s;
}
#dialog.hidden { display: none; }
#dialog.show { opacity: 1; }

#d-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background-color: rgba(15, 20, 45, 0.7);
    border: 3px solid rgba(255, 220, 235, 0.75);
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    box-shadow: 0 4px 18px rgba(0,0,0,0.5), 0 0 12px rgba(255, 214, 230, 0.35);
    backdrop-filter: blur(8px);
}
#d-avatar.hidden {
    display: none !important;
}
#d-body {
    flex-grow: 1;
    background: rgba(15, 20, 40, 0.85);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    position: relative;
    min-height: 120px;
}
#dialog.narration #d-body {
    background: rgba(0, 0, 0, 0.7);
    border-color: transparent;
    text-align: center;
}
#d-name {
    font-size: 0.9rem;
    color: #ffd6e6;
    margin-bottom: 0.5rem;
    font-weight: 700;
}
#d-text {
    font-size: 1.1rem;
    line-height: 1.6;
}
#d-next {
    position: absolute;
    bottom: 0.8rem;
    right: 1.2rem;
    opacity: 0;
    font-size: 0.82rem;
    color: #ffd6e6;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 214, 230, 0.4);
    padding: 0.25rem 0.65rem;
    border-radius: 12px;
    animation: bob 1s infinite alternate;
    pointer-events: none;
    letter-spacing: 0.05em;
}
#d-next.on { opacity: 1; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(4px); } }

#d-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}
.choice {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    text-align: left;
    padding: 0.8rem 1rem;
    font-size: 1rem;
    border-radius: 6px;
    border: none; /* override button default */
}
.choice.sel, .choice:hover {
    background: rgba(255,255,255,0.25);
}

/* Touch & Mouse Controls */
#touch {
    position: absolute;
    bottom: 1.5rem;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
#touch.hidden { display: none; }
#touch.ui-talk-active {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
}
.touch-walk {
    display: flex;
    gap: 12px;
    align-items: center;
}
#touch button {
    pointer-events: auto;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    padding: 0;
    background: rgba(15, 25, 55, 0.7);
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.3);
    backdrop-filter: blur(8px);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
#btn-act {
    width: auto;
    min-width: 140px;
    height: 54px;
    padding: 0 1.6rem;
    border-radius: 27px;
    font-size: 1.05rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: linear-gradient(135deg, rgba(255, 214, 230, 0.3), rgba(70, 90, 160, 0.55));
    border: 1.5px solid rgba(255, 214, 230, 0.7);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 214, 230, 0.25);
}
#touch button:hover {
    background: rgba(40, 60, 110, 0.85);
    border-color: rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}
#touch button.pressed, #touch button:active {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(1px) scale(0.96);
}

/* Result */
#result {
    background: rgba(4, 7, 18, 0.94);
    backdrop-filter: blur(16px);
    z-index: 30;
    justify-content: flex-start !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 4.5rem 1.2rem 4rem;
}
#result::-webkit-scrollbar {
    width: 8px;
}
#result::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}
#result::-webkit-scrollbar-thumb {
    background: rgba(255, 224, 130, 0.35);
    border-radius: 4px;
}
#result::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 224, 130, 0.6);
}


.res-card {
    background: rgba(18, 24, 52, 0.8);
    border: 1.5px solid rgba(255, 224, 130, 0.4);
    border-radius: 20px;
    padding: 2.2rem 2.4rem;
    max-width: 820px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 224, 130, 0.15);
    margin: 0 auto;
    position: relative;
    flex-shrink: 0;
}
.res-lead { font-size: 0.95rem; color: #ffd6e6; margin-bottom: 0.4rem; letter-spacing: 0.12em; }
#res-title { font-size: 1.85rem; margin-bottom: 1.2rem; font-family: 'Shippori Mincho', serif; color: #ffe082; text-shadow: 0 0 14px rgba(255, 224, 130, 0.4); }
#res-text { line-height: 1.8; color: #e0e6ed; margin-bottom: 1.6rem; font-size: 0.98rem; }
.res-stats {
    display: flex; justify-content: center; gap: 2rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 1.2rem 0; margin-bottom: 1.6rem;
    flex-wrap: wrap;
}
.res-stats div { display: flex; flex-direction: column; gap: 0.3rem; }
.res-stats small { color: #aaa; font-size: 0.8rem; }
.res-stats b { font-size: 1.15rem; color: #fff; }
.res-sub { font-size: 1rem; margin-bottom: 0.8rem; color: #ffd6e6; font-family: 'Shippori Mincho', serif; }
#res-mems {
    list-style: none;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem;
    margin-bottom: 1rem;
}
#res-mems li {
    display: flex; align-items: center; gap: 0.4rem;
    background: rgba(0,0,0,0.45); padding: 0.45rem 0.9rem; border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.12);
}
#res-mems li.got {
    border-color: rgba(255, 224, 130, 0.5);
    background: linear-gradient(135deg, rgba(35, 45, 80, 0.6), rgba(20, 26, 50, 0.6));
    color: #fff8e1;
}
#res-mems li.none { opacity: 0.35; }
#res-mems li.past { opacity: 0.75; border-color: rgba(255, 255, 255, 0.2); }
#res-hint { font-size: 0.9rem; color: #ffe082; margin-bottom: 1.8rem; }

.res-actions {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    flex-wrap: wrap;
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
}
#retry-btn {
    background: linear-gradient(135deg, rgba(255, 214, 230, 0.25), rgba(90, 120, 200, 0.55));
    border: 1.5px solid rgba(255, 214, 230, 0.7);
    color: #fff;
    padding: 0.85rem 2rem;
    border-radius: 30px;
    font-size: 1.05rem;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 214, 230, 0.2);
}
#retry-btn:hover {
    background: linear-gradient(135deg, rgba(255, 214, 230, 0.4), rgba(110, 140, 230, 0.7));
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 214, 230, 0.4);
}
.res-sub-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 224, 130, 0.5);
    color: #ffe082;
    padding: 0.85rem 1.8rem;
    border-radius: 30px;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.25s ease;
}
.res-sub-btn:hover {
    background: rgba(255, 224, 130, 0.2);
    border-color: rgba(255, 224, 130, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 12px rgba(255, 224, 130, 0.25);
}
#title-collect {
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px dashed rgba(255, 224, 130, 0.4);
    display: inline-block;
    padding-bottom: 2px;
}
#title-collect:hover {
    color: #ffe082;
    border-bottom-color: #ffe082;
    transform: scale(1.02);
}

/* FX */
#fx {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 50; transition: background 3s;
}
#fx.white { background: #fff; }
#fx.gold { background: radial-gradient(circle at 70% 30%, #ffffff 0%, #fff9c4 40%, #ffe082 70%, #ffd54f 100%); }

/* Whisper */
#whisper {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    opacity: 0;
    transition: opacity 1s;
    pointer-events: none;
    z-index: 4;
}
#whisper.on { opacity: 1; }

/* 時計ゴールド数値 */
#clock-num.gold-num {
    color: #ffe082 !important;
    text-shadow: 0 0 16px rgba(255, 224, 130, 0.9), 0 0 30px rgba(255, 215, 64, 0.6) !important;
    animation: goldPulse 1.5s infinite alternate;
}
@keyframes goldPulse {
    from { transform: scale(1); filter: brightness(1); }
    to { transform: scale(1.08); filter: brightness(1.25); }
}

/* タイトル特典エリア */
#title-bonus {
    margin-top: 1.2rem;
    padding: 0.9rem 1.4rem;
    background: rgba(20, 25, 55, 0.65);
    border: 1px solid rgba(255, 224, 130, 0.4);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 18px rgba(255, 224, 130, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    animation: fadeIn 0.8s ease-out;
}
#title-bonus.hidden {
    display: none !important;
}
.bonus-header {
    font-size: 0.85rem;
    color: #ffe082;
    letter-spacing: 0.12em;
    font-family: 'Shippori Mincho', serif;
    font-weight: 500;
    text-shadow: 0 0 8px rgba(255, 224, 130, 0.5);
}
.bonus-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
}
.bonus-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: inherit;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: all 0.2s ease;
    white-space: nowrap;
}
.bonus-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.bonus-btn.gold {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.3), rgba(255, 179, 0, 0.4));
    border-color: rgba(255, 224, 130, 0.7);
    color: #fff8e1;
    box-shadow: 0 0 10px rgba(255, 224, 130, 0.25);
}
.bonus-btn.gold:hover {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.5), rgba(255, 179, 0, 0.6));
    box-shadow: 0 0 16px rgba(255, 224, 130, 0.5);
}
.bonus-btn.toggle.active {
    background: rgba(144, 202, 249, 0.3);
    border-color: rgba(144, 202, 249, 0.8);
    color: #e3f2fd;
    box-shadow: 0 0 12px rgba(144, 202, 249, 0.4);
}

/* 夜空モードの全体フィルター */
body.night-mode #stage {
    filter: brightness(0.92) contrast(1.08) saturate(1.1);
}

/* 特別一枚絵アルバムモーダル */
#album-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 20, 0.92);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.4s ease-out;
}
#album-modal.hidden {
    display: none !important;
}
.album-content {
    position: relative;
    max-width: 760px;
    width: 100%;
    background: rgba(20, 25, 45, 0.88);
    border: 1px solid rgba(255, 224, 130, 0.5);
    border-radius: 20px;
    padding: 2.2rem 2.8rem 1.8rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 224, 130, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.2rem;
}
#album-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}
#album-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ナビゲーション矢印ボタン */
.album-nav-btn {
    position: absolute;
    top: 40%;
    transform: translateY(-50%);
    background: rgba(15, 20, 38, 0.8);
    border: 1px solid rgba(255, 224, 130, 0.6);
    color: #ffe082;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 12px rgba(255, 224, 130, 0.25);
    z-index: 10;
    backdrop-filter: blur(8px);
}
.album-nav-btn.prev {
    left: 0.8rem;
}
.album-nav-btn.next {
    right: 0.8rem;
}
.album-nav-btn:hover {
    background: rgba(255, 224, 130, 0.25);
    border-color: #ffe082;
    color: #fff;
    transform: translateY(-50%) scale(1.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 224, 130, 0.5);
}
.album-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* スライダーコンテナ */
.album-slider-container {
    width: 100%;
    position: relative;
    min-height: 380px;
}
.album-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.2rem;
    width: 100%;
}
.album-slide.active {
    display: flex;
    animation: albumFadeIn 0.35s ease-out;
}
@keyframes albumFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.album-img-wrap {
    width: 100%;
    max-height: 48vh;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}
.album-img {
    width: 100%;
    height: auto;
    max-height: 48vh;
    object-fit: contain;
    display: block;
}
.album-desc {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.album-title {
    font-size: 1.25rem;
    color: #ffe082;
    font-family: 'Shippori Mincho', serif;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.5);
    margin: 0;
}
.album-poem {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #e0e6ed;
    font-family: 'Shippori Mincho', serif;
    margin: 0;
}
.album-sub {
    font-size: 0.85rem;
    color: #ffd6e6;
    margin-top: 0.2rem;
    letter-spacing: 0.05em;
}

/* ページネーション */
.album-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-top: 0.4rem;
}
.album-indicator {
    font-size: 0.85rem;
    color: #ffe082;
    font-weight: 600;
    letter-spacing: 0.15em;
    background: rgba(255, 224, 130, 0.12);
    padding: 0.2rem 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 224, 130, 0.3);
}
.album-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.album-dot {
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    padding: 0;
}
.album-dot:hover {
    background: rgba(255, 224, 130, 0.6);
}
.album-dot.active {
    width: 26px;
    background: #ffe082;
    box-shadow: 0 0 10px rgba(255, 224, 130, 0.8);
}

/* ===== 記憶のかけら一覧モーダル（コレクション手帳） ===== */
#mem-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 22, 0.9);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    animation: fadeIn 0.3s ease-out;
}
#mem-modal.hidden {
    display: none !important;
}
.mem-modal-content {
    position: relative;
    max-width: 820px;
    width: 100%;
    max-height: 88vh;
    background: rgba(18, 24, 48, 0.94);
    border: 1.5px solid rgba(255, 224, 130, 0.45);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(255, 215, 64, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mem-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.6rem;
    background: rgba(12, 16, 36, 0.85);
    border-bottom: 1px solid rgba(255, 224, 130, 0.25);
    flex-shrink: 0;
}
.mem-modal-title {
    font-size: 1.25rem;
    font-family: 'Shippori Mincho', serif;
    font-weight: 600;
    color: #ffe082;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.4);
}
.mem-modal-stats {
    font-size: 0.9rem;
    color: #ffd6e6;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.35rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 214, 230, 0.3);
}
.mem-modal-stats b {
    color: #ffe082;
    font-size: 1.1rem;
}
#mem-modal-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
#mem-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}
.mem-modal-body {
    padding: 1.4rem 1.6rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}
.mem-modal-body::-webkit-scrollbar {
    width: 8px;
}
.mem-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.mem-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 224, 130, 0.3);
    border-radius: 4px;
}
.mem-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 224, 130, 0.5);
}
.mem-sec-title {
    font-size: 1rem;
    font-family: 'Shippori Mincho', serif;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.08em;
    padding-left: 0.4rem;
    border-left: 3px solid #ffe082;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.mem-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.mem-card {
    background: rgba(25, 33, 62, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    gap: 0.9rem;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
}
.mem-card.unlocked {
    background: linear-gradient(135deg, rgba(35, 45, 85, 0.8), rgba(20, 28, 55, 0.8));
    border-color: rgba(255, 224, 130, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 0 12px rgba(255, 224, 130, 0.08);
}
.mem-card.unlocked:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 224, 130, 0.75);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 224, 130, 0.2);
}
.mem-card.locked {
    opacity: 0.65;
    background: rgba(16, 20, 38, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
}
.mem-card.locked:hover {
    opacity: 0.85;
}
.mem-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.mem-card.unlocked .mem-card-icon {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.25), rgba(120, 80, 200, 0.25));
    border-color: rgba(255, 224, 130, 0.5);
    box-shadow: 0 0 10px rgba(255, 224, 130, 0.25);
}
.mem-card-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.mem-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.mem-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.04em;
}
.mem-card.unlocked .mem-card-name {
    color: #ffe082;
}
.mem-card-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-cur {
    background: rgba(129, 199, 132, 0.3);
    color: #c8e6c9;
    border: 1px solid rgba(129, 199, 132, 0.6);
}
.badge-saved {
    background: rgba(255, 224, 130, 0.25);
    color: #fff8e1;
    border: 1px solid rgba(255, 224, 130, 0.5);
}
.badge-locked {
    background: rgba(255, 255, 255, 0.1);
    color: #aaa;
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.mem-card-desc {
    font-size: 0.82rem;
    line-height: 1.5;
    color: #d8e2ec;
}
.mem-card.locked .mem-card-desc {
    color: #8fa0b5;
    font-style: italic;
}

/* 所持アイテムリスト */
.mem-modal-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.mem-item-card {
    background: linear-gradient(135deg, rgba(30, 40, 75, 0.7), rgba(20, 26, 50, 0.7));
    border: 1px solid rgba(255, 214, 230, 0.4);
    border-radius: 14px;
    padding: 0.9rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 240px;
    flex: 1;
}
.mem-item-icon {
    font-size: 1.8rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 214, 230, 0.3);
}
.mem-item-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.mem-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffd6e6;
}
.mem-item-desc {
    font-size: 0.8rem;
    color: #c0cad6;
    line-height: 1.4;
}
.mem-no-items {
    width: 100%;
    padding: 1.5rem;
    text-align: center;
    background: rgba(15, 20, 40, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #90a4ae;
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ===== タイトル復帰確認モーダル ===== */
#confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 6, 18, 0.88);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}
#confirm-modal.hidden {
    display: none !important;
}
.confirm-content {
    background: rgba(18, 24, 52, 0.96);
    border: 1.5px solid rgba(255, 224, 130, 0.55);
    border-radius: 22px;
    padding: 2.2rem 2.4rem;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(255, 224, 130, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    pointer-events: auto;
}
.confirm-title {
    font-size: 1.3rem;
    color: #ffe082;
    font-family: 'Shippori Mincho', serif;
    letter-spacing: 0.06em;
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.4);
}
.confirm-text {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e2eaf2;
    margin: 0.4rem 0 1.2rem;
}
.confirm-text small {
    display: block;
    margin-top: 0.4rem;
    color: #ffd6e6;
    font-size: 0.82rem;
    opacity: 0.9;
}
.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
}
.confirm-btn {
    flex: 1;
    padding: 0.85rem 1.4rem;
    border-radius: 25px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(6px);
    white-space: nowrap;
}
.confirm-btn.yes {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.35), rgba(255, 179, 0, 0.45));
    border: 1.5px solid rgba(255, 224, 130, 0.8);
    color: #fff8e1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 12px rgba(255, 224, 130, 0.3);
}
.confirm-btn.yes:hover {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.55), rgba(255, 179, 0, 0.65));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 18px rgba(255, 224, 130, 0.5);
}
.confirm-btn.no {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #e0e6ed;
}
.confirm-btn.no:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-2px);
}

/* 記憶のかけら獲得時のポップ発光アニメーション (Task 3) */
#mem-btn.pulse-gold {
    animation: memBtnPop 0.7s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}
@keyframes memBtnPop {
    0% { transform: scale(1); }
    35% {
        transform: scale(1.18);
        border-color: rgba(255, 224, 130, 0.95);
        background: rgba(45, 60, 110, 0.95);
        box-shadow: 0 0 25px rgba(255, 224, 130, 0.85), 0 6px 20px rgba(0, 0, 0, 0.5);
    }
    100% { transform: scale(1); }
}

/* 記憶獲得時に画面を舞う金色の光粒子 (Task 3) */
.gold-spark-particle {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff 10%, #ffe082 50%, rgba(255, 215, 0, 0) 100%);
    box-shadow: 0 0 12px rgba(255, 224, 130, 0.9), 0 0 24px rgba(255, 200, 50, 0.6);
    will-change: transform, opacity;
}

/* 散歩モード限定：10年前のタイムカプセル HUDバッジ */
.capsule-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    background: rgba(22, 30, 65, 0.78);
    border: 1px solid rgba(255, 224, 130, 0.45);
    border-radius: 20px;
    color: #fff9e6;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: all 0.25s ease;
    margin-left: 0.4rem;
}
.capsule-badge:hover {
    background: rgba(35, 48, 95, 0.88);
    border-color: rgba(255, 224, 130, 0.85);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 14px rgba(255, 224, 130, 0.4);
    transform: translateY(-1px);
}
.capsule-badge .capsule-icon {
    font-size: 0.95rem;
}

/* 記憶手帳モーダル内のタイムカプセルカード */
.mem-capsule-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.85rem;
    margin-top: 0.8rem;
    margin-bottom: 1.5rem;
}
.mem-card.capsule-card {
    border-color: rgba(255, 224, 130, 0.35);
}
.mem-card.capsule-card.unlocked {
    background: linear-gradient(135deg, rgba(35, 45, 80, 0.85), rgba(45, 30, 65, 0.85));
    border-color: rgba(255, 224, 130, 0.65);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 10px rgba(255, 224, 130, 0.15);
}

/* ==================================================================
   物語と登場人物（プロローグ ＆ 登場人物名鑑）UI
   ================================================================== */
.title-nav-pills {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin: 0.6rem 0;
    flex-wrap: wrap;
    z-index: 2;
}

.title-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 1.15rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 22px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
}

.title-pill-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.title-pill-btn:active {
    transform: translateY(0);
}

#guide-btn,
#prologue-btn {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.22), rgba(70, 50, 100, 0.4));
    border-color: rgba(255, 224, 130, 0.6);
    color: #fff9e6;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 12px rgba(255, 224, 130, 0.18);
}

#guide-btn:hover,
#prologue-btn:hover {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.35), rgba(90, 65, 130, 0.55));
    border-color: rgba(255, 224, 130, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 224, 130, 0.38);
}

#chars-btn {
    background: linear-gradient(135deg, rgba(160, 210, 255, 0.2), rgba(45, 55, 105, 0.42));
    border-color: rgba(180, 220, 255, 0.6);
    color: #f0f7ff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 12px rgba(180, 220, 255, 0.18);
}

#chars-btn:hover {
    background: linear-gradient(135deg, rgba(180, 225, 255, 0.32), rgba(60, 75, 135, 0.55));
    border-color: rgba(200, 235, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4), 0 0 20px rgba(180, 220, 255, 0.35);
}

/* モーダルオーバーレイ */
#guide-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 22, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    animation: fadeIn 0.3s ease-out;
}

#guide-modal.hidden {
    display: none !important;
}

.guide-modal-content {
    position: relative;
    max-width: 860px;
    width: 100%;
    max-height: 90vh;
    background: rgba(16, 22, 46, 0.95);
    border: 1.5px solid rgba(255, 224, 130, 0.5);
    border-radius: 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 40px rgba(255, 215, 64, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.guide-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.4rem;
    background: rgba(12, 16, 36, 0.9);
    border-bottom: 1px solid rgba(255, 224, 130, 0.25);
    flex-shrink: 0;
}

.guide-tabs {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.guide-tab-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 0.55rem 1.15rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-family: 'Shippori Mincho', serif;
    color: #a0aec0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.25s ease;
}

.guide-tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.guide-tab-btn.active {
    color: #ffe082;
    background: rgba(255, 224, 130, 0.15);
    border-color: rgba(255, 224, 130, 0.45);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.35);
}

#guide-modal-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#guide-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.guide-modal-body {
    padding: 1.4rem 1.8rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

.guide-modal-body::-webkit-scrollbar {
    width: 8px;
}
.guide-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.guide-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 224, 130, 0.3);
    border-radius: 4px;
}
.guide-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 224, 130, 0.5);
}

.guide-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.guide-panel.active {
    display: block;
}

/* ----- プロローグ タブ ----- */
.prologue-wrap {
    max-width: 700px;
    margin: 0 auto;
    color: #e2e8f0;
}

.prologue-header {
    text-align: center;
    margin-bottom: 1.8rem;
}

.prologue-sub {
    display: inline-block;
    font-size: 0.85rem;
    color: #94a3b8;
    letter-spacing: 0.12em;
    margin-bottom: 0.4rem;
}

.prologue-title {
    font-family: 'Shippori Mincho', serif;
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 600;
    color: #ffe082;
    letter-spacing: 0.1em;
    text-shadow: 0 0 14px rgba(255, 224, 130, 0.4);
    margin: 0.2rem 0 0.6rem;
}

.prologue-divider {
    color: #ffe082;
    font-size: 0.8rem;
    letter-spacing: 0.6em;
    opacity: 0.7;
}

/* ----- プロローグ挿絵カード ----- */
.prologue-illustration-card {
    max-width: 520px;
    margin: 1.2rem auto 1.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, rgba(22, 28, 54, 0.75), rgba(42, 30, 56, 0.65));
    border: 1px solid rgba(255, 224, 130, 0.45);
    border-radius: 18px;
    padding: 10px 10px 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(255, 200, 100, 0.18);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.prologue-illustration-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 224, 130, 0.3);
    border-color: rgba(255, 224, 130, 0.75);
}

.prologue-img-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
}

.prologue-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    display: block;
    border-radius: 14px;
    transition: transform 0.5s ease;
}

.prologue-illustration-card:hover .prologue-img {
    transform: scale(1.02);
}

.prologue-img-caption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-family: 'Shippori Mincho', serif;
    color: #f0e6cf;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    padding: 0 0.5rem;
    text-align: center;
}

.prologue-img-caption .caption-spark {
    color: #ffe082;
    font-size: 0.78rem;
    text-shadow: 0 0 8px rgba(255, 224, 130, 0.7);
}

.prologue-text {
    font-size: 0.96rem;
    line-height: 2.1;
    font-family: 'Shippori Mincho', serif;
    letter-spacing: 0.05em;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.prologue-text p {
    margin: 0;
}

.prologue-countdown {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffd6e6;
    margin: 1rem 0;
    letter-spacing: 0.15em;
    text-shadow: 0 0 16px rgba(255, 214, 230, 0.65), 0 2px 10px rgba(0,0,0,0.8);
    background: rgba(255, 214, 230, 0.08);
    padding: 0.8rem 1.4rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 214, 230, 0.35);
}

.prologue-lead {
    color: #ffe082;
    font-weight: 500;
    border-left: 3px solid #ffe082;
    padding-left: 0.8rem;
    margin-top: 0.6rem !important;
}

.prologue-truth-box {
    margin-top: 2rem;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.15), rgba(60, 40, 85, 0.35));
    border: 1.5px solid rgba(255, 224, 130, 0.65);
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(255, 224, 130, 0.25);
    animation: fadeIn 0.5s ease-out;
}

.prologue-truth-box.hidden {
    display: none !important;
}

.truth-badge {
    font-family: 'Shippori Mincho', serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffe082;
    letter-spacing: 0.12em;
    margin-bottom: 0.6rem;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.5);
}

.truth-text {
    font-size: 0.92rem;
    line-height: 1.9;
    color: #fff9e6;
    font-family: 'Shippori Mincho', serif;
    margin: 0;
}

/* ----- 登場人物名鑑 タブ ----- */
.chars-nav-bar {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 0.8rem;
    margin-bottom: 1.2rem;
    scrollbar-width: thin;
}

.chars-nav-bar::-webkit-scrollbar {
    height: 6px;
}
.chars-nav-bar::-webkit-scrollbar-thumb {
    background: rgba(255, 224, 130, 0.3);
    border-radius: 3px;
}

.char-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    border-radius: 22px;
    background: rgba(24, 32, 60, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #cbd5e1;
    font-size: 0.86rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.22s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.char-nav-btn:hover {
    background: rgba(38, 50, 92, 0.85);
    border-color: rgba(255, 224, 130, 0.5);
    color: #fff;
    transform: translateY(-1px);
}

.char-nav-btn.active {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.25), rgba(70, 50, 110, 0.45));
    border-color: #ffe082;
    color: #fff8e1;
    box-shadow: 0 0 12px rgba(255, 224, 130, 0.35);
    font-weight: 600;
}

.char-nav-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 224, 130, 0.6);
    background-color: rgba(15, 20, 45, 0.7);
}

/* キャラクター詳細表示カード */
.char-detail-card {
    display: flex;
    gap: 1.8rem;
    background: rgba(20, 27, 52, 0.7);
    border: 1px solid rgba(255, 224, 130, 0.35);
    border-radius: 18px;
    padding: 1.6rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.3s ease-out;
}

@media (max-width: 680px) {
    .char-detail-card {
        flex-direction: column;
        align-items: center;
        gap: 1.2rem;
        padding: 1.2rem;
    }
}

.char-visual-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    max-width: 260px;
    flex-shrink: 0;
    position: relative;
}

.char-visual-wrap {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    background: radial-gradient(circle, rgba(255, 224, 130, 0.15) 0%, rgba(20, 27, 52, 0) 70%);
    border-radius: 16px;
}

.char-visual-img {
    max-height: 340px;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.65));
    transition: transform 0.3s ease;
}

.char-visual-img:hover {
    transform: scale(1.03);
}

.char-info-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.char-info-head {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    padding-bottom: 0.8rem;
}

.char-name-row {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.char-main-name {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.06em;
}

.char-ruby {
    font-size: 0.82rem;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

.char-role-badge {
    font-size: 0.78rem;
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
    background: rgba(255, 224, 130, 0.18);
    border: 1px solid rgba(255, 224, 130, 0.5);
    color: #ffe082;
    font-weight: 500;
}

.char-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: #cbd5e1;
}

.char-meta-item b {
    color: #ffe082;
    font-weight: normal;
}

.char-section-box {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: rgba(14, 18, 38, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.char-sec-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #ffe082;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.char-sec-desc {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #e2e8f0;
}

/* 10年前の絆（クリア後解放枠） */
.char-bond-box {
    border-radius: 14px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: all 0.3s ease;
}

.char-bond-box.unlocked {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.16), rgba(65, 40, 95, 0.35));
    border: 1.5px solid rgba(255, 224, 130, 0.6);
    box-shadow: 0 0 18px rgba(255, 224, 130, 0.2);
}

.char-bond-box.unlocked .char-bond-label {
    color: #ffe082;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 224, 130, 0.4);
}

.char-bond-box.unlocked .char-bond-desc {
    color: #fff9e6;
    font-size: 0.9rem;
    line-height: 1.75;
}

.char-bond-box.locked {
    background: rgba(14, 18, 34, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.18);
}

.char-bond-box.locked .char-bond-label {
    color: #94a3b8;
}

.char-bond-box.locked .char-bond-desc {
    color: #718096;
    font-style: italic;
    font-size: 0.85rem;
}

/* ==================================================================
   エピローグ（明日へ続く、91秒目）UI
   ================================================================== */
.bonus-btn.gold-epilogue {
    background: linear-gradient(135deg, rgba(255, 215, 64, 0.35), rgba(255, 140, 160, 0.3), rgba(70, 90, 160, 0.45));
    border-color: rgba(255, 230, 140, 0.85);
    color: #fffdf5;
    box-shadow: 0 4px 18px rgba(255, 215, 64, 0.3), 0 0 16px rgba(255, 180, 200, 0.25);
    font-weight: 600;
    animation: goldGlowPulse 3s infinite alternate ease-in-out;
}

.bonus-btn.gold-epilogue:hover {
    background: linear-gradient(135deg, rgba(255, 225, 100, 0.5), rgba(255, 160, 180, 0.45), rgba(90, 110, 190, 0.6));
    border-color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 26px rgba(255, 215, 64, 0.45), 0 0 24px rgba(255, 200, 220, 0.4);
}

@keyframes goldGlowPulse {
    0% {
        box-shadow: 0 4px 16px rgba(255, 215, 64, 0.25), 0 0 12px rgba(255, 180, 200, 0.2);
    }
    100% {
        box-shadow: 0 4px 22px rgba(255, 224, 130, 0.5), 0 0 20px rgba(255, 200, 220, 0.4);
    }
}

/* エピローグモーダルオーバーレイ */
#epilogue-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 7, 18, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    animation: fadeIn 0.4s ease-out;
}

#epilogue-modal.hidden {
    display: none !important;
}

.epilogue-modal-content {
    position: relative;
    max-width: 780px;
    width: 100%;
    max-height: 92vh;
    background: linear-gradient(180deg, rgba(12, 17, 36, 0.96) 0%, rgba(18, 22, 46, 0.96) 65%, rgba(32, 26, 48, 0.96) 100%);
    border: 1.5px solid rgba(255, 224, 130, 0.55);
    border-radius: 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85), 0 0 44px rgba(255, 215, 64, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.epilogue-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.4rem;
    background: rgba(10, 14, 32, 0.92);
    border-bottom: 1px solid rgba(255, 224, 130, 0.25);
    flex-shrink: 0;
}

.epilogue-header-badge {
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: #ffe082;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.5);
    font-family: 'Shippori Mincho', serif;
}

#epilogue-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#epilogue-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.epilogue-modal-body {
    padding: 2rem 2.2rem 3rem;
    overflow-y: auto;
    flex-grow: 1;
    color: #e6edf8;
    font-family: 'Shippori Mincho', serif;
    line-height: 2.2;
    letter-spacing: 0.05em;
    font-size: clamp(0.96rem, 2.5vw, 1.08rem);
}

.epilogue-modal-body::-webkit-scrollbar {
    width: 8px;
}
.epilogue-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
}
.epilogue-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 224, 130, 0.35);
    border-radius: 4px;
}
.epilogue-modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 224, 130, 0.6);
}

/* タイトル見出し */
.epilogue-hero {
    text-align: center;
    margin-bottom: 2.4rem;
}

.epilogue-hero-sub {
    display: inline-block;
    font-size: 0.88rem;
    color: #94a3b8;
    letter-spacing: 0.2em;
    margin-bottom: 0.4rem;
}

.epilogue-main-title {
    font-size: clamp(1.5rem, 3.8vw, 2.2rem);
    font-weight: 600;
    color: #ffe082;
    letter-spacing: 0.12em;
    text-shadow: 0 0 18px rgba(255, 224, 130, 0.5), 0 2px 10px rgba(0, 0, 0, 0.8);
    margin: 0.2rem 0 0.8rem;
}

.epilogue-divider,
.epilogue-break {
    color: #ffe082;
    font-size: 0.82rem;
    letter-spacing: 0.7em;
    opacity: 0.65;
    text-align: center;
    margin: 2.2rem 0;
}

/* 本文セクション */
.epilogue-section {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    max-width: 660px;
    margin: 0 auto;
}

.epilogue-section p {
    margin: 0;
    text-align: justify;
}

/* 情景の詩的字下げ */
.epilogue-scenery {
    padding-left: 1.2rem;
    border-left: 2px solid rgba(255, 224, 130, 0.35);
    color: #f1e9d8;
    margin: 0.4rem 0 !important;
}

/* 台詞 */
.epilogue-quote {
    color: #fff9e6;
    font-weight: 500;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.25);
    margin: 0.3rem 0 !important;
}

/* 九十一秒目の大強調 */
.epilogue-highlight {
    text-align: center;
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffe082;
    margin: 1.4rem 0;
    letter-spacing: 0.18em;
    text-shadow: 0 0 20px rgba(255, 224, 130, 0.75), 0 2px 10px rgba(0, 0, 0, 0.9);
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.12), rgba(60, 45, 90, 0.25));
    padding: 0.9rem 1.6rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 224, 130, 0.45);
}

/* リード文 */
.epilogue-lead-quote {
    color: #ffe082;
    font-size: 1.12rem;
    font-weight: 600;
    text-align: center;
    margin: 1.2rem 0 !important;
    text-shadow: 0 0 12px rgba(255, 224, 130, 0.4);
}

/* エピローグ挿絵カード（17歳のレイが描いたコハクと新しい切符） */
.epilogue-illustration-card {
    max-width: 540px;
    width: 100%;
    margin: 1.2rem auto 2.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(145deg, rgba(22, 32, 64, 0.8), rgba(42, 28, 56, 0.7));
    border: 1.5px solid rgba(160, 215, 255, 0.6);
    border-radius: 18px;
    padding: 10px 10px 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 28px rgba(160, 215, 255, 0.25);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.epilogue-illustration-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.75), 0 0 36px rgba(180, 230, 255, 0.4);
    border-color: rgba(200, 235, 255, 0.9);
}

.epilogue-img-wrap {
    width: 100%;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
}

.epilogue-img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    display: block;
    border-radius: 14px;
    transition: transform 0.5s ease;
}

.epilogue-illustration-card:hover .epilogue-img {
    transform: scale(1.02);
}

.epilogue-img-caption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-family: 'Shippori Mincho', serif;
    color: #e2eeff;
    letter-spacing: 0.08em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    padding: 0 0.5rem;
    text-align: center;
}

.epilogue-img-caption .caption-spark {
    color: #90cdff;
    font-size: 0.78rem;
    text-shadow: 0 0 8px rgba(144, 205, 255, 0.8);
}

/* 終幕メッセージ */
.epilogue-final-message {
    margin: 2.2rem 0 1.6rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.final-line-1, .final-line-2 {
    font-size: 1.15rem;
    color: #fff9e6;
    letter-spacing: 0.15em;
    margin: 0 !important;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.35);
}

.final-question {
    font-size: clamp(1.05rem, 2.8vw, 1.25rem);
    color: #ffe082;
    font-weight: 600;
    letter-spacing: 0.12em;
    margin-top: 0.8rem !important;
    text-shadow: 0 0 16px rgba(255, 224, 130, 0.6);
}

.epilogue-end-title {
    text-align: center;
    margin: 2rem 0;
    padding: 1.2rem;
    border-top: 1px solid rgba(255, 224, 130, 0.25);
    border-bottom: 1px solid rgba(255, 224, 130, 0.25);
}

.end-game-title {
    font-size: 1.35rem;
    letter-spacing: 0.18em;
    color: #fff;
    margin-bottom: 0.4rem;
}

.end-true-badge {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffe082;
    letter-spacing: 0.3em;
    text-shadow: 0 0 16px rgba(255, 224, 130, 0.7);
}

.epilogue-actions {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.epilogue-action-btn {
    padding: 0.75rem 2.2rem;
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.25), rgba(70, 50, 100, 0.5));
    border: 1.5px solid rgba(255, 224, 130, 0.7);
    border-radius: 26px;
    color: #fffdf5;
    font-size: 1rem;
    font-family: 'Shippori Mincho', serif;
    font-weight: 600;
    letter-spacing: 0.1em;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 16px rgba(255, 224, 130, 0.3);
    transition: all 0.25s ease;
}

.epilogue-action-btn:hover {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.4), rgba(90, 65, 130, 0.7));
    border-color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 24px rgba(255, 224, 130, 0.5);
}

/* ==================================================================
   タイトル画面 クイックアクション（ホーム追加・共有）＆ 案内モーダル
   ================================================================== */
.title-top-actions {
    position: absolute;
    top: max(1rem, env(safe-area-inset-top, 1rem));
    right: max(1.2rem, env(safe-area-inset-right, 1.2rem));
    display: flex;
    gap: 0.55rem;
    z-index: 10;
}

.title-action-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.95rem;
    background: rgba(15, 22, 45, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #e2eeff;
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.title-action-pill:hover {
    background: rgba(255, 224, 130, 0.2);
    border-color: rgba(255, 224, 130, 0.7);
    color: #fff9e6;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 12px rgba(255, 224, 130, 0.25);
}

.title-action-pill:active {
    transform: translateY(0);
}

.title-action-pill .action-icon {
    font-size: 0.95rem;
}

/* ホーム画面追加 案内モーダル */
#pwa-guide-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 8, 20, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    animation: fadeIn 0.3s ease-out;
}

#pwa-guide-modal.hidden {
    display: none !important;
}

.pwa-guide-content {
    position: relative;
    max-width: 440px;
    width: 100%;
    background: linear-gradient(145deg, rgba(22, 28, 54, 0.92), rgba(35, 26, 50, 0.92));
    border: 1px solid rgba(255, 224, 130, 0.5);
    border-radius: 22px;
    padding: 2.2rem 2rem 1.8rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 25px rgba(255, 224, 130, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #e2e8f0;
}

#pwa-guide-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#pwa-guide-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.pwa-guide-badge {
    font-size: 0.8rem;
    color: #ffe082;
    letter-spacing: 0.15em;
    margin-bottom: 0.8rem;
}

.pwa-guide-icon-wrap {
    margin-bottom: 0.8rem;
}

.pwa-guide-app-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(255, 224, 130, 0.35);
    border: 1.5px solid rgba(255, 224, 130, 0.6);
    display: block;
}

.pwa-guide-title {
    font-family: 'Shippori Mincho', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffe082;
    margin: 0.2rem 0 0.6rem;
    letter-spacing: 0.08em;
}

.pwa-guide-lead {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin: 0 0 1.2rem;
}

.pwa-guide-steps {
    width: 100%;
    background: rgba(10, 15, 32, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 0.9rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    text-align: left;
    margin-bottom: 1.5rem;
}

.pwa-step-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 0.86rem;
    color: #f1f5f9;
}

.pwa-step-item .step-num {
    width: 22px;
    height: 22px;
    background: #ffe082;
    color: #0d1a3f;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-step-item .ios-share-svg {
    vertical-align: -2px;
    display: inline-block;
    color: #60a5fa;
}

.pwa-guide-btn {
    padding: 0.6rem 2.2rem;
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.3), rgba(70, 50, 100, 0.6));
    border: 1.5px solid rgba(255, 224, 130, 0.7);
    border-radius: 22px;
    color: #fffdf5;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.25s ease;
}

.pwa-guide-btn:hover {
    background: linear-gradient(135deg, rgba(255, 224, 130, 0.45), rgba(90, 65, 130, 0.75));
    border-color: #fff;
    transform: translateY(-2px);
}

/* ==================================================================
   全端末（スマホ・タブレット・PC・各アスペクト比）完全レスポンシブ対応
   ================================================================== */

/* 1. 基本ビューポート（100dvh）＆ セーフエリア（Safe Area Insets）適用 */
body, html {
    height: 100vh;
    height: 100dvh;
}

.screen {
    height: 100vh;
    height: 100dvh;
}

/* タイトル画面のセーフエリア保護 */
#title {
    padding-top: max(5vh, env(safe-area-inset-top, 16px));
    padding-bottom: max(3vh, env(safe-area-inset-bottom, 16px));
    padding-left: max(16px, env(safe-area-inset-left, 16px));
    padding-right: max(16px, env(safe-area-inset-right, 16px));
}

/* HUDのセーフエリア保護 */
#hud {
    padding-top: env(safe-area-inset-top, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

#status {
    top: max(1.4rem, env(safe-area-inset-top, 1.4rem));
    left: max(1.2rem, env(safe-area-inset-left, 1.2rem));
}

#clock {
    top: max(1.4rem, env(safe-area-inset-top, 1.4rem));
    right: max(1.2rem, env(safe-area-inset-right, 1.2rem));
}

#audio-panel {
    top: max(1.4rem, env(safe-area-inset-top, 1.4rem));
    right: max(100px, calc(env(safe-area-inset-right, 0px) + 90px));
}

#touch {
    bottom: max(1.2rem, env(safe-area-inset-bottom, 1.2rem));
    padding-left: max(1.2rem, env(safe-area-inset-left, 1.2rem));
    padding-right: max(1.2rem, env(safe-area-inset-right, 1.2rem));
}

#dialog {
    bottom: max(1.2rem, env(safe-area-inset-bottom, 1.2rem));
    max-width: min(720px, calc(100vw - max(2rem, env(safe-area-inset-left) + env(safe-area-inset-right))));
}

/* 2. スマートフォン・横向き（低画面高：max-height: 500px）最適化 */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #title {
        padding-top: max(0.5rem, env(safe-area-inset-top));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        justify-content: flex-start;
    }

    .title-copy {
        margin-bottom: 0.35rem;
    }

    #title-h1 {
        font-size: clamp(1.5rem, 3.8vw, 2.1rem);
    }

    .catch {
        font-size: 0.8rem;
        margin-top: 0.15rem;
    }

    .title-bottom {
        gap: 0.35rem;
    }

    #start-btn {
        padding: 0.55rem 2.2rem;
        font-size: 1rem;
    }

    .howto {
        display: none; /* 低画面高の横画面では不要なキーボード説明を非表示にして1画面に完璧に収める */
    }

    .title-nav-pills {
        margin-top: 0.15rem;
        gap: 0.35rem;
    }

    .title-pill-btn {
        padding: 0.3rem 0.75rem;
        font-size: 0.75rem;
    }

    .title-top-actions {
        top: max(0.5rem, env(safe-area-inset-top));
        right: max(0.8rem, env(safe-area-inset-right));
        gap: 0.35rem;
    }

    .title-action-pill {
        padding: 0.3rem 0.75rem;
        font-size: 0.76rem;
    }

    #title-bonus {
        margin-top: 0.35rem;
        padding: 0.45rem 0.75rem;
        gap: 0.3rem;
    }

    .bonus-btn {
        padding: 0.3rem 0.7rem;
        font-size: 0.75rem;
    }

    .rotate-note {
        display: none; /* 横向き時は不要 */
    }

    /* ゲーム中HUDの横画面最適化 */
    #clock {
        width: 62px;
        height: 62px;
        top: max(0.8rem, env(safe-area-inset-top));
        right: max(0.8rem, env(safe-area-inset-right));
    }

    #clock-num {
        font-size: 1.35rem;
    }

    #audio-panel {
        top: max(0.8rem, env(safe-area-inset-top));
        right: max(76px, calc(env(safe-area-inset-right, 0px) + 72px));
        gap: 0.4rem;
    }

    #menu-btn, #bgm-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.78rem;
    }

    #mute {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    #status {
        top: max(0.8rem, env(safe-area-inset-top));
        left: max(0.8rem, env(safe-area-inset-left));
        gap: 0.4rem;
    }

    #mem-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .item {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    /* タッチボタンの横画面最適化 */
    #touch {
        bottom: max(0.6rem, env(safe-area-inset-bottom));
        padding-left: max(0.8rem, env(safe-area-inset-left));
        padding-right: max(0.8rem, env(safe-area-inset-right));
    }

    #touch button {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }

    #btn-act {
        min-width: 110px;
        height: 44px;
        font-size: 0.9rem;
        padding: 0 1.1rem;
    }

    /* 会話ダイアログ */
    #dialog {
        bottom: max(0.5rem, env(safe-area-inset-bottom));
        gap: 0.6rem;
    }

    #d-avatar {
        width: 65px;
        height: 65px;
    }

    #d-body {
        padding: 0.75rem 1.1rem;
        min-height: 75px;
    }

    #d-text {
        font-size: 0.95rem;
        line-height: 1.5;
    }
}

/* 3. スマートフォン・縦向き（狭画面幅：max-width: 600px）最適化 */
@media screen and (max-width: 600px) {
    #title-h1 {
        font-size: clamp(2rem, 8.5vw, 2.9rem);
        letter-spacing: 0.08em;
    }

    .catch {
        font-size: 0.92rem;
        letter-spacing: 0.12em;
    }

    .title-top-actions {
        top: max(0.8rem, env(safe-area-inset-top));
        right: max(0.8rem, env(safe-area-inset-right));
        gap: 0.4rem;
    }

    .title-action-pill {
        padding: 0.35rem 0.8rem;
        font-size: 0.78rem;
    }

    .title-nav-pills {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.45rem;
    }

    .howto {
        display: none; /* タッチ端末の縦画面ではキーボード操作説明を非表示にしてスッキリ配置 */
    }

    .bonus-buttons {
        gap: 0.45rem;
    }

    .bonus-btn {
        padding: 0.45rem 0.85rem;
        font-size: 0.8rem;
    }

    /* ゲーム中HUDの縦画面レイアウト */
    #clock {
        width: 64px;
        height: 64px;
        top: max(0.8rem, env(safe-area-inset-top));
        right: max(0.8rem, env(safe-area-inset-right));
    }

    #clock-num {
        font-size: 1.45rem;
    }

    #audio-panel {
        top: max(0.8rem, env(safe-area-inset-top));
        right: max(78px, calc(env(safe-area-inset-right, 0px) + 74px));
        gap: 0.35rem;
    }

    #bgm-name {
        max-width: 80px;
    }

    #status {
        top: max(0.8rem, env(safe-area-inset-top));
        left: max(0.8rem, env(safe-area-inset-left));
        flex-wrap: wrap;
        max-width: 180px;
    }

    #mem-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.82rem;
    }

    /* ダイアログ（縦画面） */
    #dialog {
        width: 95%;
        gap: 0.6rem;
    }

    #d-avatar {
        width: 70px;
        height: 70px;
    }

    #d-body {
        padding: 1rem;
    }

    #d-text {
        font-size: 1rem;
    }

    /* タッチボタン（縦画面） */
    #touch {
        padding: 0 max(1rem, env(safe-area-inset-left));
    }

    #btn-act {
        min-width: 120px;
        height: 50px;
        font-size: 0.95rem;
    }
}

/* 4. タブレット（iPadなど：601px 〜 1024px）最適化 */
@media screen and (min-width: 601px) and (max-width: 1024px) {
    #title-h1 {
        font-size: clamp(2.8rem, 6vw, 3.8rem);
    }

    #dialog {
        max-width: 660px;
    }

    .mem-modal-content,
    .guide-modal-content,
    .album-content {
        max-width: 90%;
        max-height: 86vh;
    }
}

/* 5. モーダル全共通：画面突き抜け防止＆快適スクロール保証 */
.mem-modal-content,
.guide-modal-content,
.album-content,
.epilogue-modal-content,
.pwa-guide-content,
.confirm-content {
    max-height: calc(100dvh - max(2.5rem, env(safe-area-inset-top) + env(safe-area-inset-bottom)));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media screen and (max-height: 540px) {
    .pwa-guide-content {
        padding: 1.4rem 1.6rem 1.2rem;
    }

    .pwa-guide-app-icon {
        width: 52px;
        height: 52px;
    }

    .pwa-guide-badge {
        display: none;
    }

    .pwa-guide-title {
        font-size: 1.1rem;
        margin: 0.1rem 0 0.3rem;
    }

    .pwa-guide-lead {
        font-size: 0.78rem;
        margin-bottom: 0.6rem;
    }

    .pwa-guide-steps {
        padding: 0.6rem 0.8rem;
        gap: 0.45rem;
        margin-bottom: 0.8rem;
    }

    .pwa-step-item {
        font-size: 0.78rem;
    }

    .album-content {
        padding: 1.2rem 2.2rem 1rem;
        gap: 0.6rem;
    }

    .album-img-wrap {
        max-height: 38vh;
    }

    .album-img {
        max-height: 38vh;
    }

    .album-poem {
        font-size: 0.82rem;
        line-height: 1.5;
    }
}



