* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #2563eb;
    --secondary-blue: #3b82f6;
    --light-blue: #60a5fa;
    --purple: #8b5cf6;
    --light-purple: #a78bfa;
    --dark-blue: #1e40af;
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #3b82f6 0%, #a78bfa 100%);
    
    --text-color: #1e293b;
    --text-light: #64748b;
    --bg-color: #ffffff;
    --bg-light: #f8fafc;
    --bg-dark: #0f172a;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1), 0 2px 4px -1px rgba(37, 99, 235, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(37, 99, 235, 0.1), 0 10px 10px -5px rgba(37, 99, 235, 0.04);
    
    --profit-color: #10b981;
    --loss-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Noto Sans KR', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background: var(--bg-light);
    min-height: 100vh;
    padding: 17px;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* 헤더 */
.app-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.326rem 2rem;
    text-align: center;
}

.app-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.306rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-subtitle {
    font-size: 1.17rem;
    opacity: 0.95;
    margin-bottom: 0.612rem;
    font-weight: 600;
}

.app-description {
    font-size: 0.81rem;
    opacity: 0.9;
    line-height: 1.62;
    margin-top: 0.918rem;
}

.app-description strong {
    font-weight: 600;
    text-decoration: underline;
}

/* 주요 기능 섹션 */
.features-section {
    padding: 0.85rem;
    background: white;
    border-bottom: 1px solid var(--border-color);
}

.feature-item {
    margin-bottom: 0.425rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.feature-item:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow);
}

.feature-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6375rem;
    background: var(--bg-light);
    border: none;
    cursor: pointer;
    text-align: left;
    transition: all 0.3s ease;
}

.feature-toggle:hover {
    background: rgba(37, 99, 235, 0.05);
}

.feature-toggle.active {
    background: rgba(37, 99, 235, 0.1);
}

.features-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    border: none;
}

.feature-icon {
    font-size: 0.75rem;
    color: var(--primary-blue);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.feature-content {
    display: none;
    padding: 0 0.6375rem 0.6375rem 0.6375rem;
    background: white;
    animation: slideDown 0.3s ease;
}

.feature-content.active {
    display: block;
}

.features-subtitle {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-top: 0.6375rem;
    margin-bottom: 0.31875rem;
}

.features-subtitle:first-child {
    margin-top: 0;
}

.features-description {
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.425rem;
    margin-top: 0.425rem;
}

.features-text {
    font-size: 0.7rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.425rem;
}

/* 자산 선택 탭 */
.asset-selector {
    display: flex;
    gap: 0.425rem;
    padding: 1.1475rem 1.275rem;
    background: var(--bg-color);
    margin-bottom: 0;
}

.asset-tab {
    flex: 1;
    padding: 1.08rem 0.9rem;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 10px;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.asset-tab:hover {
    border-color: var(--primary-blue);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.asset-tab.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow);
}

/* 입력 영역 */
.input-section {
    padding: 0.765rem 1.53rem 1.53rem 1.53rem;
}

.input-group {
    margin-bottom: 1.1475rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.3825rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.95rem;
}

.input-group input {
    width: 100%;
    padding: 0.765rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: var(--bg-light);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

.advanced-toggle {
    margin: 1.275rem 0;
}

.toggle-btn {
    width: 100%;
    padding: 0.68rem;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    border-color: var(--primary-blue);
    background: white;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.toggle-btn.active .toggle-icon {
    transform: rotate(180deg);
}

.advanced-settings {
    margin-top: 0;
    margin-bottom: 0.382rem;
    padding: 0.382rem 1.1475rem;
    background: var(--bg-light);
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.advanced-settings .input-group {
    margin-bottom: 1.03275rem;
}

.advanced-settings .input-group label {
    margin-bottom: 0.34425rem;
}

.advanced-settings .input-group input {
    padding: 0.6885rem;
}

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

.calculate-btn {
    width: 100%;
    padding: 1.326rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.54rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    margin-top: 0.85rem;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* 결과 영역 */
.results-section {
    padding: 1.7rem;
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: white;
    border-radius: 15px;
    padding: 1.7rem;
    margin-bottom: 1.275rem;
    box-shadow: var(--shadow);
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.275rem;
    color: var(--text-color);
    padding-bottom: 0.85rem;
    border-bottom: 2px solid var(--border-color);
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.275rem;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 0.425rem;
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.result-value.profit {
    color: var(--profit-color);
}

.result-value.loss {
    color: var(--loss-color);
}

/* 본전 기준 해석 카드 */
.break-even-card {
    border: 3px solid var(--primary-blue);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.break-even-content {
    text-align: center;
}

.break-even-status {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.85rem;
    padding: 0.85rem;
    border-radius: 10px;
}

.break-even-status.loss {
    background: rgba(239, 68, 68, 0.1);
    color: var(--loss-color);
}

.break-even-status.profit {
    background: rgba(16, 185, 129, 0.1);
    color: var(--profit-color);
}

.break-even-status.neutral {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.break-even-message {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.8;
    margin-top: 0.85rem;
    color: var(--text-color);
}

.break-even-details {
    margin-top: 1.275rem;
    padding-top: 1.275rem;
    border-top: 1px solid var(--border-color);
}

.break-even-details p {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0.425rem;
}

.break-even-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-top: 0.425rem;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .app-title {
        font-size: 2rem;
    }

    .app-subtitle {
        font-size: 1.1rem;
    }

    .app-description {
        font-size: 0.9rem;
    }

    .features-section {
        padding: 0.75rem;
    }

    .features-title {
        font-size: 0.8rem;
    }

    .features-subtitle {
        font-size: 0.7rem;
    }

    .features-description,
    .features-text {
        font-size: 0.65rem;
    }

    .asset-selector {
        flex-direction: column;
        gap: 0.5rem;
    }

    .input-section,
    .results-section {
        padding: 1.5rem;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .break-even-message {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 1.8rem;
    }

    .app-header {
        padding: 2rem 1.5rem;
    }

    .input-section,
    .results-section {
        padding: 1rem;
    }

    .result-card {
        padding: 1.5rem;
    }
}
