/* ============================
   AIフリーランス節税アドバイスアプリ
   カラースキーム: 白ベース × 黄色アクセント
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* --- リセット & ベース --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
    background-color: #faf9f6;
    color: #333;
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* --- ヘッダー --- */
.app-header {
    background: linear-gradient(135deg, #FFD500 0%, #FFC107 50%, #FFB300 100%);
    padding: 28px 20px 24px;
    text-align: center;
    box-shadow: 0 3px 12px rgba(255, 193, 7, 0.3);
    position: relative;
}

.app-header::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(to bottom, rgba(255, 193, 7, 0.15), transparent);
}

.header-inner {
    max-width: 640px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #3e2c00;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    line-height: 1.3;
}

.header-sub {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #5c4300;
    font-weight: 500;
}

.sp-only {
    display: none;
}

@media (max-width: 480px) {
    .sp-only { display: inline; }
    .logo { font-size: 1.25rem; }
}

/* --- メインコンテンツ --- */
.main-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px 40px;
}

/* --- ステップインジケーター --- */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 28px 10px 12px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.4;
    transition: opacity 0.3s;
}

.step-item.active,
.step-item.done {
    opacity: 1;
}

.step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.step-item.active .step-num {
    background: #FFD500;
    color: #3e2c00;
    box-shadow: 0 2px 8px rgba(255, 213, 0, 0.4);
}

.step-item.done .step-num {
    background: #4caf50;
    color: #fff;
}

.step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #888;
}

.step-item.active .step-label {
    color: #3e2c00;
    font-weight: 700;
}

.step-item.done .step-label {
    color: #4caf50;
}

.step-bar {
    width: 48px;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    margin: 0 6px;
    margin-bottom: 22px;
    transition: background 0.3s;
}

.step-bar.filled {
    background: #4caf50;
}

/* --- セクションカード --- */
.section-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    margin-top: 16px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #222;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.title-icon {
    font-size: 1.3rem;
}

.section-desc {
    font-size: 0.88rem;
    color: #777;
    margin-bottom: 24px;
    line-height: 1.6;
}

/* --- フォーム --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 16px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 600;
    color: #444;
}

.required {
    display: inline-block;
    font-size: 0.7rem;
    color: #fff;
    background: #ef5350;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    font-weight: 700;
    vertical-align: middle;
}

.optional {
    display: inline-block;
    font-size: 0.7rem;
    color: #999;
    border: 1px solid #ccc;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: middle;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-with-unit input {
    flex: 1;
    min-width: 0;
}

.unit {
    font-size: 0.82rem;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e8e6e1;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    background: #fdfcfa;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #FFD500;
    box-shadow: 0 0 0 3px rgba(255, 213, 0, 0.2);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.input-hint {
    font-size: 0.75rem;
    color: #aaa;
}

/* --- ボタン --- */
.btn-area {
    margin-top: 28px;
    text-align: center;
}

.btn-area-multi {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #333;
    color: #fff;
}

.btn-primary:hover {
    background: #555;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-accent {
    background: linear-gradient(135deg, #FFD500, #FFC107);
    color: #3e2c00;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #ffe033, #ffd54f);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 213, 0, 0.4);
}

.btn-secondary {
    background: #f0eeea;
    color: #555;
}

.btn-secondary:hover {
    background: #e5e3de;
}

.btn-arrow {
    font-size: 1.1rem;
}

.btn-icon {
    font-size: 1.1rem;
}

/* --- ローディング --- */
.loading-card {
    text-align: center;
    padding: 60px 24px;
    margin-top: 24px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e8e6e1;
    border-top-color: #FFD500;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
}

.loading-sub {
    font-size: 0.85rem;
    color: #999;
}

/* --- 結果サマリー --- */
.result-summary-card {
    background: linear-gradient(135deg, #fffbe6 0%, #fff9cc 100%);
    border: 2px solid #ffe082;
    border-radius: 16px;
    padding: 28px 24px;
    margin-top: 16px;
}

.summary-text {
    font-size: 1rem;
    line-height: 1.8;
    color: #444;
    margin-top: 12px;
}

/* --- グラフ --- */
.chart-card {
    margin-top: 20px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 16px;
}

.chart-wrap {
    position: relative;
    height: 320px;
}

@media (max-width: 480px) {
    .chart-wrap { height: 260px; }
}

/* --- 提案カード --- */
.proposal-card {
    display: flex;
    gap: 16px;
    background: #fff;
    border-radius: 14px;
    padding: 22px 20px;
    margin-top: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    transition: transform 0.15s, box-shadow 0.15s;
    border-left: 4px solid #FFD500;
}

.proposal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.proposal-rank {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: #FFD500;
    color: #3e2c00;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
}

.proposal-body {
    flex: 1;
    min-width: 0;
}

.proposal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 6px;
}

.proposal-reason {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    line-height: 1.6;
}

.proposal-stars {
    color: #FFB300;
    font-size: 1rem;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.proposal-adjust {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #faf8f2;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

.adjust-dir {
    font-weight: 700;
    color: #e65100;
    white-space: nowrap;
}

.adjust-detail {
    color: #666;
}

.proposal-notes {
    font-size: 0.82rem;
    color: #c62828;
    background: #fff3f3;
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 8px;
}

.proposal-action {
    font-size: 0.88rem;
    color: #1b5e20;
    font-weight: 600;
    background: #f1f8e9;
    border-radius: 6px;
    padding: 8px 10px;
}

.no-result {
    text-align: center;
    color: #999;
    padding: 40px 0;
}

/* --- エラー --- */
.error-card {
    text-align: center;
    background: #fff;
    border-radius: 16px;
    padding: 48px 24px;
    margin-top: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.error-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.error-text {
    font-size: 1rem;
    color: #c62828;
    margin-bottom: 20px;
    line-height: 1.7;
}

.error-detail {
    text-align: left;
    background: #fff8f8;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.8rem;
    color: #555;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    font-family: 'Courier New', monospace;
}

/* --- 広告枠 --- */
.ad-slot {
    max-width: 680px;
    margin: 16px auto;
    padding: 0 16px;
}

.ad-inner {
    background: #f5f3ef;
    border: 1px dashed #d5d0c8;
    border-radius: 10px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-placeholder {
    font-size: 0.8rem;
    color: #bbb;
}

.ad-slot-top {
    margin-top: 12px;
}

.ad-slot-mid {
    margin-top: 20px;
    padding: 0;
}

.ad-slot-bottom {
    margin-top: 20px;
    padding: 0;
}

.ad-slot-footer {
    margin-bottom: 0;
}

/* --- フッター --- */
.app-footer {
    background: #f0eeea;
    padding: 28px 20px;
    text-align: center;
    margin-top: 40px;
}

.footer-inner {
    max-width: 640px;
    margin: 0 auto;
}

.footer-note {
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 12px;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 12px;
}

.footer-links a {
    font-size: 0.8rem;
    color: #888;
    text-decoration: none;
}

.footer-links a:hover {
    color: #555;
    text-decoration: underline;
}

.footer-copy {
    font-size: 0.75rem;
    color: #bbb;
}

/* --- ユーティリティ --- */
.hidden {
    display: none !important;
}