/* =============================================
   フリーランス情勢分析AI — スタイル
   ============================================= */

/* --- リセット・基本 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1B4965;
    --primary-light: #2D6A8F;
    --primary-pale: #E8F1F8;
    --accent: #62B6CB;
    --risk: #D64045;
    --risk-bg: #FDF0F0;
    --opportunity: #2E8B57;
    --opportunity-bg: #EEF8F2;
    --high: #D64045;
    --medium: #4A90D9;
    --bg: #F0F4F8;
    --card: #FFFFFF;
    --text: #333333;
    --text-light: #666666;
    --border: #E2E8F0;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(27, 73, 101, 0.08);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100dvh;
}

/* --- ヘッダー --- */
.site-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner { max-width: 600px; margin: 0 auto; }
.header-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    margin-right: 6px;
    flex-shrink: 0;
}

.header-logo {
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
}

/* --- 画面制御 --- */
.screen { display: none; }
.screen.active { display: block; }

/* --- イントロ --- */
.intro-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.intro-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    line-height: 1.4;
    margin-bottom: 16px;
}
.intro-catch {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.8;
}
.data-date {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 24px;
    padding: 8px 16px;
    background: var(--primary-pale);
    border-radius: 20px;
    display: block;
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
}
.btn-start {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 16px 40px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-start:hover { background: var(--primary-light); }
.btn-arrow { margin-left: 4px; }
.intro-note {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 16px;
}

/* --- ステップ共通 --- */
.step-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}
.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s;
}
.dot.active { background: var(--primary); transform: scale(1.2); }
.dot.done { background: var(--accent); }
.step-question {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}
.step-sub {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* --- 選択肢ボタン --- */
.choice-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}
.choice-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}
.choice-btn:hover { border-color: var(--accent); }
.choice-btn.selected {
    border-color: var(--primary);
    background: var(--primary-pale);
    color: var(--primary);
    font-weight: 700;
}

/* --- 送信・戻るボタン --- */
.btn-submit {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 14px 36px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 24px;
    transition: background 0.2s;
    opacity: 0.5;
    pointer-events: none;
}
.btn-submit.enabled {
    opacity: 1;
    pointer-events: auto;
}
.btn-submit.enabled:hover { background: var(--primary-light); }
.btn-back {
    display: block;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-light);
    cursor: pointer;
    margin: 16px auto 0;
    padding: 8px;
}
.btn-back:hover { color: var(--primary); }

/* --- ローディング --- */
.loading-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 100px 20px;
    text-align: center;
}
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}
.loading-sub {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* --- 結果画面 --- */
.result-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}
.result-date {
    text-align: center;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 20px;
    padding: 6px 14px;
    background: var(--primary-pale);
    border-radius: 20px;
    display: inline-block;
}

/* --- 結果セクション --- */
.result-section {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
}
.impact-title { border-left-color: var(--primary); }
.risk-title { border-left-color: var(--risk); }
.action-title { border-left-color: var(--accent); }
.link-title { border-left-color: var(--opportunity); }

.section-body {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
}

/* --- リスクと機会グリッド --- */
.risk-opportunity-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 480px) {
    .risk-opportunity-grid { grid-template-columns: 1fr; }
}
.column-label {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
}
.risk-label { background: var(--risk-bg); color: var(--risk); }
.opportunity-label { background: var(--opportunity-bg); color: var(--opportunity); }

.risk-card, .opportunity-card {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.risk-card {
    background: var(--risk-bg);
    border-left: 3px solid var(--risk);
}
.opportunity-card {
    background: var(--opportunity-bg);
    border-left: 3px solid var(--opportunity);
}
.card-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.card-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* --- アクションカード --- */
.action-card {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--primary-pale);
    border-left: 3px solid var(--accent);
}
.action-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.priority-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    flex-shrink: 0;
}
.priority-badge.high { background: var(--high); }
.priority-badge.medium { background: var(--medium); }
.action-card .card-title { font-size: 0.9rem; }
.action-card .card-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* --- 記事リンク --- */
.article-link {
    display: block;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg);
    border-radius: 8px;
    text-decoration: none;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}
.article-link:hover { background: var(--primary-pale); }
.article-link::before { content: '📰 '; }

.btn-media {
    display: block;
    text-align: center;
    padding: 12px;
    margin-top: 12px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.95rem;
    transition: background 0.2s;
}
.btn-media:hover { background: var(--primary-light); }

/* --- リトライ・エラー --- */
.btn-retry {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 24px auto 0;
    padding: 14px;
    background: var(--card);
    border: 2px solid var(--primary);
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    transition: background 0.2s;
}
.btn-retry:hover { background: var(--primary-pale); }

.error-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 100px 20px;
    text-align: center;
}
.error-icon { font-size: 3rem; margin-bottom: 16px; }
.error-text {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.7;
}

/* --- フッター --- */
.app-footer {
    background: var(--primary);
    color: rgba(255, 255, 255, 0.8);
    padding: 24px 16px;
    margin-top: 40px;
}
.footer-inner {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}
.footer-note { font-size: 0.75rem; margin-bottom: 12px; }
.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.8rem;
}
.footer-links a:hover { color: #fff; }
.footer-copy { font-size: 0.75rem; }

/* --- 静的ページ（免責事項・プライバシー・運営者情報） --- */
.static-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px 32px;
}
.static-page h1 {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 16px;
    line-height: 1.4;
    color: var(--text);
}
.static-page > p {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 24px;
}
.static-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.static-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    line-height: 1.4;
}
.static-card p {
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 12px;
}
.static-card ul {
    padding-left: 20px;
    margin-bottom: 12px;
}
.static-card ul li {
    font-size: 0.9rem;
    line-height: 1.8;
    margin-bottom: 4px;
}
.static-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.static-card a:hover { text-decoration: underline; }
.policy-date {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 24px;
}

/* 運営者情報テーブル */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}
.info-table th,
.info-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.info-table th {
    font-weight: 700;
    background: var(--bg);
    white-space: nowrap;
}
.info-table a {
    color: var(--primary);
    text-decoration: none;
}
.info-table a:hover { text-decoration: underline; }
