/* Estatex Custom Styles */

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

/* Custom Properties */
:root {
    --primary-navy: #0F172A;
    --primary-emerald: #06C755;
    --bg-light: #F8FAFC;
    --text-gray: #64748B;
    --border-light: #E2E8F0;
    --shadow-light: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    color: var(--text-gray);
    background-color: var(--bg-light);
}

.font-noto {
    font-family: 'Noto Sans JP', sans-serif;
}

/* Custom Utilities */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Animation Enhancements */
.animate-fade-in {
    animation: fadeIn 0.6s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out;
}

.animate-slide-in-bottom {
    animation: slideInBottom 0.5s ease-out;
}

.animate-pulse-soft {
    animation: pulseSoft 2s ease-in-out infinite;
}

.animate-bounce-gentle {
    animation: bounceGentle 1s ease-in-out;
}

/* LINE誘導最適化スタイル */
.line-guidance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.line-guidance-overlay.active {
    opacity: 1;
    visibility: visible;
}

.line-guidance-modal {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 90%;
    width: 400px;
    box-shadow: var(--shadow-large);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.line-guidance-overlay.active .line-guidance-modal {
    transform: scale(1);
}

.line-fixed-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #06C755, #04A54B);
    color: white;
    padding: 1rem;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.line-fixed-banner.active {
    transform: translateY(0);
}

.line-popup-slide {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-large);
    max-width: 320px;
    width: calc(100% - 40px);
    transform: translateX(120%);
    transition: transform 0.4s ease;
    z-index: 1001;
    border: 2px solid #06C755;
}

.line-popup-slide.active {
    transform: translateX(0);
}

.step-guide-container {
    background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
    border: 2px solid #06C755;
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

.step-guide-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #06C755, #04A54B, #06C755);
    background-size: 200% 100%;
    animation: gradientShift 3s ease-in-out infinite;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #D1FAE5;
}

.step-item:last-child {
    border-bottom: none;
}

.step-number {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: #06C755;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
}

.trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0;
}

.trust-badge {
    background: #FEF3C7;
    color: #92400E;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid #FCD34D;
}

.social-proof {
    background: #F0F9FF;
    border: 1px solid #0EA5E9;
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.social-proof-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #0369A1;
}

.urgency-notice {
    background: linear-gradient(135deg, #FEF3C7, #FEF08A);
    border: 1px solid #F59E0B;
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
    position: relative;
}

.urgency-notice::before {
    content: '⏰';
    position: absolute;
    top: -8px;
    left: 16px;
    background: white;
    padding: 0 8px;
    font-size: 1.2em;
}

.line-cta-enhanced {
    background: linear-gradient(135deg, #06C755, #04A54B);
    border: none;
    border-radius: 12px;
    color: white;
    padding: 1rem 2rem;
    font-weight: 600;
    font-size: 1.1rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(6, 199, 85, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.line-cta-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.line-cta-enhanced:hover::before {
    left: 100%;
}

.line-cta-enhanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 199, 85, 0.4);
}

.countdown-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.2em;
    font-weight: bold;
    color: #DC2626;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .line-popup-slide {
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }
    
    .line-guidance-modal {
        width: 95%;
        padding: 1.5rem;
    }
    
    .line-fixed-banner {
        padding: 0.75rem;
    }
    
    .step-guide-container {
        margin: 1rem 0;
        padding: 1.5rem;
    }
}

/* アニメーションキーフレーム */
@keyframes slideInBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseSoft {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes bounceGentle {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-large);
}

/* Custom Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-emerald), #04A54B);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #04A54B, #038B47);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-secondary {
    background: white;
    color: var(--primary-emerald);
    border: 2px solid var(--primary-emerald);
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--primary-emerald);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Form Styles */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-light);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: 'Noto Sans JP', sans-serif;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-emerald);
    box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.1);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--primary-navy);
}

/* Range Slider Styles */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
    background: #E2E8F0;
    height: 8px;
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    background: var(--primary-emerald);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
}

input[type="range"]::-moz-range-track {
    background: #E2E8F0;
    height: 8px;
    border-radius: 4px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    background: var(--primary-emerald);
    height: 20px;
    width: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.card-elevated {
    box-shadow: var(--shadow-medium);
}

/* Statistics Display */
.stat-display {
    background: linear-gradient(135deg, var(--primary-emerald), #04A54B);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: var(--shadow-medium);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    margin: 2rem 0;
    background: white;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: var(--shadow-light);
}

/* Comparison Table */
.comparison-table {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-light);
    margin: 2rem 0;
}

.comparison-header {
    background: var(--primary-navy);
    color: white;
    padding: 1rem;
    font-weight: 600;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 1px solid var(--border-light);
}

.comparison-cell {
    padding: 1rem;
    text-align: center;
}

.comparison-cell.highlight {
    background: rgba(6, 199, 85, 0.1);
    color: var(--primary-emerald);
    font-weight: 600;
}

/* FAQ Styles */
.faq-item {
    cursor: pointer;
    transition: all 0.3s ease;
}

.faq-item:hover {
    background: rgba(6, 199, 85, 0.05);
    border-radius: 0.5rem;
    padding: 0.5rem;
    margin: -0.5rem;
}

.faq-arrow {
    transition: transform 0.3s ease;
}

.faq-arrow.rotate {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer.show {
    max-height: 200px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .chart-container {
        height: 300px;
        padding: 0.5rem;
    }
    
    .comparison-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .comparison-cell {
        border-bottom: 1px solid var(--border-light);
    }
    
    .comparison-cell:last-child {
        border-bottom: none;
    }
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-emerald);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: #EF4444;
}

.toast.warning {
    background: #F59E0B;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-emerald), #04A54B);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--text-gray);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-emerald);
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-navy: #000000;
        --primary-emerald: #00FF00;
        --text-gray: #000000;
        --border-light: #000000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles for Accessibility */
*:focus {
    outline: 2px solid var(--primary-emerald);
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-emerald);
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-emerald);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Error States */
.error {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: #EF4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success States */
.success {
    border-color: var(--primary-emerald) !important;
    box-shadow: 0 0 0 3px rgba(6, 199, 85, 0.1) !important;
}

.success-message {
    color: var(--primary-emerald);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.grid { display: grid; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.bg-white { background-color: white; }
.bg-gray-50 { background-color: #F9FAFB; }
.bg-emerald-500 { background-color: var(--primary-emerald); }
.bg-navy-900 { background-color: var(--primary-navy); }

.text-white { color: white; }
.text-gray-600 { color: var(--text-gray); }
.text-emerald-500 { color: var(--primary-emerald); }
.text-navy-900 { color: var(--primary-navy); }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }

.shadow { box-shadow: var(--shadow-light); }
.shadow-lg { box-shadow: var(--shadow-medium); }
.shadow-xl { box-shadow: var(--shadow-large); }

/* Mobile Safe Area Support */
@supports (padding: max(0px)) {
    .safe-area-inset-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* Mobile Fixed CTA */
.mobile-cta-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: linear-gradient(135deg, var(--primary-emerald), #04A54B);
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
    .mobile-cta-fixed {
        display: none;
    }
}

/* Enhanced Mobile Form Controls */
.form-input {
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 48px;
}

/* Mobile Table Improvements */
.comparison-table {
    min-width: 300px; /* Prevents table from being too cramped */
}

/* Mobile Typography */
@media (max-width: 767px) {
    .text-responsive-xl {
        font-size: clamp(1.5rem, 4vw, 2.25rem);
    }
    
    .text-responsive-lg {
        font-size: clamp(1.125rem, 3vw, 1.5rem);
    }
}

/* Touch Target Enhancement */
.btn-touch {
    min-height: 48px;
    min-width: 48px;
    padding: 0.75rem 1rem;
}

/* Details/Summary Styling */
details summary {
    list-style: none;
    cursor: pointer;
    padding: 0.5rem 0;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::after {
    content: ' ▼';
    font-size: 0.75rem;
    color: var(--primary-emerald);
    margin-left: 0.5rem;
}

details[open] summary::after {
    content: ' ▲';
}

/* Results Tabs */
.results-tabs {
    display: flex;
    border-bottom: 2px solid #E2E8F0;
    margin-bottom: 1.5rem;
}

.results-tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: #64748B;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.results-tab.active {
    color: var(--primary-emerald);
    border-bottom-color: var(--primary-emerald);
    background: rgba(6, 199, 85, 0.05);
}

.results-tab:hover {
    color: var(--primary-emerald);
    background: rgba(6, 199, 85, 0.05);
}

/* Summary Cards */
.summary-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
}

.summary-total.other {
    background: #FEF2F2;
    border: 1px solid #FECACA;
}

.summary-total.estatex {
    background: #ECFDF5;
    border: 1px solid #BBF7D0;
}

.summary-bar {
    height: 8px;
    border-radius: 4px;
    background: #E2E8F0;
    overflow: hidden;
    margin: 1rem 0;
}

.summary-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #EF4444, var(--primary-emerald));
    transition: width 0.8s ease;
    border-radius: 4px;
}

/* Breakdown Accordion */
.breakdown-accordion {
    space-y: 0.75rem;
}

.breakdown-item {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid #E2E8F0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.breakdown-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.breakdown-header {
    padding: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    min-height: 44px;
    transition: background 0.2s ease;
}

.breakdown-header:hover {
    background: #F8FAFC;
}

.breakdown-header[aria-expanded="true"] {
    background: #F0FDF4;
    border-bottom: 1px solid #E2E8F0;
}

.breakdown-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    background: #F1F5F9;
    color: #64748B;
    font-size: 1.125rem;
}

.breakdown-content {
    flex: 1;
    min-width: 0;
}

.breakdown-title {
    font-weight: 600;
    color: #0F172A;
    margin-bottom: 0.25rem;
}

.breakdown-amounts {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: #64748B;
}

.breakdown-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.breakdown-chip.same {
    background: #F1F5F9;
    color: #64748B;
}

.breakdown-chip.diff {
    background: #ECFDF5;
    color: #059669;
}

.breakdown-arrow {
    margin-left: auto;
    transition: transform 0.2s ease;
    color: var(--primary-emerald);
}

.breakdown-arrow.rotated {
    transform: rotate(180deg);
}

.breakdown-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.breakdown-detail.expanded {
    max-height: 200px;
}

.breakdown-detail-content {
    padding: 1rem;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #475569;
}

/* Display Control - Desktop vs Mobile */
.breakdown-desktop {
    display: none;
}

.breakdown-mobile {
    display: block;
}

/* Tablet and above - show desktop layout */
@media (min-width: 768px) {
    .breakdown-desktop {
        display: block;
    }
    
    .breakdown-mobile {
        display: none;
    }
}

/* モバイルで表示方法を切り替える - デスクトップテーブルのみ表示 */
@media (max-width: 480px) {
    /* デスクトップ版テーブルを表示（上記の480px以下のスタイルが適用される） */
    .breakdown-desktop {
        display: block !important;
    }
    
    /* モバイルカード表示を無効化 */
    .breakdown-mobile {
        display: none !important;
    }
}

/* Tab Panel Control */
.tab-panel {
    display: block;
}

.tab-panel.hidden {
    display: none;
}

/* Accordion Panel States */
.acc-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}

.acc-panel.open {
    max-height: 1200px;
}

/* Mobile Breakdown Cards */
.breakdown-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #E2E8F0;
}

.breakdown-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.breakdown-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    background: #F1F5F9;
    color: #64748B;
    font-size: 0.875rem;
}

.breakdown-card-title {
    font-weight: 600;
    color: #0F172A;
    flex: 1;
    font-size: 1rem;
}

.breakdown-card-amounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.breakdown-card-amount {
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
}

.breakdown-card-amount.other {
    background: #FEF2F2;
    border: 1px solid #FECACA;
}

.breakdown-card-amount.estatex {
    background: #ECFDF5;
    border: 1px solid #BBF7D0;
}

.breakdown-card-amount-label {
    font-size: 0.75rem;
    color: #64748B;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.breakdown-card-amount-value {
    font-weight: 600;
    color: #0F172A;
    font-size: 0.875rem;
}

.breakdown-card-bar {
    height: 4px;
    background: #E2E8F0;
    border-radius: 2px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.breakdown-card-bar-fill {
    height: 100%;
    background: var(--primary-emerald);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.breakdown-card-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.breakdown-card-chip.same {
    background: #F1F5F9;
    color: #64748B;
}

.breakdown-card-chip.diff {
    background: #ECFDF5;
    color: #059669;
}

/* Mobile Component Visibility */
@media (max-width: 767px) {
    .breakdown-mobile {
        display: block !important;
    }
    
    .breakdown-desktop {
        display: none !important;
    }
    
    #breakdownMobileCards {
        min-height: 20px;
    }
}

/* Ensure tab panels are properly controlled */
.tab-panel.hidden {
    display: none !important;
}

/* Controls */
.breakdown-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.breakdown-expand-all {
    font-size: 0.875rem;
    color: var(--primary-emerald);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background 0.2s ease;
}

.breakdown-expand-all:hover {
    background: rgba(6, 199, 85, 0.1);
}

/* Count Animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-count-up {
    animation: countUp 0.6s ease-out;
}

/* Accessibility */
.breakdown-header:focus {
    outline: 2px solid var(--primary-emerald);
    outline-offset: 2px;
}

.results-tab:focus {
    outline: 2px solid var(--primary-emerald);
    outline-offset: 2px;
}

/* ==========================================================
   モバイル内訳表示改善パッチ（無限ローディング防止）
   - スマホでの見やすさ改善。JSは触らない
   - 画面幅480px以下で適用
   - 既存のJavaScriptロジックは変更しない
   ========================================================== */

@media (max-width: 480px) {
  /* 濃紺のヘッダーやtheadをコンパクト化/非表示 */
  .result-header, .header-table, .comparison-header {
    display: none !important;
  }

  /* 基本テーブル設定 - divベースのcomparison-tableに対応 */
  .comparison-table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0; 
  }

  /* 各行をブロック表示に変更 */
  .comparison-row { 
    display: block !important; 
    width: 100% !important; 
    margin-bottom: 16px !important;
    background: #ffffff !important;
    border-radius: 12px !important;
    padding: 12px !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    border: 1px solid #E2E8F0 !important;
  }

  /* 費目名（1番目のセル）をラベル行として表示 */
  .comparison-row .comparison-cell:nth-child(1) {
    display: block !important;
    width: 100% !important;
    padding: 0 0 8px 0 !important;
    font-weight: 600 !important;
    color: #0F172A !important;
    font-size: 14px !important;
    text-align: left !important;
    border-bottom: 1px solid #E2E8F0 !important;
    margin-bottom: 8px !important;
  }

  /* 他社とEstatexの金額セルを2分割で並べる */
  .comparison-row .comparison-cell:nth-child(2),
  .comparison-row .comparison-cell:nth-child(3) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: calc(50% - 6px) !important;
    vertical-align: top !important;
    margin: 0 3px !important;
    padding: 10px 12px !important;
    border: 1px solid #E2E8F0 !important;
    border-radius: 8px !important;
    background: #F8FAFC !important;
    font-size: 14px !important;
    text-align: center !important;
    box-sizing: border-box !important;
    min-height: 50px !important;
  }

  /* 他社セルの色分け */
  .comparison-row .comparison-cell:nth-child(2) {
    background: #FEF2F2 !important;
    border-color: #FECACA !important;
  }
  .comparison-row .comparison-cell:nth-child(2)::before {
    content: "他社 ";
    color: #64748B;
    font-size: 12px;
    margin-right: 4px;
  }

  /* Estatexセルの色分け */
  .comparison-row .comparison-cell:nth-child(3) {
    background: #ECFDF5 !important;
    border-color: #BBF7D0 !important;
  }
  .comparison-row .comparison-cell:nth-child(3)::before {
    content: "Estatex ";
    color: #64748B;
    font-size: 12px;
    margin-right: 4px;
  }

  /* 固定CTAと被りを回避（下余白を確保） */
  :root { 
    --cta-h: 64px; 
  }
  .page-container, main, .content, #resultsSection {
    padding-bottom: calc(var(--cta-h) + env(safe-area-inset-bottom) + 20px) !important;
  }
  .fixed-cta {
    height: var(--cta-h);
    padding-bottom: env(safe-area-inset-bottom);
  }
}