/* 京都タワー SANDO バル アンケートアプリ - Liquid Glass モバイルファースト版 */

:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --accent-color: #FF6B6B;
    --text-color: #1d1d1f;
    --glass-background: rgba(255, 255, 255, 0.15); /* より透明に */
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: rgba(0, 0, 0, 0.2);
    --background: linear-gradient(135deg, rgba(102, 126, 234, 0.6) 0%, rgba(118, 75, 162, 0.6) 100%);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* フォールバック背景色 */
    background-color: #667eea;
    background: 
        var(--background),
                    url('./assets/images/kyoto-tower-bg.jpg') center/cover no-repeat,
        linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-blend-mode: overlay;
    color: var(--text-color);
    min-height: 100vh;
    min-height: 100dvh; /* 動的ビューポート高さ */
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden; /* 横スクロール防止 */
    position: relative;
    
    /* iOS Safe Areaサポート */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* 言語切り替えセレクトボックス */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    /* iOS Safe Areaサポート */
    top: calc(20px + env(safe-area-inset-top));
    right: calc(20px + env(safe-area-inset-right));
}

.language-selector select {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    appearance: none;
    min-width: 120px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* カスタム矢印 */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 32px;
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 
        0 0 0 3px rgba(0, 122, 255, 0.2),
        0 6px 20px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.language-selector select option {
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    padding: 8px 12px;
}

/* 京都タワー背景画像のオーバーレイ */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.4); /* ブルーオーバーレイ */
    z-index: -1;
    pointer-events: none;
}

/* フルスクリーン背景コンテナ */
.full-screen-container {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 16px; /* 周りに余白 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* フォームカード */
.form-card {
    width: 100%;
    max-width: 500px; /* 最大幅を制限 */
    background: var(--glass-background);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 24px; /* カード風の角丸 */
    padding: 24px 20px 32px 20px;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.form-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    pointer-events: none;
}

/* フォームコンテンツエリア */
form {
    flex: 1;
    width: 100%;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin: 20px 0 8px 0;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 32px;
    font-size: 1rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* Liquid Glass フォーム要素 - モバイルファースト */
input[type="text"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 18px 20px; /* タッチターゲット拡大 */
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    font-size: 16px; /* iOSズーム防止 */
    font-weight: 500;
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.3); /* より不透明に */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    min-height: 56px; /* タッチターゲット推奨サイズ */
    touch-action: manipulation;
    position: relative;
}

/* selectのカスタムスタイリング */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 16px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 48px;
    cursor: pointer;
}

/* Liquid Glass フォーカスエフェクト */
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 
        0 0 0 3px rgba(0, 122, 255, 0.2),
        0 8px 24px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Liquid Glass ボタン */
button {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px 40px; /* タッチターゲット拡大 */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    display: block;
    margin: 32px auto 20px auto;
    min-width: 240px; /* モバイルファースト */
    min-height: 64px; /* タッチターゲット拡大 */
    box-shadow: 
        0 8px 24px rgba(0, 122, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 
        0 4px 12px rgba(0, 122, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Liquid Glass ガチャ結果エリア - 京都タワーテーマ */
#gacha-result {
    margin-top: 24px;
    padding: 24px 16px;
    background: linear-gradient(135deg, rgba(220, 38, 27, 0.3), rgba(255, 140, 0, 0.3)); /* 京都タワーの赤とオレンジ */
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    text-align: center;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    display: none;
    box-shadow: 
        0 12px 32px rgba(220, 38, 27, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#gacha-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 16px;
    margin: 20px auto;
    display: block;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* モバイルファースト レスポンシブ設計 */

/* 小さなモバイル (320px - 480px) - カードスタイル */
@media (max-width: 480px) {
    .language-selector {
        top: calc(12px + env(safe-area-inset-top));
        right: calc(12px + env(safe-area-inset-right));
    }
    
    .language-selector select {
        font-size: 12px;
        padding: 6px 8px;
        min-width: 100px;
        padding-right: 28px;
        background-size: 14px;
        background-position: right 6px center;
    }
    
    .full-screen-container {
        padding: 12px;
    }
    
    .form-card {
        padding: 20px 16px 28px 16px;
        border-radius: 20px;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.6rem;
        margin: 12px 0 6px 0;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    input[type="text"],
    input[type="email"],
    textarea,
    select {
        padding: 16px 16px;
        font-size: 16px; /* iOSズーム防止 */
        border-radius: 14px;
    }
    
    button {
        padding: 16px 24px;
        min-width: 100%;
        min-height: 56px;
        font-size: 1rem;
        margin: 20px auto 12px auto;
    }
    
    #gacha-result {
        margin-top: 16px;
        padding: 20px 12px;
        border-radius: 16px;
    }
}

/* タブレット (769px - 1024px) - カードスタイル */
@media (min-width: 769px) and (max-width: 1024px) {
    .full-screen-container {
        padding: 24px;
    }
    
    .form-card {
        padding: 32px 28px 40px 28px;
        max-width: 600px;
    }
    
    h1 {
        font-size: 2.2rem;
        margin: 24px 0 12px 0;
    }
    
    .subtitle {
        font-size: 1.1rem;
        margin-bottom: 36px;
    }
    
    button {
        min-width: 320px;
        margin: 36px auto 20px auto;
    }
    
    #gacha-result {
        margin-top: 28px;
        padding: 28px 20px;
    }
}

/* デスクトップ (1025px+) - カードスタイル（中央集約） */
@media (min-width: 1025px) {
    .full-screen-container {
        padding: 40px;
    }
    
    .form-card {
        padding: 48px 40px 56px 40px;
        max-width: 700px;
        border-radius: 28px;
    }
    
    h1 {
        font-size: 2.4rem;
        margin: 32px 0 16px 0;
    }
    
    .subtitle {
        font-size: 1.2rem;
        margin-bottom: 44px;
    }
    
    .form-group {
        margin-bottom: 28px;
    }
    
    input[type="text"],
    input[type="email"],
    textarea,
    select {
        padding: 20px 24px;
        font-size: 1.1rem;
        border-radius: 18px;
    }
    
    button {
        min-width: 360px;
        min-height: 72px;
        font-size: 1.2rem;
        margin: 44px auto 28px auto;
    }
    
    #gacha-result {
        margin-top: 36px;
        padding: 36px 28px;
        border-radius: 24px;
    }
}

/* GPU加速とパフォーマンス最適化 */
.form-card,
input[type="text"],
input[type="email"],
textarea,
select,
button,
#gacha-result {
    will-change: transform;
    transform: translateZ(0); /* GPU層作成 */
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #ffffff;
        --glass-background: rgba(0, 0, 0, 0.3);
        --glass-border: rgba(255, 255, 255, 0.2);
    }
}

/* アクセシビリティ向上 */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    .form-card,
    input[type="text"],
    input[type="email"],
    textarea,
    select,
    button,
    #gacha-result {
        will-change: auto;
        transform: none;
    }
}

/* 高解像度ディスプレイ対応 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .form-card {
        backdrop-filter: blur(28px);
        -webkit-backdrop-filter: blur(28px);
    }
}