/* ==========================================================================
   1. 基本設定 & 変数定義
   ========================================================================== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent-color: #0ea5e9;
    --bg-gradient: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%);
    --surface-color: #ffffff;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --border-color: #cbd5e1;
    --border-light: #e2e8f0;
    --shadow-card: 0 10px 25px -5px rgba(37, 99, 235, 0.08), 0 8px 10px -6px rgba(37, 99, 235, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
    padding: 24px 16px 40px 16px;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    background: var(--surface-color);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-card);
}

/* ==========================================================================
   2. ヘッダーエリア
   ========================================================================== */
.site-header {
    margin-bottom: 20px;
}

h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
    text-align: center;
    margin: 0 0 6px 0;
}

.subtitle-year {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin: 0 0 8px 0;
}

.description {
    font-size: 12px; /* 12pxに調整 */
    color: var(--text-sub);
    text-align: left; /* スマホ表示時は左寄せ */
    margin: 0 0 16px 0;
    line-height: 1.6;
}

.notice-box {
    background-color: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #1e40af;
    line-height: 1.6;
}

.notice-box.guide {
    background-color: #fff8f0;
    border-color: #fed7aa;
    border-left-color: #f97316;
    color: #9a3412;
    font-size: 11.5px;
    padding: 8px 12px;
    margin-bottom: 0;
}

/* ==========================================================================
   3. スクロール追従コンテナ ＆ ミニ誘導バナー
   ========================================================================== */
.sticky-header-container {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 4px 0 8px 0;
    margin-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.sticky-guide {
    font-size: 11px !important;
    padding: 5px 10px !important;
    margin-bottom: 6px !important;
    border-radius: 6px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sticky-tab-bar {
    width: 100%;
}

.tab-container {
    display: flex;
    gap: 8px;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
}

.tab-button {
    flex: 1;
    padding: 10px 12px;
    font-size: 13.5px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    line-height: 1.3;
}

.sp-only {
    display: inline;
}

.tab-button:hover {
    color: var(--primary-color);
}

.tab-button.active {
    background-color: #ffffff;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

/* ==========================================================================
   4. かんたんシミュレーション & カスタムスピンボタン
   ========================================================================== */
.easy-card {
    background-color: #f8fafc;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 24px;
}

.input-desc {
    font-size: 12px;
    color: var(--text-sub);
    margin: -4px 0 10px 0;
}

.input-with-unit-outer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-with-unit-outer .unit-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
}

.custom-step-input {
    display: flex;
    align-items: center;
    flex: 1;
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #ffffff;
    overflow: hidden;
    transition: all 0.2s ease;
}

.custom-step-input:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.custom-step-input input {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 10px 12px;
    font-size: 18px;
    font-weight: 700;
    width: 100%;
}

.step-btn-group {
    display: flex;
    flex-direction: column;
    width: 32px;
    align-self: stretch;
    border-left: 1px solid var(--border-color);
    background-color: #f8fafc;
}

.step-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-sub);
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
}

.step-btn:hover {
    background-color: #e2e8f0;
    color: var(--primary-color);
}

.step-btn:active {
    background-color: #cbd5e1;
}

#btn-easy-up {
    border-bottom: 1px solid var(--border-color);
}

.easy-result-box {
    margin-top: 20px;
    margin-bottom: 16px;
}

.calc-details-note {
    background-color: #ffffff;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ==========================================================================
   5. 詳細シミュレーション & 共通フォーム
   ========================================================================== */
.step-section {
    border: 2px solid #3b82f6;
    border-radius: 12px;
    margin-bottom: 32px;
    background-color: #ffffff;
    overflow: hidden;
}

.step-header {
    background-color: #eff6ff;
    padding: 12px 20px;
    border-bottom: 2px solid #bfdbfe;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
}

.step-badge {
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.step-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e3a8a;
    margin: 0;
}

.step-body {
    padding: 20px;
}

.step1-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.q-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #cbd5e1;
    border-left: 5px solid #3b82f6;
    border-radius: 10px;
    padding: 16px 20px;
    transition: all 0.2s ease-in-out;
}

.q-card:hover {
    border-color: #93c5fd;
    border-left-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.q-card label {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    cursor: pointer;
}

.q-number {
    flex-shrink: 0;
    width: 22px;
}

.q-text {
    flex: 1;
}

.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 11px 14px;
    font-size: 14px;
    color: var(--text-main);
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}

.q-card select {
    font-size: 12px;
    padding: 8px 10px;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.calc-button {
    display: block;
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 24px;
}

.result-section .step-body {
    padding: 20px 12px;
}

.result-box {
    text-align: center;
    background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
    padding: 20px 12px;
    border-radius: 12px;
    border: 1px solid #93c5fd;
    margin: 0 4px;
}

.result-title {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 8px;
    font-weight: 600;
    text-align: center;
}

.result-title .sp-break {
    display: inline;
}

.result-title .sp-break::after {
    content: " ";
}

@media screen and (max-width: 600px) {
    .result-title .sp-break {
        display: block;
    }
}

.result-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
}

.sub-table-title {
    font-size: 14px;
    margin: 20px 4px 10px 8px;
    color: #1e293b;
    text-align: left;
    white-space: normal;
}

.result-table {
    width: calc(100% - 8px);
    margin: 0 auto;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 12.5px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    table-layout: fixed;
}

.result-table th {
    width: 58%;
    border-bottom: 1px solid var(--border-light);
    padding: 12px 8px;
    text-align: left;
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--text-sub);
    white-space: normal;
    line-height: 1.4;
}

.result-table td {
    width: 42%;
    border-bottom: 1px solid var(--border-light);
    padding: 12px 8px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.total-row th,
.total-row td {
    font-weight: 700;
    background-color: var(--primary-light);
    color: #1e3a8a;
    border-top: 2px solid var(--primary-color);
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   6. アフィリエイトセクション用スタイル
   ========================================================================== */
.popular-container {
    margin-top: 40px;
    margin-bottom: 40px;
}

.popular-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #2c3e50;
    text-align: center;
}

.popular-desc {
    font-size: 12px;
    color: #666;
    text-align: left;
    margin-bottom: 20px;
}

.affiliate-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.affiliate-card {
    width: 100%;
    display: flex;
    justify-content: center;
    overflow-x: auto;
}

.rakuten-affiliate-box {
    border: 1px solid #95a5a6;
    border-radius: .75rem;
    background-color: #FFFFFF;
    width: 504px;
    max-width: 100%;
    margin: 0px;
    padding: 5px;
    text-align: center;
    overflow: hidden;
    box-sizing: border-box;
}

.rakuten-affiliate-box table {
    margin: 0 auto !important;
}

.affiliate-img-cell {
    width: 240px;
}

.affiliate-detail-cell {
    vertical-align: top;
    width: 248px;
}

.affiliate-text {
    font-size: 12px;
    line-height: 1.4em;
    text-align: left;
    margin: 0px;
    padding: 2px 6px;
    word-wrap: break-word;
}

.affiliate-date {
    color: #BBB;
}

.affiliate-btn-wrapper {
    margin: 10px;
}

.affiliate-buy-btn {
    float: right;
    width: 41%;
    height: 27px;
    background-color: #bf0000;
    color: #fff !important;
    font-size: 12px;
    font-weight: 500;
    line-height: 27px;
    margin-left: 1px;
    padding: 0 12px;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
}

/* ==========================================================================
   7. レスポンシブ設定 (PC・タブレット向け: 768px以上)
   ========================================================================== */
@media (min-width: 768px) {
    .container {
        padding: 32px;
    }

    .description {
        text-align: center; /* PCサイズ時は中央寄せ */
    }

    .sp-only {
        display: none;
    }

    .tab-button {
        font-size: 14px;
        padding: 12px 16px;
    }

    .grid-2col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .grid-full {
        grid-column: 1 / -1;
    }
}