/* 기본 스타일 초기화 */
.rr-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 헤더 스타일 */
.rr-header {
    text-align: center;
    margin-bottom: 5px;
    padding: 25px;
    background: linear-gradient(135deg, #ff9494 0%, #f7d65e 100%);
    border-radius: 15px;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.rr-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.rr-header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 통계 요약 */
.rr-stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 5px;
    margin-bottom: 40px;
    margin-top: 0px;
}

.rr-stat-card {
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.rr-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.rr-stat-value {
    font-size: 2.2em;
    font-weight: 700;
    color: #ff9494;
    margin-bottom: 0px;
}

.rr-stat-label {
    font-size: 0.9em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 연도 섹션 */
.rr-year-section {
    margin-bottom: 50px;
}

.rr-year-header {
    background: linear-gradient(135deg, #ff9494 0%, #f7d65e 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 10px 10px 0 0;
    font-size: 1.4em;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rr-year-stats {
    font-size: 0.8em;
    opacity: 0.9;
}

/* 테이블 스타일 */
.rr-table-container {
    background: white;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.rr-table-container table {
    width: 100%;
    border-collapse: collapse;
}

.rr-table-container th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
    text-align: left;
    padding: 15px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
}

.rr-table-container td {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.2s ease;
}

.rr-table-container tr:hover td {
    background-color: #f8f9fa;
}

.rr-table-container tr:last-child td {
    border-bottom: none;
}

/* 코스 링크 */
.rr-course-name {
    font-weight: 500;
    color: #333;
}

.rr-course-link {
    color: #ff9494;
    text-decoration: none;
    transition: color 0.2s ease;
    font-size: 0.9em;
}

.rr-course-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* 특별 행 스타일 */
.rr-dnf {
    color: #e74c3c;
    font-weight: 600;
}

.rr-special {
    background-color: #fff3cd;
    font-weight: 600;
}

.rr-fleche {
    background: linear-gradient(90deg, #e8f5e9 0%, #ffffff 100%);
}

.rr-adventure {
    background: linear-gradient(90deg, #e3f2fd 0%, #ffffff 100%);
}

/* 스탯 스타일 */
.rr-distance {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.rr-elevation {
    color: #e67e22;
    font-size: 0.9em;
}

.rr-time {
    color: #3498db;
    font-size: 0.9em;
}

.rr-speed {
    color: #27ae60;
    font-weight: 600;
    font-size: 0.9em;
}

/* 배지 스타일 */
.rr-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 8px;
}

.rr-badge-special {
    background-color: #ffeaa7;
    color: #d63031;
}

.rr-badge-dnf {
    background-color: #ffcccc;
    color: #d63031;
}

.rr-badge-fleche {
    background: #c8e6c9;
    color: #2e7d32;
}

.rr-badge-adventure {
    background: #bbdefb;
    color: #1565c0;
}

/* 모바일 스크롤 */
.rr-mobile-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rr-mobile-scroll table {
    min-width: 700px;
}

/* 모바일 카드 뷰 - 기본 숨김 */
.rr-mobile-cards {
    display: none;
}

/* 600px 이하 모바일 최적화 */
@media (max-width: 600px) {
    .rr-container {
        padding: 3px;
    }

    .rr-header {
        padding: 8px;
        margin-bottom: 6px;
        border-radius: 6px;
    }

    .rr-header h1 {
        font-size: 1em;
        margin-bottom: 2px;
    }

    .rr-header p {
        font-size: 0.65em;
    }

    .rr-stats-summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        margin-bottom: 8px;
    }

    .rr-stat-card {
        padding: 4px 2px;
        border-radius: 4px;
    }

    .rr-stat-value {
        font-size: 0.8em;
        margin-bottom: 0;
    }

    .rr-stat-label {
        font-size: 0.4em;
        letter-spacing: 0;
    }

    /* 연도 섹션 */
    .rr-year-section {
        margin-bottom: 8px;
    }

    .rr-year-header {
        padding: 4px 6px;
        font-size: 0.75em;
        border-radius: 4px;
        margin-bottom: 0px;
        border-bottom-left-radius: 0px;
        border-bottom-right-radius: 0px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .rr-year-stats {
        font-size: 0.55em;
        opacity: 0.8;
    }

    /* 테이블 숨기고 카드 보이기 */
    .rr-table-container {
        display: none;
    }

    .rr-mobile-cards {
        display: block;
        background: white;
        border-radius: 4px;
        overflow: hidden;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        border-top-left-radius: 0px;
        border-top-right-radius: 0px;
    }

    /* 극한 컴팩트 한줄 카드 */
    .rr-ride-row {
        display: flex;
        align-items: center;
        padding: 3px 4px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.55em;
        min-height: 20px;
        position: relative;
    }

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

    .rr-ride-row:active {
        background: #fafafa;
    }

    .rr-ride-row.rr-special {
        background: linear-gradient(to right, #fffbf0 0%, white 100%);
    }

    .rr-ride-row.rr-has-dnf {
        background: linear-gradient(to right, white 0%, #fff5f5 100%);
    }

    .rr-ride-badge.rr-badge-fleche {
        background: #c8e6c9;
        color: #2e7d32;
    }

    .rr-ride-badge.rr-badge-adventure {
        background: #bbdefb;
        color: #1565c0;
    }

    /* 번호 */
    .rr-ride-num {
        font-weight: 700;
        color: #ff9494;
        width: 14px;
        text-align: center;
        flex-shrink: 0;
        font-size: 0.9em;
    }

    /* 코스명 */
    .rr-ride-name {
        flex: 0 0 32%;
        padding: 0 3px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 500;
        color: #ff9494;
    }

    .rr-ride-name a {
        color: inherit;
        text-decoration: none;
    }

    /* 스탯 */
    .rr-ride-stats {
        flex: 1;
        display: flex;
        justify-content: space-between;
        gap: 3px;
        font-variant-numeric: tabular-nums;
        padding-right: 28px;
    }

    .rr-ride-stat {
        white-space: nowrap;
        font-weight: 600;
    }

    /* 스탯 색상 */
    .rr-stat-dist {
        color: #1565c0;
    }

    .rr-stat-elev {
        color: #e65100;
    }

    .rr-stat-time {
        color: #6a1b9a;
    }

    .rr-stat-speed {
        color: #2e7d32;
    }

    /* 단위 표시 */
    .rr-stat-dist::after {
        content: 'km';
        font-weight: 400;
        font-size: 0.85em;
        opacity: 0.6;
    }

    .rr-stat-elev::after {
        content: 'm';
        font-weight: 400;
        font-size: 0.85em;
        opacity: 0.6;
    }

    .rr-stat-speed::after {
        content: 'km/h';
        font-weight: 400;
        font-size: 0.85em;
        opacity: 0.6;
    }

    /* 배지 */
    .rr-ride-badge {
        position: absolute;
        right: 3px;
        top: 50%;
        transform: translateY(-50%);
        padding: 1px 3px;
        font-size: 0.75em;
        border-radius: 2px;
        line-height: 1.2;
        font-weight: 600;
        white-space: nowrap;
    }
}

/* 아주 작은 화면 (400px 이하) */
@media (max-width: 400px) {
    .rr-container {
        padding: 2px;
    }

    .rr-header {
        padding: 6px;
        margin-bottom: 4px;
    }

    .rr-header h1 {
        font-size: 0.9em;
    }

    .rr-header p {
        font-size: 0.6em;
    }

    .rr-stats-summary {
        gap: 2px;
        margin-bottom: 6px;
    }

    .rr-stat-card {
        padding: 3px 1px;
    }

    .rr-stat-value {
        font-size: 0.7em;
    }

    .rr-stat-label {
        font-size: 0.35em;
    }

    .rr-year-header {
        padding: 3px 5px;
        font-size: 0.7em;
    }

    .rr-year-stats {
        font-size: 0.5em;
    }

    .rr-ride-row {
        padding: 2px 3px;
        font-size: 0.5em;
        min-height: 18px;
    }

    .rr-ride-num {
        width: 12px;
        font-size: 0.85em;
    }

    .rr-ride-name {
        flex: 0 0 30%;
    }

    .rr-ride-stats {
        gap: 2px;
        padding-right: 25px;
    }

    .rr-ride-badge {
        font-size: 0.7em;
        padding: 0 2px;
        right: 2px;
    }
}