/* Main Content Layout */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
    /* 조절된 자연스러운 간격 */
}

/* Dashboard */
.dashboard-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 16px;
    z-index: 100;
    overflow: hidden;
    overflow-anchor: none;
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1), gap 0.3s cubic-bezier(0.4, 0, 0.2, 1), top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-card.compact {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    gap: 8px;
    top: 8px;
    flex-wrap: nowrap;
}

.dashboard-card.compact .dashboard-header {
    margin: 0;
    width: auto;
    flex-shrink: 0;
}

.dashboard-card.compact .dashboard-header h2 {
    display: none;
}

.dashboard-card.compact .main-result {
    flex: 1;
    gap: 4px;
    padding-left: 4px;
    white-space: nowrap;
    justify-content: flex-end;
}

.dashboard-card.compact .main-result .amount {
    font-size: clamp(20px, 5vw, 26px);
}

.dashboard-card.compact .main-result .currency,
.dashboard-card.compact .main-result .unit {
    font-size: clamp(12px, 3.5vw, 14px);
}

.dashboard-card.compact .scenarios-container,
.dashboard-card.compact::before {
    display: none !important;
}

.dashboard-card.compact /* Plan B Reply Style */
.plan-b-reply-container {
    margin-top: 4px;
    margin-left: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--plan-b-bg);
    border: 1px solid var(--plan-b-border);
    position: relative;
}

/* L curver connector */
.plan-b-reply-container::before {
    content: '';
    position: absolute;
    top: -24px;
    left: -14px;
    width: 14px;
    height: 50px;
    border-left: 2px solid var(--plan-b-accent);
    border-bottom: 2px solid var(--plan-b-accent);
    border-bottom-left-radius: 8px;
    opacity: 0.5;
    pointer-events: none;
}

.plan-b-label-text {
    color: var(--plan-b-accent);
    font-weight: 500;
}


/* Adjust input within Plan B module */
.plan-b-reply-container .number-input-wrap input {
    background: var(--plan-b-input-bg);
    border-color: var(--plan-b-border);
}


.main-result {
    display: flex;
    align-items: baseline;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.main-result .currency,
.main-result .unit {
    font-size: 20px;
    color: var(--text-secondary);
    font-weight: 500;
}

.main-result .amount {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -1px;
}

.sub-results {
    position: relative;
    z-index: 1;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.light-theme .result-item {
    background: rgba(255, 255, 255, 0.5);
}

.result-item .label {
    font-size: 14px;
    color: var(--text-secondary);
}

.result-item .value {
    font-size: 16px;
    font-weight: 600;
}

.result-item .highlight {
    color: var(--text-accent);
}

/* Scenarios Container for Side-by-Side Comparison */
.scenarios-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-top: 8px;
}

.scenarios-container.compare-active {
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
}

.scenario-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Make result items compact in compare mode */
.scenarios-container.compare-active .result-item {
    padding: 10px 12px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    height: 64px;
}

.scenarios-container.compare-active .result-item .label {
    font-size: 11px;
}

.scenarios-container.compare-active .result-item .value {
    font-size: 18px;
}

.scenarios-container.compare-active .progress-labels {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.scenario-divider {
    display: none;
    position: absolute;
    left: -6px;
    top: 10%;
    width: 1px;
    height: 80%;
    background: var(--border-glass);
}

.scenarios-container.compare-active .scenario-divider {
    display: block;
}

/* Progress Bar */
.progress-container {
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.light-theme .progress-bar {
    background: rgba(0, 0, 0, 0.15);
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Milestones Timeline */
.milestone-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.milestone-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 4px solid var(--text-accent);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, background 0.2s;
}

.light-theme .milestone-item {
    background: rgba(0, 0, 0, 0.02);
}

.milestone-item:hover {
    transform: translateY(-2px);
    background: rgba(56, 189, 248, 0.1);
}

.light-theme .milestone-item:hover {
    background: rgba(2, 132, 199, 0.08);
}

.milestone-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.light-theme .milestone-icon {
    background: rgba(0, 0, 0, 0.05);
}

.milestone-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.milestone-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.milestone-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.milestone-target {
    border-left-color: #a855f7;
    background: rgba(168, 85, 247, 0.05);
}

.light-theme .milestone-target {
    background: rgba(168, 85, 247, 0.05);
}

/* Inputs */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 500;
    gap: 12px;
}

.input-group label>span:first-child {
    white-space: nowrap;
}

.input-group label .value-display {
    color: var(--text-accent);
    font-weight: 600;
    background: rgba(56, 189, 248, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 14px;
}

/* Custom Range Slider */
.styled-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
    border: 1px solid var(--border-glass);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.light-theme .styled-slider {
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 2px solid var(--text-accent);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    transition: transform 0.1s;
}

.styled-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

/* Dual Range Slider Styles */
.dual-slider-container {
    position: relative;
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
}

.dual-range-input {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    width: 100%;
    background: transparent !important;
    pointer-events: none;
    /* Let clicks pass through track */
    border: none !important;
    box-shadow: none !important;
    margin: 0;
    padding: 0;
}

.dual-range-input::-webkit-slider-thumb {
    pointer-events: auto;
    /* Enable clicks on thumb */
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 2px solid var(--text-accent);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
    position: relative;
    z-index: 10;
}

.dual-range-input#target-age::-webkit-slider-thumb {
    border: 2px solid var(--plan-b-accent);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

/* Number Inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type=number],
input[type=text][inputmode="numeric"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.number-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.number-input-wrap input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 12px 48px 12px 16px;
    border-radius: var(--radius-md);
    font-size: 18px;
    font-weight: 500;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    appearance: none;
}

.number-input-wrap input:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.number-input-wrap .unit-suffix {
    position: absolute;
    right: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 16px;
}

/* Settings Groups Layout */
.settings-group {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-glass);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-glass);
    letter-spacing: -0.2px;
}

/* Settings Groups Layout */
.settings-group {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: var(--shadow-glass);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-glass);
    letter-spacing: -0.2px;
}

/* Compare Toggle Switch Active Color */
input#compare-mode-toggle:checked+.slider {
    background: linear-gradient(135deg, #a855f7, #d946ef) !important;
}

/* Active Toggle Handle Setup */
.switch .slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input#compare-mode-toggle:checked+.slider::before {
    transform: translateX(22px);
}

/* ============================
   Help Overlay UI
   ============================ */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.help-content {
    width: 90%;
    max-width: 400px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 12px;
}

.help-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-help-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
}

.close-help-btn:hover {
    color: #ef4444;
}

.help-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.help-body b {
    color: var(--text-primary);
}

.help-start-btn {
    margin-top: 8px;
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s;
}

.help-start-btn:active {
    transform: scale(0.98);
}

/* ============================
   Plan A vs Plan B Distinction
   ============================ */
.input-group.plan-a-highlight {
    background: var(--plan-a-bg);
    border: 1px solid var(--plan-a-border);
    border-left: 4px solid var(--text-accent);
    /* A distinct line for Plan A */
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-left: -8px;
    margin-right: -8px;
    width: calc(100% + 16px);
    transition: background 0.3s, border 0.3s, border-left 0.3s;
}

.input-group.plan-a-highlight label {
    margin-bottom: 8px;
}

/* Reset inner small groups to handle padding properly */
.settings-group.compare-active>.input-group:not(.plan-b-input) {
    background: var(--plan-a-bg);
    border: 1px solid var(--plan-a-border);
    border-left: 4px solid var(--text-accent);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-left: -8px;
    margin-right: -8px;
    width: calc(100% + 16px);
}

/* --- Guide Quest Styles --- */
.guide-quest-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.guide-spotlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.8);
    border: 2px solid var(--text-accent);
    border-radius: 12px;
    z-index: 10001;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.8), 0 0 20px var(--text-accent);
}

.guide-dialog {
    position: fixed;
    z-index: 10002;
    width: 340px;
    max-width: 90vw;
    pointer-events: auto;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(0);
    padding: 20px;
}

.guide-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.guide-badge {
    background: var(--text-accent);
    color: #000;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.guide-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.close-guide-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.guide-body p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin: 0;
}

.guide-footer {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 8px;
}

.guide-progress {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.guide-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--text-accent);
    cursor: pointer;
}

.guide-checkbox-label {
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.guide-nav-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-glass);
}

.guide-nav-btn.prev {
    background: transparent;
    color: var(--text-primary);
}

.guide-nav-btn.next {
    background: var(--accent-gradient);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.guide-nav-btn:active {
    transform: scale(0.95);
}

/* Tooltip Arrow */
.guide-dialog::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--bg-card);
    transform: rotate(45deg);
    z-index: -1;
    border: 1px solid var(--border-glass);
    display: none;
    /* Dynamic positioning logic will handle arrow if needed, but keeping it simple for now */
}

@media (max-width: 480px) {
    .guide-dialog {
        width: 300px;
    }
}

/* Mobile UI Refinement */
@media (max-width: 480px) {
    .guide-dialog {
        width: 320px;
        max-width: 95vw;
        padding: 16px;
    }

    .guide-nav-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .guide-checkbox-label {
        font-size: 11px;
    }

    .guide-actions {
        gap: 4px;
    }

    .guide-header h2 {
        font-size: 16px;
    }
}

