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

:root {
    --color-primary: #007aff;
    --color-accent: #ff9500;
    --color-success: #34c759;
    --color-danger: #ff3b30;
    --color-bg: #f5f5f7;
    --color-card: #fff;
    --color-text: #111;
    --color-label: #555;
}

body {
    font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", sans-serif;
    background: var(--color-bg);
    margin: 0;
    padding: 16px;
    color: var(--color-text);
}

h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.ios-block {
    background: var(--color-card);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.ios-block h2 {
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 12px;
}

.ios-subblock {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

label {
    font-size: 13px;
    color: var(--color-label);
}

input[type="number"],
select {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #ddd;
    outline: none;
    margin-top: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007aff;
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007aff;
    cursor: pointer;
}

button {
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    background: var(--color-primary);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

button:hover {
    background: #0060d1;
}

button.accent-btn {
    background: var(--color-accent);
}

button.accent-btn:hover {
    background: #e08600;
}

button.remove-rule {
    background: var(--color-danger);
    margin-top: 4px;
}

button.remove-rule:hover {
    background: #d92b22;
}

.ios-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ios-table th,
.ios-table td {
    border-bottom: 1px solid #eee;
    padding: 4px 6px;
    text-align: left;
}

.ios-table input[type="number"] {
    width: 100%;
    box-sizing: border-box;
}

.note {
    font-size: 12px;
    color: #777;
    margin-bottom: 8px;
}

/* ============================
   グローバルナビ
============================ */
.global-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.global-nav a {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--color-card);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.global-nav a:hover {
    background: #e8f0fe;
}

.global-nav a.active {
    background: var(--color-primary);
    color: #fff;
}

/* ============================
   結果カード 3分割グリッド
============================ */
.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.result-grid .ios-block {
    margin-bottom: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.detail-grid .ios-block {
    margin-bottom: 0;
}

.result-card-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary);
}

.result-card-value.accent {
    color: var(--color-accent);
}

.hint {
    font-size: 12px;
    color: #777;
    margin: 4px 0 0;
}

/* ============================
   ヒーローセクション
============================ */
.hero-section {
    text-align: center;
    padding: 32px 16px;
    max-width: 480px;
    margin: 0 auto;
}

.hero-section h1 {
    font-size: 22px;
    margin-bottom: 12px;
}

.hero-lead {
    font-size: 15px;
    color: var(--color-label);
    line-height: 1.8;
    margin-bottom: 24px;
}

.hero-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.hero-step {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-card);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.hero-step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hero-step strong {
    display: block;
    font-size: 14px;
}

.hero-time {
    font-size: 12px;
    color: var(--color-label);
}

/* ============================
   ウィザード: ステップ切替
============================ */
.step-section {
    display: none;
}

.step-section.active {
    display: block;
}

.step-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.step-buttons .primary-btn {
    flex: 2;
}

.step-buttons .secondary-btn {
    flex: 1;
}

.secondary-btn {
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    border: 2px solid var(--color-primary);
    background: var(--color-card);
    color: var(--color-primary);
    cursor: pointer;
    font-family: inherit;
}

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

/* ============================
   ステップナビ
============================ */
.step-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.step {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 12px;
    color: var(--color-label);
    background: var(--color-card);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    white-space: nowrap;
}

.step.active {
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
}

/* ============================
   ボタン追加スタイル
============================ */
.primary-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 8px;
}

.add-rule-btn {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    background: var(--color-card);
    color: var(--color-primary);
    border: 2px dashed var(--color-primary);
    border-radius: 10px;
    margin-top: 8px;
}

.add-rule-btn:hover {
    background: #e8f0fe;
}

/* ============================
   セクション説明・結果カード
============================ */
.section-desc {
    font-size: 13px;
    color: var(--color-label);
    margin: 0 0 12px;
    line-height: 1.6;
}

.result-card {
    background: #f0f6ff;
    border-radius: 12px;
    padding: 12px;
    margin-top: 12px;
}

.collapsible {
    margin-top: 8px;
}

/* ============================
   積立ルール行
============================ */
.rule-block {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 8px;
}

.rule-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rule-timeline {
    position: relative;
    height: 20px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-top: 6px;
    overflow: hidden;
}

.timeline-bar {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--color-primary);
    opacity: 0.3;
    border-radius: 4px;
}

.timeline-label {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 11px;
    line-height: 20px;
    color: var(--color-text);
}

/* ============================
   ローディング
============================ */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 12px;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #ddd;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    color: var(--color-label);
}

/* ============================
   バリデーションエラー
============================ */
.input-error {
    border-color: var(--color-danger) !important;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.2);
}

.error-msg {
    font-size: 12px;
    color: var(--color-danger);
    margin: 4px 0 0;
    display: none;
}

.error-msg.visible {
    display: block;
}

/* ============================
   フッター
============================ */
/* 広告枠 */
.ad-footer, .ad-article-bottom {
    margin: 24px auto 0;
    max-width: 728px;
    text-align: center;
}
.ad-label {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 4px;
}
.ad-placeholder {
    background: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    color: #999;
    font-size: 0.8rem;
}

.site-footer {
    text-align: center;
    padding: 16px;
    margin-top: 24px;
    font-size: 12px;
    color: var(--color-label);
}

.site-footer a {
    color: var(--color-label);
    text-decoration: underline;
}

/* ============================
   免責ページ
============================ */
.disclaimer-list {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.8;
    padding-left: 20px;
    margin: 8px 0;
}

.disclaimer-list li {
    margin-bottom: 6px;
}

/* ============================
   アドバイス（警告）
============================ */
.advice-item {
    background: #fff8e1;
    border-left: 4px solid var(--color-accent);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.7;
    color: var(--color-text);
}

/* ============================
   ガイドページ
============================ */
.guide-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.guide-step-card {
    background: var(--color-card);
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.guide-step-num {
    display: inline-flex;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.guide-step-card strong {
    display: block;
    font-size: 15px;
    margin-bottom: 6px;
}

.guide-step-card p {
    font-size: 13px;
    color: var(--color-label);
    margin: 0;
    line-height: 1.6;
}

.guide-merit-card,
.guide-method-card {
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.guide-merit-card h3,
.guide-method-card h3 {
    font-size: 15px;
    margin: 0 0 8px;
}

.guide-merit-card p,
.guide-method-card p {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.7;
    margin: 4px 0;
}

.guide-example {
    background: #f0f6ff;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.7;
    margin: 8px 0;
}

.guide-faq {
    border-bottom: 1px solid #eee;
    padding: 12px 0;
}

.guide-faq:last-child {
    border-bottom: none;
}

.guide-faq h3 {
    font-size: 14px;
    color: var(--color-primary);
    margin: 0 0 6px;
}

.guide-faq p,
.guide-faq ul {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.7;
    margin: 4px 0;
}

/* ============================
   スマホ最適化
============================ */
@media (max-width: 600px) {
    body {
        padding: 8px;
    }

    .hero-section {
        padding: 16px 12px;
    }

    .hero-section h1 {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .hero-lead {
        font-size: 13px;
        margin-bottom: 16px;
    }

    .hero-steps {
        gap: 8px;
        margin-bottom: 16px;
    }

    .hero-step {
        padding: 8px 12px;
    }

    .result-grid,
    .detail-grid,
    .guide-steps {
        grid-template-columns: 1fr;
    }
}
