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

body {
    font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* レイアウトラッパー - 3カラム構成 */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* サイドバー広告 */
.sidebar-left,
.sidebar-right {
    width: 200px;
    flex-shrink: 0;
    padding: 20px 10px;
    display: none; /* デフォルトは非表示（スマホ対応） */
}

.sidebar-ad {
    position: sticky;
    top: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.container {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
}

/* 言語切り替えボタンのスタイル */
.language-switcher {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

#languageSwitch {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#languageSwitch:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

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.1rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.input-section {
    margin-bottom: 30px;
}

#promptInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
    margin-bottom: 15px;
}

#promptInput:focus {
    outline: none;
    border-color: #667eea;
}

#generateBtn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#generateBtn:hover {
    transform: translateY(-2px);
}

#generateBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.loading-section {
    text-align: center;
    padding: 40px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.result-section {
    text-align: center;
}

.result-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

#generatedImage {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.image-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.image-actions button {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.image-actions button:hover {
    background: #667eea;
    color: white;
}

.error-section {
    background: #fff5f5;
    border: 2px solid #feb2b2;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

#errorMessage {
    color: #c53030;
    margin-bottom: 15px;
    font-weight: bold;
}

.error-section button {
    padding: 8px 16px;
    background: #c53030;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* AdSense広告用スタイル */
.ad-container {
    margin: 20px 0;
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.ad-container .adsbygoogle {
    display: block;
    margin: 0 auto;
}

/* ヘッダー下バナー広告 */
.header-banner-ad {
    margin: 20px 0;
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

/* 画像生成完了後の広告 */
.completion-ad {
    margin: 20px 0;
    text-align: center;
    background: #f0f8ff;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #cce7ff;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 右サイドバー：スクロール追従広告 */
.sticky-ad {
    position: sticky;
    top: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e9ecef;
    text-align: center;
    margin-bottom: 20px;
}

/* フッター手前広告 */
.footer-before-ad {
    background: #fff3cd;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #ffeaa7;
    text-align: center;
    margin-top: 30px;
}

/* visually-hiddenクラス（スクリーンリーダー用） */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* コンテンツ拡充セクション */
.content-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-top: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.usage-guide h2,
.faq-section h2 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.usage-guide ol {
    padding-left: 20px;
    line-height: 1.8;
}

.usage-guide li {
    margin-bottom: 10px;
}

.faq-section {
    margin-top: 30px;
}

.faq-section details {
    margin-bottom: 15px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.faq-section summary {
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: bold;
    border-bottom: 1px solid #e1e5e9;
    transition: background-color 0.3s ease;
}

.faq-section summary:hover {
    background: #e9ecef;
}

.faq-section details[open] summary {
    background: #667eea;
    color: white;
}

.faq-section details p {
    padding: 15px 20px;
    margin: 0;
    line-height: 1.6;
}

/* PC表示：サイドバー広告を表示 */
@media (min-width: 1200px) {
    .sidebar-left,
    .sidebar-right {
        display: block;
    }
}

/* タブレット・スマホ表示 */
@media (max-width: 1199px) {
    .layout-wrapper {
        flex-direction: column;
    }
    
    .sidebar-left,
    .sidebar-right {
        display: none; /* サイドバー広告は非表示 */
    }
    
    .container {
        max-width: 100%;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    /* モバイルでの言語切り替えボタン調整 */
    .language-switcher {
        position: static;
        text-align: center;
        margin-bottom: 15px;
    }
    
    #languageSwitch {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    main {
        padding: 20px;
    }
    
    .image-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .image-actions button {
        width: 100%;
        max-width: 200px;
    }
    
    .ad-container {
        margin: 15px 0;
        padding: 10px;
    }
    
    .header-banner-ad {
        margin: 15px 0;
        padding: 10px;
    }
    
    .completion-ad {
        margin: 15px 0;
        padding: 10px;
    }
}