:root {
    --primary-color: #f43f5e; /* Rose / Danger */
    --card-bg: rgba(15, 23, 42, 0.9);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-gradient-start: #3f182b; /* Dark rose */
    --bg-gradient-end: #020617;
}

* {
    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;
    transition: background 0.8s ease;
}

.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);
    transition: box-shadow 0.5s ease;
}

/* 金利15%時の赤いグロウ */
.glass-card.danger-mode {
    box-shadow: 0 0 40px rgba(244, 63, 94, 0.2), 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    border-color: rgba(244, 63, 94, 0.3);
}

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

header h1 {
    font-size: 1.5rem;
    font-weight: 900;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(244, 63, 94, 0.4);
}

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

/* スライダー部 */
.input-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: 8px;
    font-size: 0.95rem;
}

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: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border: 4px solid #3b82f6;
}

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

.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;
    line-height: 1.3;
}
.rate-toggles .toggle-btn {
    padding: 6px 4px;
}
.rate-toggles .toggle-btn small {
    font-size: 0.6rem;
    font-weight: 400;
}

/* 汎用地としてクリックされたら白テキ */
.toggle-container input[type="radio"]:checked + .toggle-btn {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* 特に回数系 */
#month-12:checked + label { border-color: #60a5fa; background: rgba(96, 165, 250, 0.2); }
#month-24:checked + label { border-color: #60a5fa; background: rgba(96, 165, 250, 0.2); }
#month-36:checked + label { border-color: #60a5fa; background: rgba(96, 165, 250, 0.2); }
#month-48:checked + label { border-color: #60a5fa; background: rgba(96, 165, 250, 0.2); }

/* 金利トグルのアクティブ色 */
#rate-0:checked + label { border-color: #3b82f6; background: rgba(59, 130, 246, 0.2); box-shadow: 0 0 10px rgba(59,130,246,0.3); }
#rate-8:checked + label { border-color: #f59e0b; background: rgba(245, 158, 11, 0.2); box-shadow: 0 0 10px rgba(245,158,11,0.3); }
#rate-15:checked + label { border-color: #ef4444; background: rgba(239, 68, 68, 0.2); box-shadow: 0 0 10px rgba(239,68,68,0.3); }


/* ビジュアルセクション（横棒グラフ） */
.visual-section {
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.monthly-illusion {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    border: 1px dashed #3b82f6;
}
.monthly-illusion strong {
    font-size: 1.8rem;
    color: #93c5fd;
    text-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    font-variant-numeric: tabular-nums;
}

/* バーグラフ関連 */
.chart-wrapper {
    position: relative;
    padding-top: 10px;
}

.chart-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: #94a3b8;
}

.bar-container {
    display: flex;
    width: 100%;
    height: 48px;
    background: #1e293b;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
    margin-bottom: 12px;
}

.base-bar {
    height: 100%;
    background: linear-gradient(90deg, #1d4ed8 0%, #3b82f6 100%);
    /* widthはJS制御 */
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.fee-bar {
    height: 100%;
    background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIklEQVQIW2NkQAKrVq36zwjjgzhhYWGMYAEYB8RmROaABADeOQ8CXl/xfgAAAABJRU5ErkJggg==') repeat;
    background-color: #9f1239; /* Dark Red */
    display: flex;
    align-items: center;
    justify-content: center;
    /* widthはJS制御。伸びてくるアニメーションのエッセンス */
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    border-left: 2px solid rgba(0,0,0,0.5);
}

.fee-flash {
    font-size: 0.85rem;
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
    opacity: 0;
    transition: opacity 0.5s ease 0.5s; /* バーが伸びてからふわっと出る */
}
.fee-bar.show-fee .fee-flash {
    opacity: 1;
}

.total-bar-label {
    text-align: right;
    font-weight: 700;
    font-size: 0.9rem;
    color: #cbd5e1;
}
.total-bar-label .huge-total {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    font-variant-numeric: tabular-nums;
}


/* カツアゲ宣告パネル */
.result-section {
    margin-bottom: 16px;
}

.extortion-card {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    transition: all 0.5s ease;
}

.extortion-card.danger {
    background: rgba(159, 18, 57, 0.2);
    border-color: #e11d48;
}

.extortion-header {
    font-size: 1rem;
    font-weight: 900;
    color: #cbd5e1;
    margin-bottom: 4px;
    transition: color 0.3s;
}
.extortion-card.danger .extortion-header {
    color: #fda4af;
}

.extortion-fee {
    font-size: 3.5rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 15px rgba(0,0,0,0.5);
    transition: color 0.5s, text-shadow 0.5s;
}
.extortion-card.danger .extortion-fee {
    color: #fb7185;
    text-shadow: 0 0 20px rgba(225, 29, 72, 0.6);
}
.extortion-unit {
    font-size: 1.2rem;
    font-weight: 700;
    color: #94a3b8;
}

/* 逸失利益ブロック */
.opportunity-cost {
    margin-top: 16px;
    padding: 12px;
    background: rgba(0,0,0,0.5);
    border-radius: 8px;
    text-align: left;
    display: none; /* デフォは非表示 (JSで手数料発生時のみBlock) */
    border-left: 4px solid #f43f5e;
    animation: fade-in 0.5s forwards;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.opp-title {
    font-size: 0.8rem;
    color: #cbd5e1;
    margin-bottom: 6px;
    font-weight: 700;
}
.opp-text {
    font-size: 0.95rem;
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
}
