@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,400&family=Noto+Serif+JP:wght@200;300;400;550;700&family=Noto+Sans+JP:wght@300;400;500;700&family=Inter:wght@400;500;700&display=swap');

:root {
    --bg-color: #FAFAFA;
    --text-color: #1a1a1a;
    --accent-color: #b8860b; /* Darker Gold for visibility on white */
    --accent-hover: #8b6508;
    --border-color: #e0e0e0;
    --font-japanese: 'Cormorant Garamond', 'Noto Serif JP', 'Hiragino Mincho ProN', 'Yu Mincho', serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-japanese);
    line-height: 1.6;
}

body.view-body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

/* --- Index (View) Page Styles --- */
.view-container {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Background subtly animated pattern / gradient */
.view-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, #ffffff 0%, #f0f0f0 100%);
    z-index: -2;
}

/* Soft gradients at the top and bottom to ensure text readability on arbitrary background images */
.view-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(to bottom, rgba(250, 250, 250, 0.85) 0%, rgba(250, 250, 250, 0) 180px),
        linear-gradient(to top, rgba(250, 250, 250, 0.85) 0%, rgba(250, 250, 250, 0) 240px);
    pointer-events: none;
    z-index: 5;
}

#image-display {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.02);
    filter: saturate(0) blur(4px);
    transition: opacity 2s ease, filter 2s ease, transform 30s linear;
    border: none;
    z-index: 1;
}

#image-display.show {
    opacity: 1;
    transform: scale(1.05);
    filter: saturate(1) blur(0);
    transition: opacity 3s ease-out, filter 3s ease-out, transform 15s cubic-bezier(0.1, 0.8, 0.2, 1);
}

/* Center Overlay Container */
#center-info-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 25px;
    width: 90%;
    max-width: 900px;
    z-index: 100;
    pointer-events: none;
    text-align: center;
}

#caption-display {
    font-family: "Georgia", "Times New Roman", "Noto Serif JP", "YuMincho", "MS Mincho", serif;
    font-size: 2.2rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: #222222;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 2s ease-in-out, transform 2s ease-out;
    text-shadow: 2px 2px 12px rgba(255,255,255,0.95), 0 0 5px rgba(255,255,255,0.6);
    line-height: 1.5;
}

#caption-display.show {
    opacity: 1;
    transform: translateY(0);
}

#catchphrase-display {
    font-family: var(--font-japanese);
    font-size: 2.8rem;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 2s ease-in-out, transform 2s ease-out;
    letter-spacing: 0.25em;
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
    font-weight: 300;
}

#catchphrase-display.show {
    opacity: 1;
    transform: translateY(0);
}

.no-data {
    font-size: 1.2rem;
    color: #666;
    letter-spacing: 0.1em;
}

/* Admin Link slightly visible */
.admin-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: rgba(0, 0, 0, 0.2);
    text-decoration: none;
    font-size: 0.8rem;
    transition: 0.3s;
    font-family: sans-serif;
}
.admin-link:hover {
    color: var(--accent-color);
}

/* --- Admin Page Styles --- */
.admin-body {
    background-color: #f5f5f5;
    padding: 40px 20px;
}

.admin-header {
    text-align: center;
    margin-bottom: 40px;
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--accent-color);
    letter-spacing: 0.1em;
    font-weight: 400;
}

.admin-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: #ffffff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9rem;
}

.form-group input[type="file"],
.form-group input[type="text"],
.form-group input[type="url"] {
    width: 100%;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--border-color);
    color: #1a1a1a;
    font-family: inherit;
    border-radius: 4px;
}

.form-group input[type="file"] {
    padding: 8px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn {
    display: inline-block;
    background: var(--accent-color);
    color: #000;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: background 0.3s;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn-danger {
    background: #8b0000;
    color: #fff;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: normal;
}
.btn-danger:hover {
    background: #660000;
}

.message {
    margin-top: 15px;
    padding: 10px;
    display: none;
    border-radius: 4px;
}
.message.success {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border: 1px solid #2ecc71;
    display: block;
}
.message.error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
    display: block;
}

/* List of uploaded items */
.item-list {
    margin-top: 50px;
}

.item-list h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    font-weight: 300;
}

.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.list-item {
    background: #fafafa;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.list-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.list-item p {
    font-size: 0.9rem;
    margin-bottom: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

#insta-display {
    pointer-events: auto;
    color: #ff6719; /* Substack Brand Orange */
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid #ff6719;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-family: var(--font-japanese);
    letter-spacing: 0.1em;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s ease, opacity 2s ease-in-out, transform 2s ease-out;
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(255, 103, 25, 0.08);
}

#insta-display svg {
    width: 20px;
    height: 20px;
}

#insta-display:hover {
    background: rgba(255, 103, 25, 0.08);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 103, 25, 0.2);
    color: #e0530b; /* Slightly darker orange on hover */
    border-color: #e0530b;
}

#insta-display.show {
    opacity: 1;
    transform: translateY(0);
}

/* --- Site Logo --- */
#site-logo {
    position: absolute;
    top: 65px;
    left: 55px;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: #0a4a8b;
    line-height: 1;
    z-index: 100;
    opacity: 0;
    transform: translateY(0);
    transform-origin: left center;
    animation: fadeInSiteLogo 3.5s ease-out forwards 1.2s;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: default;
    text-transform: uppercase;
    text-shadow: 0 0 8px #ffffff, 0 0 16px #ffffff, 0 0 24px rgba(255,255,255,0.9);
}

#site-logo:hover {
    transform: translateY(-2px);
    color: #06315c;
    text-shadow: 0 0 15px rgba(10, 74, 139, 0.4);
}

/* --- Site Subcopy --- */
#site-subcopy {
    position: absolute;
    top: 112px;
    left: 56px;
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: #0a4a8b;
    line-height: 1;
    z-index: 100;
    opacity: 0;
    transform: translateY(0);
    transform-origin: left center;
    animation: fadeInSiteLogo 3.5s ease-out forwards 1.3s;
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    cursor: default;
    text-transform: uppercase;
    text-shadow: 0 0 8px #ffffff, 0 0 16px #ffffff, 0 0 24px rgba(255,255,255,0.9);
}

#site-logo:hover ~ #site-subcopy,
#site-subcopy:hover {
    color: #06315c;
    text-shadow: 0 0 15px rgba(10, 74, 139, 0.4);
}

@keyframes fadeInSiteLogo {
    to { opacity: 0.9; }
}

/* --- Partners Display --- */
#partners-display {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    z-index: 101;
    display: flex;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeInSiteLogo 3s ease-out forwards 1.8s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

#partners-display .partner-item {
    display: flex;
    align-items: center;
    background: transparent;
    padding: 2px 0;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

#partners-display .partner-item:hover {
    opacity: 0.8;
}

/* --- BGM Toggle --- */
/* --- Bottom Right Controls Container --- */
#bottom-right-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    gap: 10px;
    align-items: center;
}

#bgm-toggle-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    color: #666;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    font-family: var(--font-japanese), sans-serif;
    letter-spacing: 0.05em;
    display: none; /* Shown dynamically via JS */
}

#bgm-toggle-btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

#bgm-toggle-btn.playing {
    color: #ce6e0a; /* Signature TSCC Orange */
    border-color: #ce6e0a;
}

/* Contain Mode (Show Entire Image) Styling */
.view-container.contain-mode {
    background: #111111 !important;
}

.view-container.contain-mode::before,
.view-container.contain-mode::after {
    opacity: 0;
}

.view-container.contain-mode #image-display {
    object-fit: contain;
    background-color: #111111;
    transform: none !important;
}

/* --- Bottom Left Links --- */
#bottom-links {
    position: absolute;
    bottom: 40px;
    left: 50px;
    z-index: 110;
    opacity: 0;
    animation: fadeInLogo 3s ease-in-out forwards 1.5s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.bottom-link-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 10px 24px;
    color: #fff;
    font-family: var(--font-japanese);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    border-radius: 2px; /* Crisp rectangular shape */
    border: 2px solid transparent; /* Enables outline for note without shifting */
    transition: all 0.3s cubic-bezier(0.25, 1.5, 0.5, 1);
}

.bottom-link-btn:hover {
    transform: translateY(-4px) scale(1.05);
}

.bottom-link-btn.note-btn {
    background: #fff;
    color: #111;
    border-color: #111;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Subtle shadow for white */
}

.bottom-link-btn.note-btn:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    background: #fcfcfc;
    color: #111;
}

.bottom-link-btn.fit-btn {
    background: rgba(255, 255, 255, 0.85);
    color: #111;
    border-color: #111;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.bottom-link-btn.fit-btn:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    background: #ffffff;
    color: #111;
}

#business-hours-display {
    position: absolute;
    bottom: 140px; /* Shifted up to clear vertical bottom links */
    left: 50px;
    font-size: 0.85rem;
    font-weight: 300;
    letter-spacing: 0.15em;
    color: var(--text-color);
    text-shadow: 0 0 5px rgba(255,255,255,0.8);
    font-family: 'Cinzel', 'Noto Serif JP', serif;
    z-index: 100;
    opacity: 0;
    animation: fadeInLogo 3s ease-in-out forwards 1.4s;
    transition: all 0.6s ease;
    border-left: 2px solid var(--accent-color);
    padding-left: 12px;
    text-shadow: 0 0 5px rgba(255,255,255,0.8);
}

/* --- Footer Copyright --- */
#footer-copyright-display {
    position: absolute;
    bottom: 15px;
    left: 50px;
    font-size: 0.75rem;
    color: var(--text-color);
    opacity: 0.6;
    z-index: 100;
    pointer-events: none;
    letter-spacing: 0.05em;
    animation: fadeInLogo 3s ease-in-out forwards 1.7s;
    opacity: 0; /* Animated in */
    text-shadow: 0 0 5px rgba(255,255,255,0.8);
}

/* --- Date Display --- */
#date-display {
    font-family: "Georgia", "Times New Roman", "Noto Serif JP", "YuMincho", "MS Mincho", serif;
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.2em;
    color: #666666;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 2s ease-in-out, transform 2s ease-out;
    pointer-events: none;
    text-shadow: 2px 2px 12px rgba(255,255,255,0.95), 0 0 5px rgba(255,255,255,0.6);
}

#date-display.show {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeInLogo {
    to { opacity: 0.95; }
}
/* --- Mobile Device Optimizations --- */
@media (max-width: 768px) {
    /* Main Display */
    #site-logo {
        top: 55px;
        left: 20px;
        font-size: 1.1rem;
        letter-spacing: 0.18em;
    }

    #site-subcopy {
        top: 86px;
        left: 21px;
        font-size: 0.8rem;
        letter-spacing: 0.22em;
    }

    #partners-display {
        top: 0;
        left: 0;
        width: 100%;
        height: 36px;
        gap: 8px;
    }

    #bottom-right-controls {
        bottom: 15px;
        right: 15px;
        gap: 6px;
    }

    #bgm-toggle-btn {
        font-size: 0.7rem;
        padding: 6px 12px;
    }

    #bottom-links {
        bottom: calc(45px + env(safe-area-inset-bottom));
        left: calc(20px + env(safe-area-inset-left));
        gap: 10px;
    }

    .bottom-link-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    #business-hours-display {
        bottom: 145px; /* Shifted up to clear vertical bottom links */
        left: 20px;
        font-size: 0.65rem;
        padding-left: 10px;
        max-width: calc(100vw - 40px);
        line-height: 1.5;
    }

    #footer-copyright-display {
        bottom: 15px;
        left: 20px;
        font-size: 0.6rem;
        max-width: calc(100vw - 110px); /* Leave empty space for the BGM button on the right */
        word-wrap: break-word;
        line-height: 1.2;
    }

    #center-info-container {
        gap: 16px;
    }

    #date-display {
        font-size: 0.95rem;
        letter-spacing: 0.2em;
    }

    #image-display {
        width: 100%;
        height: 100%;
    }
    
    #caption-display {
        font-size: 1.5rem;
        letter-spacing: 0.12em;
        line-height: 1.6;
        text-shadow: 2px 2px 10px rgba(255,255,255,0.95);
    }

    #catchphrase-display {
        font-size: 2.2rem;
        white-space: normal;
        width: 80vw;
    }

    #insta-display {
        font-size: 0.85rem;
        padding: 8px 16px;
    }

    #insta-display svg {
        width: 16px;
        height: 16px;
    }

    /* Admin Panel */
    .admin-wrapper {
        padding: 20px 15px;
        margin: 10px;
    }

    .admin-header h1 {
        font-size: 1.6rem;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .btn {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    
    .list-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
    
    .list-item {
        padding: 10px;
    }
    
    .list-item img {
        height: 120px;
    }
}

@media (max-width: 480px) {
    /* Smaller iPhones, etc */
    #caption-display {
        font-size: 1rem;
        letter-spacing: 0.1em;
        line-height: 1.8;
        padding-left: 8px;
    }
    
    .admin-header h1 {
        font-size: 1.3rem;
    }
    
    .list-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
}

/* --- Mobile Landscape / Low Screen Height Optimizations --- */
@media (max-height: 550px) {
    #site-logo {
        top: 45px;
        left: 20px;
        font-size: 1rem;
    }
    
    #site-subcopy {
        top: 69px;
        left: 21px;
        font-size: 0.45rem;
    }
    
    #image-badge {
        top: 42px;
        right: 15px;
        width: 60px;
        height: 60px;
    }
    
    #bottom-links {
        bottom: calc(15px + env(safe-area-inset-bottom));
        left: calc(20px + env(safe-area-inset-left));
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }
    
    .bottom-link-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    #business-hours-display {
        position: absolute;
        bottom: 15px;
        left: 170px;
        font-size: 0.65rem;
        padding-left: 10px;
        border-left: 2px solid var(--accent-color);
        margin-bottom: 3px;
        max-width: calc(100vw - 320px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #footer-copyright-display {
        position: absolute;
        bottom: 18px;
        left: auto;
        right: 120px;
        font-size: 0.6rem;
        text-align: right;
        max-width: calc(100vw - 450px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    #center-info-container {
        gap: 12px;
        width: 80%;
    }
    
    #caption-display {
        font-size: 1.25rem;
        letter-spacing: 0.1em;
        line-height: 1.4;
        text-shadow: 2px 2px 10px rgba(255,255,255,0.95);
    }
    
    #catchphrase-display {
        font-size: 1.8rem;
        white-space: normal;
        width: 75vw;
        line-height: 1.3;
    }
    
    #insta-display {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    #insta-display svg {
        width: 14px;
        height: 14px;
    }
    
    #bgm-toggle-btn {
        bottom: 15px;
        right: 15px;
        font-size: 0.7rem;
        padding: 6px 12px;
    }
}
