:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f3f4f6;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 16px;
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
}

.container {
    background-color: var(--white);
    width: 100%;
    max-width: 480px;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

.badge {
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

h1 {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 10px;
    color: #111827;
}

.subtitle {
    font-size: 15px;
    color: var(--text-light);
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease-out;
}

.menu-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.menu-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    background-color: #f8fafc;
    transform: translateY(-2px);
}

.menu-card .icon-box {
    font-size: 28px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.menu-card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #374151;
}

.menu-card p {
    font-size: 12px;
    color: #9ca3af;
}

/* Calculator Section */
.back-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 15px;
    padding: 0;
}

.back-btn:hover {
    color: var(--text-color);
}

#calcTitle {
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* Forms */
.input-group {
    margin-bottom: 24px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #374151;
}

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

.input-wrapper input {
    width: 100%;
    padding: 14px 16px;
    /* 텍스트 입력 시 편안한 패딩 */
    padding-right: 50px;
    /* 단위 공간 확보 */
    font-size: 18px;
    /* 입력 글씨 크기 키움 */
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
    font-weight: 500;
    appearance: none;
    /* 브라우저 기본 스타일 제거 */
}

/* input type number의 스피너 제거 (크롬 등) */
.input-wrapper input::-webkit-outer-spin-button,
.input-wrapper input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-wrapper input:focus {
    border-color: var(--primary-color);
}

.unit {
    position: absolute;
    right: 16px;
    color: var(--text-light);
    font-weight: 500;
    font-size: 15px;
}

.helper-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
}

/* Radio Buttons for Gender */
.radio-wrapper {
    display: flex;
    gap: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 6px;
    font-size: 15px;
}

.radio-label input {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}


.cta-button {
    width: 100%;
    background-color: #111827;
    /* 더 진한 검정 계열 */
    color: white;
    border: none;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
    background-color: #000000;
    transform: translateY(-1px);
}

.cta-button:active {
    transform: translateY(1px);
}

/* Result Section */
.result-container {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px dashed #e5e7eb;
    animation: slideUp 0.5s ease-out;
}

.result-content {
    text-align: center;
}

.user-info {
    font-size: 16px;
    color: #4b5563;
    margin-bottom: 10px;
}

.percentile-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    padding: 20px;
    border-radius: 16px;
    display: inline-block;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.5);
    min-width: 200px;
}

.percentile-box .label {
    display: block;
    font-size: 14px;
    color: var(--primary-dark);
    margin-bottom: 4px;
    font-weight: 600;
}

.percentile-box .number {
    font-size: 48px;
    font-weight: 900;
    color: var(--primary-dark);
    line-height: 1;
}

.percentile-box .percent {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Visualization Bar */
.chart-container {
    margin-bottom: 30px;
}

.bar-bg {
    width: 100%;
    height: 12px;
    background-color: #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa 0%, #2563eb 100%);
    width: 0%;
    transition: width 1.5s cubic-bezier(0.22, 1, 0.36, 1);
    border-radius: 6px;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #9ca3af;
}

.comparison-text {
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
}

/* Statistics Table */
.detail-stat {
    background-color: #f9fafb;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row .value {
    font-weight: 700;
    color: #111827;
}

/* Result Actions */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.reset-button {
    flex: 1;
    background: white;
    border: 1px solid #d1d5db;
    color: #4b5563;
    padding: 12px 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.reset-button:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.kakao-button {
    flex: 1;
    background: #FFE812;
    /* Kakao Yellow */
    border: none;
    color: #381E1F;
    padding: 12px 10px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.kakao-button:hover {
    background-color: #f7e000;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    margin-top: auto;
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.6;
    border-top: 1px solid #f3f4f6;
    padding-top: 20px;
}