:root {
    --primary-color: #10b981; /* Emerald green for money/growth */
    --card-bg: rgba(20, 20, 20, 0.85);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --bg-gradient-start: #291509; /* Coffee brown */
    --bg-gradient-end: #064e3b;  /* Deep green */
}

* {
    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: #000;
    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: 520px;
    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: var(--primary-color);
    margin-bottom: 8px;
    letter-spacing: -0.05em;
    text-shadow: 0 2px 10px rgba(16, 185, 129, 0.4);
    transition: color 0.5s;
}

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

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

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

.highlight-value {
    color: var(--primary-color);
    font-size: 2.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 10px rgba(16, 185, 129, 0.8), inset 0 0 5px rgba(0,0,0,0.2);
    border: 4px solid var(--primary-color);
    transition: transform 0.1s, box-shadow 0.3s;
}

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

.warning-badge {
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.5);
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px dashed rgba(239, 68, 68, 0.4);
}

/* ビジュアルセクション (コーヒー vs 木) */
.visual-section {
    margin-bottom: 24px;
    padding: 20px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.illustration-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.waste-side, .invest-side {
    text-align: center;
    width: 40%;
}

.arrow-icon {
    font-size: 2rem;
    color: var(--text-muted);
    font-weight: 900;
    opacity: 0.5;
}

.emoji-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    text-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.tree-container {
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 8px;
}

.tree-icon {
    transform-origin: bottom center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 0px;
}

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

.side-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #cbd5e1;
}

.side-value.highlight {
    color: var(--primary-color);
    font-size: 1.3rem;
}

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

.result-card.primary {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.9) 0%, rgba(6, 78, 59, 0.9) 100%);
    color: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(5, 150, 105, 0.3);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.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: 0.95rem;
    font-weight: 600;
    color: #fecdd3; /* Reddish to show pain of loss */
}

#profit-only {
    font-weight: 900;
}

/* メタファーカード */
.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) {
    .glass-card { padding: 24px 16px; }
    .amount { font-size: 2.5rem; }
    .emoji-icon { font-size: 2.5rem; }
}
