/* ==========================================================================
   手取りシミュレーター — 独立ページ
   ========================================================================== */

/* ── Page wrapper ── */
.ts-page {
    background: #f5f7fa;
    min-height: 100vh;
}

/* ── Hero ── */
.ts-hero {
    background: linear-gradient(135deg, #043e80 0%, #065ba8 60%, #0a7fd4 100%);
    color: #fff;
    text-align: center;
    padding: 56px 20px 48px;
}

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

.ts-hero-badge {
    display: inline-block;
    background: rgba(245, 181, 0, 0.2);
    color: #f5d56e;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 16px;
    border-radius: 20px;
    margin-bottom: 12px;
    letter-spacing: 0.04em;
}

.ts-hero h1 {
    font-size: 2rem;
    font-weight: 900;
    margin: 0 0 12px;
    line-height: 1.3;
}

.ts-hero-lead {
    font-size: 0.95rem;
    opacity: 0.85;
    line-height: 1.6;
    margin: 0;
}

/* ── Container ── */
.ts-container {
    max-width: 720px;
    margin: -24px auto 0;
    padding: 0 16px 60px;
    position: relative;
    z-index: 1;
}

/* ── Result card (sticky-ish top) ── */
.ts-result-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    margin-bottom: 20px;
    position: sticky;
    top: 80px;
    z-index: 10;
}

.ts-result-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 8px;
}

.ts-result-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
}

.ts-result-amount {
    font-size: 3rem;
    font-weight: 900;
    color: #059669;
    line-height: 1;
    margin: 0 4px;
    display: inline-block;
    transition: color 0.3s;
}

.ts-result-unit {
    font-size: 1.2rem;
    font-weight: 700;
    color: #059669;
}

/* ── Bar chart ── */
.ts-bar-chart {
    display: flex;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0 10px;
    background: #e5e7eb;
}

.ts-bar-segment {
    height: 100%;
    transition: width 0.4s ease, opacity 0.3s;
    min-width: 0;
    position: relative;
}

.ts-bar-segment[data-policy="deduction25"]   { background: #1d4ed8; }
.ts-bar-segment[data-policy="deduction26"]   { background: #3b82f6; }
.ts-bar-segment[data-policy="deductionwall"] { background: #93c5fd; }
.ts-bar-segment[data-policy="child"]     { background: #8b5cf6; }
.ts-bar-segment[data-policy="social"]    { background: #06b6d4; }
.ts-bar-segment[data-policy="gas"]       { background: #f59e0b; }
.ts-bar-segment[data-policy="consumption"] { background: #ef4444; }

/* ── Bar legend ── */
.ts-bar-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    font-size: 0.75rem;
    color: #666;
}

.ts-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ts-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ── Income input card ── */
.ts-input-card {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.ts-input-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

.ts-input-label i {
    color: var(--dpfp-blue, #043e80);
    margin-right: 6px;
}

.ts-income-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ts-income-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.ts-income-input {
    width: 80px;
    padding: 8px 10px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    color: var(--dpfp-blue, #043e80);
    transition: border-color 0.2s;
}

.ts-income-input:focus {
    outline: none;
    border-color: var(--dpfp-blue, #043e80);
}

.ts-income-unit {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.ts-income-display {
    text-align: center;
    margin-top: 12px;
}

.ts-income-value {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--dpfp-blue, #043e80);
}

.ts-income-display-unit {
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    margin-left: 4px;
}

/* ── Slider ── */
.ts-slider {
    flex: 1;
    min-width: 0;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(90deg, var(--dpfp-blue, #043e80), var(--dpfp-yellow, #f5b500));
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.ts-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--dpfp-blue, #043e80);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

.ts-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.ts-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--dpfp-blue, #043e80);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.ts-slider-small {
    height: 6px;
}

.ts-slider-small::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
}

.ts-slider-small::-moz-range-thumb {
    width: 22px;
    height: 22px;
}

/* ── Policy cards ── */
.ts-policies {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.ts-policy-card {
    background: #fff;
    border-radius: 14px;
    border: 2px solid #e5e7eb;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.ts-policy-card.active {
    border-color: var(--dpfp-blue, #043e80);
    box-shadow: 0 2px 12px rgba(4, 62, 128, 0.1);
}

.ts-policy-card:not(.active) {
    opacity: 0.6;
}

.ts-policy-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
}

/* ── Toggle switch ── */
.ts-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.ts-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ts-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.3s;
}

.ts-toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
}

.ts-toggle input:checked + .ts-toggle-slider {
    background: var(--dpfp-blue, #043e80);
}

.ts-toggle input:checked + .ts-toggle-slider::before {
    transform: translateX(20px);
}

/* ── Policy icon ── */
.ts-policy-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
}

.ts-policy-card[data-policy="deduction25"] .ts-policy-icon   { background: #1d4ed8; }
.ts-policy-card[data-policy="deduction26"] .ts-policy-icon   { background: #3b82f6; }
.ts-policy-card[data-policy="deductionwall"] .ts-policy-icon { background: #93c5fd; color: #1e3a5f; }
.ts-policy-card[data-policy="child"] .ts-policy-icon     { background: #8b5cf6; }
.ts-policy-card[data-policy="social"] .ts-policy-icon    { background: #06b6d4; }
.ts-policy-card[data-policy="gas"] .ts-policy-icon       { background: #f59e0b; }
.ts-policy-card[data-policy="consumption"] .ts-policy-icon { background: #ef4444; }

/* ── Policy info ── */
.ts-policy-info {
    flex: 1;
    min-width: 0;
}

.ts-policy-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.ts-policy-desc {
    display: block;
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
    line-height: 1.4;
}

/* ── Policy amount ── */
.ts-policy-amount {
    font-size: 1.1rem;
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 60px;
    text-align: right;
}

.ts-policy-card[data-policy="deduction25"] .ts-policy-amount   { color: #1d4ed8; }
.ts-policy-card[data-policy="deduction26"] .ts-policy-amount   { color: #3b82f6; }
.ts-policy-card[data-policy="deductionwall"] .ts-policy-amount { color: #6366f1; }
.ts-policy-card[data-policy="child"] .ts-policy-amount     { color: #8b5cf6; }
.ts-policy-card[data-policy="social"] .ts-policy-amount    { color: #06b6d4; }
.ts-policy-card[data-policy="gas"] .ts-policy-amount       { color: #f59e0b; }
.ts-policy-card[data-policy="consumption"] .ts-policy-amount { color: #ef4444; }

.ts-policy-card:not(.active) .ts-policy-amount {
    color: #ccc;
}

/* ── Policy extra inputs ── */
.ts-policy-extra {
    padding: 0 16px 14px;
    display: none;
}

.ts-policy-card.active .ts-policy-extra {
    display: block;
}

.ts-extra-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.ts-extra-label i {
    margin-right: 4px;
}

/* Child count selector */
.ts-child-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ts-child-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dpfp-blue, #043e80);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.ts-child-btn:hover {
    background: #f0f4f8;
    border-color: var(--dpfp-blue, #043e80);
}

.ts-child-count {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dpfp-blue, #043e80);
    min-width: 24px;
    text-align: center;
}

/* Gas slider row */
.ts-gas-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ts-gas-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    min-width: 90px;
}

/* ── Policy detail (calculation breakdown) ── */
.ts-policy-detail {
    padding: 0 16px 14px;
    font-size: 0.78rem;
    color: #999;
    line-height: 1.5;
    display: none;
}

.ts-policy-card.active .ts-policy-detail {
    display: block;
}

.ts-policy-card:not(.active) .ts-policy-detail {
    display: none;
}

/* ── Status badges ── */
.ts-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
    letter-spacing: 0.02em;
}

.ts-badge-enacted {
    background: #d1fae5;
    color: #065f46;
}

.ts-badge-proposed {
    background: #dbeafe;
    color: #1e40af;
}

.ts-badge-agreed {
    background: #cffafe;
    color: #155e75;
}

.ts-badge-temporary {
    background: #fef3c7;
    color: #92400e;
}

/* ── Policy group (基礎控除3段階) ── */
.ts-policy-group {
    background: #e8eefb;
    border: 1.5px solid #bfcfee;
    border-left: 4px solid #3b82f6;
    border-radius: 14px;
    padding: 14px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ts-policy-group-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a8a;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ts-policy-group-title i {
    font-size: 0.85rem;
    color: #3b82f6;
}

.ts-policy-group .ts-policy-card {
    border-radius: 10px;
}

/* ── Footer ── */
.ts-footer {
    text-align: center;
}

.ts-note {
    font-size: 0.82rem;
    color: #999;
    margin-bottom: 16px;
}

.ts-note i {
    margin-right: 4px;
    color: #bbb;
}

.ts-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.ts-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: var(--dpfp-blue, #043e80);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 10px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.ts-link:hover {
    opacity: 0.85;
    color: #fff;
}

/* ── sp-only helper ── */
.sp-only {
    display: none;
}

/* ══════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════ */

@media (max-width: 600px) {
    .sp-only { display: inline; }

    .ts-hero {
        padding: 44px 16px 40px;
    }

    .ts-hero h1 {
        font-size: 1.5rem;
    }

    .ts-hero-lead {
        font-size: 0.85rem;
    }

    .ts-container {
        padding: 0 12px 40px;
    }

    .ts-result-card {
        padding: 20px 16px;
        position: static;
    }

    .ts-result-amount {
        font-size: 2.4rem;
    }

    .ts-bar-chart {
        height: 22px;
    }

    .ts-input-card {
        padding: 20px 16px;
    }

    .ts-income-row {
        flex-direction: column;
        gap: 12px;
    }

    .ts-income-input {
        width: 100px;
    }

    .ts-income-value {
        font-size: 2rem;
    }

    .ts-policy-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 12px;
    }

    .ts-policy-icon {
        width: 34px;
        height: 34px;
        font-size: 0.95rem;
    }

    .ts-policy-name {
        font-size: 0.82rem;
    }

    .ts-policy-desc {
        display: none;
    }

    .ts-policy-amount {
        font-size: 1rem;
        width: 100%;
        text-align: right;
        margin-top: -4px;
    }

    .ts-policy-extra {
        padding: 0 12px 12px;
    }

    .ts-gas-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .ts-gas-value {
        text-align: center;
    }

    .ts-bar-legend {
        gap: 6px 10px;
        font-size: 0.7rem;
    }
}
