:root {
    --primary-color: #3b82f6; /* Car Blue */
    --card-bg: rgba(20, 25, 30, 0.9);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #020617;
    
    --weight-color: #ef4444; /* Red interest weight */
    --weight-border: #b91c1c;
}

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

body {
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    background-color: #0f172a;
    position: relative;
    overflow-x: hidden;
}

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 100;
    transition: background 0.3s;
}

.back-link:hover {
    background: rgba(255,255,255,0.2);
}

.bg-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    z-index: -1;
}

.app-container {
    width: 100%;
    max-width: 600px;
    z-index: 10;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* スライダー・トグル部 */
.slider-section {
    margin-bottom: 24px;
    background: rgba(0,0,0,0.3);
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.input-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 12px;
    font-size: 1rem;
}

.highlight-value {
    color: #fff;
    font-size: 2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

input[type="range"] {
    width: 100%;
    height: 14px;
    background: #334155;
    border-radius: 8px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    margin-bottom: 8px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 4px solid var(--primary-color);
    transition: transform 0.1s;
}

/* トグル行 */
.toggle-container {
    display: flex;
    gap: 8px;
}

.toggle-container input[type="radio"] {
    display: none;
}

.toggle-btn {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 10px 4px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.2;
}

.toggle-btn small {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 4px;
}

.toggle-container input[type="radio"]:checked + .toggle-btn {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.payment-methods input[type="radio"][value="zankure"]:checked + .toggle-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}


/* 演出ステージ */
.visual-section {
    position: relative;
    margin-bottom: 24px;
    background: rgba(0,0,0,0.5);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    border-bottom: 4px solid #64748b;
    height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
    padding-bottom: 0;
}

/* 車本体ブロック */
.car-block {
    width: 220px;
    height: 120px;
    background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
    border: 2px solid #1e40af;
    border-radius: 12px 12px 4px 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5), inset 0 2px 10px rgba(255,255,255,0.3);
    position: relative;
    z-index: 2;
    transition: transform 0.1s ease-out;
}
.car-block strong {
    font-size: 1.5rem;
    color: #e0f2fe;
}
.car-block.crushed {
    /* 落ちてきた瞬間に沈み込むアニメーション用クラス */
    animation: car-crush 0.4s cubic-bezier(0.36, 0, 0.66,-0.56) forwards;
}

@keyframes car-crush {
    0% { transform: scaleY(1); }
    50% { transform: scaleY(0.85) translateY(10px); }
    100% { transform: scaleY(0.95) translateY(3px); }
}

/* 利息の重りブロック */
.weight-block {
    width: 200px;
    /* heightはJSで動的にセット */
    background: linear-gradient(180deg, var(--weight-color) 0%, #991b1b 100%);
    border: 2px solid var(--weight-border);
    border-radius: 4px;
    position: absolute;
    bottom: 120px; /* 車体ブロックの上 */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.6), inset 0 2px 5px rgba(255,255,255,0.3);
    z-index: 1;
    overflow: hidden;
    opacity: 0; /* 最初は隠す */
}
.weight-block strong {
    font-size: 1.3rem;
    color: #fecaca;
    display: block;
    margin-top: 4px;
}
.weight-block.dropping {
    animation: drop-in 0.6s cubic-bezier(0.5, 0, 0.75, 0) forwards;
}

@keyframes drop-in {
    0% {
        transform: translateY(-400px);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}


/* 結果パネル */
.result-section {
    margin-bottom: 24px;
}

.result-card {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid #334155;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.result-card.danger {
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.result-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: #94a3b8;
    margin-bottom: 4px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 12px;
}
.result-card.danger .result-value {
    color: #fca5a5;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.monthly-breakdown {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.monthly-breakdown strong {
    font-size: 1.3rem;
    color: #fff;
}

.zankure-warning {
    margin-top: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #fca5a5;
    text-align: left;
    line-height: 1.4;
}

/* 内訳 */
.breakdown-card {
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

.breakdown-card h3 {
    font-size: 0.9rem;
    color: #cbd5e1;
    margin-bottom: 12px;
    text-align: center;
}

.cost-hint-list {
    list-style: none;
}

.cost-hint-list li {
    font-size: 0.8rem;
    color: #e2e8f0;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.05);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    line-height: 1.4;
}
