/* CSS Variables */
:root {
    --primary-purple: #6B46C1;
    --secondary-purple: #8B5CF6;
    --accent-gold: #FFD700;
    --dark-purple: #4C1D95;
    --light-purple: #DDD6FE;
    --background-dark: #1F1B24;
    --text-light: #F3F4F6;
    --text-dark: #374151;
    --border-color: #4B5563;
    --gradient-bg: linear-gradient(135deg, #6B46C1 0%, #8B5CF6 50%, #A855F7 100%);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
    background-image: url('x_image/wall_image.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 27, 36, 0.8);
    z-index: -1;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid var(--accent-gold);
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-gold);
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.mode-toggle {
    display: flex;
    gap: 10px;
}

.mode-btn {
    padding: 12px 24px;
    background: var(--primary-purple);
    color: var(--text-light);
    border: 2px solid var(--accent-gold);
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: var(--secondary-purple);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.mode-btn.active {
    background: var(--accent-gold);
    color: var(--dark-purple);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* Calendar Section */
.calendar-section {
    background: rgba(107, 70, 193, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    height: 800px;
    display: flex;
    flex-direction: column;
}

.calendar-section h2 {
    color: var(--accent-gold);
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
}

.calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.calendar-nav-btn {
    background: var(--primary-purple);
    color: var(--text-light);
    border: 1px solid var(--accent-gold);
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.calendar-nav-btn:hover {
    background: var(--secondary-purple);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.3);
}

.calendar-nav-btn:disabled {
    background: var(--border-color);
    color: #9CA3AF;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Month picker modal */
.month-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.month-picker-content {
    background: var(--primary-purple);
    border: 2px solid var(--accent-gold);
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.month-picker-header {
    text-align: center;
    color: var(--accent-gold);
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
}

.month-picker-years {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.year-btn {
    background: var(--secondary-purple);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.year-btn:hover, .year-btn.active {
    background: var(--accent-gold);
    color: var(--dark-purple);
    border-color: var(--accent-gold);
}

.month-picker-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.month-btn {
    background: var(--secondary-purple);
    color: var(--text-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.month-btn:hover, .month-btn.active {
    background: var(--accent-gold);
    color: var(--dark-purple);
    border-color: var(--accent-gold);
}

.month-picker-close {
    width: 100%;
    background: var(--border-color);
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.month-picker-close:hover {
    background: var(--secondary-purple);
}

#calendar-month-year {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-gold);
    text-align: center;
    min-width: 120px;
}

.month-selector {
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.month-selector:hover {
    background: var(--secondary-purple);
    border-color: var(--accent-gold);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-content: start;  /* グリッドアイテムを上詰めに */
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 0;
    min-height: 200px;  /* 最小高さ */
    max-height: 600px;  /* 最大高さ（スクロール可能） */
}

.calendar-grid::-webkit-scrollbar {
    width: 8px;
}

.calendar-grid::-webkit-scrollbar-track {
    background: var(--background-dark);
    border-radius: 10px;
}

.calendar-grid::-webkit-scrollbar-thumb {
    background: var(--accent-gold);
    border-radius: 10px;
}

.calendar-grid::-webkit-scrollbar-thumb:hover {
    background: #FFC107;
}

.calendar-day {
    background: var(--primary-purple);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80px;
}

.calendar-day:hover {
    border-color: var(--accent-gold);
    background: var(--secondary-purple);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.calendar-day.selected {
    border-color: var(--accent-gold);
    background: var(--accent-gold);
    color: var(--dark-purple);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.day-number {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 5px;
}

.day-label {
    font-size: 12px;
    opacity: 0.8;
}

/* Video Section */
.video-section {
    background: rgba(107, 70, 193, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    height: 800px;
    display: flex;
    flex-direction: column;
}

.video-section h2 {
    color: var(--accent-gold);
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
}

#video-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 20px;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-player {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
}

.video-player.active {
    display: block;
}

#video-2d-element {
    width: 100%;
    height: 500px;
    background: #000;
    outline: none;
    display: block;
    border-radius: 10px;
    object-fit: contain;
}

/* メディアコントロールはブラウザデフォルトを使用 */

#video-vr {
    border: 2px solid var(--accent-gold);
    border-radius: 10px;
}

#video-vr #vr-scene {
    width: 100%;
    height: 400px;
    border-radius: 10px;
}

/* VRモード時はフルスクリーン */
#video-vr #vr-scene.fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0;
}

.video-info {
    text-align: center;
    padding: 20px;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 10px;
    margin-top: 20px;
    flex-shrink: 0;
    min-height: 120px;
}

#video-title {
    color: var(--accent-gold);
    margin-bottom: 10px;
    font-size: 18px;
}

#video-date {
    opacity: 0.8;
    font-size: 14px;
}

/* Products Section */
.products-section {
    grid-column: 1 / -1;
    background: rgba(107, 70, 193, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
}

.products-section h2 {
    color: var(--accent-gold);
    margin-bottom: 20px;
    text-align: center;
    font-size: 20px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--primary-purple);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 450px;
}

.product-card:hover {
    border-color: var(--accent-gold);
    background: var(--secondary-purple);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.3);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 15px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
}

.product-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-light);
    margin-bottom: 15px;
    line-height: 1.4;
    height: 112px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    flex: 1;
}

.product-link {
    display: inline-block;
    padding: 10px 20px;
    background: var(--accent-gold);
    color: var(--dark-purple);
    text-decoration: none;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    align-self: center;
    margin-top: 10px;
}

.product-link:hover {
    background: #FFC107;
    transform: scale(1.05);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    border-top: 2px solid var(--accent-gold);
    margin-top: 30px;
    opacity: 0.7;
}

/* Responsive Design */

/* PC用設定（1024px以上） */
@media (min-width: 1024px) {
    body {
        min-width: 1000px;
    }
    
    #app {
        min-width: 1000px;
    }
    
    .main-content {
        min-width: 900px;
    }
}

/* タブレット用（768px以下） */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .calendar-section {
        height: auto;
        min-height: 400px;
    }
    
    .video-section {
        height: auto;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
        max-height: 400px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* スマートフォン用（480px以下） */
@media (max-width: 480px) {
    #app {
        padding: 0 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .mode-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .mode-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    /* 年齢確認モーダルの調整 */
    .age-modal-content {
        padding: 30px 20px;
        margin: 20px;
        max-width: calc(100% - 40px);
    }
    
    .age-question {
        font-size: 24px;
    }
    
    .age-warning {
        font-size: 16px;
    }
    
    .age-modal-buttons {
        flex-direction: column;
        gap: 20px;
    }
    
    .age-btn {
        width: 100%;
        min-width: auto;
    }
    
    /* カレンダーナビゲーション */
    .calendar-navigation {
        gap: 5px;  /* 間隔を狭める */
    }
    
    .calendar-nav-btn {
        font-size: 10px;  /* 文字を小さく */
        padding: 6px 8px;  /* パディングを調整 */
    }
    
    #calendar-month-year {
        font-size: 14px;  /* 月表示も小さく */
        min-width: 80px;  /* 最小幅を狭める */
    }
    
    /* 動画セクション */
    #video-container {
        height: 300px;
    }
    
    #video-2d-element {
        height: 300px;
    }
    
    /* 商品カード */
    .product-card {
        height: auto;
        min-height: 350px;
    }
}

/* 年齢確認モーダル */
.age-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(31, 27, 36, 0.98);
    backdrop-filter: blur(15px);
}

.age-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

.age-modal-content {
    background: linear-gradient(135deg, #4C1D95 0%, #6B46C1 25%, #8B5CF6 50%, #A855F7 100%);
    border: 3px solid var(--accent-gold);
    border-radius: 25px;
    padding: 60px 80px;
    text-align: center;
    box-shadow: 
        0 0 100px rgba(255, 215, 0, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.age-modal-content::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.age-warning {
    color: #FFD700;
    font-size: 18px;
    margin-bottom: 30px;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.age-question {
    color: #FFFFFF;
    font-size: 32px;
    margin: 40px 0;
    font-weight: bold;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.age-modal-buttons {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 50px;
    position: relative;
    z-index: 1;
}

.age-btn {
    padding: 18px 60px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    text-transform: none;
    letter-spacing: 2px;
}

.age-btn-yes {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1F1B24;
    box-shadow: 
        0 10px 30px rgba(255, 215, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.age-btn-yes:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 
        0 15px 40px rgba(255, 215, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.age-btn-no {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.age-btn-no:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-3px) scale(1.05);
}

/* メインコンテンツを非表示（年齢確認前） */
body.age-verification-pending #app {
    filter: blur(20px);
    pointer-events: none;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent-gold);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notification - Hidden */
.notification {
    display: none;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* VR Mode Specific */
a-scene {
    border-radius: 10px;
}

/* VRプレイヤーのサイズ設定 */
#video-vr a-scene {
    height: 500px;
    width: 100%;
    display: block;
    position: relative;
}

/* VRモード時は制約を解除 */
#video-vr a-scene.a-fullscreen {
    height: 100vh !important;
    width: 100vw !important;
}

/* A-FrameのデフォルトVRボタンを非表示（一時的） */
.a-enter-vr-button {
    display: none !important;
}

/* VR機能復元時は以下のコメントを解除 */
/*
.a-enter-vr-button {
    background: var(--accent-gold) !important;
    color: var(--dark-purple) !important;
    border: 2px solid var(--primary-purple) !important;
}

.a-enter-vr-button:hover {
    background: #FFC107 !important;
}
*/

/* VR外部コントロール */
.vr-external-controls {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.vr-control-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.vr-btn {
    background: var(--primary-purple);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.vr-btn:hover {
    background: var(--secondary-purple);
}

.vr-btn:active {
    transform: scale(0.95);
}

.vr-volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.vr-volume-control input[type="range"] {
    width: 100px;
}

.vr-mode-toggle {
    margin-left: 20px;
}

.vr-mode-toggle label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--text-light);
}

.vr-mode-toggle input[type="checkbox"] {
    cursor: pointer;
}

.vr-seek-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

#vr-seek-slider {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

#vr-seek-slider::-webkit-slider-thumb {
    appearance: none;
    width: 15px;
    height: 15px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
}

#vr-seek-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: var(--accent-gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.vr-time-display {
    color: var(--text-light);
    font-size: 14px;
    white-space: nowrap;
}