@import url('https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;600&display=swap');

:root {
    --bg-color: #0a0f18;
    --font-color: #d0d8e0;
    --accent-color: #88c0d0;
}

body {
    background-color: var(--bg-color);
    color: var(--font-color);
    font-family: 'Shippori Mincho', serif;
    margin: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}

#main-content, #gate, #splash-screen {
    display: none;
}

#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 10001;
    opacity: 1;
    transition: opacity 1s ease-in-out;
}

.hitodama {
    position: absolute;
    background: radial-gradient(circle at 50% 80%, rgba(173, 216, 230, 0.7), transparent 70%);
    border-radius: 50% / 60% 60% 40% 40%;
    will-change: transform, filter, opacity;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 2s ease-out, transform 2s ease-out;
}

.hitodama::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 10px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    filter: blur(2px);
    transform: translateX(-50%);
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: none;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 10000;
    transition: opacity 1.5s ease-out, transform 1s ease-in-out;
}

#splash-screen.hidden {
    opacity: 0;
    transform: scale(2);
    pointer-events: none;
}

#splash-content {
    text-align: center;
}

#splash-enter-text {
    cursor: pointer;
    font-size: 1rem;
    letter-spacing: 0.1em;
}

.splash-button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--font-color);
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
    font-family: 'Shippori Mincho', serif;
    transition: background-color 0.3s;
}

.splash-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

#splash-screen h1 {
    font-size: 2rem;
    letter-spacing: 0.1em;
    animation: fadeInOut 4s infinite;
}

#desktop-blocker {
    display: none;
}

@media (min-width: 769px) {
    #desktop-blocker {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 9999;
        justify-content: center;
        align-items: center;
        text-align: center;
        background-color: var(--bg-color);
    }
    #desktop-blocker .message-box {
        padding: 40px;
    }
    #desktop-blocker .qr-code {
        margin-top: 20px;
        width: 150px;
        height: 150px;
        border: 5px solid white;
        border-radius: 8px;
    }
    #main-content, #gate {
        display: none !important;
    }
}

body.dev-mode #desktop-blocker {
    display: none !important;
}

body.dev-mode #main-content {
    display: block !important;
}

body.dev-mode #gate {
    display: none !important;
}

#gallery-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

#gallery-wrapper.panning {
    cursor: grabbing;
}

#gallery-container {
    position: relative;
}

.polaroid {
    position: absolute;
    cursor: pointer;
    opacity: 0;
    transition: transform 1s cubic-bezier(0.3, 1, 0.7, 1), opacity 0.8s;
    will-change: transform, opacity;
}
.polaroid:hover {
    transform: scale(1.05) !important;
    z-index: 100;
}
.polaroid img {
    display: block;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    -webkit-user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
}
.polaroid.is-viewed-transparent {
    /* JavaScriptが最終的な透明度を決定するため、!importantは不要 */
    opacity: 0.5;
}
.polaroid.is-viewed-transparent:hover {
    /* ホバーした際は確実に不透明にしたいので!importantを指定 */
    opacity: 1 !important;
}
#menu-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
}

#copyright-footer {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: var(--font-color);
    opacity: 0.6;
    white-space: nowrap;
    pointer-events: none;
}

#menu-options {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
}

.menu-button {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(25, 30, 45, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--font-color);
    padding: 8px 15px;
    font-family: 'Shippori Mincho', serif;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

#main-menu-toggle {
    position: relative;
    opacity: 1;
    pointer-events: auto;
    width: 48px;
    height: 48px;
    padding: 0;
    font-size: 1.8rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#menu-container.active .menu-button {
    opacity: 1;
    pointer-events: auto;
}

#menu-container.active #main-menu-toggle {
    transform: translateX(-50%) rotate(135deg);
}

#menu-container.active .menu-button:nth-child(1) { transform: translate(-110%, -60px); }
#menu-container.active .menu-button:nth-child(2) { transform: translate(10%,  -60px); }
#menu-container.active .menu-button:nth-child(3) { transform: translate(-155%, -115px); }
#menu-container.active .menu-button:nth-child(4) { transform: translate(55%, -115px); }
#menu-container.active .menu-button:nth-child(5) { transform: translate(-110%, -170px); }
#menu-container.active .menu-button:nth-child(6) { transform: translate(10%, -170px); }
#menu-container.active .menu-button:nth-child(7) { transform: translate(-155%, -225px); }
#menu-container.active .menu-button:nth-child(8) { transform: translate(55%, -225px); }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 15, 24, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: pointer;
    animation: fadeIn 0.5s;
}

.modal-content {
    background-color: var(--bg-color);
    border: 1px solid var(--accent-color);
    padding: 30px;
    max-width: 90vw;
    max-height: 85vh;
    cursor: default;
    text-align: center;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content p {
    line-height: 1.8;
}

#image-modal {
    z-index: 2001;
}

#image-modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 90vw;
    height: 85vh;
    padding: 20px;
    box-sizing: border-box;
    cursor: default;
    background: none;
    border: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

#modal-bg-image {
    width: 100%;
    flex-shrink: 1;
    min-height: 50%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

#modal-title {
    font-weight: 600;
    margin: 10px 0 5px 0;
    flex-shrink: 0;
    text-align: center;
    white-space: nowrap;
}

#modal-meta-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    opacity: 0.7;
    margin: 0 0 15px 0;
    flex-shrink: 0;
}

#modal-text-container {
    flex-grow: 1;
    overflow-y: auto;
    text-align: left;
}

#modal-text {
    font-size: 1rem;
    line-height: 1.7;
}

.modal-close-button {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    font-size: 2.5rem;
    color: var(--font-color);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    z-index: 2002;
}

.modal-close-button:hover {
    opacity: 1;
}

#favorite-button {
    position: absolute;
    top: 15px;
    left: 15px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
}

#favorite-button.favorited {
    color: #ffdd00;
    transform: scale(1.2);
}

#album-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

.album-item {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 159.292%;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.album-item > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.album-item img {
    object-fit: contain;
}

.placeholder-content {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

#album-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 20px;
}

#album-page-info {
    min-width: 60px;
    text-align: center;
}

.pagination-button {
    background: rgba(25, 30, 45, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--font-color);
    padding: 8px 15px;
    font-family: 'Shippori Mincho', serif;
    cursor: pointer;
    border-radius: 5px;
}

.pagination-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.firefly {
    position: fixed;
    width: 4px;
    height: 4px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px 2px var(--accent-color);
    pointer-events: none;
    animation: flicker 3s infinite, ambient-float 15s infinite ease-in-out;
    will-change: transform, opacity;
}

#omikuji-modal-content {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    height: 250px;
    cursor: pointer;
}

#omikuji-box {
    width: 80px;
    height: 120px;
    border: 3px solid var(--accent-color);
    position: relative;
}

#omikuji-box.shake {
    animation: shake 0.5s infinite;
}

#omikuji-box.hidden {
    display: none;
}

#omikuji-box::before {
    content: '運試し';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
}

#omikuji-result {
    display: none;
    font-size: 1.5rem;
    text-align: center;
}

.shooting-star {
    position: fixed;
    top: 50%;
    left: 50%;
    height: 2px;
    background: linear-gradient(-45deg, #fff, rgba(255, 255, 255, 0));
    border-radius: 999px;
    filter: drop-shadow(0 0 6px #fff);
    animation: tail 3s ease-in-out infinite, shooting 3s ease-in-out infinite;
    pointer-events: none;
}

.shooting-star::before,
.shooting-star::after {
    content: '';
    position: absolute;
    top: calc(50% - 1px);
    right: 0;
    height: 2px;
    background: linear-gradient(-45deg, rgba(255, 255, 255, 0), #fff, rgba(255, 255, 255, 0));
    transform: translateX(50%) rotateZ(45deg);
    border-radius: 100%;
    animation: shining 3s ease-in-out infinite;
}

#dev-panel {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 5px;
    z-index: 9999;
    font-size: 12px;
}

body.dev-mode #dev-panel {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#dev-panel input {
    width: 50px;
}

#dev-panel button {
    padding: 2px 5px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 280px; /* 新しい項目に合わせて横幅をさらに調整 */
    margin-bottom: 15px; /* 行間の余白を調整 */
}

.setting-row span {
    text-align: left;
    flex-grow: 1; 
}

.toggle-button {
    padding: 5px 10px;
    width: 60px;
    border: 1px solid var(--accent-color);
    background-color: var(--bg-color);
    color: var(--font-color);
    cursor: pointer;
}

.toggle-button.active {
    background-color: var(--accent-color);
    color: var(--bg-color);
}

.tutorial-step {
    display: none;
}

.tutorial-step.active {
    display: block;
}

#tutorial-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

#tutorial-nav button {
    padding: 8px 15px;
}

#omoide-filter-container {
    margin-bottom: 15px;
}

@keyframes tail {
    0% { width: 0; }
    30% { width: 100px; }
    100% { width: 0; }
}

@keyframes shining {
    0% { width: 0; }
    50% { width: 30px; }
    100% { width: 0; }
}

@keyframes shooting {
    0% { transform: translateX(0); }
    100% { transform: translateX(300px); }
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.2; }
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes ambient-float {
    0% { transform: translate(0, 0); }
    25% { transform: translate(var(--dx), var(--dy)); }
    50% { transform: translate(var(--dx2), var(--dy2)); }
    75% { transform: translate(var(--dx3), var(--dy3)); }
    100% { transform: translate(0, 0); }
}

@media (max-width: 768px) {
    #modal-title { font-size: 1.2rem; }
    #modal-text { font-size: 0.9rem; }
    #album-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

#favorite-filter-toggle {
    width: auto; /* 固定幅を解除 */
    padding: 8px 20px; /* 余白を調整して自然な幅に */
}