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

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #ffffff;
    background: #171921;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: #171921;
    color: #ffffff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.nav-brand h1 {
    font-size: 1.5rem;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #ffffff;
    margin: 3px 0;
    transition: 0.3s;
}

.nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2F3872;
    display: none;
    flex-direction: column;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.nav-menu.active {
    display: flex;
}

.nav-menu a {
    color: #ffffff;
    text-decoration: none;
    padding: 1rem 20px;
    border-bottom: 1px solid #171921;
    transition: background 0.3s;
}

.nav-menu a:hover {
    background: #506881;
}

main {
    margin-top: 70px;
}

.hero {
    background: linear-gradient(135deg, #2F3872 0%, #506881 100%);
    color: #ffffff;
    min-height: 50vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 20px;
}

.hero-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-button {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.cta-button:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.section {
    padding: 4rem 0;
}

.section:nth-child(even) {
    background: #171921;
}

.section h2 {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: #ffffff;
}

.card {
    background: #2F3872;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    margin: 2rem 0;
    text-align: center;
}

.service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.service-card {
    background: #2F3872;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    text-align: center;
    transition: transform 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
}

.service-card h3 {
    color: #ffffff;
    margin-bottom: 1rem;
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 15px;
    margin-bottom: 1rem;
    border: 1px solid #506881;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
    background: #2F3872;
    color: #ffffff;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #8AD2A0;
    box-shadow: 0 0 0 2px rgba(138, 210, 160, 0.2);
}

.contact-form button {
    background: #8AD2A0;
    color: #171921;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
    width: 100%;
}

.contact-form button:hover {
    background: #B5A0BF;
}

footer {
    background: #171921;
    color: #ffffff;
    text-align: center;
    padding: 2rem 0;
}

/* タブレット以上のサイズ */
@media (min-width: 768px) {
    .hero-content h2 {
        font-size: 3rem;
    }
    
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-menu {
        position: static;
        display: flex;
        flex-direction: row;
        background: transparent;
        box-shadow: none;
    }
    
    .nav-menu a {
        border-bottom: none;
        padding: 0 1rem;
    }
    
    .menu-toggle {
        display: none;
    }
    
    .contact-form button {
        width: auto;
    }
}

/* デスクトップサイズ */
@media (min-width: 1024px) {
    .service-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .hero-content h2 {
        font-size: 3.5rem;
    }
}

/* アニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.service-card {
    animation: fadeInUp 0.6s ease-out;
}

/* スクロール時のスムーズな動作 */
html {
    scroll-behavior: smooth;
}

/* 画像アップロード関連 */
.upload-area {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

#imageInput {
    display: none;
}

.upload-label {
    display: block;
    background: linear-gradient(135deg, #2F3872 0%, #506881 100%);
    color: #ffffff;
    padding: 3rem 2rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    border: 3px dashed rgba(255, 255, 255, 0.3);
    margin-bottom: 2rem;
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(47, 56, 114, 0.5);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-label p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.upload-hint {
    opacity: 0.8;
    font-size: 0.9rem !important;
}

.image-preview {
    display: none;
    margin-top: 2rem;
}

.image-preview.active {
    display: block;
}

.image-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* 変換パネル */
.transform-panel {
    max-width: 800px;
    margin: 0 auto;
}

.prompt-input-section {
    background: #2F3872;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    margin-bottom: 2rem;
}

.prompt-input-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #ffffff;
}

#promptInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #506881;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 0.1rem;
    transition: border-color 0.3s;
    background: #171921;
    color: #ffffff;
}

#promptInput:focus {
    outline: none;
    border-color: #8AD2A0;
    box-shadow: 0 0 0 3px rgba(138, 210, 160, 0.2);
}

.process-button {
    background: linear-gradient(135deg, #8AD2A0 0%, #B5A0BF 100%);
    color: #171921;
    border: none;
    padding: 15px 30px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    box-shadow: 0 4px 15px rgba(138, 210, 160, 0.3);
    font-weight: bold;
}

.process-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 210, 160, 0.4);
}

.process-button:disabled {
    background: #506881;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    color: #ffffff;
    opacity: 0.5;
}

/* 結果グリッド */
.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.result-card {
    background: #2F3872;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    text-align: center;
}

.result-card h3 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.image-container {
    min-height: 200px;
    background: #171921;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.image-container img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: contain;
}

/* transformedCaption用のスタイル */
#transformedCaption {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ローディングスピナー */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-spinner p {
    color: #ffffff;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.9),
                 0 2px 4px rgba(0, 0, 0, 0.8),
                 0 8px 24px rgba(0, 0, 0, 0.7);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #506881;
    border-top: 4px solid #8AD2A0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 8px rgba(138, 210, 160, 0.9))
            drop-shadow(0 0 16px rgba(138, 210, 160, 0.7))
            drop-shadow(0 4px 12px rgba(0, 0, 0, 1))
            drop-shadow(0 8px 24px rgba(0, 0, 0, 0.9));
}

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

/* キャプションパネル */
.caption-panel {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.caption-results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.caption-card {
    background: #2F3872;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.caption-card h3 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.caption-text {
    min-height: 100px;
    padding: 1.5rem;
    background: #171921;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.6;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.caption-text.has-content {
    text-align: left;
    justify-content: flex-start;
    align-items: flex-start;
}

/* キャプション表示スタイル */
.caption-english {
    font-style: italic;
    color: #B5A0BF;
    margin-bottom: 0.5rem;
    border-left: 3px solid #8AD2A0;
    padding-left: 1rem;
}

.caption-japanese {
    color: #ffffff;
    font-weight: 500;
    padding-left: 1rem;
}

/* タブレット以上のサイズでの調整 */
@media (min-width: 768px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .caption-results {
        grid-template-columns: 1fr;
    }
    
    .process-button {
        width: auto;
        min-width: 250px;
    }
}

/* エラー状態 */
.error-message {
    background: #e74c3c;
    color: white;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    text-align: center;
}

/* 成功状態 */
.success-message {
    background: #8AD2A0;
    color: #171921;
    padding: 1rem;
    border-radius: 5px;
    margin: 1rem 0;
    text-align: center;
    font-weight: bold;
}

/* パラメータセクション */
.parameters-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #171921;
    border-radius: 10px;
    border: 1px solid #506881;
}

.parameter-group {
    margin-bottom: 0.5rem;
}

.parameter-group:last-child {
    margin-bottom: 0;
}

.parameter-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #ffffff;
    font-size: 0.95rem;
}

.parameter-hint {
    font-size: 0.85rem;
    color: #B5A0BF;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Seed入力 */
#seedInput {
    width: 100%;
    padding: 10px;
    border: 1px solid #506881;
    border-radius: 5px;
    font-size: 1rem;
    background: #2F3872;
    color: #ffffff;
}

.random-btn {
    background: #8AD2A0;
    color: #171921;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
    font-weight: bold;
}

.random-btn:hover {
    background: #B5A0BF;
}

/* 強度コントロール */
.strength-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 0.5rem;
}

#strengthSlider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #506881;
    outline: none;
    -webkit-appearance: none;
}

#strengthSlider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8AD2A0;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#strengthSlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8AD2A0;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#strengthInput {
    width: 80px;
    padding: 8px;
    border: 1px solid #506881;
    border-radius: 5px;
    text-align: center;
    font-size: 0.9rem;
    background: #2F3872;
    color: #ffffff;
}

.strength-label {
    font-weight: bold;
    color: #8AD2A0;
    font-size: 0.95rem;
    margin-left: 0.5rem;
}

/* ギャラリーグリッド */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.gallery-item {
    background: #2F3872;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: transform 0.3s;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-image-container {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.gallery-caption {
    padding: 1rem;
    color: #ffffff;
}

.gallery-caption-jp {
    font-size: 0.9em;
    margin-bottom: 0.5rem;
}

.gallery-caption-en {
    font-size: 0.75em;
    color: #B5A0BF;
    margin-bottom: 0.75rem;
}

.gallery-info {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #506881;
}

.gallery-info-item {
    font-size: 0.7em;
    color: #B5A0BF;
    margin-bottom: 0.25rem;
}

.gallery-info-item strong {
    color: #8AD2A0;
}

.gallery-download-btn {
    margin-top: 0.75rem;
    width: 100%;
    padding: 0.5rem;
    background: #8AD2A0;
    color: #171921;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85em;
    transition: background 0.3s;
}

.gallery-download-btn:hover {
    background: #B5A0BF;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .strength-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    #strengthInput {
        width: 100%;
    }

    .strength-label {
        text-align: left;
    }

    #seedInput {
        width: calc(100% - 90px);
    }

    .random-btn {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}