/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', AppleSDGothicNeo-Regular, 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    background: white;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

.phone-frame {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    position: relative;
}

/* ===== App Bar ===== */
.app-bar {
    height: calc(44px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)));
    padding-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
    background: #f8f9fa;
    color: #4A3660;
    display: flex;
    align-items: center;
    padding-left: 16px;
    padding-right: 16px;
    gap: 10px;
}

.app-bar-title {
    font-size: 16px;
    font-weight: 700;
    color: #6C5CE7;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.back-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0) saturate(100%) invert(33%) sepia(60%) saturate(2000%) hue-rotate(230deg) brightness(85%);
}

/* ===== Content Area ===== */
.content {
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

.card-title-row {
    font-size: 15px;
    font-weight: 700;
    color: #4A3660;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title-row img { width: 20px; height: 20px; }

/* ===== Buttons ===== */
.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #6C5CE7 0%, #A78BFA 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108,92,231,0.3);
    transition: opacity 0.2s;
}

.btn-primary:active { opacity: 0.85; transform: scale(0.98); }

/* ===== Toggle Group ===== */
.toggle-group { display: flex; gap: 10px; }

.toggle-btn {
    flex: 1;
    padding: 11px;
    border: 2px solid #E8E0F5;
    border-radius: 12px;
    background: #FDFBFF;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #8B7EC8;
    text-align: center;
    transition: all 0.2s;
}

.toggle-btn.active {
    border-color: #6C5CE7;
    background: #F0EBFF;
    color: #6C5CE7;
}

/* ===== Form Fields ===== */
.form-row { margin-bottom: 14px; }

.form-row label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #718096;
    margin-bottom: 6px;
}

.form-row input,
.form-row select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #E8E0F5;
    border-radius: 12px;
    font-size: 15px;
    color: #2d3748;
    background: #FDFBFF;
    outline: none;
    transition: border-color 0.2s;
}

.form-row input:focus,
.form-row select:focus { border-color: #A78BFA; }

.form-row input::placeholder { color: #C4B5E3; }

/* Field style (profile/naming/match) */
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: #4A3660;
    margin-bottom: 8px;
    display: block;
}

.field-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #E8E0F5;
    border-radius: 12px;
    font-size: 15px;
    color: #2d3748;
    background: #FDFBFF;
    outline: none;
    transition: border-color 0.2s;
}

.field-input:focus { border-color: #A78BFA; }
.field-input::placeholder { color: #C4B5E3; }
.field-input:disabled { opacity: 0.45; }

/* ===== Loading ===== */
.loading { text-align: center; padding: 60px 20px; display: none; }
.loading.show { display: block; }

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E8E0F5;
    border-top-color: #6C5CE7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 14px; color: #8B7EC8; }

/* ===== Error ===== */
.error-msg {
    text-align: center;
    padding: 40px 20px;
    color: #e53e3e;
    font-size: 14px;
    display: none;
}

.error-msg.show { display: block; }

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(20px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    z-index: 50;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #cbd5e0;
    font-size: 11px;
    cursor: pointer;
    transition: color 0.2s;
    background: none;
    border: none;
    padding: 0;
}

.nav-item.active { color: #6C5CE7; }

.nav-item img { width: 24px; height: 24px; opacity: 0.4; }
.nav-item span { font-size: 10px; color: #a0aec0; font-weight: 600; }
.nav-item.active img { opacity: 1; filter: brightness(0) saturate(100%) invert(33%) sepia(60%) saturate(2000%) hue-rotate(230deg) brightness(85%); }
.nav-item.active span { color: #6C5CE7; }

.nav-icon {
    width: 24px;
    height: 24px;
}

/* ===== Detail / Advice ===== */
.detail-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

.advice-box {
    margin-top: 14px;
    padding: 14px;
    background: #F5F0FF;
    border-radius: 12px;
    border-left: 4px solid #6C5CE7;
}

/* ===== Score Card (Purple Gradient) ===== */
.score-card {
    background: linear-gradient(135deg, #6C5CE7 0%, #A78BFA 100%);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    color: white;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

/* ===== Utility ===== */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
