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

html {
    margin: 0;
    padding: 0;
    height: auto;
    min-height: auto;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    height: auto;
    min-height: auto;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* ページラッパー：コンテンツを上に配置 */
.page-wrapper {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start;
    align-items: center;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    padding: 0 20px;
    min-height: auto;
    gap: 0;
    box-sizing: border-box;
}

/* container-wrapper：コンテンツをラップ */
.container-wrapper {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    margin: 0 auto;
    padding: 0;
    position: relative;
}


.container {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 40px;
    text-align: center;
    margin: 0;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 8px;
    margin-top: 0;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 8px;
    margin-top: 0;
}

.security-badge {
    font-size: 0.95em;
    opacity: 0.85;
    margin-top: 8px;
    margin-bottom: 0;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

main {
    padding: 30px 40px;
    min-height: 400px;
}

.upload-section {
    margin-bottom: 40px;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* モデル選択 */
.model-selector {
    margin-bottom: 30px;
}

.model-selector label {
    display: block;
    margin-bottom: 8px;
    margin-top: 0;
    font-weight: 600;
    color: #555;
}

.model-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.model-select:hover {
    border-color: #667eea;
}

.model-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.model-description {
    margin-top: 8px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 6px;
    color: #666;
    font-size: 0.9em;
}

/* ファイルアップロードエリア */
.file-upload-area {
    position: relative;
    margin-bottom: 20px;
}

#file-input {
    display: none;
}

.upload-label {
    display: block;
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-label:hover {
    border-color: #667eea;
    background: #f0f0ff;
}

.upload-label.dragover {
    border: 3px dashed #667eea !important;
    background: #e8eaff !important;
}

.file-upload-area.dragover {
    border: none;
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.upload-text {
    color: #666;
}

.upload-text strong {
    display: block;
    color: #333;
    font-size: 1.1em;
    margin-bottom: 5px;
}

/* ファイルリスト */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 8px;
    margin-top: 0;
}

.file-name {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.file-size {
    color: #666;
    font-size: 0.9em;
    margin-left: 10px;
}

.remove-file {
    background: #ff4444;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.remove-file:hover {
    background: #cc0000;
}

/* アップロードボタン */
.upload-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.upload-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.upload-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 結果セクション */
.results-section {
    display: none !important; /* 初期状態は非表示 */
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #eee;
}

.result-item {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

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

.result-filename {
    font-weight: 600;
    color: #333;
}

.result-meta {
    font-size: 0.9em;
    color: #666;
}

.result-text {
    background: white;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
}

.download-btn {
    margin-top: 10px;
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}

.download-btn:hover {
    background: #5568d3;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
}

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

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

/* フッター */
footer {
    margin-bottom: 0; /* フッター下部の余白を削除 */
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* エラーメッセージ */
.error-message {
    background: #ffe6e6;
    color: #cc0000;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #cc0000;
}

/* 完了メッセージ */
.completion-message {
    background: #e6f7e6;
    color: #006600;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid #00cc00;
    text-align: center;
}

.completion-message p {
    margin: 0;
    font-size: 1.1em;
}

/* 出力形式選択セクション */
.output-format-section {
    margin-bottom: 40px;
}

/* 処理タイプ選択セクション */
.process-type-section {
    margin-bottom: 40px;
    display: block !important;
    visibility: visible !important;
}

.process-type-section h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.8em;
    text-align: center;
}

.process-type-section .section-description {
    color: #666;
    font-size: 1em;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.6;
}

.process-type-cards {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.format-icon .file-icon.audio,
.process-type-card .file-icon.audio,
.process-type-card .format-icon .file-icon.audio {
    background: #ff6b6b !important;
    font-size: 0.85em !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-weight: bold !important;
    min-width: 50px !important;
    text-align: center !important;
}

.format-cards {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
    align-items: stretch;
    visibility: visible !important;
    opacity: 1 !important;
}

.format-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    transition: all 0.3s ease;
    display: flex !important;
    flex-direction: column;
    height: 100%;
    min-height: 300px;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ランディングページ（index.html）のカードはリンクがクリック可能なように */
.process-type-card {
    cursor: default;
    pointer-events: auto;
}

.process-type-card .format-select-btn,
.process-type-card .process-type-select-btn {
    cursor: pointer !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
    display: inline-block !important;
    width: 100%;
    text-align: center;
}

.format-card:hover {
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-5px);
}

.format-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.file-icon {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: bold;
    color: white;
    min-width: 50px;
    text-align: center;
    display: inline-block;
}

.file-icon.pdf {
    background: #dc3545;
}

.file-icon.img {
    background: #ff9800;
}

.file-icon.audio {
    background: #ff6b6b !important;
    font-size: 0.85em !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-weight: bold !important;
    min-width: 50px !important;
    text-align: center !important;
    display: inline-block !important;
}

.file-icon.txt {
    background: #17a2b8;
}

.file-icon.excel {
    background: #28a745;
}

.file-icon.word {
    background: #007bff;
}

.file-icon.pdf-out {
    background: #dc3545;
}

.arrow {
    font-size: 1.5em;
    color: #667eea;
    font-weight: bold;
}

.format-card h3 {
    color: #333;
    margin-bottom: 8px;
    margin-top: 0;
    font-size: 1.2em;
}

.format-card p {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
}

.format-select-btn,
.process-type-select-btn {
    background: #667eea;
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer !important;
    transition: background 0.3s;
    width: 100%;
    margin-top: auto;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center;
    box-sizing: border-box;
    pointer-events: auto !important;
}

.format-select-btn:hover,
.process-type-select-btn:hover {
    background: #5568d3;
    text-decoration: none !important;
    color: white !important;
}

.back-to-format {
    margin-bottom: 20px;
}

.back-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
    text-decoration: none;
    display: inline-block;
}

.back-btn:hover {
    background: #5568d3;
}

/* 音声文字起こし結果表示 */
.transcribe-results {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    display: none;
}

.transcribe-results h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.results-container {
    margin-bottom: 20px;
}

#transcribe-result-text {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    box-sizing: border-box;
}

.results-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.copy-btn, .download-btn, .close-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

.copy-btn {
    background: #28a745;
    color: white;
}

.copy-btn:hover {
    background: #218838;
}

.download-btn {
    background: #007bff;
    color: white;
}

.download-btn:hover {
    background: #0056b3;
}

.close-btn {
    background: #6c757d;
    color: white;
}

.close-btn:hover {
    background: #5a6268;
}

.selected-format-display {
    background: #e7f3ff;
    border-left: 4px solid #667eea;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #333;
}

.selected-process-type-display {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    color: #333;
}

/* SEOコンテンツ */
.section-description {
    color: #666;
    font-size: 1em;
    margin-bottom: 20px;
    line-height: 1.6;
}

.seo-content {
    display: block; /* 検索エンジン向けに表示 */
    margin-top: 40px;
    margin-bottom: 20px; /* 下部の余白を削減 */
    padding: 40px;
    background: #f9f9f9;
    border-top: 2px solid #eee;
    border-radius: 10px;
}

.seo-content h2,
.seo-content h3 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 8px;
    margin-top: 0;
}

.seo-content ul,
.seo-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
}

.seo-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.seo-content dl {
    margin-bottom: 15px;
}

.seo-content dt {
    font-weight: 600;
    color: #333;
    margin-top: 15px;
}

.seo-content dd {
    margin-left: 20px;
    color: #666;
    margin-bottom: 8px;
    margin-top: 0;
}

/* フッター */
footer nav {
    margin-top: 10px;
}

footer nav a {
    color: #666;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9em;
}

footer nav a:hover {
    color: #667eea;
    text-decoration: underline;
}

/* moecounterコンテナ */
.moecounter-container {
    text-align: center;
    margin-top: 20px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
}

.moecounter-image {
    display: inline-block;
    max-width: 100%;
    height: auto;
    image-rendering: pixelated;
}


/* レスポンシブ */
@media (max-width: 1200px) {
    .page-wrapper {
        justify-content: center;
    }
    
    /* スマホでコンテンツを全幅に */
    .container-wrapper {
        width: 100%;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    main {
        padding: 20px;
    }
    
    .upload-label {
        padding: 40px 15px;
    }
    
    footer nav {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    footer nav a {
        margin: 5px 0;
    }
    
    .moecounter-container {
        margin-top: 15px;
        padding: 5px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .moecounter-image {
        max-width: 100%;
        height: auto;
    }
    
    .page-wrapper {
        padding: 0 10px;
        gap: 0; /* スマホではgapを削除 */
        flex-direction: column;
    }
    
    body {
        padding: 0;
    }
    
    header {
        padding: 15px 20px;
    }
    
    header h1 {
        font-size: 1.8em;
        margin-bottom: 5px;
    }
    
    main {
        padding: 15px 20px;
    }
}

