/* ============================================================================
   account.css — 로그인 / 프로필 페이지 전용
   "Performance Calm" 디자인 토큰 (tokens.css) 사용 — 다크/라이트/시스템 자동 대응
   반응형 4단(xs/sm/md/lg) + TV(xl) 모두 지원
   ============================================================================ */

/* ── 공통 wrapper (헤더·푸터 사이를 채우는 중앙 정렬) ─────────────────── */
.ro-auth-wrap {
    min-height: calc(100vh - 80px); /* 헤더 높이 정도 빼서 중앙 정렬 자연스럽게 */
    background:
        radial-gradient(120% 80% at 100% 0%, rgba(78, 143, 255, 0.10), transparent 60%),
        radial-gradient(80% 80% at 0% 100%, rgba(255, 107, 74, 0.06), transparent 60%),
        var(--ro-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    /* 헤더 높이(80px) + 작은 여유만 — 큰 상단 여백 제거 */
    padding: clamp(24px, 5vh, 60px) 16px clamp(24px, 5vh, 60px);
}

/* ── 로그인 카드 ──────────────────────────────────────────────────────── */
.ro-login-card {
    width: 100%;
    max-width: 440px;
    background: var(--ro-surface);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-2xl);
    box-shadow: var(--ro-shadow-xl);
    padding: clamp(28px, 5vw, 44px) clamp(24px, 4vw, 36px);
    color: var(--ro-text);
}
.ro-login-card__logo {
    display: inline-flex; align-items: center;
    margin-bottom: var(--ro-space-6);
}
.ro-login-card__logo img {
    height: 36px; width: auto;
    display: block;
}
/* 호환용 — 더 이상 사용되지 않음 */
.ro-login-card__brand { display: none; }
.ro-login-card__title {
    font-size: var(--ro-text-2xl);
    font-weight: var(--ro-weight-bold);
    margin: 0 0 6px;
}
.ro-login-card__lede {
    color: var(--ro-text-sub);
    font-size: var(--ro-text-sm);
    margin: 0 0 var(--ro-space-6);
}

.ro-field {
    display: flex; flex-direction: column; gap: 6px;
    margin-bottom: var(--ro-space-4);
}
.ro-field__label {
    font-size: var(--ro-text-sm);
    font-weight: var(--ro-weight-semibold);
    color: var(--ro-text-sub);
}
.ro-field__input {
    width: 100%;
    padding: 12px 14px;
    font-family: inherit;
    font-size: var(--ro-text-base);
    color: var(--ro-text);
    background: var(--ro-surface);
    border: 1.5px solid var(--ro-border);
    border-radius: var(--ro-radius-md);
    transition: border-color var(--ro-dur-fast), box-shadow var(--ro-dur-fast);
    appearance: none;
}
.ro-field__input:focus {
    outline: none;
    border-color: var(--ro-primary-500);
    box-shadow: 0 0 0 4px rgba(78, 143, 255, 0.16);
}
.ro-field__input::placeholder { color: var(--ro-text-muted); }
.ro-field__error {
    font-size: var(--ro-text-xs);
    color: var(--ro-danger-500);
    margin-top: 2px;
}

.ro-checkbox {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: var(--ro-text-sm);
    color: var(--ro-text-sub);
    cursor: pointer;
    user-select: none;
}
.ro-checkbox input { width: 16px; height: 16px; accent-color: var(--ro-primary-500); }

.ro-login-card__error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.20);
    border-radius: var(--ro-radius-md);
    padding: 10px 14px;
    color: var(--ro-danger-500);
    font-size: var(--ro-text-sm);
    margin-bottom: var(--ro-space-4);
}

.ro-login-card__hint {
    margin-top: var(--ro-space-6);
    padding-top: var(--ro-space-4);
    border-top: 1px solid var(--ro-border);
    font-size: var(--ro-text-xs);
    color: var(--ro-text-muted);
    line-height: 1.6;
}
.ro-login-card__hint a { color: var(--ro-primary-600); font-weight: 600; }
.ro-login-card__hint a:hover { text-decoration: underline; }

/* ── 프로필 페이지 ──────────────────────────────────────────────────── */
.ro-profile {
    padding: clamp(28px, 5vh, 56px) 16px clamp(60px, 10vh, 96px);
    max-width: var(--ro-container-lg);
    margin-inline: auto;
    color: var(--ro-text);
}

.ro-profile-hero {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: clamp(16px, 3vw, 28px);
    align-items: center;
    background: var(--ro-surface);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-2xl);
    padding: clamp(20px, 4vw, 32px);
    box-shadow: var(--ro-shadow-lg);
    margin-bottom: var(--ro-space-6);
}
.ro-profile-hero__avatar {
    width: clamp(64px, 12vw, 96px);
    height: clamp(64px, 12vw, 96px);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ro-primary-500), var(--ro-accent-500));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: clamp(24px, 4vw, 36px);
    font-weight: var(--ro-weight-black);
    overflow: hidden;
}
.ro-profile-hero__avatar img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.ro-profile-hero__id { min-width: 0; }
.ro-profile-hero__nick {
    font-size: clamp(var(--ro-text-xl), 4vw, var(--ro-text-3xl));
    font-weight: var(--ro-weight-black);
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}
.ro-profile-hero__email {
    color: var(--ro-text-sub);
    font-size: var(--ro-text-sm);
    margin-top: 6px;
    overflow-wrap: anywhere;
}
.ro-profile-hero__plan {
    margin-top: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    background: var(--ro-primary-50);
    color: var(--ro-primary-700);
    border-radius: var(--ro-radius-pill);
    font-size: var(--ro-text-xs);
    font-weight: var(--ro-weight-bold);
    border: 1px solid var(--ro-primary-100);
}

@media (max-width: 639px) {
    .ro-profile-hero {
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "avatar id"
            "logout logout";
    }
    .ro-profile-hero__avatar { grid-area: avatar; }
    .ro-profile-hero__id     { grid-area: id; }
    .ro-profile-hero__logout { grid-area: logout; justify-self: stretch; }
    .ro-profile-hero__logout button { width: 100%; }
}

/* 스탯 그리드 (반응형 auto-fit) — 정보 카드들과 시각 톤·간격 통일 */
.ro-profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: var(--ro-space-3);
    margin-bottom: var(--ro-space-4);  /* 24px → 16px : 정보 섹션과 동일 리듬 */
}
.ro-profile-stat {
    background: var(--ro-surface);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-lg);
    padding: clamp(16px, 2.4vw, 22px) clamp(16px, 2.5vw, 22px);
    box-shadow: var(--ro-shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ro-profile-stat__label {
    font-size: var(--ro-text-xs);
    font-weight: var(--ro-weight-bold);
    color: var(--ro-text-sub);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0;
}
.ro-profile-stat__num {
    /* 카드 높이 균형 위해 4xl → 3xl 로 한 단계 줄임 (큰 0이 카드를 늘리는 문제 해소) */
    font-size: clamp(var(--ro-text-2xl), 3.4vw, var(--ro-text-3xl));
    font-weight: var(--ro-weight-black);
    color: var(--ro-primary-600);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    margin-top: 4px;
}
.ro-profile-stat__num--empty {
    color: var(--ro-text-muted);
}
.ro-profile-stat__unit {
    font-size: var(--ro-text-sm);
    color: var(--ro-text-sub);
    font-weight: var(--ro-weight-medium);
    margin-left: 4px;
}
.ro-profile-stat__hint {
    font-size: var(--ro-text-xs);
    color: var(--ro-text-muted);
    margin-top: auto;
}

/* 활동 없음 안내 (stats 0일 때) */
.ro-empty-runs {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 18px);
    padding: clamp(14px, 2.5vw, 20px) clamp(16px, 3vw, 24px);
    background: linear-gradient(135deg, var(--ro-primary-50), var(--ro-surface));
    border: 1px solid var(--ro-primary-100);
    border-radius: var(--ro-radius-xl);
    margin-bottom: var(--ro-space-4);
    box-shadow: var(--ro-shadow-xs);
    flex-wrap: wrap;
}
[data-theme="dark"] .ro-empty-runs {
    background: linear-gradient(135deg, rgba(78,143,255,0.10), var(--ro-surface));
    border-color: rgba(78,143,255,0.20);
}
.ro-empty-runs__emoji,
.ro-empty-runs__icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
    color: var(--ro-primary-600);
    display: inline-flex; align-items: center;
}
.ro-empty-runs > div {
    flex: 1 1 220px;
    min-width: 0;
}
.ro-empty-runs strong {
    display: block;
    font-size: var(--ro-text-base);
    font-weight: var(--ro-weight-bold);
    color: var(--ro-text);
    margin-bottom: 4px;
}
.ro-empty-runs p {
    margin: 0;
    color: var(--ro-text-sub);
    font-size: var(--ro-text-sm);
    line-height: 1.6;
}

/* 정보 섹션 — stats와 동일 간격 */
.ro-profile-section {
    background: var(--ro-surface);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-xl);
    padding: clamp(18px, 3vw, 28px);
    margin-bottom: var(--ro-space-4);
    box-shadow: var(--ro-shadow-xs);
}
.ro-profile-section__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    margin-bottom: var(--ro-space-4);
    flex-wrap: wrap;
}
.ro-profile-section__title {
    font-size: var(--ro-text-lg);
    font-weight: var(--ro-weight-bold);
    margin: 0;
}
.ro-profile-section__hint {
    font-size: var(--ro-text-xs);
    color: var(--ro-text-muted);
}

.ro-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: var(--ro-space-4);
}
.ro-info-cell {
    display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.ro-info-cell__label {
    font-size: var(--ro-text-xs);
    color: var(--ro-text-sub);
    font-weight: var(--ro-weight-semibold);
}
.ro-info-cell__value {
    font-size: var(--ro-text-base);
    color: var(--ro-text);
    font-weight: var(--ro-weight-medium);
    overflow-wrap: anywhere;
}
.ro-info-cell__value--muted { color: var(--ro-text-muted); font-style: italic; }

/* 읽기 전용 안내 배너 */
.ro-readonly-note {
    background: var(--ro-surface-alt);
    border-left: 4px solid var(--ro-primary-500);
    border-radius: var(--ro-radius-md);
    padding: 12px 16px;
    font-size: var(--ro-text-sm);
    color: var(--ro-text-sub);
    margin-bottom: var(--ro-space-5);
    display: flex; align-items: flex-start; gap: 10px;
}
.ro-readonly-note__icon {
    flex-shrink: 0;
    color: var(--ro-primary-600);
    margin-top: 2px;
}

/* 가시성 칩 */
.ro-vis-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--ro-radius-pill);
    font-size: var(--ro-text-xs);
    font-weight: var(--ro-weight-bold);
    border: 1px solid var(--ro-border);
    background: var(--ro-surface);
}
.ro-vis-chip--private { color: var(--ro-text-sub); }
.ro-vis-chip--friends { color: var(--ro-primary-700); background: var(--ro-primary-50); border-color: var(--ro-primary-100); }
.ro-vis-chip--public  { color: var(--ro-accent-700); background: var(--ro-accent-50);  border-color: var(--ro-accent-100); }

/* 대표 뱃지 (히어로 닉네임 옆) */
.ro-leader-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    margin-left: 10px;
    background: linear-gradient(135deg, #FFD24A, #FFA94A);
    color: #4a2b00;
    font-size: var(--ro-text-xs);
    font-weight: var(--ro-weight-black);
    border-radius: var(--ro-radius-pill);
    box-shadow: 0 1px 4px rgba(255, 169, 74, 0.30);
    letter-spacing: 0.02em;
    vertical-align: middle;
    line-height: 1.4;
}

/* 섹션 카운트 칩 */
.ro-section-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px;
    padding: 0 7px;
    margin-left: 8px;
    border-radius: var(--ro-radius-pill);
    background: var(--ro-primary-50);
    color: var(--ro-primary-700);
    font-size: var(--ro-text-xs);
    font-weight: var(--ro-weight-bold);
    vertical-align: middle;
}
[data-theme="dark"] .ro-section-count {
    background: rgba(78,143,255,0.16);
    color: var(--ro-primary-300, #93b9ff);
}

/* 가벼운 빈 상태 안내 */
.ro-emptyish {
    background: var(--ro-surface-alt);
    border: 1px dashed var(--ro-border);
    border-radius: var(--ro-radius-lg);
    padding: 14px 16px;
    font-size: var(--ro-text-sm);
    color: var(--ro-text-sub);
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
}
.ro-emptyish__cta {
    color: var(--ro-primary-600);
    font-weight: var(--ro-weight-bold);
    text-decoration: none;
    white-space: nowrap;
}
.ro-emptyish__cta:hover { text-decoration: underline; }

/* 크루 칩 리스트 */
.ro-chip-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: 8px;
}
.ro-chip-card {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    background: var(--ro-surface-alt);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-pill);
    font-size: var(--ro-text-sm);
    font-weight: var(--ro-weight-semibold);
    transition: transform var(--ro-dur-fast), box-shadow var(--ro-dur-fast);
}
.ro-chip-card:hover { transform: translateY(-1px); box-shadow: var(--ro-shadow-sm); }
.ro-chip-card--leader {
    background: linear-gradient(135deg, rgba(255,210,74,0.18), rgba(255,169,74,0.10));
    border-color: rgba(255,169,74,0.45);
}
.ro-chip-card__role {
    display: inline-block;
    padding: 2px 8px;
    background: linear-gradient(135deg, #FFD24A, #FFA94A);
    color: #4a2b00;
    border-radius: var(--ro-radius-pill);
    font-size: 10.5px;
    font-weight: var(--ro-weight-black);
    letter-spacing: 0.02em;
}

/* 챌린지 리스트 */
.ro-challenge-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column; gap: 10px;
}
.ro-challenge-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 16px;
    padding: 12px 16px;
    background: var(--ro-surface-alt);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-lg);
}
.ro-challenge-row__title {
    font-weight: var(--ro-weight-semibold);
    overflow-wrap: anywhere;
}
.ro-challenge-row__meta {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: var(--ro-text-xs);
    color: var(--ro-text-sub);
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    white-space: nowrap;
}
.ro-status {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: var(--ro-radius-pill);
    font-size: var(--ro-text-xs);
    font-weight: var(--ro-weight-bold);
}
.ro-status--live {
    background: rgba(16, 185, 129, 0.14);
    color: #065F46;
    position: relative;
}
[data-theme="dark"] .ro-status--live { color: #6EE7B7; }
.ro-status--live::before {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 0 rgba(16,185,129,0.6);
    animation: ro-pulse 1.6s ease-out infinite;
}
@@keyframes ro-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
@@media (prefers-reduced-motion: reduce) {
    .ro-status--live::before { animation: none; }
}
.ro-status--upcoming {
    background: var(--ro-primary-50);
    color: var(--ro-primary-700);
}
[data-theme="dark"] .ro-status--upcoming {
    background: rgba(78,143,255,0.16);
    color: var(--ro-primary-300, #93b9ff);
}
.ro-status--ended {
    background: rgba(0,0,0,0.06);
    color: var(--ro-text-sub);
}
[data-theme="dark"] .ro-status--ended {
    background: rgba(255,255,255,0.06);
}

@@media (max-width: 540px) {
    .ro-challenge-row {
        grid-template-columns: 1fr;
    }
    .ro-challenge-row__meta {
        grid-column: 1;
        grid-row: auto;
        white-space: normal;
    }
}

/* TV (1920+) — 컨테이너 폭만 확대, 카드 폭은 유지해 정보 밀도 보호 */
@media (min-width: 1920px) {
    .ro-profile { max-width: var(--ro-container-2xl); }
}

/* 접근성: 모션 감소 */
@media (prefers-reduced-motion: reduce) {
    .ro-profile-hero, .ro-profile-stat, .ro-profile-section, .ro-login-card {
        transition: none !important;
    }
}

/* ── 프로필 주간 추이 차트 ──────────────────────────────────────────── */
.ro-weekly {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    align-items: end;
    height: 140px;
    padding: 8px 0 0;
}
.ro-weekly__col {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
.ro-weekly__bar-wrap {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 4px;
}
.ro-weekly__bar {
    width: 100%;
    max-width: 28px;
    background: linear-gradient(180deg, var(--ro-primary-300, #93b9ff), var(--ro-primary-500, #4E8FFF));
    border-radius: 6px 6px 0 0;
    position: relative;
    transition: transform 0.18s ease;
    min-height: 4px;
}
.ro-weekly__bar:hover { transform: translateY(-2px); }
.ro-weekly__bar--today {
    background: linear-gradient(180deg, #FFB07A, #FF7F50);
}
.ro-weekly__km {
    position: absolute;
    top: -18px; left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--ro-text, #0f172a);
    white-space: nowrap;
}
.ro-weekly__label {
    margin-top: 6px;
    font-size: 11px;
    color: var(--ro-text-sub, #64748b);
    font-weight: 600;
}
.ro-weekly__label--today {
    color: var(--ro-accent-500, #FF7F50);
    font-weight: 800;
}

/* ── 최근 활동 리스트 ──────────────────────────────────────────────── */
.ro-activity-list {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; flex-direction: column;
    gap: 10px;
}
.ro-activity-row {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 14px;
    padding: 12px 14px;
    background: var(--ro-surface-alt);
    border: 1px solid var(--ro-border-soft);
    border-radius: var(--ro-radius-lg);
    align-items: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ro-activity-row:hover {
    transform: translateY(-1px);
    box-shadow: var(--ro-shadow-sm);
}
.ro-activity-row__date {
    display: flex; flex-direction: column;
    text-align: center;
    color: var(--ro-text-sub);
    line-height: 1.2;
}
.ro-activity-row__date strong {
    font-size: 16px;
    font-weight: 800;
    color: var(--ro-text);
    letter-spacing: -0.01em;
}
.ro-activity-row__date span {
    font-size: 10.5px;
    color: var(--ro-text-muted);
    margin-top: 2px;
}
.ro-activity-row__km {
    font-size: 22px;
    font-weight: 800;
    color: var(--ro-primary-600);
    line-height: 1;
    letter-spacing: -0.02em;
}
.ro-activity-row__km em {
    font-style: normal;
    font-size: 12px;
    color: var(--ro-text-sub);
    font-weight: 600;
    margin-left: 2px;
}
.ro-activity-row__meta {
    display: flex; gap: 12px; align-items: center;
    margin-top: 4px;
    font-size: 12px;
    color: var(--ro-text-sub);
    font-variant-numeric: tabular-nums;
}
.ro-activity-row__pace {
    padding: 2px 8px;
    background: var(--ro-primary-50);
    color: var(--ro-primary-700);
    border-radius: var(--ro-radius-pill);
    font-weight: 700;
}
[data-theme="dark"] .ro-activity-row__pace {
    background: rgba(78,143,255,0.16);
    color: var(--ro-primary-300, #93b9ff);
}

@media (max-width: 480px) {
    .ro-weekly { height: 120px; gap: 4px; }
    .ro-weekly__bar { max-width: 24px; }
    .ro-weekly__km { font-size: 9px; top: -16px; }
}
