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

:root {
    /* デジタル庁風のカラーパレット */
    --primary-blue: #0052CC;
    --primary-blue-dark: #003d99;
    --primary-blue-light: #cce7ff;
    --secondary-blue: #0066ff;
    --orange: #ff6b35;
    --orange-hover: #ff8c42;
    --text-primary: #1a1a1a;
    --text-secondary: #595959;
    --text-muted: #8c8c8c;
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --background-tertiary: #e8f4fd;
    --border-light: #e6e6e6;
    --border-medium: #d9d9d9;
    --success: #00a85a;
    --warning: #ff9500;
    --error: #d93025;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

body {
    font-family: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', sans-serif;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--background-secondary);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-top: 80px; /* ヘッダーの高さ分を確保 */
}

/* サイトヘッダー */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--background-primary);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.logo h1 {
    margin: 0;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--primary-blue);
}

.logo a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.logo a:hover {
    color: var(--primary-blue-dark);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* モバイル優先のレスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* ヒーローセクション - モバイル優先 */
.hero-section {
    background: url('images/32883206_m.jpg') center/cover no-repeat;
    color: var(--background-primary);
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-xl);
    position: relative;
    overflow: hidden;
    min-height: 450px;
    display: flex;
    align-items: flex-end;
}

/* デスクトップ版のヒーローセクション */
@media (min-width: 769px) {
    .hero-section {
        padding: var(--spacing-xl) 0;
        min-height: 600px;
    }
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

/* デスクトップ版のヒーローコンテンツ */
@media (min-width: 769px) {
    .hero-content {
        display: flex;
        flex-direction: column;
        text-align: center;
        max-width: 800px;
    }
}

.hero-text {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-xl);
    margin: 0 var(--spacing-md) var(--spacing-md) var(--spacing-md);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-align: center;
    width: calc(100% - 2rem);
    position: relative;
    z-index: 2;
}

/* デスクトップ版のヒーローテキスト */
@media (min-width: 769px) {
    .hero-text {
        text-align: center;
        max-width: 600px;
        margin: 0 auto var(--spacing-md) auto;
    }
}

.hero-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    color: var(--primary-blue);
}

.orange-text {
    color: var(--orange) !important;
}

.hero-features {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: 0;
    align-items: center;
}

/* デスクトップ版のヒーロー機能 */
@media (min-width: 769px) {
    .hero-features {
        flex-direction: row;
        gap: var(--spacing-lg);
        align-items: flex-start;
    }
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
}

.feature-icon {
    background: var(--success);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* デスクトップ版のCTAボタン */
@media (min-width: 769px) {
    .cta-button {
        padding: 1.2rem 2.5rem;
        font-size: 1.1rem;
    }
}

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

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.6);
}

.cta-button:hover::before {
    left: 100%;
}

.hero-image {
    display: none; /* 背景画像として使用するため非表示 */
}

.hero-img {
    display: none; /* 背景画像として使用するため非表示 */
}

/* フォームセクション */
.form-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.cta-message {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    margin-bottom: var(--spacing-lg);
}

.form-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: var(--spacing-md);
}

.form-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

.form-section {
    background: var(--background-primary);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--border-light);
}

@media (max-width: 768px) {
    .form-section {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }
}

/* テストシナリオスタイル */
.test-scenarios {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 2px dashed #dee2e6;
    display: none; /* デフォルトでは非表示 */
}

/* デバッグモード時のみ表示 */
.debug-mode .test-scenarios {
    display: block;
}

.test-scenarios h3 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.test-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.test-btn {
    padding: 0.5rem 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

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

.test-btn:active {
    transform: translateY(1px);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

select, input[type="number"] {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: var(--background-primary);
    color: var(--text-primary);
    transition: all 0.2s ease-in-out;
    font-family: inherit;
    appearance: none;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6,9 12,15 18,9"></polyline></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 48px;
}

input[type="number"] {
    background-image: none;
    padding-right: var(--spacing-md);
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--primary-blue-light);
}

select:hover, input[type="number"]:hover {
    border-color: var(--border-medium);
}

select:disabled, input[type="number"]:disabled {
    background-color: var(--background-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

#otherLoanAmountGroup {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    margin-top: -0.5rem;
}

.lender-selection {
    margin-top: 2rem;
}

.lender-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.lender-info h3 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.selected-lenders-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.selected-lenders-display span {
    color: #495057;
    font-size: 0.9rem;
}

.count-badge {
    background: #007bff;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: none;
}

.change-btn {
    background: transparent;
    color: #007bff;
    border: 1px solid #007bff;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 80px;
}

.change-btn:hover {
    background: #007bff;
    color: white;
    transform: translateY(-1px);
}

.toggle-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.toggle-icon {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.lender-settings {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.lender-settings.collapsed {
    max-height: 0;
    opacity: 0;
}

.lender-settings.expanded {
    max-height: 500px;
    opacity: 1;
}

.lender-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    padding-top: 1rem;
}

.lender-actions {
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    margin-top: 1rem;
}

.confirm-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.7rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.confirm-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.select-all {
    padding: 0.5rem;
    background-color: #f0f0f0;
    border-radius: 4px;
    flex: 0 0 auto;
}

/* デバッグトグルボタンのスタイル（削除）
.debug-toggle {
    padding: 0.5rem 1rem;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.debug-toggle:hover {
    background-color: #5a6268;
}
*/

.lender-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.lender-checkbox {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    position: relative;
}

.lender-checkbox:hover {
    background-color: #f8f8f8;
    border-color: #3498db;
}

.lender-checkbox:active {
    transform: scale(0.98);
}

.lender-checkbox input[type="checkbox"] {
    margin-right: 0.75rem;
    cursor: pointer;
}

.lender-checkbox label {
    flex: 1;
    cursor: pointer;
    margin: 0;
}

.submit-btn {
    width: 100%;
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    color: var(--background-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-transform: none;
    letter-spacing: 0.025em;
    position: relative;
    overflow: hidden;
}

.orange-btn {
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-hover) 100%) !important;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.orange-btn:hover {
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.6) !important;
}

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

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn:disabled::before {
    display: none;
}

.results-section {
    background: var(--background-primary);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

@media (max-width: 768px) {
    .results-section {
        padding: var(--spacing-lg);
    }
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 2rem;
}

.progress-container {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    text-align: left;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

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

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-info h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-results {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.progress-stat {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: bold;
}

.progress-stat.approved {
    background-color: #d5f4e6;
    color: #27ae60;
}

.progress-stat.rejected {
    background-color: #fadbd8;
    color: #e74c3c;
}

.progress-stat.undetermined {
    background-color: #fef9e7;
    color: #f39c12;
}

.progress-stat.error {
    background-color: #f4f6f7;
    color: #95a5a6;
}

.current-lender {
    font-style: italic;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

.result-card {
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease-in-out;
    background: var(--background-primary);
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.result-card.approved {
    border-color: var(--success);
    background-color: rgba(0, 168, 90, 0.05);
}

.result-card.rejected {
    border-color: var(--error);
    background-color: rgba(217, 48, 37, 0.05);
}

.result-card.error {
    border-color: var(--text-muted);
    background-color: var(--background-secondary);
}

.status-approved {
    color: var(--success);
    font-weight: 600;
}

.status-rejected {
    color: var(--error);
    font-weight: 600;
}

.status-undetermined {
    color: var(--warning);
    font-weight: 600;
}

.status-error {
    color: var(--text-muted);
    font-weight: 600;
}

.raw-message {
    margin-top: 0.5rem;
    padding: 0.25rem;
    background-color: #f9f9f9;
    border-left: 3px solid #ddd;
    font-style: italic;
}

.result-info {
    flex: 1;
}

.lender-name {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.result-status {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.result-message {
    color: #666;
    font-size: 0.9rem;
}

.result-actions {
    margin-left: 1rem;
}

.apply-btn {
    padding: 0.75rem 1.5rem;
    background-color: #27ae60;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    display: inline-block;
    font-weight: bold;
    transition: background-color 0.3s;
}

.apply-btn:hover {
    background-color: #229954;
}

.pr-indicator {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 0.3rem;
    color: rgba(255, 255, 255, 0.8);
}

.result-summary {
    background-color: #ecf0f1;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 2rem;
    text-align: center;
}

.result-summary h3 {
    margin-bottom: 0.5rem;
}

.diagnosis-condition {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
}

footer {
    text-align: center;
    padding: var(--spacing-xl) 0;
    color: var(--text-muted);
    margin-top: var(--spacing-xl);
    border-top: 1px solid var(--border-light);
    background: var(--background-primary);
}

/* スマホファーストのレスポンシブデザイン */
@media (max-width: 768px) {
    :root {
        --spacing-xs: 0.25rem;
        --spacing-sm: 0.5rem;
        --spacing-md: 0.75rem;
        --spacing-lg: 1rem;
        --spacing-xl: 1.25rem;
    }

    body {
        padding-top: 60px; /* モバイルではヘッダーを小さく */
    }

    .header-container {
        height: 60px;
        padding: 0 var(--spacing-md);
    }

    .logo h1 {
        font-size: 1.3rem;
    }

    .form-title {
        font-size: clamp(1.4rem, 3.5vw, 2rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .lender-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .result-card {
        flex-direction: column;
        text-align: center;
        padding: var(--spacing-md);
    }
    
    .result-actions {
        margin-left: 0;
        margin-top: var(--spacing-md);
    }
    
    .progress-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: var(--spacing-lg);
    }
    
    .progress-results {
        justify-content: center;
    }
    
    .test-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }
    
    .lender-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .toggle-btn {
        align-self: flex-end;
    }
}

/* タブレット向けのレスポンシブ */
@media (min-width: 769px) and (max-width: 1024px) {
    .lender-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .test-buttons {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* デバッグモード用のスタイル */
.debug-control {
    border-top: 1px solid #e9ecef;
    padding-top: 1rem;
    margin-top: 1rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 1rem;
}

.unimplemented-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.unimplemented-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    margin: 0;
}

.toggle-help {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
}

/* デバッグモード時の金融機関項目のスタイル */
.lender-checkbox.unimplemented {
    border-color: #ffc107;
    background-color: #fff9e6;
}

.lender-checkbox.unimplemented label::after {
    content: " (未実装)";
    color: #856404;
    font-size: 0.8rem;
    font-weight: 500;
}

