/* 基本設定とレイアウト */

/* リセット & 基本設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* html要素の背景設定（iPhone/Safari対策） */
html {
    background-color: #667eea; /* フォールバック色 */
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: scroll;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center center;
    min-height: 100%;
}

/* ダークモード切り替えアニメーション */
body {
    transition: background 0.5s ease, color 0.3s ease;
}
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    /* iPhone Safari対応の背景設定 */
    background-color: #667eea; /* フォールバック色 */
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    /* Webkit向けの追加設定 */
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    /* iPhone用設定 */
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* 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);
}
nav.page-nav {
    margin: 1rem 0 0.5rem 0;
}
.nav-btn {
    display: inline-block;
    background: #fff;
    color: #667eea;
    border: 1px solid #fff;
    border-radius: 20px;
    padding: 0.4rem 1.2rem;
    margin: 0 0.3rem;
    font-size: 1rem;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(102,126,234,0.08);
    transition: background 0.2s, color 0.2s;
}
.nav-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #fff;
}

/* iPhone/Safari特別対応 */
@supports (-webkit-appearance: none) {
    body {
        background-attachment: scroll; /* iOSでfixedが効かない場合の対策 */
        background-size: 100% 100%;
        min-height: -webkit-fill-available;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
    /* iPhone用最小幅設定 */
    min-width: 0;
    width: 100%;
}

/* ヘッダー */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ヘッダーコントロール */
.header-controls {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.control-btn i {
    font-size: 1rem;
}

.control-btn span {
    font-size: 0.8rem;
}

/* フッター */
footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    text-align: center;
    color: white;
    padding: 25px 20px;
    margin: 30px auto 20px;
    max-width: 1200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

footer p {
    margin: 0;
    line-height: 1.6;
}

footer p:first-child {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

footer p:last-child {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 背景アニメーション用スタイル */
#backgroundCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.8;
}

/* モーション軽減設定を尊重 */
@media (prefers-reduced-motion: reduce) {
    #backgroundCanvas {
        display: none !important;
    }
}
