:root {
    --primary: #F59E0B;
    --primary-hover: #D97706;
    --primary-light: #FEF3C7;
    --primary-gradient: linear-gradient(135deg, #F59E0B 0%, #F97316 100%);
    --secondary: #10B981;
    --secondary-light: #ECFDF5;
    --blue: #3B82F6;
    --blue-light: #EFF6FF;
    --red: #EF4444;
    --red-light: #FEF2F2;
    --bg-light: #FAFAFA;
    --bg-gray: #F3F4F6;
    --text-main: #1F2937;
    --text-sub: #6B7280;
    --border-color: #E5E7EB;
    --white: #FFFFFF;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 20px -3px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: #E5E7EB;
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 960px;
    margin: 0 auto;
    background: var(--bg-light);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 768px) {
    .app-container {
        margin: 30px auto;
        min-height: calc(100vh - 60px);
        height: calc(100vh - 60px);
        border-radius: var(--radius-lg);
    }
}

header {
    padding: 16px 24px 12px;
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    flex-shrink: 0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 800;
    cursor: pointer;
    padding: 6px 13px;
    border-radius: 9999px;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1;
}

/* 戻るボタン：爽やかで清潔感のあるパステルスカイブルー */
.back-btn {
    background: #EFF6FF;
    color: #2563EB;
    border: 1.5px solid #BFDBFE;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}
.back-btn:hover {
    background: #DBEAFE;
    color: #1D4ED8;
    border-color: #93C5FD;
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.22);
}
.back-btn:active {
    transform: translateY(0) scale(0.97);
}

/* TOPボタン：りするんカラーに合わせた優しいミントグリーン×おうちアイコン */
.top-btn {
    background: #ECFDF5;
    color: #059669;
    border: 1.5px solid #A7F3D0;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.12);
}
.top-btn:hover {
    background: #D1FAE5;
    color: #047857;
    border-color: #6EE7B7;
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.22);
}
.top-btn:active {
    transform: translateY(0) scale(0.97);
}

.reset-btn {
    background: #FFF1F2;
    color: #E11D48;
    border: 1.5px solid #FECDD3;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 5px 10px;
}
.reset-btn:hover {
    background: #FFE4E6;
    color: #BE123C;
    border-color: #FDA4AF;
    transform: translateY(-1px) scale(1.04);
}
.reset-btn:active {
    transform: translateY(0) scale(0.97);
}

/* 結果へボタン：爽やかなスカイブルー */
.result-jump-btn {
    background: #EFF6FF;
    color: #2563EB;
    border: 1.5px solid #BFDBFE;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}
.result-jump-btn:hover {
    background: #DBEAFE;
    color: #1D4ED8;
    border-color: #93C5FD;
    transform: translateY(-1px) scale(1.04);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.2);
}
.result-jump-btn:active {
    transform: translateY(0) scale(0.97);
}

/* メニュー（ハンバーガー）ボタン：りするんのほっぺピンク（ピーチコーラル） */
.menu-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    background: #FFF1F2;
    color: #E11D48;
    border: 1.5px solid #FECDD3;
    box-shadow: 0 1px 3px rgba(225, 29, 72, 0.12);
}
.menu-btn:hover {
    background: #FFE4E6;
    border-color: #FDA4AF;
    color: #BE123C;
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 3px 10px rgba(225, 29, 72, 0.22);
}
.menu-btn:active {
    transform: translateY(0) scale(0.95);
}

/* サイドバードロワー（TOPと完全統一） */
.drawer-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}
.drawer-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 88%;
    max-width: 360px;
    background: #FFFFFF;
    box-shadow: -10px 0 25px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 28px 16px 20px;
    box-sizing: border-box;
}
.drawer-overlay.active .drawer-panel {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-right: 36px;
    position: relative;
}
.drawer-close {
    position: absolute;
    top: -10px;
    right: -4px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #9CA3AF;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: 0.2s;
}
.drawer-close:hover {
    background: #F3F4F6;
    color: #1F2937;
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}
.drawer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 10px;
    color: #1E293B;
    text-decoration: none;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: -0.02em;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
    white-space: nowrap;
}
.drawer-link:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
    transform: translateX(3px);
    color: #0F172A;
}
.drawer-link-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}
.drawer-link-left span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drawer-link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    flex-shrink: 0;
}
.drawer-link-icon svg {
    width: 16px;
    height: 16px;
}
.drawer-link-arrow {
    color: #94A3B8;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.drawer-link-arrow svg {
    width: 14px;
    height: 14px;
}

.drawer-link-sub {
    font-size: 0.82rem;
    color: #64748B;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    background: #F8FAFC;
    border: 1px solid #F1F5F9;
    cursor: pointer;
    box-sizing: border-box;
    width: 100%;
}
.drawer-link-sub:hover {
    color: #0F172A;
    background: #F1F5F9;
    border-color: #E2E8F0;
    padding-left: 16px;
}
.btn-apply-tax {
    width: 100%;
    background: #10B981;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
}
.btn-apply-tax:hover {
    background: #059669;
}

.step-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--text-main);
    background: var(--bg-gray);
    padding: 4px 14px;
    border-radius: var(--radius-full);
    transition: all 0.2s ease;
}

.step-title-clickable {
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
}
.step-title-clickable:hover {
    background: #FEF3C7;
    border-color: #FCD34D;
    color: #92400E;
    transform: scale(1.03);
}
.step-arrow-down {
    font-size: 0.65rem;
    color: var(--primary);
    margin-left: 3px;
    vertical-align: middle;
}

/* ステップ直接ジャンプボタン */
.step-jump-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #1E293B;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
}
.step-jump-btn:hover {
    background: #FEF3C7;
    border-color: #FCD34D;
    transform: translateX(3px);
}
.step-jump-btn span {
    font-size: 0.75rem;
    font-weight: 900;
    color: var(--primary);
    background: #FFFFFF;
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid #CBD5E1;
}
.step-jump-result {
    background: #FFFBEB;
    border-color: #FCD34D;
    color: #92400E;
}
.step-jump-result:hover {
    background: #FEF3C7;
}

.progress-bar-bg {
    height: 8px;
    background: #E5E7EB;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary-gradient);
    width: 0%;
    transition: width 0.35s ease-out;
}

.wizard-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-light);
}

.wizard-slide {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 24px 24px 90px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
    transform: translateX(100%);
    opacity: 0;
    overflow-y: auto;
    visibility: hidden;
}
@media (min-width: 768px) {
    .wizard-slide {
        padding: 36px 50px 100px;
    }
}
.wizard-slide.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
}
.wizard-slide.prev {
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
}

.question-title {
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--text-main);
}
.question-desc {
    font-size: 0.88rem;
    color: var(--text-sub);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* スライド1・2：全幅オープンヒーロー（枠線・テーブルなし、大きなフォントで高視認性） */
.slide-fullwidth-hero {
    position: relative;
    width: 100%;
    min-height: 180px;
    margin-bottom: 20px;
    padding: 10px 0 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: none;
    border: none;
    box-shadow: none;
}

/* スライド1：全幅オープンヒーロー（枠線・テーブルなし、大きなフォントで高視認性） - 8ca65e6完全復元版 */
.slide-fullwidth-hero {
    position: relative;
    width: 100%;
    min-height: 180px;
    margin-bottom: 20px;
    padding: 10px 0 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: none;
    border: none;
    box-shadow: none;
}

/* 背景の全幅イラスト：右側に大きくダイナミックに配置 */
.fullwidth-hero-bg {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 320px;
    max-width: 58%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}
.fullwidth-hero-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

/* 2ページ目専用（お勤め先：お月見りするん） - 画像全体が100%隠れず見えるゆったりマージン */
.hero-moon.slide-fullwidth-hero {
    min-height: 180px;
    margin-bottom: 60px;
    padding: 10px 0 6px;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.hero-moon .fullwidth-hero-bg {
    position: absolute;
    right: -4px;
    top: 2px;
    bottom: auto;
    width: 275px;
    max-width: 55%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.hero-moon .fullwidth-hero-img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    transform: none;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
}

/* 3ページ目専用（配偶者：二人三脚りするん） - 画像全体が100%隠れず見えるゆったりマージン */
.hero-spouse.slide-fullwidth-hero {
    min-height: 180px;
    margin-bottom: 60px;
    padding: 10px 0 6px;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.hero-spouse .fullwidth-hero-bg {
    position: absolute;
    right: -4px;
    top: 2px;
    width: 265px;
    max-width: 53%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.hero-spouse .fullwidth-hero-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
}

/* 4ページ目専用（扶養親族：七五三・鳥居りするん） - 画像全体が100%隠れず見えるゆったりマージン */
.hero-dependents.slide-fullwidth-hero {
    min-height: 180px;
    margin-bottom: 60px;
    padding: 10px 0 6px;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.hero-dependents .fullwidth-hero-bg {
    position: absolute;
    right: -4px;
    top: 2px;
    width: 275px;
    max-width: 55%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.hero-dependents .fullwidth-hero-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
}

/* 5ページ目専用（保険料控除：ハロウィーンりするん） - 画像全体が100%隠れず見えるゆったりマージン */
.hero-insurance.slide-fullwidth-hero {
    min-height: 180px;
    margin-bottom: 60px;
    padding: 10px 0 6px;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.hero-insurance .fullwidth-hero-bg {
    position: absolute;
    right: -4px;
    top: 2px;
    width: 275px;
    max-width: 55%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.hero-insurance .fullwidth-hero-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
}

/* 6ページ目専用（住宅ローン控除：どんぐりハウスとりするん） - 画像全体が100%隠れず見えるゆったりマージン */
.hero-housing.slide-fullwidth-hero {
    min-height: 180px;
    margin-bottom: 60px;
    padding: 10px 0 6px;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.hero-housing .fullwidth-hero-bg {
    position: absolute;
    right: -4px;
    top: 2px;
    width: 275px;
    max-width: 55%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.hero-housing .fullwidth-hero-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
}

/* 7ページ目専用（計算結果：おつかれさまりするん） - 画像全体が100%隠れず見えるゆったりマージン */
.hero-result.slide-fullwidth-hero {
    min-height: 180px;
    margin-bottom: 60px;
    padding: 10px 0 6px;
    position: relative;
    z-index: 1;
    overflow: visible;
}
.hero-result .fullwidth-hero-bg {
    position: absolute;
    right: -4px;
    top: 2px;
    width: 275px;
    max-width: 55%;
    pointer-events: none;
    z-index: 0;
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.hero-result .fullwidth-hero-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.08));
    display: block;
}

/* テーブル・ボタン・結果ボックスは前景レイヤー（z-index: 2）でイラストの下に自然に重ねる */
.radio-cards, .input-card, .result-box, .result-actions {
    position: relative;
    z-index: 2;
}

/* 前面テキスト：大きなフォントで高い視認性 */
.fullwidth-hero-overlay {
    position: relative;
    z-index: 1;
    max-width: 60%;
}
.fullwidth-hero-overlay .question-title {
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1.25;
    margin-bottom: 6px;
    color: #0F172A;
    letter-spacing: -0.02em;
}
.fullwidth-hero-overlay .question-desc {
    font-size: 0.95rem;
    color: #334155;
    font-weight: 600;
    margin-bottom: 14px;
    line-height: 1.45;
}

/* コメント欄：りするんアイコンからの清潔な吹き出し ＆ 右側独立電卓ボタン */
.risurun-bubble-overlay {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    position: relative;
    z-index: 2;
}
.risurun-avatar-col {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.risurun-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid #FCD34D;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    display: block;
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.risurun-avatar:hover {
    transform: scale(1.06);
}
.risurun-bubble-overlay .bubble-text {
    position: relative;
    background: #FFFFFF;
    border: 2px solid #FCD34D;
    border-radius: 14px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 900;
    color: #0F172A;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
}
/* 左の丸アイコンから出る本物の吹き出しのしっぽ（アバターの中心高さと完全連動） */
.risurun-bubble-overlay .bubble-text::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #FCD34D;
}
.risurun-bubble-overlay .bubble-text::after {
    content: '';
    position: absolute;
    top: 50%;
    left: -5px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 6px solid #FFFFFF;
}

/* 電卓ツールボタン（吹き出しの右側に独立配置） */
.risurun-calc-btn-inline {
    width: 36px;
    height: 36px;
    padding: 0;
    margin: 0;
    background: #FFFFFF;
    border: 1.5px solid #FCD34D;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.risurun-calc-btn-inline:hover {
    transform: scale(1.12);
    border-color: #F59E0B;
    background: #FEF3C7;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}
.risurun-calc-btn-inline:active {
    transform: scale(0.95);
}
.cute-calc-btn-img {
    width: 20px;
    height: 20px;
    display: block;
    object-fit: contain;
}

/* PC・タブレットでの広々とした表示 */
@media (min-width: 768px) {
    .slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 24px;
        padding: 14px 0 10px;
    }
    .fullwidth-hero-bg {
        width: 420px;
        max-width: 55%;
        right: 0;
        bottom: -15px;
    }
    .hero-moon.slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 95px;
        padding: 14px 0 10px;
    }
    .hero-moon .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: 4px;
        width: 360px;
        max-width: 52%;
    }
    .hero-moon .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        transform: none;
        object-fit: contain;
    }
    .hero-spouse.slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 95px;
        padding: 14px 0 10px;
    }
    .hero-spouse .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: 4px;
        width: 340px;
        max-width: 48%;
    }
    .hero-spouse .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-dependents.slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 95px;
        padding: 14px 0 10px;
    }
    .hero-dependents .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: 4px;
        width: 360px;
        max-width: 52%;
    }
    .hero-dependents .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-insurance.slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 95px;
        padding: 14px 0 10px;
    }
    .hero-insurance .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: 4px;
        width: 360px;
        max-width: 52%;
    }
    .hero-insurance .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-housing.slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 95px;
        padding: 14px 0 10px;
    }
    .hero-housing .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: 4px;
        width: 360px;
        max-width: 52%;
    }
    .hero-housing .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-result.slide-fullwidth-hero {
        min-height: 220px;
        margin-bottom: 95px;
        padding: 14px 0 10px;
    }
    .hero-result .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: 4px;
        width: 360px;
        max-width: 52%;
    }
    .hero-result .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .fullwidth-hero-overlay {
        max-width: 58%;
    }
    .fullwidth-hero-overlay .question-title {
        font-size: 1.95rem;
    }
    .fullwidth-hero-overlay .question-desc {
        font-size: 1.02rem;
    }
    .risurun-bubble-overlay .risurun-avatar {
        width: 94px;
        height: 94px;
    }
    .risurun-bubble-overlay .bubble-text {
        font-size: 0.98rem;
        padding: 9px 18px;
    }
}

/* スマホ表示での最適化（1ページ目同様の特大サイズ＆上端フィット） */
@media (max-width: 480px) {
    .slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 14px;
    }
    .fullwidth-hero-bg {
        width: 240px;
        max-width: 60%;
        right: -6px;
        bottom: -10px;
    }
    .hero-moon.slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 58px;
        padding: 10px 0 6px;
    }
    .hero-moon .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: -4px;
        width: 220px;
        max-width: 56%;
    }
    .hero-moon .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        transform: none;
        object-fit: contain;
    }
    .hero-spouse.slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 58px;
        padding: 10px 0 6px;
    }
    .hero-spouse .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: -4px;
        width: 210px;
        max-width: 54%;
    }
    .hero-spouse .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-dependents.slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 58px;
        padding: 10px 0 6px;
    }
    .hero-dependents .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: -4px;
        width: 220px;
        max-width: 56%;
    }
    .hero-dependents .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-insurance.slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 58px;
        padding: 10px 0 6px;
    }
    .hero-insurance .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: -4px;
        width: 220px;
        max-width: 56%;
    }
    .hero-insurance .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-housing.slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 58px;
        padding: 10px 0 6px;
    }
    .hero-housing .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: -4px;
        width: 220px;
        max-width: 56%;
    }
    .hero-housing .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .hero-result.slide-fullwidth-hero {
        min-height: 165px;
        margin-bottom: 58px;
        padding: 10px 0 6px;
    }
    .hero-result .fullwidth-hero-bg {
        top: 2px;
        bottom: auto;
        right: -4px;
        width: 220px;
        max-width: 56%;
    }
    .hero-result .fullwidth-hero-img {
        width: 100%;
        height: auto;
        max-height: none;
        object-fit: contain;
    }
    .fullwidth-hero-overlay {
        max-width: 64%;
    }
    .fullwidth-hero-overlay .question-title {
        font-size: 1.42rem;
        margin-bottom: 3px;
    }
    .fullwidth-hero-overlay .question-desc {
        font-size: 0.82rem;
        margin-bottom: 8px;
        line-height: 1.35;
    }
    .risurun-bubble-overlay {
        gap: 10px;
    }
    .risurun-bubble-overlay .risurun-avatar {
        width: 76px;
        height: 76px;
    }
    .risurun-bubble-overlay .bubble-text {
        font-size: 0.78rem;
        padding: 6px 11px;
    }
}

/* フォーム部品 */
.input-card {
    background: var(--white);
    padding: 18px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 18px;
    position: relative;
    z-index: 1;
}
.input-card-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.btn-card-clear {
    background: #FFF1F2;
    color: #E11D48;
    border: 1px solid #FECDD3;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.btn-card-clear:hover {
    background: #FFE4E6;
    color: #BE123C;
    border-color: #FDA4AF;
    transform: translateY(-1px);
}
/* フォーム共通バッジ（必須・任意・該当者のみ・自動判定） */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.25;
    vertical-align: middle;
    background: #FEE2E2;
    color: #DC2626;
    border: 1px solid #FECACA;
    margin-left: 4px;
}

/* 任意バッジ（淡いソフトグリーン） */
.badge.opt,
.badge.optional {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

/* 該当者のみ・全額控除バッジ（淡いソフトブルー） */
.badge.cond,
.badge.info {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
}

/* 自動判定バッジ（淡いスレートグレー） */
.badge.auto {
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #CBD5E1;
}

.input-group {
    margin-bottom: 14px;
}
.input-group:last-child {
    margin-bottom: 0;
}
.input-group.inline {
    display: flex;
    gap: 10px;
}
.input-group.inline > div { flex: 1; min-width: 0; }

/* 生年月日グループ：年を広め(flex:1.6)にして見切れ・はみ出しを完全防止 */
.input-group.inline.date-group > div:first-child,
.input-group.inline.date-group > .col-year,
.input-group.inline > div:has(.date-year) {
    flex: 1.6;
    min-width: 0;
}
.input-group.inline.date-group > div:nth-child(2),
.input-group.inline.date-group > div:nth-child(3),
.input-group.inline.date-group > .col-month,
.input-group.inline.date-group > .col-day,
.input-group.inline > div:has(.date-month),
.input-group.inline > div:has(.date-day) {
    flex: 1;
    min-width: 0;
}

.input-select.date-year {
    font-size: 0.88rem;
    padding: 11px 4px 11px 8px;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.input-select.date-month,
.input-select.date-day {
    font-size: 0.92rem;
    padding: 11px 4px 11px 6px;
    text-align: center;
}

.input-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.83rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #4B5563;
}
.input-group label .label-hint {
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--blue);
}

.input-text, .input-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #D1D5DB;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: all 0.2s;
    background: #FFFFFF;
    color: var(--text-main);
}
.input-text:focus, .input-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.input-text:disabled, .input-text[readonly] {
    background: var(--bg-gray);
    color: var(--text-sub);
    cursor: not-allowed;
    border-color: var(--border-color);
}

/* 必須項目の上品でソフトな色付け（邪魔にならない淡いウォームアイボリー） */
.input-text.input-required,
.input-select.input-required,
.input-required {
    background-color: #FFFDF5;
    border-color: #FCD34D;
    box-shadow: 0 1px 2px rgba(245, 158, 11, 0.05);
}
.input-text.input-required:hover,
.input-select.input-required:hover,
.input-required:hover {
    border-color: #F59E0B;
}
.input-text.input-required:focus,
.input-select.input-required:focus,
.input-required:focus {
    background-color: #FFFFFF;
    border-color: #F59E0B;
    box-shadow: 0 0 0 3.5px rgba(245, 158, 11, 0.2);
}

/* セグメントコントロール（元号切り替えUI） */
.era-segmented {
    display: inline-flex;
    background: var(--bg-gray);
    padding: 3px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    gap: 2px;
    border: 1px solid var(--border-color);
}
.era-segmented label {
    display: inline-block;
    margin: 0;
    cursor: pointer;
}
.era-segmented input[type="radio"] {
    display: none;
}
.era-segmented span {
    display: block;
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-sub);
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
}
.era-segmented input[type="radio"]:checked + span {
    background: var(--white);
    color: var(--primary-hover);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-weight: 800;
}

/* 特別控除選択リスト */
.deduction-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.deduction-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
}
.deduction-item:hover {
    border-color: #CBD5E1;
    background: #F9FAFB;
}
.deduction-item.checked {
    border-color: var(--primary);
    background: #FFFBEB;
}
.deduction-item input[type="checkbox"], .deduction-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
}
.deduction-content {
    flex: 1;
}
.deduction-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 2px;
}
.deduction-desc {
    font-size: 0.78rem;
    color: var(--text-sub);
    line-height: 1.4;
}

/* ラジオカード（はい/いいえ） */
.radio-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.radio-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.radio-card:hover { background: #FFFBEB; border-color: #FCD34D; }
.radio-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.12);
}
.radio-label { font-weight: 800; font-size: 1rem; margin-top: 6px; }

/* りするん吹き出し（アイコンから飛び出すリアルな吹き出しデザイン） */
.risurun-bubble {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
    background: transparent;
    padding: 0;
    border: none;
}
.risurun-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
    flex-shrink: 0;
    border: 2px solid #FCD34D;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    background: #FFFFFF;
}
.bubble-text {
    position: relative;
    background: #F0FDF4;
    border: 1.5px solid #86EFAC;
    border-radius: 14px;
    padding: 11px 15px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #166534;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.08);
    flex: 1;
}
/* 吹き出しのしっぽ（左向きの三角矢印） */
.bubble-text::before {
    content: '';
    position: absolute;
    top: 14px;
    left: -8px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #86EFAC;
}
.bubble-text::after {
    content: '';
    position: absolute;
    top: 15px;
    left: -6px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 6px solid #F0FDF4;
}

/* 配偶者控除・スキップ親切ガイドボックス */
.spouse-guide-box {
    background: #F0F9FF;
    border: 1.5px solid #BAE6FD;
    border-left: 4px solid #0284C7;
    border-radius: 12px;
    padding: 14px 16px;
    margin-top: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}
.spouse-guide-box.highlight {
    background: #FFFBEB;
    border-color: #FDE68A;
    border-left-color: #F59E0B;
}
.spouse-guide-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
}
.spouse-guide-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #0284C7;
    color: #FFFFFF;
}
.spouse-guide-box.highlight .spouse-guide-badge {
    background: #D97706;
}

/* アラート */
.alert-box {
    background: var(--red-light);
    border-left: 4px solid var(--red);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-top: 8px;
    font-size: 0.82rem;
    color: #991B1B;
    font-weight: 700;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    line-height: 1.4;
}

/* 動的リスト（扶養親族など） */
.dynamic-list { margin-bottom: 16px; }
.list-item {
    background: var(--white);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    margin-bottom: 14px;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.btn-add {
    width: 100%;
    padding: 14px;
    border: 2px dashed #CBD5E1;
    background: var(--white);
    color: #4B5563;
    font-weight: 800;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-add:hover {
    border-color: var(--primary);
    color: var(--primary-hover);
    background: #FFFBEB;
}
.btn-remove {
    position: absolute;
    top: 14px; right: 14px;
    background: #FEE2E2;
    color: var(--red);
    border: none;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-remove:hover {
    background: #FECACA;
}

/* OCRボタン */
.ocr-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--secondary);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-weight: 800;
    font-size: 1rem;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    border: none;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
}
.ocr-btn:hover {
    background: #059669;
}

/* ボトム固定ナビゲーションバー */
.bottom-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 14px 24px;
    background: var(--white);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.04);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-prev-bottom {
    flex: 0.35;
    min-width: 84px;
    padding: 14px 12px;
    background: #FFFFFF;
    color: #475569;
    border: 1.5px solid #CBD5E1;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.2s;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.btn-prev-bottom:hover {
    background: #F8FAFC;
    border-color: #94A3B8;
    color: #0F172A;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.btn-prev-bottom:active {
    transform: translateY(1px);
    background: #F1F5F9;
}
.btn-next {
    flex: 1;
    padding: 15px;
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: var(--radius-full);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
    transition: all 0.2s;
    box-sizing: border-box;
}
.btn-next:hover:not(:disabled) {
    opacity: 0.95;
    transform: translateY(-1px);
}
.btn-next:active:not(:disabled) {
    transform: translateY(1px);
}
.btn-next:disabled {
    background: #D1D5DB;
    box-shadow: none;
    cursor: not-allowed;
    color: #9CA3AF;
}

/* 結果画面 */
.result-box {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}
.result-row:last-child { border-bottom: none; }
.r-label { font-weight: 700; color: var(--text-sub); font-size: 0.9rem; display: flex; align-items: center; gap: 4px; }
.r-val { font-weight: 900; font-size: 1.05rem; color: var(--text-main); }
.r-val.highlight { color: var(--secondary); font-size: 1.3rem; }
.r-val.total { color: var(--primary); font-size: 1.45rem; }

/* 丸型クエスチョンヘルプボタン */
.help-q-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #E2E8F0;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #CBD5E1;
    padding: 0;
    line-height: 1;
}
.help-q-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary-hover);
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

/* 解説・規約・ポップアップモーダル */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: 20px;
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    background: #ECFDF5 !important;
    max-width: 480px;
    width: 100%;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    border: 1.5px solid #A7F3D0 !important;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.modal-overlay.active .modal-content {
    transform: scale(1);
}
.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--text-main);
}
.modal-body {
    font-size: 0.9rem;
    color: #374151;
    line-height: 1.6;
    margin-bottom: 20px;
    background: #FFFFFF;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid #DCFCE7;
}
.modal-close-btn {
    width: 100%;
    padding: 13px;
    background: var(--primary-gradient);
    color: white;
    font-weight: 800;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
    transition: all 0.15s;
}
.modal-close-btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* ==========================================
   4枚の用紙 表・裏 りするんのかんたん説明 モーダル（フォーム内）
   ========================================== */
#paperGuideModal .modal-content {
    background: #FFFFFF !important;
    border: none !important;
    padding: 0 !important;
}
.paper-modal-header {
    background: linear-gradient(135deg, #F0FDF4 0%, #EFF6FF 50%, #FFFBEB 100%);
    padding: 16px 20px 12px;
    border-bottom: 1.5px solid #E2E8F0;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.paper-modal-badge {
    background: #10B981;
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    transition: background 0.3s ease;
}
.paper-modal-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: #0F172A;
    margin: 0;
}
.paper-close-btn {
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #475569;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.paper-close-btn:hover {
    background: #F1F5F9;
    color: #0F172A;
}
.paper-tabs-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 8px;
}
.paper-tabs-nav {
    display: flex;
    gap: 6px;
    min-width: max-content;
}
.paper-tab-btn {
    background: #FFFFFF;
    border: 1.5px solid #E2E8F0;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.paper-tab-btn:hover {
    border-color: #CBD5E1;
    color: #0F172A;
}
.paper-tab-btn.active {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    border-color: #059669;
    font-weight: 900;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}

.paper-side-switch-wrap {
    display: flex;
    justify-content: center;
}
.paper-side-switch {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.06);
    padding: 3px;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.paper-side-btn {
    background: transparent;
    border: none;
    color: #64748B;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 5px 20px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s;
}
.paper-side-btn.active {
    background: #FFFFFF;
    color: #0F172A;
    font-weight: 900;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.paper-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    background: #F0FDF4;
    transition: background 0.3s ease;
}

.paper-header-summary {
    background: #FFFFFF;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    transition: border-color 0.3s ease;
}
.paper-header-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0F172A;
    margin-bottom: 4px;
}
.paper-header-sub {
    font-size: 0.82rem;
    color: #64748B;
    line-height: 1.5;
}
.paper-side-badge {
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 9999px;
}

.paper-section-card {
    background: #FFFFFF;
    border: 1.5px solid #E2E8F0;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: border-color 0.3s ease;
}
.paper-tag-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.paper-tag-pill {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}
.paper-item-name {
    font-size: 1.0rem;
    font-weight: 900;
    color: #0F172A;
    margin-bottom: 10px;
    line-height: 1.4;
}

.paper-official-box {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-left: 3.5px solid #64748B;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 10px;
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.6;
}
.paper-official-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: #475569;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.paper-risurun-box {
    background: #FFFBEB;
    border: 1.5px solid #FDE68A;
    border-left: 4px solid #F59E0B;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
.paper-risurun-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 900;
    padding: 2px 9px;
    border-radius: 4px;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
.paper-risurun-text {
    font-size: 0.88rem;
    line-height: 1.65;
    font-weight: 500;
}

.paper-modal-footer {
    padding: 14px 20px;
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

/* 4つの用紙 テーマカラー */
[data-paper-theme="fuyou"] .paper-modal-header {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    border-bottom-color: #A7F3D0;
}
[data-paper-theme="fuyou"] .paper-modal-badge { background: #059669; }
[data-paper-theme="fuyou"] .paper-tab-btn.active {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    border-color: #059669;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.35);
}
[data-paper-theme="fuyou"] .paper-modal-body { background: #F0FDF4; }
[data-paper-theme="fuyou"] .paper-header-summary { border-color: #BBF7D0; }
[data-paper-theme="fuyou"] .paper-side-badge {
    background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0;
}
[data-paper-theme="fuyou"] .paper-section-card { border-color: #DCFCE7; }
[data-paper-theme="fuyou"] .paper-tag-pill {
    background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0;
}
[data-paper-theme="fuyou"] .paper-risurun-box {
    background: #F0FDF4; border: 1.5px solid #A7F3D0; border-left: 4px solid #059669;
}
[data-paper-theme="fuyou"] .paper-risurun-tag { background: #059669; color: #FFFFFF; }
[data-paper-theme="fuyou"] .paper-risurun-text { color: #064E3B; }

[data-paper-theme="kiso"] .paper-modal-header {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-bottom-color: #FDE68A;
}
[data-paper-theme="kiso"] .paper-modal-badge { background: #D97706; }
[data-paper-theme="kiso"] .paper-tab-btn.active {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    border-color: #D97706;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
}
[data-paper-theme="kiso"] .paper-modal-body { background: #FFFDF5; }
[data-paper-theme="kiso"] .paper-header-summary { border-color: #FDE68A; }
[data-paper-theme="kiso"] .paper-side-badge {
    background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A;
}
[data-paper-theme="kiso"] .paper-section-card { border-color: #FEF3C7; }
[data-paper-theme="kiso"] .paper-tag-pill {
    background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A;
}
[data-paper-theme="kiso"] .paper-risurun-box {
    background: #FFFBEB; border: 1.5px solid #FDE68A; border-left: 4px solid #D97706;
}
[data-paper-theme="kiso"] .paper-risurun-tag { background: #D97706; color: #FFFFFF; }
[data-paper-theme="kiso"] .paper-risurun-text { color: #78350F; }

[data-paper-theme="hoken"] .paper-modal-header {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-bottom-color: #BFDBFE;
}
[data-paper-theme="hoken"] .paper-modal-badge { background: #2563EB; }
[data-paper-theme="hoken"] .paper-tab-btn.active {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    border-color: #2563EB;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}
[data-paper-theme="hoken"] .paper-modal-body { background: #F4F8FF; }
[data-paper-theme="hoken"] .paper-header-summary { border-color: #BFDBFE; }
[data-paper-theme="hoken"] .paper-side-badge {
    background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE;
}
[data-paper-theme="hoken"] .paper-section-card { border-color: #DBEAFE; }
[data-paper-theme="hoken"] .paper-tag-pill {
    background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE;
}
[data-paper-theme="hoken"] .paper-risurun-box {
    background: #EFF6FF; border: 1.5px solid #BFDBFE; border-left: 4px solid #2563EB;
}
[data-paper-theme="hoken"] .paper-risurun-tag { background: #2563EB; color: #FFFFFF; }
[data-paper-theme="hoken"] .paper-risurun-text { color: #1E3A8A; }

[data-paper-theme="loan"] .paper-modal-header {
    background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
    border-bottom-color: #DDD6FE;
}
[data-paper-theme="loan"] .paper-modal-badge { background: #7C3AED; }
[data-paper-theme="loan"] .paper-tab-btn.active {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
    border-color: #7C3AED;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}
[data-paper-theme="loan"] .paper-modal-body { background: #FAF7FF; }
[data-paper-theme="loan"] .paper-header-summary { border-color: #DDD6FE; }
[data-paper-theme="loan"] .paper-side-badge {
    background: #F5F3FF; color: #5B21B6; border: 1px solid #DDD6FE;
}
[data-paper-theme="loan"] .paper-section-card { border-color: #EDE9FE; }
[data-paper-theme="loan"] .paper-tag-pill {
    background: #F5F3FF; color: #6D28D9; border: 1px solid #DDD6FE;
}
[data-paper-theme="loan"] .paper-risurun-box {
    background: #F5F3FF; border: 1.5px solid #DDD6FE; border-left: 4px solid #7C3AED;
}
[data-paper-theme="loan"] .paper-risurun-tag { background: #7C3AED; color: #FFFFFF; }
[data-paper-theme="loan"] .paper-risurun-text { color: #4C1D95; }

/* モーダル右上の「×」アイコンボタン（ズレを完全に排除した完璧な中央配置） */
.modal-close-icon-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F1F5F9;
    color: #64748B;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: none;
    z-index: 10;
}
.modal-close-icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.5;
    display: block;
}
.modal-close-icon-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
    transform: scale(1.08);
}

/* ==========================================
   クイック修正サマリー用スタイル
========================================== */
.edit-summary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.edit-summary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    gap: 10px;
    transition: all 0.15s;
}
.edit-summary-item:hover {
    background: #F1F5F9;
    border-color: #CBD5E1;
}
.edit-summary-info {
    flex: 1;
    min-width: 0;
}
.edit-summary-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #64748B;
}
.edit-summary-val {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0F172A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.btn-quick-edit {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: white;
    border: 1.5px solid var(--primary);
    color: var(--primary-dark);
    font-weight: 800;
    font-size: 0.78rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-quick-edit:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

/* ==========================================
   公式申告書 プレビュー＆印刷用スタイル
========================================== */
.sheet-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}
.sheet-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
/* ベータ版 注意アナウンスバー */
.sheet-beta-notice-bar {
    background: #0F172A;
    border-bottom: 1px solid #334155;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sheet-beta-notice-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.sheet-beta-pill {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #FFFFFF;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.sheet-beta-text {
    font-size: 0.76rem;
    color: #94A3B8;
    font-weight: 500;
    line-height: 1.3;
}
@media (max-width: 640px) {
    .sheet-beta-notice-bar {
        padding: 5px 10px;
    }
    .sheet-beta-text {
        font-size: 0.7rem;
    }
}

.sheet-toolbar {
    background: #1E293B;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #334155;
    flex-wrap: wrap;
}
.sheet-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    max-width: 100%;
}
.sheet-tab-btn {
    padding: 8px 16px;
    background: #334155;
    color: #94A3B8;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.sheet-tab-btn.active {
    background: var(--primary);
    color: white;
}
.sheet-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sheet-btn-print {
    padding: 9px 18px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(16,185,129,0.4);
    transition: all 0.15s;
}
.sheet-btn-print:hover { background: #059669; }
.sheet-btn-close {
    padding: 9px 14px;
    background: #475569;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}
.sheet-viewport {
    flex: 1;
    overflow: auto;
    padding: 24px 16px;
    display: flex;
    justify-content: center;
    background: #0F172A;
}

/* A4公式用紙レイアウト */
.official-sheet {
    display: none;
    width: 100%;
    background: transparent;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border: none;
    box-sizing: border-box;
}
.official-sheet.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}
.sheet-header-title {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    position: relative;
    padding-bottom: 4px;
    border-bottom: 2px solid #000;
}
.sheet-header-sub {
    font-size: 0.72rem;
    font-weight: normal;
    color: #4B5563;
    display: block;
    margin-top: 2px;
}
.sheet-circle-badge {
    position: absolute;
    right: 0;
    top: -2px;
    width: 32px;
    height: 32px;
    border: 2px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.05rem;
    background: #FFFBEB;
}
.sheet-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 8px;
    border: 1.5px solid #000;
}
.sheet-table th, .sheet-table td {
    border: 1px solid #000;
    padding: 3px 5px;
    vertical-align: middle;
    font-size: 10px;
}
.sheet-table th {
    background: #F1F5F9;
    font-weight: 700;
    text-align: center;
    color: #0F172A;
}
.sheet-fill-val {
    font-weight: 800;
    color: #0F172A;
    font-size: 10.5px;
    word-break: break-all;
}
.sheet-fill-num {
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 800;
    text-align: right;
    font-size: 10.5px;
}
.sheet-check-box {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 1.2px solid #000;
    text-align: center;
    line-height: 11px;
    font-weight: 900;
    font-size: 10px;
    margin-right: 2px;
    vertical-align: middle;
    background: white;
}
.sheet-check-box.checked::after {
    content: 'レ';
    color: #DC2626;
    font-weight: 900;
}
.sheet-sec-title {
    background: #334155;
    color: #FFFFFF;
    font-weight: 900;
    padding: 3px 6px;
    font-size: 10.5px;
    margin-top: 6px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sheet-seal-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px dashed #94A3B8;
    border-radius: 50%;
    color: #94A3B8;
    font-size: 9px;
    margin-left: 6px;
}

/* 印刷時最適化 (A4出力) */
@media print {
    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
    }
    .app-container, .sheet-toolbar, .modal-overlay {
        display: none !important;
    }
    .sheet-modal-overlay {
        position: static !important;
        background: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        padding: 0 !important;
    }
    .sheet-viewport {
        background: none !important;
        padding: 0 !important;
        overflow: visible !important;
        display: block !important;
    }
    .official-sheet {
        box-shadow: none !important;
        margin: 0 0 20mm 0 !important;
        padding: 8mm !important;
        width: 100% !important;
        max-width: 100% !important;
        page-break-after: always;
        break-after: page;
        display: block !important;
    }
}

/* ヘルプアイコン（丸クエスチョンマーク） */
.help-circle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #E2E8F0;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 50%;
    margin-left: 6px;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1;
}
.help-circle-icon:hover {
    background: var(--primary);
    color: #ffffff;
    transform: scale(1.15);
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

/* フォーム内ブログ記事誘導リンク & モーダル */
.form-blog-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #2563EB;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    border-radius: 6px;
    padding: 4px 9px;
    margin-top: 4px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    line-height: 1.4;
    text-decoration: none;
}
.form-blog-link-btn:hover {
    background: #DBEAFE;
    color: #1D4ED8;
    border-color: #93C5FD;
    transform: translateY(-1px);
}
.form-blog-link-btn svg {
    flex-shrink: 0;
}
.form-blog-tips-box {
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 10px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-blog-tips-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 5px;
}
#blogReaderModal .modal-content {
    background: #FFFFFF !important;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid #E2E8F0 !important;
}

/* 記事内いいねフィードバックボックス */
.blog-feedback-box {
    margin-top: 28px;
    padding: 20px 16px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 14px;
    text-align: center;
}
.blog-feedback-title {
    font-size: 1rem;
    font-weight: 900;
    color: #1E293B;
    margin-bottom: 4px;
}
.blog-feedback-sub {
    font-size: 0.8rem;
    color: #64748B;
    margin-bottom: 12px;
}
.blog-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    color: #2563EB;
    border: 1.5px solid #BFDBFE;
    padding: 10px 22px;
    border-radius: 9999px;
    font-size: 0.92rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.12);
}
.blog-like-btn:hover {
    background: #EFF6FF;
    border-color: #93C5FD;
    transform: scale(1.03);
}
.blog-like-btn.liked {
    background: #10B981;
    color: #FFFFFF;
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.like-count-badge {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.82rem;
}
.blog-like-btn.liked .like-count-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
}

/* モーダル内検索ウィジェット */
.modal-search-box-widget {
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    border: 1.5px solid #BAE6FD;
    border-radius: 14px;
    padding: 20px 16px;
    margin: 28px 0 20px;
    text-align: left;
}
.msb-header {
    margin-bottom: 10px;
}
.msb-badge {
    display: inline-block;
    background: #0284C7;
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}
.msb-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0C4A6E;
    margin-bottom: 4px;
}
.msb-desc {
    font-size: 0.8rem;
    color: #0369A1;
    line-height: 1.45;
}
.msb-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 10px;
}
.msb-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #0284C7;
    pointer-events: none;
}
.msb-input {
    width: 100%;
    padding: 11px 36px 11px 36px;
    font-size: 0.9rem;
    border: 1.5px solid #7DD3FC;
    border-radius: 10px;
    background: #FFFFFF;
    color: #0F172A;
    transition: all 0.2s;
    box-sizing: border-box;
}
.msb-input:focus {
    outline: none;
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}
.msb-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #E2E8F0;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    color: #64748B;
    cursor: pointer;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msb-dropdown {
    margin-top: 10px;
    background: #FFFFFF;
    border: 1.5px solid #BAE6FD;
    border-radius: 10px;
    max-height: 260px;
    overflow-y: auto;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}
.msb-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #F1F5F9;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.msb-item:last-child {
    border-bottom: none;
}
.msb-item:hover {
    background: #F0F9FF;
}
.msb-item-tag {
    display: inline-block;
    background: #E0F2FE;
    color: #0284C7;
    font-size: 0.68rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
}
.msb-item-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.4;
}
.msb-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}
.msb-chips-label {
    font-size: 0.75rem;
    color: #0369A1;
    font-weight: 700;
}
.msb-chip {
    background: #FFFFFF;
    border: 1px solid #BAE6FD;
    color: #0284C7;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.msb-chip:hover {
    background: #0284C7;
    color: #FFFFFF;
}

/* モーダル内関連記事リスト */
.modal-related-section {
    margin: 28px 0 20px;
    text-align: left;
}
.modal-related-heading {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0F172A;
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3.5px solid #2563EB;
}
.modal-related-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.modal-related-card {
    display: block;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.modal-related-card:hover {
    background: #EFF6FF;
    border-color: #2563EB;
    transform: translateX(4px);
}
.modal-related-tag {
    display: inline-block;
    background: #EFF6FF;
    color: #2563EB;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}
.modal-related-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.4;
    margin-bottom: 4px;
}
.modal-related-lead {
    font-size: 0.78rem;
    color: #64748B;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}
.modal-related-arrow {
    font-size: 0.78rem;
    font-weight: 800;
    color: #2563EB;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* モーダル内アクションバナー */
.modal-action-banner {
    margin: 20px 0;
}
.modal-action-portal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0F172A;
    color: #FFFFFF;
    font-size: 0.92rem;
    font-weight: 800;
    padding: 12px 18px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}
.modal-action-portal-btn:hover {
    background: #1E293B;
}

/* モーダルフッター専用スタイル */
.modal-blog-footer {
    padding: 12px 16px;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}
.modal-footer-form-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 800;
    padding: 12px 16px;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transition: all 0.2s;
    white-space: nowrap;
    width: 100%;
    box-sizing: border-box;
}
.modal-footer-form-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
}
.modal-footer-sub-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.modal-footer-portal-link {
    flex: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #0F172A;
    color: #FFFFFF;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s;
    box-sizing: border-box;
}
.modal-footer-portal-link:hover {
    background: #1E293B;
}
.modal-footer-close-action {
    flex: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #E2E8F0;
    color: #334155;
    border: 1px solid #CBD5E1;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    box-sizing: border-box;
}
.modal-footer-close-action:hover {
    background: #CBD5E1;
    color: #0F172A;
}

/* ----------------------------------------------------
   虫眼鏡ルーペ機能・実際の用紙ビューア
   ---------------------------------------------------- */
.paper-viewmode-switch-wrap {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}
.paper-viewmode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.paper-viewmode-btn:hover {
    border-color: #94A3B8;
    color: #0F172A;
}
.paper-viewmode-btn.active {
    background: #1E293B;
    border-color: #0F172A;
    color: #FDE68A;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.paper-loupe-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.loupe-controls-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.loupe-mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.78rem;
    font-weight: 800;
    color: #059669;
    background: #ECFDF5;
    padding: 3px 8px;
    border-radius: 9999px;
    border: 1px solid #A7F3D0;
}
.loupe-zoom-selector {
    display: flex;
    align-items: center;
    gap: 4px;
}
.zoom-level-btn {
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.zoom-level-btn.active {
    background: #D97706;
    color: #FFFFFF;
    border-color: #B45309;
    box-shadow: 0 1px 4px rgba(217, 119, 6, 0.3);
}
/* ----------------------------------------------------
   公式用紙ビューア＆PDFポップアップ
   ---------------------------------------------------- */
.paper-viewer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: #0F172A;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #334155;
    flex-wrap: wrap;
}
.paper-scale-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.paper-scale-btn {
    padding: 5px 11px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid #475569;
    background: #1E293B;
    color: #CBD5E1;
    cursor: pointer;
    transition: all 0.15s;
}
.paper-scale-btn:hover {
    background: #334155;
    color: #FFFFFF;
}
.paper-scale-btn.active {
    background: #0284C7;
    border-color: #38BDF8;
    color: #FFFFFF;
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.4);
}

.btn-open-pdf-popup {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: #2563EB;
    color: #FFFFFF;
    border: 1px solid #3B82F6;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn-open-pdf-popup:hover {
    background: #1D4ED8;
    color: #FFFFFF;
    transform: translateY(-1px);
}

/* 表示エリア */
.paper-sheet-display-area {
    width: 100%;
    min-height: 280px;
    max-height: 60vh;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 14px;
    box-sizing: border-box;
    background: #1E293B;
    border-radius: 0 0 8px 8px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.35);
}
.paper-sheet-display-area.mode-fit {
    align-items: center;
    overflow: hidden;
}
.paper-sheet-display-area.mode-fit .real-sheet-img {
    max-height: calc(60vh - 28px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-radius: 4px;
    display: block;
}
.paper-sheet-display-area.mode-zoom .real-sheet-img {
    width: 135%;
    max-width: none;
    height: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-radius: 4px;
    display: block;
}
.paper-sheet-display-area.mode-super .real-sheet-img {
    width: 180%;
    max-width: none;
    height: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    border-radius: 4px;
    display: block;
}

.real-sheet-image-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

/* 縦向き申告書（住宅ローン等）の最適化 */
.paper-sheet-display-area.is-portrait.mode-fit .real-sheet-img {
    max-height: calc(60vh - 28px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
}

/* サンプル注意バナー */
.paper-sample-alert-box {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: #FFFBEB;
    border: 1.5px solid #FCD34D;
    border-left: 5px solid #F59E0B;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: #92400E;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.1);
}
.paper-sample-alert-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    color: #B45309;
    margin-bottom: 4px;
    font-size: 0.88rem;
}
.paper-sample-alert-desc {
    font-weight: 500;
    color: #78350F;
}
.paper-sample-alert-desc strong {
    color: #9A3412;
    font-weight: 800;
}

/* サンプル透かしバッジ */
.paper-sample-watermark-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(220, 38, 38, 0.88);
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
    pointer-events: none;
}

/* 国税庁出典クレジット */
.paper-source-attribution {
    margin-top: 14px;
    padding: 8px 12px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}
.paper-source-attribution a {
    color: #0284C7;
    font-weight: 700;
    text-decoration: none;
}
.paper-source-attribution a:hover {
    text-decoration: underline;
}

/* 全画面PDFポップアップモーダル */
.pdf-popup-content {
    max-width: 1040px;
    width: 95vw;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    background: #0F172A;
    box-shadow: 0 25px 60px rgba(0,0,0,0.5);
}
.pdf-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: #1E293B;
    border-bottom: 1px solid #334155;
    flex-shrink: 0;
}
.pdf-popup-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pdf-popup-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
    background: #0284C7;
    color: #FFFFFF;
}
.pdf-popup-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #F8FAFC;
    margin: 0;
}
.pdf-popup-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.pdf-popup-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: #2563EB;
    color: #FFFFFF;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: 0.15s;
}
.pdf-popup-dl-btn:hover {
    background: #1D4ED8;
}
.pdf-popup-body {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #334155;
    overflow: hidden;
    position: relative;
}
.pdf-popup-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #FFFFFF;
}

/* ----------------------------------------------------
   昨年のQRコードからデータ復元 モーダル & バナー
   ---------------------------------------------------- */
.qr-restore-modal-content {
    max-width: 580px;
    width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    background: #FFFFFF;
    box-shadow: 0 20px 45px rgba(0,0,0,0.3);
}

.qr-restore-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.qr-restore-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.qr-restore-modal-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0F172A;
    margin: 0;
}

.qr-restore-tabs {
    display: flex;
    background: #F1F5F9;
    padding: 6px 12px;
    gap: 6px;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.qr-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 0.84rem;
    font-weight: 800;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #64748B;
    cursor: pointer;
    transition: all 0.2s;
}

.qr-tab-btn.active {
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.qr-restore-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.qr-tab-panel {
    display: none;
}
.qr-tab-panel.active {
    display: block;
}

/* ドロップゾーン */
.qr-dropzone {
    border: 2.5px dashed #38BDF8;
    background: #F0F9FF;
    border-radius: 14px;
    padding: 28px 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.qr-dropzone:hover, .qr-dropzone.dragover {
    border-color: #0284C7;
    background: #E0F2FE;
    transform: translateY(-2px);
}
.qr-dropzone-icon {
    width: 60px;
    height: 60px;
    background: #BAE6FD;
    color: #0284C7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.qr-dropzone-title {
    font-size: 0.95rem;
    font-weight: 900;
    color: #0369A1;
    margin-bottom: 6px;
}
.qr-dropzone-desc {
    font-size: 0.78rem;
    color: #0284C7;
    margin-bottom: 14px;
    line-height: 1.4;
}
.qr-select-file-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #0284C7;
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 800;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
    transition: 0.15s;
}
.qr-select-file-btn:hover {
    background: #0369A1;
}

/* カメラビューファインダー */
.qr-camera-wrap {
    position: relative;
    width: 100%;
    height: 260px;
    background: #000000;
    border-radius: 12px;
    overflow: hidden;
}
.qr-camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.qr-camera-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.qr-scan-reticle {
    position: relative;
    width: 180px;
    height: 180px;
    border: 3px solid #38BDF8;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}
.qr-scan-line {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, transparent, #38BDF8, transparent);
    box-shadow: 0 0 8px #38BDF8;
    animation: qrScanAnim 2s linear infinite;
}
@keyframes qrScanAnim {
    0% { top: 0; }
    50% { top: 100%; }
    100% { top: 0; }
}
.qr-camera-hint {
    position: absolute;
    bottom: 12px;
    left: 0;
    width: 100%;
    text-align: center;
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    pointer-events: none;
}
.qr-camera-error {
    margin-top: 10px;
    padding: 12px;
    background: #FEF2F2;
    border: 1px solid #FECDD3;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #991B1B;
    line-height: 1.5;
}

/* インジケータ＆エラー */
.qr-scanning-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: #F8FAFC;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}
.qr-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #CBD5E1;
    border-top-color: #0284C7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.qr-error-box {
    padding: 12px 14px;
    background: #FEF2F2;
    border: 1px solid #FECDD3;
    border-left: 4px solid #EF4444;
    border-radius: 8px;
    color: #991B1B;
    font-size: 0.82rem;
    line-height: 1.5;
}

/* 復元成功プレビューカード */
.qr-success-card {
    background: #F0FDF4;
    border: 1.5px solid #86EFAC;
    border-radius: 12px;
    padding: 16px;
}
.qr-success-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.qr-success-icon {
    width: 38px;
    height: 38px;
    background: #10B981;
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qr-success-badge {
    font-size: 0.68rem;
    font-weight: 800;
    color: #059669;
}
.qr-success-title {
    font-size: 1rem;
    font-weight: 900;
    color: #166534;
    margin: 2px 0 0;
}
.qr-success-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.qr-summary-pill {
    background: #FFFFFF;
    border: 1px solid #BBF7D0;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    color: #374151;
}
.qr-summary-pill strong {
    color: #15803D;
    font-weight: 800;
}
.qr-success-note {
    font-size: 0.72rem;
    color: #166534;
    line-height: 1.4;
    margin-bottom: 14px;
}
.qr-apply-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transition: all 0.2s;
}
.qr-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

/* フォーム側 Slide 1 の QRバナー */
.qr-restore-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    border: 1.5px solid #BAE6FD;
    border-radius: 14px;
    margin-bottom: 18px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.08);
}
.qr-restore-banner:hover {
    border-color: #38BDF8;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
    transform: translateY(-1px);
}
.qr-restore-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.qr-restore-banner-icon {
    width: 40px;
    height: 40px;
    background: #0284C7;
    color: #FFFFFF;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qr-restore-banner-title {
    font-size: 0.92rem;
    font-weight: 900;
    color: #0369A1;
}
.qr-restore-banner-desc {
    font-size: 0.75rem;
    color: #0284C7;
    margin-top: 2px;
}
.qr-restore-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    background: #0284C7;
    color: #FFFFFF;
    font-size: 0.8rem;
    font-weight: 800;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
    transition: all 0.15s;
}
.qr-restore-banner-btn:hover {
    background: #0369A1;
}

@media (max-width: 640px) {
    .qr-restore-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .qr-restore-banner-btn {
        justify-content: center;
    }
    .qr-success-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* ----------------------------------------------------
   申告書PDFダウンロード・出力 モーダル
   ---------------------------------------------------- */
.pdf-export-modal-content {
    max-width: 620px;
    width: 92vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    background: #FFFFFF;
    box-shadow: 0 20px 45px rgba(0,0,0,0.3);
}

.pdf-export-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    flex-shrink: 0;
}

.pdf-export-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
}

.pdf-export-modal-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #0F172A;
    margin: 0;
}

.pdf-export-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pdf-export-desc {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.5;
    margin: 0;
}

/* 一括ダウンロード推奨カード */
.pdf-export-card {
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
}
.primary-export-card {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    border: 2px solid #86EFAC;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}
.export-card-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.export-card-icon {
    width: 44px;
    height: 44px;
    background: #10B981;
    color: #FFFFFF;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.export-card-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 900;
    background: #10B981;
    color: #FFFFFF;
    padding: 2px 7px;
    border-radius: 4px;
    margin-bottom: 3px;
}
.export-card-title {
    font-size: 1.02rem;
    font-weight: 900;
    color: #14532D;
}
.export-card-sub {
    font-size: 0.76rem;
    color: #166534;
    margin-top: 2px;
    line-height: 1.4;
}

.export-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 13px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
    font-size: 0.95rem;
    font-weight: 900;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transition: all 0.2s;
}
.export-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

/* 個別用紙グリッド */
.pdf-export-section-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #1E293B;
    margin-top: 4px;
}
.pdf-export-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pdf-export-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    gap: 10px;
}
.pdf-item-code {
    font-size: 0.72rem;
    font-weight: 800;
    color: #2563EB;
}
.pdf-item-title {
    font-size: 0.84rem;
    font-weight: 800;
    color: #0F172A;
}
.export-btn-sub {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    background: #FFFFFF;
    color: #2563EB;
    border: 1.5px solid #BFDBFE;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.export-btn-sub:hover {
    background: #EFF6FF;
    border-color: #2563EB;
}

/* 本人控用ボックス */
.pdf-export-copy-box {
    background: #FFFBEB;
    border: 1.5px dashed #FCD34D;
    border-radius: 10px;
    padding: 12px 14px;
}
.export-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    background: #FFFFFF;
    color: #B45309;
    border: 1.5px solid #FCD34D;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.export-btn-outline:hover {
    background: #FEF3C7;
}

/* 生成中インジケータ */
.pdf-generating-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: #F1F5F9;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 800;
    color: #334155;
}

/* 本人控用 透かしスタイル（PDF出力時用） */
.sheet-watermark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 99;
}
.sheet-watermark-text {
    font-size: 48px;
    font-weight: 900;
    color: rgba(220, 38, 38, 0.18);
    transform: rotate(-30deg);
    border: 5px solid rgba(220, 38, 38, 0.22);
    padding: 14px 28px;
    border-radius: 12px;
    letter-spacing: 4px;
    user-select: none;
}







/* ----------------------------------------------------
   国税庁公式申告書 実物原本プレビュー＆印刷スタイル
   ---------------------------------------------------- */
.real-official-canvas {
    display: none;
    position: relative;
    background: #FFFFFF;
    padding: 0;
    margin: 0 auto 20px auto;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    user-select: text;
}
.real-official-canvas.active {
    display: block;
}

.sheet-canvas-inner {
    position: relative;
    background: #FFFFFF;
    margin: 0 auto;
    transform-origin: top center;
    transition: transform 0.2s ease;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    border-radius: 6px;
    overflow: hidden;
}

.sheet-canvas-inner.landscape {
    width: 1000px;
    max-width: 100%;
    aspect-ratio: 2525 / 1785;
}

.sheet-canvas-inner.portrait {
    width: 750px;
    max-width: 100%;
    aspect-ratio: 1785 / 2525;
}

.sheet-bg-image {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
    object-fit: contain;
}

/* 拡大縮小モード */
.sheet-viewport.mode-fit .sheet-canvas-inner {
    transform: scale(1);
}
.sheet-viewport.mode-zoom .sheet-canvas-inner {
    transform: scale(1.35);
    margin-bottom: 200px;
}
.sheet-viewport.mode-super .sheet-canvas-inner {
    transform: scale(1.8);
    margin-bottom: 450px;
}

/* ツールバーボタンスタイル拡張 */
.sheet-scale-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #E2E8F0;
    padding: 3px;
    border-radius: 8px;
}
.official-scale-btn {
    padding: 5px 10px;
    font-size: 0.76rem;
    font-weight: 800;
    color: #475569;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}
.official-scale-btn.active {
    background: #FFFFFF;
    color: #0F172A;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.sheet-btn-rawpdf {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}
.sheet-btn-rawpdf:hover {
    background: #DBEAFE;
}
.sheet-btn-download {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 12px;
    background: #10B981;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(16,185,129,0.3);
    transition: all 0.15s;
}
.sheet-btn-download:hover {
    background: #059669;
}

/* 印字オーバーレイ基本クラス（公式記入例・目立つ鮮明な赤文字） */
.sov {
    position: absolute;
    color: #DC2626 !important;
    font-family: 'Noto Sans JP', 'Hiragino Sans', 'Meiryo', sans-serif;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    z-index: 20;
    pointer-events: auto;
    text-shadow: 0 0 1px #FFFFFF, 0 0 2px #FFFFFF;
}
.sov-num {
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', monospace;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #DC2626 !important;
}
.sov-chk {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 12px;
    height: 12px;
}
.sov-chk.checked::after {
    content: '✓';
    font-size: 11px;
    font-weight: 900;
    color: #DC2626 !important;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
}

.era-tag {
    font-weight: 800;
    color: #DC2626;
    margin-right: 1px;
    font-size: 0.9em;
}
.era-y, .era-m, .era-d {
    font-weight: 800;
    color: #DC2626;
    display: inline-block;
    min-width: 12px;
    text-align: center;
}
.era-sep {
    color: #94A3B8;
    margin: 0 1px;
    font-size: 8.5px;
}

/* ==========================================
   用紙①（マル扶: 給与所得者の扶養控除等申告書） 座標完全補正
   ========================================== */
.ps1-tax-office   { top: 12.0%; left: 4.2%; width: 6.2%; text-align: center; font-size: 10px; }
.ps1-city         { top: 15.5%; left: 4.5%; width: 5.8%; text-align: center; font-size: 9.5px; font-weight: 800; }
.ps1-company-name { top: 7.2%; left: 19.8%; max-width: 19.5%; font-size: 11px; }
.ps1-corp-number  { top: 12.5%; left: 20.0%; letter-spacing: 2px; font-size: 11px; }
.ps1-company-addr { top: 16.5%; left: 19.8%; max-width: 19.5%; font-size: 10px; }

.ps1-user-kana     { top: 6.2%; left: 46.0%; font-size: 9.0px; } /* -3pt下げ枠線被り防止 */
.ps1-user-name     { top: 9.2%; left: 46.0%; font-size: 13.0px; font-weight: 900; } /* -2pt下げ中央配置 */
.ps1-user-birth    { top: 6.2%; left: 67.5%; font-size: 9.5px; }
.ps1-user-addr     { top: 16.6%; left: 46.0%; font-size: 10.0px; max-width: 27.5%; }
.ps1-household     { top: 8.8%; left: 69.0%; font-size: 11px; }
.ps1-relation      { top: 12.5%; left: 69.0%; font-size: 11px; }
.ps1-has-spouse-chk { top: 16.2%; left: 79.5%; width: 12px; height: 12px; }
.ps1-no-spouse-chk  { top: 16.2%; left: 81.2%; width: 12px; height: 12px; }

/* A欄 配偶者 */
.ps1-sp-kana     { top: 24.0%; left: 17.5%; font-size: 8.5px; } /* -3pt下げ */
.ps1-sp-name     { top: 26.5%; left: 17.5%; font-size: 11.5px; font-weight: 900; } /* -2pt下げ */
.ps1-sp-birth    { top: 27.2%; left: 32.5%; font-size: 9.5px; }
.ps1-sp-income   { top: 27.2%; left: 45.5%; width: 9.5%; text-align: right; font-size: 10.5px; font-weight: 800; padding-right: 4px; }
.ps1-sp-addr     { top: 26.5%; left: 69.0%; font-size: 10px; }
.ps1-sp-overseas { top: 26.5%; left: 66.5%; width: 12px; height: 12px; }

/* B欄 扶養親族動的コンテナ (33.5% 〜 60.0%) */
.ps1-dep-container {
    position: absolute;
    top: 33.5%;
    left: 0;
    width: 100%;
    height: 26.5%;
    pointer-events: none;
}
.ps1-dep-row {
    position: absolute;
    width: 100%;
    height: 24.0%;
}
.ps1-dep-row:nth-child(1) { top: 0%; }
.ps1-dep-row:nth-child(2) { top: 25.5%; }
.ps1-dep-row:nth-child(3) { top: 51.0%; }
.ps1-dep-row:nth-child(4) { top: 76.5%; }

/* C欄 障害者・寡婦・ひとり親 */
.ps1-chk-dis-normal { top: 63.3%; left: 23.0%; width: 12px; height: 12px; }
.ps1-chk-dis-spec   { top: 65.5%; left: 23.0%; width: 12px; height: 12px; }
.ps1-chk-dis-coct   { top: 67.8%; left: 23.0%; width: 12px; height: 12px; }
.ps1-chk-widow      { top: 63.3%; left: 35.5%; width: 12px; height: 12px; }
.ps1-chk-single     { top: 63.3%; left: 39.5%; width: 12px; height: 12px; }
.ps1-chk-student    { top: 63.3%; left: 43.5%; width: 12px; height: 12px; }

/* 住民税16歳未満親族動的コンテナ (83.0% 〜 97.5%) */
.ps1-u16-container {
    position: absolute;
    top: 83.0%;
    left: 0;
    width: 100%;
    height: 14.5%;
    pointer-events: none;
}
.ps1-u16-row {
    position: absolute;
    width: 100%;
    height: 24.0%;
}
.ps1-u16-row:nth-child(1) { top: 0%; }
.ps1-u16-row:nth-child(2) { top: 25.5%; }
.ps1-u16-row:nth-child(3) { top: 51.0%; }
.ps1-u16-row:nth-child(4) { top: 76.5%; }

/* ==========================================
   用紙②（マル保: 保険料控除申告書） 座標完全補正
   ========================================== */
.ps2-tax-office   { top: 9.3%; left: 4.8%; width: 5.5%; text-align: center; font-size: 10.5px; }
.ps2-company-name { top: 9.8%; left: 19.5%; max-width: 25%; font-size: 11px; }
.ps2-user-kana    { top: 11.2%; left: 54.5%; font-size: 9.5px; } /* -3pt下げ */
.ps2-user-name    { top: 13.8%; left: 54.5%; font-size: 13.5px; font-weight: 900; } /* -2pt下げ */
.ps2-user-addr    { top: 17.5%; left: 54.5%; font-size: 10.5px; max-width: 40%; }

.ps2-life-container {
    position: absolute;
    top: 29.8%;
    left: 6.8%;
    width: 44.0%;
    height: 16.0%;
    pointer-events: none;
}
.ps2-care-container {
    position: absolute;
    top: 58.5%;
    left: 6.8%;
    width: 44.0%;
    height: 7.0%;
    pointer-events: none;
}
.ps2-annuity-container {
    position: absolute;
    top: 72.0%;
    left: 6.8%;
    width: 44.0%;
    height: 7.0%;
    pointer-events: none;
}

.ps2-ins-row {
    position: absolute;
    width: 100%;
    height: 24%;
}
.ps2-ins-row > .sov {
    position: absolute;
    top: 0;
}

/* 一般生命小計・計算結果欄 */
.ps2-shin-ippan-total  { top: 45.7%; left: 14.2%; width: 9.0%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-shin-ippan-deduct { top: 45.7%; left: 32.5%; width: 8.5%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-old-ippan-total   { top: 49.0%; left: 14.2%; width: 9.0%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-old-ippan-deduct  { top: 49.0%; left: 32.5%; width: 8.5%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-life-gen-ded      { top: 49.0%; left: 44.5%; width: 9.0%; text-align: right; font-size: 11.5px; font-weight: 800; padding-right: 4px; }

/* 介護医療小計・計算結果欄 */
.ps2-kaigo-total       { top: 65.5%; left: 14.2%; width: 9.0%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-life-care-ded     { top: 65.5%; left: 44.5%; width: 9.0%; text-align: right; font-size: 11.5px; font-weight: 800; padding-right: 4px; }

/* 個人年金小計・計算結果欄 */
.ps2-shin-nenkin-total  { top: 78.2%; left: 14.2%; width: 9.0%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-shin-nenkin-deduct { top: 78.2%; left: 32.5%; width: 8.5%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-old-nenkin-total   { top: 81.2%; left: 14.2%; width: 9.0%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-old-nenkin-deduct  { top: 81.2%; left: 32.5%; width: 8.5%; text-align: right; font-size: 10.5px; padding-right: 4px; }
.ps2-life-ann-ded       { top: 81.2%; left: 44.5%; width: 9.0%; text-align: right; font-size: 11.5px; font-weight: 800; padding-right: 4px; }

/* 生命保険合計 */
.ps2-life-total        { top: 82.8%; left: 44.5%; width: 9.0%; text-align: right; font-size: 12.5px; font-weight: 900; padding-right: 4px; }

/* 地震保険 */
.ps2-earth-container {
    position: absolute;
    top: 36.5%;
    left: 56.8%;
    width: 42.0%;
    height: 10.0%;
    pointer-events: none;
}
.ps2-jishin-total { top: 47.0%; left: 80.5%; width: 7.5%; text-align: right; font-size: 11px; padding-right: 4px; }
.ps2-earth-total  { top: 56.5%; left: 80.5%; width: 7.5%; text-align: right; font-size: 11.5px; font-weight: 900; padding-right: 4px; }

/* 社会保険 */
.ps2-social-container {
    position: absolute;
    top: 64.5%;
    left: 56.8%;
    width: 42.0%;
    height: 6.0%;
    pointer-events: none;
}
.ps2-social-total { top: 70.2%; left: 80.5%; width: 7.5%; text-align: right; font-size: 11.5px; font-weight: 900; padding-right: 4px; }

/* iDeCo / 小規模企業共済 */
.ps2-ideco-pay   { top: 83.5%; left: 80.5%; width: 7.5%; text-align: right; font-size: 11.5px; font-weight: 900; padding-right: 4px; }
.ps2-ideco-total { top: 90.5%; left: 80.5%; width: 7.5%; text-align: right; font-size: 12.5px; font-weight: 900; padding-right: 4px; }

/* ==========================================
   用紙③（マル基・配・所） 座標完全補正
   ========================================== */
.ps3-tax-office   { top: 6.8%; left: 6.8%; width: 5.5%; text-align: center; font-size: 11px; }
.ps3-company-name { top: 6.5%; left: 22.5%; max-width: 18%; font-size: 11px; }
.ps3-user-kana    { top: 8.5%; left: 50.0%; font-size: 9.5px; } /* -3pt下げ */
.ps3-user-name    { top: 10.5%; left: 50.0%; font-size: 13.5px; font-weight: 900; } /* -2pt下げ */
.ps3-user-addr    { top: 13.5%; left: 50.0%; font-size: 10.5px; max-width: 44%; }

/* 基礎控除 (左側) */
.ps3-user-salary-rev { top: 26.5%; left: 16.5%; width: 8.5%; text-align: right; font-size: 11.0px; padding-right: 4px; }
.ps3-user-income     { top: 26.5%; left: 27.5%; width: 8.5%; text-align: right; font-size: 11.0px; padding-right: 4px; }
.ps3-user-total-inc  { top: 34.0%; left: 27.5%; width: 8.5%; text-align: right; font-size: 11.5px; font-weight: 900; padding-right: 4px; }
.ps3-basic-chk       { top: 40.5%; left: 10.4%; width: 12px; height: 12px; }
.ps3-basic-group     { top: 40.5%; left: 32.5%; font-size: 14px; font-weight: 900; }
.ps3-basic-ded-val   { top: 51.0%; left: 27.5%; width: 8.5%; text-align: right; font-size: 13.5px; font-weight: 900; padding-right: 4px; }

/* 配偶者控除等 (右側) */
.ps3-sp-kana        { top: 24.5%; left: 43.0%; font-size: 8.5px; } /* -3pt下げ */
.ps3-sp-name        { top: 26.8%; left: 43.0%; font-size: 12.0px; font-weight: 900; } /* -2pt下げ */
.ps3-sp-birth       { top: 25.5%; left: 74.5%; font-size: 10.5px; }
.ps3-sp-addr        { top: 27.5%; left: 72.5%; font-size: 10px; }
.ps3-sp-salary-rev  { top: 36.5%; left: 47.0%; width: 9.0%; text-align: right; font-size: 11px; padding-right: 4px; }
.ps3-sp-income      { top: 36.5%; left: 58.5%; width: 9.0%; text-align: right; font-size: 11px; padding-right: 4px; }
.ps3-sp-total-inc   { top: 43.0%; left: 58.5%; width: 9.0%; text-align: right; font-size: 11.5px; font-weight: 900; padding-right: 4px; }
.ps3-sp-chk         { top: 40.5%; left: 72.2%; width: 12px; height: 12px; }
.ps3-sp-group       { top: 35.0%; left: 88.0%; font-size: 14px; font-weight: 900; }
.ps3-sp-ded-val     { top: 55.5%; left: 78.5%; width: 9.5%; text-align: right; font-size: 13.5px; font-weight: 900; padding-right: 4px; } /* 右寄せ */

.ps3-adj-chk-child  { top: 94.0%; left: 8.0%; width: 12px; height: 12px; }
.ps3-adj-chk-dis    { top: 86.5%; left: 8.0%; width: 12px; height: 12px; }
.ps3-adj-dep-name   { top: 89.5%; left: 34.5%; font-size: 11.5px; font-weight: 900; }
.ps3-adj-dep-birth  { top: 89.5%; left: 66.5%; font-size: 10.5px; }
.ps3-adj-ded-val    { top: 94.0%; left: 68.5%; width: 10.0%; text-align: right; font-size: 13.5px; font-weight: 900; padding-right: 4px; }

/* ==========================================
   用紙④（マル住） 座標補正（公式白紙A4縦レイアウト）
   ========================================== */
.ps4-company-name  { top: 7.8%; left: 16.0%; max-width: 30%; font-size: 10.5px; font-weight: 700; color: #1a202c !important; }
.ps4-company-addr  { top: 13.0%; left: 16.0%; max-width: 30%; font-size: 9.5px; color: #1a202c !important; line-height: 1.2; }
.ps4-user-name     { top: 10.2%; left: 59.0%; font-size: 12.5px; font-weight: 900; color: #1a202c !important; }
.ps4-user-addr     { top: 12.8%; left: 59.0%; font-size: 9.5px; max-width: 35%; color: #1a202c !important; line-height: 1.25; }

.ps4-loan-bal-c    { top: 22.0%; left: 74.5%; width: 20.5%; text-align: right; font-size: 12px; font-weight: 900; color: #1a202c !important; }
.ps4-acq-cost-c    { top: 25.5%; left: 74.5%; width: 20.5%; text-align: right; font-size: 12px; font-weight: 900; color: #1a202c !important; }
.ps4-living-ratio-c{ top: 29.5%; left: 74.5%; width: 20.5%; text-align: center; font-size: 11.5px; font-weight: 800; color: #1a202c !important; }
.ps4-living-cost-c { top: 33.5%; left: 74.5%; width: 20.5%; text-align: right; font-size: 12px; font-weight: 900; color: #1a202c !important; }
.ps4-target-bal-c  { top: 37.5%; left: 74.5%; width: 20.5%; text-align: right; font-size: 12px; font-weight: 900; color: #1a202c !important; }
.ps4-total-bal-c   { top: 41.5%; left: 74.5%; width: 20.5%; text-align: right; font-size: 12px; font-weight: 900; color: #1a202c !important; }
.ps4-loan-rate     { display: none; }
.ps4-loan-ded-val  { top: 45.5%; left: 74.5%; width: 20.5%; text-align: right; font-size: 13px; font-weight: 900; color: #1a202c !important; }
.ps4-income-val    { top: 49.5%; left: 74.5%; width: 20.5%; text-align: right; font-size: 11.5px; font-weight: 900; color: #1a202c !important; }
.ps4-biko-val      { top: 53.5%; left: 38.0%; width: 57.0%; text-align: left; font-size: 10.0px; color: #1a202c !important; }

/* ----------------------------------------------------
   スマートボタングループ（カードボタン＆ピルボタン）
   ---------------------------------------------------- */
.btn-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.btn-choice-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 12px 14px;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}
.btn-choice-card:hover {
    border-color: #CBD5E1;
    background: #F8FAFC;
    transform: translateY(-1px);
}
.btn-choice-card.active {
    border-color: #2563EB !important;
    background: #EFF6FF !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.14) !important;
}
.btn-choice-card.active-emerald {
    border-color: #059669 !important;
    background: #ECFDF5 !important;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15) !important;
}

.btn-choice-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-choice-card.active .btn-choice-title {
    color: #1D4ED8;
}
.btn-choice-card.active-emerald .btn-choice-title {
    color: #065F46;
}

.btn-choice-sub {
    font-size: 0.74rem;
    color: #64748B;
    margin-top: 3px;
    line-height: 1.35;
}
.btn-choice-card.active .btn-choice-sub {
    color: #3B82F6;
}
.btn-choice-card.active-emerald .btn-choice-sub {
    color: #059669;
}

/* ピルボタングループ（年号・割合用） */
.btn-pill-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 6px;
}
.btn-pill {
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 700;
    border-radius: 9999px;
    border: 1.5px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}
.btn-pill:hover {
    border-color: #94A3B8;
    background: #F1F5F9;
    color: #0F172A;
}
.btn-pill.active {
    border-color: #2563EB !important;
    background: #2563EB !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25) !important;
}
.btn-pill.active-emerald {
    border-color: #059669 !important;
    background: #059669 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25) !important;
}

/* 連帯債務・共同名義 クイック割合ボタンスタイル */
.btn-burden-ratio {
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1.5px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-burden-ratio:hover {
    border-color: #10B981;
    color: #047857;
    background: #F0FDF4;
}
.btn-burden-ratio.active {
    border-color: #059669 !important;
    background: #DCFCE7 !important;
    color: #065F46 !important;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.2) !important;
}

/* ----------------------------------------------------
   複数枚一括OCR（最大8枚）モーダル＆ボタンスタイル
   ---------------------------------------------------- */
.ocr-trigger-container {
    margin: 12px 0 16px 0;
}
.ocr-btn-multi {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 0.96rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ocr-btn-multi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
    background: linear-gradient(135deg, #047857 0%, #059669 100%);
}
.ocr-btn-multi:active {
    transform: translateY(0);
}
.ocr-badge-new {
    display: inline-block;
    background: #FEF08A;
    color: #854D0E;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0.5px;
}

.ocr-multi-modal-content {
    max-width: 680px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border-radius: 20px;
    background: #FFFFFF;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
}
.ocr-modal-header {
    background: #0F172A;
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1E293B;
}
.ocr-modal-badge {
    display: inline-block;
    font-size: 0.72rem;
    background: #10B981;
    color: #FFFFFF;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 800;
}
.ocr-modal-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: #FFFFFF;
    margin: 0;
}
.ocr-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    background: #F8FAFC;
}
.ocr-modal-desc {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* アップロードドロップゾーン */
.ocr-dropzone-box {
    background: #FFFFFF;
    border: 2px dashed #CBD5E1;
    border-radius: 14px;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.ocr-dropzone-box:hover {
    border-color: #10B981;
    background: #F0FDF4;
}
.ocr-dropzone-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #ECFDF5;
    color: #059669;
    border-radius: 50%;
    margin-bottom: 12px;
}
.ocr-dropzone-text-main {
    font-size: 1rem;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 4px;
}
.ocr-dropzone-text-sub {
    font-size: 0.8rem;
    color: #64748B;
    margin-bottom: 16px;
}
.ocr-action-btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.ocr-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
}
.ocr-action-btn.primary {
    background: #0284C7;
    color: #FFFFFF;
    border: none;
}
.ocr-action-btn.primary:hover {
    background: #0369A1;
}
.ocr-action-btn.camera {
    background: #10B981;
    color: #FFFFFF;
    border: none;
}
.ocr-action-btn.camera:hover {
    background: #059669;
}

/* サムネイルキュー一覧 */
.ocr-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    margin-bottom: 10px;
}
.ocr-queue-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #1E293B;
}
.ocr-queue-add-btn {
    background: #F1F5F9;
    color: #0284C7;
    border: 1px solid #CBD5E1;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}
.ocr-queue-add-btn:hover {
    background: #E2E8F0;
}
.ocr-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.ocr-thumb-item {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #E2E8F0;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #CBD5E1;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.ocr-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ocr-thumb-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(15, 23, 42, 0.75);
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    transition: background 0.15s;
}
.ocr-thumb-del:hover {
    background: #DC2626;
}
.ocr-thumb-tag {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(15, 23, 42, 0.75);
    color: #FFFFFF;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
}

.ocr-start-action-wrap {
    margin-top: 14px;
}
.ocr-start-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    font-size: 1rem;
    font-weight: 800;
}

/* プログレスステージ */
.ocr-processing-card {
    background: #FFFFFF;
    border-radius: 14px;
    padding: 36px 20px;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.ocr-proc-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: #0F172A;
    margin: 0 0 6px 0;
}
.ocr-proc-status {
    font-size: 0.88rem;
    font-weight: 800;
    color: #059669;
    margin-bottom: 16px;
}
.ocr-proc-bar-wrap {
    width: 100%;
    max-width: 400px;
    height: 10px;
    background: #E2E8F0;
    border-radius: 9999px;
    margin: 0 auto 16px auto;
    overflow: hidden;
}
.ocr-proc-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #059669);
    border-radius: 9999px;
    transition: width 0.3s ease;
}
.ocr-proc-tip {
    font-size: 0.76rem;
    color: #64748B;
    line-height: 1.5;
    margin: 0;
}

/* レビューステージ */
.ocr-review-header-box {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.ocr-review-badge {
    display: inline-block;
    background: #059669;
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}
.ocr-review-title {
    font-size: 1rem;
    font-weight: 900;
    color: #065F46;
    margin: 0 0 4px 0;
}
.ocr-review-desc {
    font-size: 0.78rem;
    color: #047857;
    margin: 0;
    line-height: 1.5;
}

.ocr-review-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.ocr-review-card {
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    gap: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    transition: border-color 0.2s;
}
.ocr-review-card.disabled {
    opacity: 0.5;
    background: #F1F5F9;
}
.ocr-card-thumb-wrap {
    width: 90px;
    flex-shrink: 0;
}
.ocr-card-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #E2E8F0;
    display: block;
}
.ocr-card-fields {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 8px 12px;
}
.ocr-card-field-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ocr-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748B;
}
.ocr-card-input {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.84rem;
    font-weight: 700;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    background: #FFFFFF;
    color: #0F172A;
    box-sizing: border-box;
}
.ocr-card-input:focus {
    border-color: #10B981;
    outline: none;
}
.ocr-card-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
    padding-top: 6px;
    border-top: 1px dashed #E2E8F0;
    margin-top: 2px;
}
.ocr-card-toggle-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

/* サマリーバー */
.ocr-review-summary-bar {
    background: #0F172A;
    color: #FFFFFF;
    border-radius: 12px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.ocr-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ocr-summary-label {
    font-size: 0.8rem;
    color: #94A3B8;
}
.ocr-summary-val {
    font-size: 1rem;
    font-weight: 800;
    color: #FFFFFF;
}
.ocr-summary-amount {
    font-size: 1.15rem;
    font-weight: 900;
    color: #34D399;
}

.ocr-review-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.ocr-apply-all-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px;
    font-size: 1rem;
    font-weight: 900;
    background: #059669;
}
.ocr-apply-all-btn:hover {
    background: #047857;
}

/* ----------------------------------------------------
   Step 5 保険入力方法 選択ガイド ＆ 二重入力防止スタイル
   ---------------------------------------------------- */
.insurance-entry-guide-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 16px;
    margin: 14px 0 16px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.entry-guide-title {
    font-size: 0.86rem;
    font-weight: 900;
    color: #1E293B;
    text-align: center;
    margin-bottom: 12px;
}
.entry-method-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 540px) {
    .entry-method-grid {
        grid-template-columns: 1fr;
    }
}
.entry-method-box {
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.entry-method-box.method-auto {
    background: linear-gradient(180deg, #F0FDF4 0%, #DCFCE7 100%);
    border: 2px solid #86EFAC;
}
.entry-method-box.method-auto:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.2);
    border-color: #10B981;
}
.entry-method-box.method-manual {
    background: #F8FAFC;
    border: 1.5px solid #CBD5E1;
}
.entry-method-box.method-manual:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    border-color: #94A3B8;
}

.entry-method-badge {
    position: absolute;
    top: -9px;
    left: 50%;
    transform: translateX(-50%);
    background: #10B981;
    color: #FFFFFF;
    font-size: 0.7rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 9999px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.entry-method-badge.sub {
    background: #64748B;
}
.entry-method-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0 8px 0;
}
.method-auto .entry-method-icon {
    background: #10B981;
    color: #FFFFFF;
}
.method-manual .entry-method-icon {
    background: #E2E8F0;
    color: #475569;
}
.entry-method-name {
    font-size: 0.95rem;
    font-weight: 900;
    color: #0F172A;
    margin-bottom: 4px;
}
.entry-method-sub {
    font-size: 0.74rem;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 10px;
    flex: 1;
}
.entry-method-btn {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.entry-method-btn.auto-btn {
    background: #059669;
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(5,150,105,0.3);
}
.entry-method-btn.auto-btn:hover {
    background: #047857;
}
.entry-method-btn.manual-btn {
    background: #E2E8F0;
    color: #334155;
}
.entry-method-btn.manual-btn:hover {
    background: #CBD5E1;
}

/* OCR反映完了通知バナー */
.ocr-applied-notice {
    background: #ECFDF5;
    border: 1.5px solid #10B981;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: fadeIn 0.3s ease;
}
.ocr-notice-icon {
    width: 24px;
    height: 24px;
    background: #10B981;
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}
.ocr-notice-content {
    font-size: 0.8rem;
    color: #065F46;
    line-height: 1.45;
}
.ocr-notice-content strong {
    display: block;
    font-size: 0.86rem;
    font-weight: 900;
    color: #047857;
    margin-bottom: 2px;
}
.ins-card-note {
    font-size: 0.78rem;
    color: #64748B;
    line-height: 1.5;
    margin-bottom: 12px;
    background: #F8FAFC;
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 3px solid #0284C7;
}

/* ==========================================================================
   スマートフォン専用 最適化スタイル（画面幅 640px以下限定・PC版完全非破壊）
   ========================================================================== */
@media (max-width: 640px) {
    /* 1. アプリコンテナ＆全体レイアウト */
    body {
        background-color: #F8FAFC;
    }
    .app-container {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

    /* 2. ヘッダー */
    header {
        padding: 10px 14px 8px;
    }
    .header-top {
        margin-bottom: 6px;
    }
    .nav-btn {
        font-size: 0.76rem;
        padding: 5px 10px;
    }
    .step-title {
        font-size: 0.82rem;
        padding: 3px 10px;
    }
    .progress-bar-bg {
        height: 6px;
    }

    /* 3. ウィザードスライド＆パディング適正化 */
    .wizard-slide {
        padding: 12px 12px 85px;
    }

    /* 4. スライドヒーローヘッダー（スマホ専用レイアウト：文字潰れ・重なり完全解消） */
    .slide-fullwidth-hero,
    .hero-moon.slide-fullwidth-hero,
    .hero-spouse.slide-fullwidth-hero,
    .hero-dependents.slide-fullwidth-hero,
    .hero-insurance.slide-fullwidth-hero,
    .hero-housing.slide-fullwidth-hero,
    .hero-result.slide-fullwidth-hero {
        min-height: auto;
        margin-bottom: 12px;
        padding: 4px 0 6px;
        position: relative;
        overflow: visible;
        display: block;
    }

    /* イラストを右上にコンパクトかつ綺麗に配置（文字と衝突しない比率） */
    .fullwidth-hero-bg,
    .hero-moon .fullwidth-hero-bg,
    .hero-spouse .fullwidth-hero-bg,
    .hero-dependents .fullwidth-hero-bg,
    .hero-insurance .fullwidth-hero-bg,
    .hero-housing .fullwidth-hero-bg,
    .hero-result .fullwidth-hero-bg {
        position: absolute;
        top: -4px;
        right: -4px;
        bottom: auto;
        width: 80px;
        max-width: 25%;
        z-index: 0;
    }
    .fullwidth-hero-img,
    .hero-moon .fullwidth-hero-img,
    .hero-spouse .fullwidth-hero-img,
    .hero-dependents .fullwidth-hero-img,
    .hero-insurance .fullwidth-hero-img,
    .hero-housing .fullwidth-hero-img,
    .hero-result .fullwidth-hero-img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }

    /* 前面テキスト（全幅を活用して自然に改行） */
    .fullwidth-hero-overlay {
        max-width: 100%;
        padding-right: 76px;
        position: relative;
        z-index: 1;
    }
    .fullwidth-hero-overlay .question-title {
        font-size: 1.18rem;
        line-height: 1.3;
        margin-bottom: 2px;
        color: #0F172A;
    }
    .fullwidth-hero-overlay .question-desc {
        font-size: 0.76rem;
        line-height: 1.35;
        margin-bottom: 8px;
        color: #475569;
    }

    /* りするん吹き出し（スマホ画面幅に100%フィット・折り返し対応） */
    .risurun-bubble-overlay {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 4px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .risurun-avatar-col {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .risurun-avatar {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 1.5px solid #FCD34D;
        flex-shrink: 0;
    }
    .risurun-bubble-overlay .bubble-text {
        font-size: 0.78rem;
        padding: 6px 11px;
        line-height: 1.35;
        white-space: normal;
        word-break: break-word;
        flex: 1;
        border-radius: 12px;
        border-width: 1.5px;
    }
    .risurun-calc-btn-inline {
        width: 32px;
        height: 32px;
        border-width: 1.5px;
    }
    .cute-calc-btn-img {
        width: 17px;
        height: 17px;
    }

    /* 4.5. ラジオカード（はい/いいえ/共働き等）スマホ最適化 */
    .radio-cards {
        display: flex;
        gap: 8px;
        margin-bottom: 14px;
    }
    .radio-card {
        padding: 10px 4px;
        min-height: 72px;
        border-radius: 12px;
    }
    .radio-card svg {
        width: 24px;
        height: 24px;
    }
    .radio-label {
        font-size: 0.84rem;
        margin-top: 4px;
        line-height: 1.25;
    }

    /* 5. 入力カード＆フォーム部品 */
    .input-card {
        padding: 14px 12px;
        border-radius: 14px;
        margin-bottom: 12px;
    }
    .input-card-title {
        font-size: 0.92rem;
        margin-bottom: 12px;
        font-weight: 800;
    }
    .input-group {
        margin-bottom: 12px;
    }
    .input-group label {
        font-size: 0.82rem;
        font-weight: 700;
        margin-bottom: 6px;
        color: #334155;
    }
    .input-text, .input-select, select, input[type="text"], input[type="number"], input[type="tel"] {
        padding: 10px 12px;
        font-size: 16px !important; /* iOS Safari 自動ズーム防止 */
        border-radius: 10px;
        min-height: 44px;
        box-sizing: border-box;
    }
    /* 生年月日の選択肢がスマホ枠内に綺麗に収まるようフォントとパディングを最適化 */
    .input-select.date-year {
        font-size: 13.5px !important;
        padding: 10px 2px 10px 6px !important;
        letter-spacing: -0.03em;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .input-select.date-month,
    .input-select.date-day {
        font-size: 14.5px !important;
        padding: 10px 2px 10px 4px !important;
        text-align: center;
    }
    .input-group.inline {
        gap: 6px;
    }
    .input-group.inline.date-group > div:first-child,
    .input-group.inline.date-group > .col-year,
    .input-group.inline > div:has(.date-year) {
        flex: 1.65;
        min-width: 0;
    }
    .input-group.inline.date-group > div:nth-child(2),
    .input-group.inline.date-group > div:nth-child(3),
    .input-group.inline.date-group > .col-month,
    .input-group.inline.date-group > .col-day,
    .input-group.inline > div:has(.date-month),
    .input-group.inline > div:has(.date-day) {
        flex: 1;
        min-width: 0;
    }

    /* セグメント元号切り替え */
    .era-segmented {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-bottom: 10px;
        padding: 3px;
        background: #F1F5F9;
        border-radius: 10px;
    }
    .era-segmented label {
        flex: 1;
        text-align: center;
    }
    .era-segmented span {
        padding: 8px 0;
        font-size: 0.82rem;
        font-weight: 700;
        border-radius: 8px;
    }

    /* 6. Step 5 保険料選択ガイドカード */
    .insurance-entry-guide-card {
        padding: 14px 12px;
        margin: 12px 0 14px 0;
        border-radius: 14px;
    }
    .entry-guide-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    .entry-method-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .entry-method-box {
        padding: 14px 12px;
        border-radius: 12px;
    }
    .entry-method-icon {
        width: 42px;
        height: 42px;
        margin: 2px 0 6px 0;
    }
    .entry-method-name {
        font-size: 0.92rem;
    }
    .entry-method-sub {
        font-size: 0.76rem;
        margin-bottom: 8px;
    }
    .entry-method-btn {
        padding: 9px 12px;
        font-size: 0.82rem;
        min-height: 40px;
    }

    /* 7. ボトム固定ナビゲーションバー */
    .bottom-bar {
        padding: 10px 14px max(10px, env(safe-area-inset-bottom));
        gap: 8px;
    }
    .btn-prev-bottom {
        flex: 0.35;
        min-width: 74px;
        padding: 12px 6px;
        font-size: 0.88rem;
    }
    .btn-next {
        flex: 1;
        padding: 12px;
        font-size: 0.96rem;
    }

    /* 8. 一括OCRモーダル (スマホ最適化) */
    .ocr-multi-modal-content {
        width: 95vw;
        max-width: 95vw;
        border-radius: 14px;
        max-height: 92vh;
    }
    .ocr-modal-header {
        padding: 12px 14px;
    }
    .ocr-modal-title {
        font-size: 0.95rem;
    }
    .ocr-modal-body {
        padding: 14px 12px;
    }
    .ocr-thumbnails-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .ocr-review-card {
        flex-direction: column;
        gap: 8px;
        padding: 10px;
    }
    .ocr-card-thumb-wrap {
        width: 100%;
        height: 100px;
    }
    .ocr-card-fields {
        grid-template-columns: 1fr 1fr;
        gap: 6px 8px;
    }

    /* 9. 公式原本プレビューモーダル (スマホ最適化＆自動スケールフィット) */
    .official-sheet-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    .sheet-modal-header {
        padding: 10px 12px;
    }
    .sheet-toolbar {
        padding: 8px 10px;
        gap: 6px;
    }
    .sheet-tab-btn {
        font-size: 0.76rem;
        padding: 5px 8px;
    }
    .sheet-viewport {
        padding: 12px 6px;
        overflow-x: auto;
    }
    .sheet-viewport.mode-fit .sheet-canvas-inner.landscape {
        transform: scale(calc((100vw - 20px) / 1000));
        transform-origin: top center;
        margin-bottom: calc(-707px * (1 - ((100vw - 20px) / 1000)));
    }
    .sheet-viewport.mode-fit .sheet-canvas-inner.portrait {
        transform: scale(calc((100vw - 20px) / 750));
        transform-origin: top center;
        margin-bottom: calc(-1060px * (1 - ((100vw - 20px) / 750)));
    }
    .sheet-viewport.mode-zoom .sheet-canvas-inner {
        transform: scale(0.75);
        transform-origin: top left;
    }
    .sheet-viewport.mode-super .sheet-canvas-inner {
        transform: scale(1.05);
        transform-origin: top left;
    }
}

/* ----------------------------------------------------
   公式SNS・ショート動画 アイコンボタン
   ---------------------------------------------------- */
.hero-sns-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hero-sns-icon-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.hero-sns-icon-btn.x { background: #0F172A; }
.hero-sns-icon-btn.ig { background: linear-gradient(135deg, #833AB4 0%, #FD1D1D 50%, #FCAF45 100%); }
.hero-sns-icon-btn.tiktok { background: #010101; }
.hero-sns-icon-btn.line { background: #06C755; }
.hero-sns-icon-btn.yt { background: #FF0000; }
.hero-sns-icon-btn.disabled {
    background: #E2E8F0 !important;
    color: #94A3B8 !important;
    box-shadow: none !important;
    cursor: not-allowed !important;
    opacity: 0.55 !important;
    transform: none !important;
    pointer-events: none;
}

/* ==========================================
   💰 12月の還付金・追徴金リアルタイム計算機
   ========================================== */
.refund-hero-card {
    margin-top: 24px;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    border: 2px solid #FCD34D;
    border-radius: 20px;
    padding: 24px 20px;
    color: #FFFFFF;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
    position: relative;
    overflow: hidden;
}
.refund-hero-card::before {
    content: "";
    position: absolute;
    top: -50px;
    right: -50px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(252, 211, 77, 0.2) 0%, rgba(252, 211, 77, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}
.refund-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 8px;
}
.refund-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(252, 211, 77, 0.15);
    border: 1px solid #FCD34D;
    color: #FCD34D;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 9999px;
    letter-spacing: 0.03em;
}
.refund-main-display {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 18px 16px;
    text-align: center;
    margin-bottom: 16px;
}
.refund-main-title {
    font-size: 0.88rem;
    color: #94A3B8;
    font-weight: 700;
    margin-bottom: 6px;
}
.refund-amount-value {
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}
.refund-amount-value.surplus {
    color: #34D399; /* 還付金：エメラルドグリーン */
    text-shadow: 0 0 20px rgba(52, 211, 153, 0.3);
}
.refund-amount-value.shortage {
    color: #F87171; /* 追徴金：レッド */
}
.refund-amount-value.even {
    color: #FCD34D;
}
.refund-amount-unit {
    font-size: 1.1rem;
    font-weight: 700;
    color: #E2E8F0;
}
.refund-desc-note {
    font-size: 0.78rem;
    color: #CBD5E1;
    margin-top: 6px;
    line-height: 1.4;
}
.refund-input-section {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.refund-mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.25);
    padding: 3px;
    border-radius: 10px;
}
.refund-mode-btn {
    flex: 1;
    padding: 8px 6px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: #94A3B8;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.refund-mode-btn.active {
    background: #2563EB;
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}
.refund-withheld-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.refund-withheld-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    color: #FFFFFF;
    font-size: 1.05rem;
    font-weight: 800;
    padding: 10px 14px;
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
}
.refund-withheld-input:focus {
    border-color: #FCD34D;
    box-shadow: 0 0 0 3px rgba(252, 211, 77, 0.25);
}

/* 計算内訳アコーディオン */
.refund-details-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #E2E8F0;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.refund-details-toggle:hover {
    background: rgba(255, 255, 255, 0.14);
}
.refund-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.82rem;
}
.refund-breakdown-table tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.refund-breakdown-table tr:last-child {
    border-bottom: none;
}
.refund-breakdown-table td {
    padding: 8px 6px;
    color: #CBD5E1;
}
.refund-breakdown-table td.step-num {
    color: #FCD34D;
    font-weight: 800;
    width: 24px;
}
.refund-breakdown-table td.step-val {
    text-align: right;
    font-weight: 800;
    color: #FFFFFF;
    white-space: nowrap;
}
.refund-breakdown-table tr.highlight-row {
    background: rgba(52, 211, 153, 0.12);
}
.refund-breakdown-table tr.highlight-row td {
    color: #6EE7B7;
    font-weight: 800;
}

/* ==========================================
   🎁 ふるさと納税 控除上限シミュレーションカード（同系色ダークスタイル & ASP導線）
   ========================================== */
.furusato-sim-card {
    margin-top: 20px;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    border: 2px solid #FCD34D;
    border-radius: 20px;
    padding: 24px 20px;
    color: #FFFFFF;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
    position: relative;
    overflow: hidden;
}
.furusato-sim-card::before {
    content: "";
    position: absolute;
    top: -50px;
    left: -50px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(252, 211, 77, 0.2) 0%, rgba(252, 211, 77, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}
.furusato-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(252, 211, 77, 0.15);
    border: 1px solid #FCD34D;
    color: #FCD34D;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 9999px;
    letter-spacing: 0.03em;
}
.furusato-main-display {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 18px 16px;
    text-align: center;
    margin-bottom: 14px;
}
.furusato-main-title {
    font-size: 0.88rem;
    color: #94A3B8;
    font-weight: 700;
    margin-bottom: 6px;
}
.furusato-amount-value {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    color: #FCD34D;
    text-shadow: 0 0 20px rgba(252, 211, 77, 0.35);
}
.furusato-approx {
    font-size: 1.1rem;
    font-weight: 700;
    color: #E2E8F0;
    margin-right: 2px;
}
.furusato-unit {
    font-size: 1.1rem;
    font-weight: 700;
    color: #E2E8F0;
    margin-left: 2px;
}
.furusato-desc-note {
    font-size: 0.78rem;
    color: #CBD5E1;
    margin-top: 6px;
    line-height: 1.4;
}

/* りするんアドバイス吹き出し */
.furusato-risurun-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(254, 243, 199, 0.12);
    border: 1.5px solid rgba(252, 211, 77, 0.35);
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.furusato-risurun-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid #FCD34D;
    object-fit: cover;
    flex-shrink: 0;
}
.furusato-risurun-bubble {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #FEF3C7;
    font-weight: 700;
    flex: 1;
}

/* 内訳テーブルラッパー */
.furusato-breakdown-wrap {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.furusato-table-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 800;
    color: #E2E8F0;
    margin-bottom: 8px;
}

/* ASPポータルカードセクション */
.furusato-asp-section {
    margin-top: 8px;
}
.furusato-asp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}
.furusato-asp-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: #FCD34D;
}
.furusato-asp-sub {
    font-size: 0.72rem;
    color: #94A3B8;
    font-weight: 700;
}
.furusato-asp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.furusato-portal-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 10px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}
.furusato-portal-card:hover {
    transform: translateY(-3px);
    border-color: #FCD34D;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.furusato-portal-card:active {
    transform: scale(0.98);
}
.portal-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 9999px;
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}
.portal-rakuten .portal-badge { background: rgba(239, 68, 68, 0.25); color: #FCA5A5; border: 1px solid #EF4444; }
.portal-satofull .portal-badge { background: rgba(245, 158, 11, 0.25); color: #FDE68A; border: 1px solid #F59E0B; }
.portal-furunavi .portal-badge { background: rgba(59, 130, 246, 0.25); color: #93C5FD; border: 1px solid #3B82F6; }

.portal-icon {
    font-size: 1.5rem;
    margin-bottom: 4px;
}
.portal-name {
    font-size: 0.86rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 4px;
}
.portal-desc {
    font-size: 0.68rem;
    color: #CBD5E1;
    line-height: 1.35;
    margin-bottom: 8px;
    flex: 1;
}
.portal-btn {
    font-size: 0.72rem;
    font-weight: 800;
    color: #0F172A;
    background: #FCD34D;
    padding: 5px 10px;
    border-radius: 9999px;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
}
.furusato-portal-card:hover .portal-btn {
    background: #FBBF24;
}
.furusato-asp-notice {
    font-size: 0.72rem;
    color: #94A3B8;
    line-height: 1.4;
    text-align: center;
    margin-top: 8px;
}

@media (max-width: 640px) {
    .furusato-asp-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .furusato-portal-card {
        flex-direction: row;
        text-align: left;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
    }
    .portal-icon {
        font-size: 1.4rem;
        margin-bottom: 0;
    }
    .portal-desc {
        display: none;
    }
    .furusato-portal-card .portal-badge {
        display: inline-block;
        margin-bottom: 2px;
    }
    .furusato-portal-card .portal-name {
        margin-bottom: 0;
    }
    .portal-btn {
        width: auto;
        padding: 6px 12px;
        white-space: nowrap;
        margin-left: auto;
    }
    .furusato-amount-value {
        font-size: 1.85rem;
    }
}

/* ==========================================
   🏢 源泉徴収簿（Withholding Ledger）モーダル＆テーブル
   ========================================== */
.gensenbo-modal-content {
    width: 95%;
    max-width: 860px;
    max-height: 90vh;
    background: #FFFFFF;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
    padding: 0;
}
.gensenbo-header {
    background: #0F172A;
    color: #FFFFFF;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: relative;
}
.gensenbo-title-box {
    flex: 1;
    min-width: 0;
    padding-right: 10px;
}
.gensenbo-close-btn {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.gensenbo-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}
.gensenbo-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.9rem;
}
.gensenbo-quick-autofill-box {
    background: #F1F5F9;
    border: 1px solid #CBD5E1;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.gensenbo-table-wrap {
    overflow-x: auto;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    margin-bottom: 18px;
}
.gensenbo-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: right;
}
.gensenbo-table th {
    background: #F8FAFC;
    color: #334155;
    font-weight: 800;
    padding: 8px 10px;
    border: 1px solid #E2E8F0;
    text-align: center;
}
.gensenbo-table td {
    padding: 6px 8px;
    border: 1px solid #E2E8F0;
}
.gensenbo-table td.month-label {
    text-align: center;
    font-weight: 700;
    background: #F8FAFC;
}
.gensenbo-table input.g-input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    text-align: right;
    font-size: 0.82rem;
    font-weight: 700;
    box-sizing: border-box;
}
.gensenbo-table input.g-input:focus {
    border-color: #2563EB;
    outline: none;
    background: #EFF6FF;
}
.gensenbo-table tr.total-row td {
    background: #EFF6FF;
    font-weight: 800;
    color: #1E3A8A;
}
.gensenbo-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.gensenbo-summary-card {
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    padding: 12px 14px;
}
.gensenbo-summary-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748B;
    margin-bottom: 4px;
}
.gensenbo-summary-val {
    font-size: 1.25rem;
    font-weight: 900;
    color: #0F172A;
}


/* ==========================================================================
   グローバル フローティング電卓ボタン（Pattern 1: カード内右下に常駐）
   ========================================================================== */
.risurun-floating-calc-btn {
    position: absolute;
    bottom: 80px; /* .bottom-bar (高さ約60px) のすぐ上 */
    right: 24px;
    z-index: 15;
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border: 2px solid #F59E0B;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3), 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
}
.risurun-floating-calc-btn:hover {
    transform: translateY(-3px) scale(1.1);
    background: #FEF3C7;
    border-color: #D97706;
    box-shadow: 0 8px 24px rgba(245, 158, 11, 0.42), 0 3px 8px rgba(0, 0, 0, 0.12);
}
.risurun-floating-calc-btn:active {
    transform: translateY(0) scale(0.94);
}
.floating-calc-icon {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
}

@media (min-width: 768px) {
    .risurun-floating-calc-btn {
        bottom: 88px;
        right: 32px;
        width: 52px;
        height: 52px;
    }
    .floating-calc-icon {
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .risurun-floating-calc-btn {
        bottom: 74px;
        right: 14px;
        width: 42px;
        height: 42px;
        box-shadow: 0 3px 12px rgba(245, 158, 11, 0.25);
    }
    .floating-calc-icon {
        width: 24px;
        height: 24px;
    }
}

/* ==========================================================================
   計算中インタースティシャル画面（ステップ6→7 演出 ＆ 広告枠）
   ========================================================================== */
.calculating-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.calculating-overlay.active {
    opacity: 1;
    visibility: visible;
}
.calculating-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.calculating-card {
    position: relative;
    z-index: 2;
    background: #FFFFFF;
    border-radius: 20px;
    max-width: 520px;
    width: 100%;
    padding: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    border: 2px solid #FCD34D;
    animation: calcCardPop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@keyframes calcCardPop {
    from { transform: scale(0.92) translateY(12px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.calculating-visual-wrap {
    position: relative;
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: #FEF3C7;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.calculating-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    display: block;
    object-fit: cover;
}
.calculating-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(0, 0, 0, 0.2);
}
.calculating-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #10B981, #F59E0B, #10B981);
    background-size: 200% 100%;
    animation: pBarGlow 1.5s linear infinite;
    transition: width 0.35s ease;
}
@keyframes pBarGlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}
.calculating-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #F8FAFC;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}
.calculating-spinner-ring {
    width: 22px;
    height: 22px;
    border: 3px solid #E2E8F0;
    border-top-color: #10B981;
    border-radius: 50%;
    animation: calcSpin 0.75s linear infinite;
    flex-shrink: 0;
}
@keyframes calcSpin {
    to { transform: rotate(360deg); }
}
.calculating-text-col {
    flex: 1;
    min-width: 0;
}
.calculating-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.calculating-sub {
    font-size: 0.72rem;
    color: #64748B;
    font-weight: 600;
}
.calculating-percent {
    font-size: 1.05rem;
    font-weight: 900;
    color: #059669;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

/* AdSense広告スロット */
.calculating-ad-section {
    background: #F1F5F9;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px dashed #CBD5E1;
    text-align: center;
}
.ad-banner-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94A3B8;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.ad-banner-frame {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border-radius: 8px;
    border: 1px solid #E2E8F0;
    overflow: hidden;
}
.ad-placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px;
    color: #94A3B8;
}
.ad-placeholder-caption {
    font-size: 0.76rem;
    font-weight: 700;
}

@media (max-width: 480px) {
    .calculating-card {
        padding: 12px;
        border-radius: 16px;
        gap: 10px;
    }
    .calculating-title {
        font-size: 0.82rem;
    }
    .ad-banner-frame {
        min-height: 65px;
    }
}
