:root {
    --primary-color: #fbbf24; /* Gold for wealth */
    --primary-dark: #d97706;
    --principal-color: #3b82f6; /* Blue for reliable principal */
    --card-bg: rgba(15, 23, 42, 0.85); /* Navy background */
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-gradient-start: #0f172a; /* Deep Navy */
    --bg-gradient-end: #064e3b;  /* Deep Emerald Forest */
}

* {
    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 1s 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), inset 0 1px 0 rgba(255,255,255,0.1);
}

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

header h1 {
    font-size: 1.6rem;
    font-weight: 900;
    background: linear-gradient(90deg, #fcd34d, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.05em;
    text-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* スライダー */
.slider-section {
    margin-bottom: 32px;
}

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

.highlight-value {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    transition: color 0.3s ease;
}

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

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 15px rgba(245, 158, 11, 0.6), inset 0 0 5px rgba(0,0,0,0.2);
    border: 4px solid var(--primary-color);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.warning-badge {
    margin-top: 12px;
    font-size: 0.8rem;
    color: #cbd5e1;
    background: rgba(255,255,255,0.05);
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
}

/* ビジュアルセクション */
.visual-section {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    padding: 24px 0;
    border-top: 1px dashed rgba(255,255,255,0.1);
    border-bottom: 1px dashed rgba(255,255,255,0.1);
}

/* ドーナツチャート */
.chart-container {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.donut-chart {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    /* javascript で更新する --interest-deg を用いた円グラフ */
    background: conic-gradient(
        var(--primary-color) 0deg, 
        var(--primary-color) var(--interest-deg), 
        var(--principal-color) var(--interest-deg), 
        var(--principal-color) 360deg
    );
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0,0,0,0.6), inset 0 0 10px rgba(0,0,0,0.5);
    /* GSAP等がなくてもJS側の中間値計算でアニメーション風にする */
}

/* ドーナツの穴 */
.donut-hole {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.5);
}

.hole-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}

.hole-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.hole-unit {
    font-size: 0.8rem;
    font-weight: 700;
}

/* 統計パネル */
.stats-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 12px 16px;
    border-left: 4px solid transparent;
}

.stat-box.principal {
    border-left-color: var(--principal-color);
}

.stat-box.profit {
    border-left-color: var(--primary-color);
    background: rgba(245, 158, 11, 0.1);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 700;
}

.stat-box.profit .stat-label {
    color: #fcd34d;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.stat-value.gold-glow {
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.stat-operator {
    text-align: center;
    font-weight: 900;
    color: var(--text-muted);
    opacity: 0.5;
}

/* Results */
.result-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-card.primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    border: 1px solid #3b82f6;
    color: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(30, 58, 138, 0.5);
    position: relative;
    overflow: hidden;
}

/* シャインエフェクト */
.result-card.primary::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
    transform: rotate(30deg);
    animation: shine 4s infinite linear;
    pointer-events: none;
}

@keyframes shine {
    0% { transform: translateX(-100%) rotate(30deg); }
    30% { transform: translateX(100%) rotate(30deg); }
    100% { transform: translateX(100%) rotate(30deg); }
}

.result-card.primary h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #bfdbfe;
}

.amount {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 8px;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.unit {
    font-size: 1.2rem;
    font-weight: 700;
    margin-left: 4px;
}

.sub-amount {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fde68a; /* Soft gold */
}

/* メタファーカード */
.metaphor-card {
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
}

.metaphor-icon {
    font-size: 2.5rem;
    line-height: 1;
    text-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.metaphor-text {
    flex: 1;
    text-align: left;
}

.metaphor-text h3 {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}

.metaphor-text p {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.4;
}

@media (max-width: 480px) {
    .visual-section {
        flex-direction: column;
        gap: 16px;
    }
    .chart-container {
        margin-bottom: 12px;
    }
    .stats-panel {
        width: 100%;
    }
}
