:root {
    --primary: #d4a846;
    --primary-dark: #b8922e;
    --secondary: #8b7355;
    --success: #4ade80;
    --bg-body: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    --bg-card: linear-gradient(145deg, #2d2d44 0%, #1f1f2e 100%);
    --bg-card-solid: #252538;
    --text-main: #ffffff;
    --text-muted: #d4a846;
    --border: #d4a846;
    --gold: #d4a846;
    --gold-light: #f0d78c;
}

/* Base Setup */
html { font-size: 100%; box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; margin: 0; padding: 0; }
body { background: var(--bg-body); background-attachment: fixed; color: var(--text-main); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; padding-bottom: 10rem; min-height: 100vh; }

/* Fluid Header */
header { width: 100%; padding: 2rem 5%; background: var(--bg-card); border-bottom: 2px solid var(--gold); text-align: center; display: flex; flex-direction: column; align-items: center; }
header h1 { font-size: 7rem; margin-bottom: 1rem; color: var(--gold); text-shadow: 0 0 15px rgba(212, 168, 70, 0.4); letter-spacing: 0.25rem; font-weight: 700; font-family: 'Libre Baskeville', serif; }
.subheader-container { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2rem; width: 100%; max-width: 1200px; margin-inline: auto; }
.subheader-container h2 { font-size: 1.25rem; font-weight: 400; color: var(--gold-light); flex: 1 1 auto; min-width: 200px; text-align: center; }
.ad-container { flex: 0 0 160px; min-height: 90px; background: linear-gradient(145deg, #3d3d54 0%, #2a2a3e 100%); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: var(--gold); border: 1px solid var(--gold); border-radius: 0.5rem; overflow: hidden; }
.ad-container ins { display: block !important; width: 160px; height: 90px; }

/* Fluid Main Container */
.container { width: 90%; max-width: 800px; margin-inline: auto; margin-top: 2rem; margin-bottom: 2rem; display: flex; flex-direction: column; align-items: center; }

/* Cards */
.card { background: var(--bg-card); width: 100%; padding: 3%; border-radius: 0.75rem; box-shadow: 0 4px 20px rgba(0,0,0,0.4); margin-bottom: 2rem; border: 1px solid var(--gold); }
.card h3 { font-size: 1.2rem; margin-bottom: 1.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--gold); color: var(--gold); }
.privacy-notice { text-align: center; color: var(--gold-light); font-size: 0.9rem; margin-bottom: 1rem; font-style: italic; }
.note { font-size: 0.9rem; color: var(--gold-light); margin-bottom: 0.5rem; }

/* Inputs & Sliders */
.input-group, .slider-group { width: 100%; margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-size: 1rem; font-weight: 500; color: var(--text-main); }
input, select { width: 100%; padding: 0.75rem; font-size: 1rem; border: 1px solid var(--gold); border-radius: 0.375rem; background: #1a1a2e; color: var(--text-main); }
input:focus, select:focus { outline: none; border-color: var(--gold-light); box-shadow: 0 0 8px rgba(212, 168, 70, 0.3); }

.slider-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.slider-row input[type="range"] { flex: 1 1 70%; cursor: pointer; accent-color: var(--gold); }
.slider-row input[type="number"] { flex: 1 1 20%; min-width: 80px; padding: 0.5rem; }

/* Drag & Drop */
.drop-zone { width: 100%; border: 0.15rem dashed var(--gold); padding: 4rem 2rem; text-align: center; border-radius: 0.5rem; color: var(--gold-light); cursor: pointer; transition: background 0.2s; background: rgba(212, 168, 70, 0.05); }
.drop-zone:hover { background: rgba(212, 168, 70, 0.15); }

/* Time Preference Buttons */
.time-btn-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.time-btn { flex: 1 0 14%; min-width: 90px; padding: 0.75rem 0.5rem; font-size: 0.9rem; font-weight: 600; background: transparent; border: 2px solid var(--gold); color: var(--gold); border-radius: 0.5rem; cursor: pointer; transition: all 0.2s ease; margin-bottom: 0; }
.time-btn:hover { background: rgba(212, 168, 70, 0.2); }
.time-btn.selected { background: var(--gold); color: #1a1a2e; box-shadow: 0 0 15px rgba(212, 168, 70, 0.4); }

/* Checkbox Grid */
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.checkbox-grid label { flex: 1 0 14%; min-width: 100px; display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; background: rgba(212, 168, 70, 0.1); padding: 0.5rem; border-radius: 0.25rem; border: 1px solid var(--gold); color: var(--text-main); }

/* Buttons */
button { width: 100%; padding: 1rem; font-size: 1rem; font-weight: 600; border-radius: 0.375rem; border: none; cursor: pointer; margin-bottom: 0.75rem; transition: all 0.2s ease; }
.btn-primary { background: var(--gold); color: #1a1a2e; }
.btn-primary:hover { background: var(--gold-light); box-shadow: 0 0 15px rgba(212, 168, 70, 0.4); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #9d8566; }
.btn-success { background: var(--success); color: #1a1a2e; }
.btn-outline { background: transparent; border: 2px solid var(--gold); color: var(--gold); }
.btn-outline:hover { background: rgba(212, 168, 70, 0.2); }
.action-row { display: flex; flex-wrap: wrap; gap: 1rem; width: 100%; justify-content: center; margin-top: 1rem; }
.action-row button { flex: 1 1 45%; min-width: 250px; }

/* Dynamic Items */
.dynamic-item { background: linear-gradient(145deg, #2a2a3e 0%, #1e1e2e 100%); border-left: 0.3rem solid var(--gold); padding: 0; margin-bottom: 1rem; border-radius: 0 0.5rem 0.5rem 0; width: 100%; overflow: hidden; }
.item-header { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; cursor: pointer; background: linear-gradient(90deg, rgba(212, 168, 70, 0.2) 0%, rgba(212, 168, 70, 0.05) 100%); user-select: none; }
.item-header:hover { background: linear-gradient(90deg, rgba(212, 168, 70, 0.3) 0%, rgba(212, 168, 70, 0.1) 100%); }
.item-toggle { font-weight: bold; font-size: 1.2rem; width: 1rem; text-align: center; color: var(--gold); }
.item-title { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.item-content { padding: 1rem; }
.remove-btn { color: #ff6b6b; background: none; border: none; padding: 0.25rem 0.5rem; font-size: 0.8rem; text-decoration: underline; width: auto; margin: 0; }
.highlight-section { width: 100%; text-align: center; padding: 2rem; background: linear-gradient(145deg, rgba(212, 168, 70, 0.15) 0%, rgba(212, 168, 70, 0.05) 100%); border: 1px solid var(--gold); border-radius: 0.75rem; margin-bottom: 2rem; }
.highlight-section h2 { font-size: 2rem; color: var(--gold); }

/* Final Section Grid */
.final-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; width: 100%; }
.final-box { padding: 1rem; border-radius: 8px; border: 1px solid; }
.cash-box { background: linear-gradient(145deg, rgba(74, 222, 128, 0.15) 0%, rgba(74, 222, 128, 0.05) 100%); border-color: #4ade80; }
.asset-box { background: linear-gradient(145deg, rgba(96, 165, 250, 0.15) 0%, rgba(96, 165, 250, 0.05) 100%); border-color: #60a5fa; }
.worth-box { background: linear-gradient(145deg, rgba(192, 132, 252, 0.15) 0%, rgba(192, 132, 252, 0.05) 100%); border-color: #c084fc; }
.box-label { font-size: 0.9rem; font-weight: bold; }
.box-value { font-size: 1.5rem; font-weight: 800; margin: 0.5rem 0; word-break: break-all; }
.box-sub { font-size: 0.8rem; color: var(--gold-light); }
.text-green { color: #4ade80; } .text-green-dark { color: #22c55e; }
.text-blue { color: #60a5fa; } .text-blue-dark { color: #3b82f6; }
.text-purple { color: #c084fc; } .text-purple-dark { color: #a855f7; }

/* Benchmarking */
.benchmark-box { background: var(--bg-card); border: 2px solid var(--gold); padding: 1.5rem; border-radius: 0.75rem; width: 100%; margin-top: 2rem; }
.benchmark-box h3 { color: var(--gold); margin-bottom: 1rem; text-align: center; }
.ranking-grid { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: center; }
.ranking-section { flex: 1 1 45%; min-width: 200px; background: rgba(212, 168, 70, 0.05); padding: 1rem; border-radius: 0.5rem; border: 1px solid rgba(212, 168, 70, 0.2); }
.ranking-section h4 { color: var(--gold); font-size: 0.95rem; margin-bottom: 0.75rem; text-align: center; border-bottom: 1px solid var(--gold); padding-bottom: 0.5rem; }
.ranking-row { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; }
.ranking-label { color: var(--text-main); font-size: 0.85rem; }
.ranking-value { color: var(--gold); font-weight: bold; font-size: 0.9rem; }
#reality-context-display { font-size: 0.9rem; color: var(--gold-light); font-style: italic; margin-top: 0.5rem; text-align: center; }

/* Detailed Worth Breakdown */
.worth-breakdown-grid { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.worth-item { flex: 1 1 30%; min-width: 200px; text-align: center; padding: 1rem; background: rgba(168, 85, 247, 0.1); border-radius: 0.5rem; border: 1px solid rgba(168, 85, 247, 0.3); }
.worth-label { display: block; font-size: 0.9rem; color: var(--text-main); margin-bottom: 0.5rem; }
.worth-value { display: block; font-size: 1.25rem; font-weight: bold; color: var(--gold); }
.worth-note { display: block; font-size: 0.75rem; color: var(--gold-light); margin-top: 0.25rem; }

.percentile-context { font-size: 0.95rem; color: var(--text-main); line-height: 1.6; }
.percentile-highlight { color: var(--gold); font-weight: bold; }

.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.tier-item { text-align: center; padding: 0.75rem; background: rgba(212, 168, 70, 0.08); border-radius: 0.5rem; border: 1px solid rgba(212, 168, 70, 0.2); }
.tier-label { display: block; font-size: 0.75rem; color: var(--gold-light); margin-bottom: 0.25rem; }
.tier-value { display: block; font-size: 0.9rem; font-weight: bold; color: var(--gold); }

/* Toggle Switch (Pill Design) */
.toggle-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.toggle-group { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.toggle-group span { font-size: 0.9rem; color: var(--text-main); }

.switch, .toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input, .toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider, .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #444; transition: .3s; border-radius: 24px; }
.slider:before, .toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
input:checked + .slider, input:checked + .toggle-slider { background-color: var(--gold); }
input:checked + .slider:before, input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Frequency section styling */
.frequency-section { margin-left: 1rem; padding-left: 1rem; border-left: 2px solid var(--gold); margin-bottom: 1rem; }
.custom-frequency-input { margin-top: 0.5rem; }

/* Sticky Video Ad */
#video-ad-container { position: fixed; bottom: 2%; left: 2%; width: 25%; min-width: 280px; aspect-ratio: 16 / 9; background: #0a0a12; border: 2px solid var(--gold); box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 1000; display: flex; flex-direction: column; border-radius: 0.5rem; overflow: hidden; }
.video-header { background: linear-gradient(90deg, #2d2d44 0%, #1f1f2e 100%); color: var(--gold); padding: 0.5rem; display: flex; justify-content: space-between; font-size: 0.8rem; }
.video-content { flex-grow: 1; display: flex; align-items: center; justify-content: center; color: var(--gold-light); background: #0a0a12; }
#skip-ad-btn { background: var(--gold); color: #1a1a2e; padding: 0.25rem 0.5rem; border-radius: 0.25rem; width: auto; margin: 0; }
#skip-ad-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #666; color: #999; }

/* Status Stack (Gamification) - Enlarged */
#status-stack-container { position: fixed; bottom: 3%; right: 3%; width: 15%; min-width: 150px; background: var(--bg-card); border: 2px solid var(--gold); border-radius: 1rem; box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 15px rgba(212, 168, 70, 0.2); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.25rem 0.75rem; z-index: 1000; transition: all 0.3s ease; cursor: pointer; }
#status-stack-container:hover { transform: scale(1.05); box-shadow: 0 6px 25px rgba(0,0,0,0.5), 0 0 20px rgba(212, 168, 70, 0.3); }
.status-item { font-size: 3.5rem; line-height: 1.1; transition: all 0.3s; }
#status-label { font-size: 1rem; font-weight: bold; color: var(--gold); margin-top: 10px; text-align: center; text-transform: uppercase; letter-spacing: 1px; }

/* Status Popup */
#status-popup { display: none; position: fixed; bottom: 3%; right: calc(3% + 14%); width: 280px; max-height: 70vh; background: var(--bg-card); border: 2px solid var(--gold); border-radius: 1rem; box-shadow: 0 4px 20px rgba(0,0,0,0.5); z-index: 1001; overflow-y: auto; padding: 1rem; }
#status-popup.visible { display: block; }
#status-popup h4 { color: var(--gold); margin-bottom: 1rem; text-align: center; border-bottom: 1px solid var(--gold); padding-bottom: 0.5rem; }
.status-list-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; border-radius: 0.5rem; margin-bottom: 0.5rem; background: rgba(212, 168, 70, 0.05); }
.status-list-item.current { background: rgba(212, 168, 70, 0.2); border: 1px solid var(--gold); }
.status-list-item .status-emoji { font-size: 1.5rem; }
.status-list-item .status-info { flex: 1; }
.status-list-item .status-name { font-weight: 600; color: var(--text-main); font-size: 0.9rem; }
.status-list-item .status-threshold { font-size: 0.75rem; color: var(--gold-light); }

/* Modal */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.85); overflow-y: auto; }
.modal-content { background: var(--bg-card); margin: 3% auto; padding: 2rem; border-radius: 0.75rem; width: 90%; max-width: 900px; position: relative; display: flex; flex-direction: column; border: 2px solid var(--gold); }
.modal-content h2 { color: var(--gold); margin-bottom: 1.5rem; text-align: center; }
.chart-container { position: relative; flex-grow: 1; width: 100%; min-height: 400px; }
.close-modal { position: absolute; right: 1rem; top: 1rem; font-size: 2rem; font-weight: bold; cursor: pointer; color: var(--gold); line-height: 1; z-index: 10; padding: 0.5rem; }
.close-modal:hover { color: var(--gold-light); }
.modal-nav { display: flex; justify-content: center; gap: 1rem; margin-top: 1.5rem; width: 100%; flex-wrap: wrap; }

/* Receipt Modal */
.receipt-content { max-height: 90vh; }
.receipt-body { flex-grow: 1; overflow-y: auto; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 0.5rem; border: 1px solid var(--gold); }
.receipt-section { margin-bottom: 1.5rem; }
.receipt-section h3 { color: var(--gold); font-size: 1rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--gold); padding-bottom: 0.5rem; }
.receipt-item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px dashed rgba(212, 168, 70, 0.3); }
.receipt-item:last-child { border-bottom: none; }
.receipt-item .label { color: var(--text-main); }
.receipt-item .value { color: var(--gold-light); font-weight: 600; }
.receipt-reality-item { background: rgba(212, 168, 70, 0.08); padding: 1rem; margin-bottom: 0.75rem; border-radius: 0.5rem; border-left: 3px solid var(--gold); }
.receipt-reality-item .reality-statement { font-size: 1rem; margin-bottom: 0.5rem; line-height: 1.5; }
.receipt-reality-item .reality-detail { font-size: 0.85rem; color: var(--gold-light); }
.receipt-reality-combined { background: rgba(168, 85, 247, 0.1); padding: 1rem; margin-top: 1rem; border-radius: 0.5rem; border: 1px solid rgba(168, 85, 247, 0.3); }
.text-gold { color: var(--gold); }
.receipt-total { font-size: 1.2rem; padding: 1rem; background: rgba(212, 168, 70, 0.1); border-radius: 0.5rem; margin-top: 1rem; }

/* Lifestyle Modal */
.lifestyle-content { max-height: 90vh; }
.lifestyle-body { flex-grow: 1; overflow-y: auto; padding: 1rem; }
.lifestyle-period { background: rgba(0,0,0,0.2); border-radius: 0.5rem; border: 1px solid var(--gold); padding: 1rem; margin-bottom: 1rem; }
.lifestyle-period h4 { color: var(--gold); margin-bottom: 1rem; }
.lifestyle-row { display: flex; justify-content: space-between; padding: 0.5rem 0; }
.lifestyle-row .label { color: var(--text-main); }
.lifestyle-row .value { color: var(--gold-light); font-weight: 600; }

/* Animation */
@keyframes pulse { 0% { opacity: 0.8; } 50% { opacity: 1; } 100% { opacity: 0.8; } }
#inflation-readout { animation: pulse 2s infinite; font-style: italic; color: #ff6b6b; }

/* Scrollbar Styling */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-light); }
