@charset "utf-8";

@scope (.blog-page--blog-ranker) {
:scope {
    --br-bg: var(--rp-page);
    --br-card: var(--rp-surface);
    --br-card-alt: var(--rp-surface-alt);
    --br-border: var(--rp-border);
    --br-border-strong: var(--rp-border-strong);
    --br-accent: var(--rp-primary);
    --br-accent-soft: color-mix(in srgb, var(--rp-primary) 14%, transparent);
    --br-text: var(--rp-text);
    --br-text-muted: var(--rp-text-muted);
    --br-shadow: var(--rp-shadow-sm);
}

.title-box {
    margin: 0;
    padding: 0 0 20px;
    border-bottom: 1px solid var(--br-border);
}

.title-box h1 {
    margin: 0;
    color: var(--br-text);
    font-size: clamp(1.65rem, 2.8vw, 2.1rem);
    line-height: 1.25;
    font-weight: 800;
}

.title-box .breadcrumb {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    color: var(--br-text-muted);
    font-size: 12px;
}

.title-box .breadcrumb li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.br-search-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
    max-width: 680px;
    margin: 24px auto 32px;
    padding: 0 16px;
}

.br-search-wrap input {
    flex: 1;
    min-height: 48px;
    padding: 12px 16px;
    border-radius: var(--rp-radius);
    border: 1px solid var(--br-border-strong);
    background: var(--br-card);
    color: var(--br-text);
    font-size: 15px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.br-search-wrap input:focus {
    border-color: var(--br-accent);
    box-shadow: var(--rp-input-shadow);
}

.br-search-wrap input::placeholder { color: var(--br-text-muted); }

/* ── 로딩 스피너 & 상태 안내 ────────────────────────────────────────── */
#br-loading {
    display: none;
    text-align: center;
    padding: 48px 20px 40px;
    max-width: 520px;
    margin: 20px auto 30px;
    background: var(--br-card);
    border: 1px solid var(--br-border);
    border-radius: var(--rp-radius-card-lg);
    box-shadow: var(--br-shadow);
}

.br-loading-spinner {
    font-size: 34px;
    color: var(--br-accent);
    margin-bottom: 16px;
    line-height: 1;
}

.br-loading-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--br-text);
    line-height: 1.4;
    word-break: keep-all;
}

.br-loading-line {
    width: 120px;
    height: 3px;
    margin: 18px auto 0;
    background: var(--br-border);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.br-loading-line::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--br-accent), transparent);
    animation: brLoadingSlide 1.4s infinite ease-in-out;
}

@keyframes brLoadingSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(260%); }
}

#br-result { display: none; }

.br-topbar {
    display: flex;
    justify-content: end;
    align-items: center;
    gap: 12px;
    padding: 14px 0 22px;
    border-bottom: 1px solid var(--br-border);
    margin-bottom: 20px;
}

.br-logo {
    font-size: 20px;
    font-weight: 900;
    color: var(--br-text);
    letter-spacing: -0.4px;
}

.br-logo span { color: var(--br-accent); }

.br-topbar-tag {
    font-size: 12px;
    color: var(--br-text-muted);
    border: 1px solid var(--br-border);
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--br-card-alt);
}

.br-header {
    background: var(--br-card);
    border: 1px solid var(--br-border);
    border-radius: var(--rp-radius-card-lg);
    box-shadow: var(--br-shadow);
    padding: 28px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.br-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--rp-primary), var(--rp-primary-hover));
}

.br-h-left { display: flex; align-items: center; gap: 20px; }

.br-profile-img,
.br-profile-fallback {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    border: 2px solid color-mix(in srgb, var(--rp-primary) 70%, transparent);
    box-shadow: 0 0 0 6px var(--br-accent-soft);
}

.br-profile-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--br-card-alt);
    color: var(--br-accent);
    font-size: 34px;
    font-weight: 900;
}

.br-blog-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--br-text);
}

.br-blog-sub {
    font-size: 13px;
    color: var(--br-text-muted);
    margin-top: 4px;
}

.br-h-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.br-grade-badge {
    min-width: 68px;
    height: 68px;
    border-radius: 12px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-break: keep-all;
    font-size: 20px;
    font-weight: 900;
    color: var(--rp-on-brand);
    background: linear-gradient(135deg, var(--rp-primary), var(--rp-primary-hover));
    box-shadow: 0 12px 24px color-mix(in srgb, var(--rp-primary) 28%, transparent);
}

.br-date-lbl { font-size: 12px; color: var(--br-text-muted); }

.br-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.br-card {
    background: var(--br-card);
    border: 1px solid var(--br-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--br-shadow);
    padding: 20px;
    transition: border-color .2s ease, transform .2s ease;
}

.br-card:hover {
    border-color: color-mix(in srgb, var(--rp-primary) 35%, var(--br-border));
    transform: translateY(-1px);
}

.br-card:first-child {
    border-color: color-mix(in srgb, var(--rp-primary) 40%, var(--br-border));
}

.br-s-label { font-size: 12px; color: var(--br-text-muted); font-weight: 500; margin-bottom: 8px; }
.br-s-value { font-size: 26px; font-weight: 800; color: var(--br-text); line-height: 1.1; }
.br-s-sub { font-size: 12px; color: var(--br-text-muted); margin-top: 5px; }
.br-s-sub-detail { font-size: 11px; color: var(--br-text-muted); margin-top: 3px; line-height: 1.5; }
.br-s-accent { color: var(--br-accent); font-weight: 700; }

.br-main-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.br-chart-card {
    background: var(--br-card);
    border: 1px solid var(--br-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--br-shadow);
    padding: 22px;
}

.br-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--br-text);
}

.br-card-title::before {
    content: "";
    width: 3px;
    height: 16px;
    background: var(--br-accent);
    border-radius: 2px;
    display: inline-block;
}

.br-card-note { font-size: 11px; color: var(--br-text-muted); margin: -6px 0 12px; }

.br-radar-wrap {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.br-radar-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 2;
}

.br-rc-grade {
    font-size: clamp(26px, 11cqw, 52px);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -1px;
    color: var(--br-accent);
}

.br-rc-pct {
    margin-top: 6px;
    font-size: clamp(10px, 3.2cqw, 13px);
    font-weight: 600;
    color: var(--br-text-muted);
    white-space: nowrap;
}

.br-radar-wrap { container-type: inline-size; }

.br-scatter-wrap { position: relative; height: 340px; }

.br-bottom-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

.br-pop-list { max-height: 210px; overflow-y: auto; }
.br-pop-list::-webkit-scrollbar { width: 6px; }
.br-pop-list::-webkit-scrollbar-track { background: var(--br-card-alt); border-radius: 3px; }
.br-pop-list::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--rp-primary) 32%, var(--br-border));
    border-radius: 3px;
}

.br-pop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--br-border);
    border-radius: 6px;
    transition: background-color .2s ease;
}

.br-pop-item:hover { background: var(--br-card-alt); }
.br-pop-item:last-child { border-bottom: none; margin-bottom: 0; }

.br-pop-rank {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--rp-primary) 15%, transparent);
    color: var(--br-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.br-pop-rank.r1,
.br-pop-rank.r2,
.br-pop-rank.r3 {
    color: var(--rp-on-brand);
    box-shadow: 0 6px 14px color-mix(in srgb, var(--rp-primary) 28%, transparent);
}

.br-pop-rank.r1 { background: linear-gradient(135deg, var(--rp-danger), #e11d48); }
.br-pop-rank.r2 { background: linear-gradient(135deg, var(--rp-warning), #f97316); }
.br-pop-rank.r3 { background: linear-gradient(135deg, #f59e0b, #d97706); }

.br-pop-title {
    flex: 1;
    font-size: 13px;
    color: var(--br-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.br-pop-cnt {
    min-width: 60px;
    text-align: right;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    color: var(--br-text-muted);
}

.br-table-card {
    background: var(--br-card);
    border: 1px solid var(--br-border);
    border-radius: var(--rp-radius);
    box-shadow: var(--br-shadow);
    padding: 22px;
    overflow: hidden;
}

.br-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
}

#br-pt {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--br-card);
}

#br-pt th,
#br-pt td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--br-border);
    color: var(--br-text);
    white-space: nowrap;
}

#br-pt th {
    position: sticky;
    top: 0;
    z-index: 3;
    font-weight: 700;
    background: var(--br-card-alt);
}

#br-pt th:nth-child(2), #br-pt td:nth-child(2) {
    min-width: 160px;
    white-space: normal;
    word-break: keep-all;
}

#br-pt th:nth-child(14), #br-pt td:nth-child(14) {
    min-width: 110px;
    white-space: normal;
    word-break: keep-all;
}

#br-pt th:nth-child(16), #br-pt td:nth-child(16) {
    width: 44px;
    min-width: 44px;
    position: sticky;
    right: 62px;
    z-index: 2;
    background: var(--br-card);
    box-shadow: -2px 0 8px color-mix(in srgb, var(--rp-black) 18%, transparent);
}

#br-pt th:nth-child(17), #br-pt td:nth-child(17) {
    width: 62px;
    min-width: 62px;
    position: sticky;
    right: 0;
    z-index: 2;
    background: var(--br-card);
}

#br-pt thead th:nth-child(16),
#br-pt thead th:nth-child(17) { z-index: 4; }

.br-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
    color: var(--rp-on-brand);
    background: color-mix(in srgb, var(--rp-primary) 70%, #111);
}

.br-post-link {
    color: var(--br-text);
    text-decoration: none;
    font-size: 14px;
}

.br-post-link:hover { color: var(--br-accent); }

.br-sort-btn { cursor: pointer; user-select: none; }
.br-sort-btn:hover { color: var(--br-accent) !important; }

.br-footer {
    margin-top: 10px;
    padding: 18px 0 8px;
    border-top: 1px solid var(--br-border);
    text-align: center;
    color: var(--br-text-muted);
    font-size: 11px;
    line-height: 1.8;
}

.br-footer-brand { font-size: 13px; font-weight: 800; color: var(--br-text); margin-bottom: 4px; }
.br-footer-brand span { color: var(--br-accent); }

@media (max-width: 1024px) {
    .br-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .br-main-grid,
    .br-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .title-box {
        padding-bottom: 16px;
    }

    .title-box h1 {
        font-size: 1.4rem;
    }

    .br-search-wrap {
        flex-direction: column;
        align-items: stretch;
        margin: 18px auto 24px;
    }

    .br-btn { width: 100%; justify-content: center; }

    .br-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 22px 20px;
    }

    .br-h-right {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        width: 100%;
        gap: 12px;
        padding-top: 14px;
        border-top: 1px dashed var(--br-border);
    }

    .br-h-right .br-grade-badge {
        min-width: 52px;
        height: 52px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .br-h-right .br-date-lbl {
        margin-left: auto;
        text-align: right;
    }

    .br-chart-card,
    .br-table-card { padding: 16px; }

    /* 범례 줄바꿈으로 고정 높이 안에서 그래프가 눌려 잘리는 것을 방지 */
    .br-scatter-wrap { height: 380px; }
}

@media (max-width: 560px) {
    .br-cards { grid-template-columns: 1fr; }
    .br-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .br-pop-title {
        max-width: 180px;
    }

    /* 범례가 여러 줄로 줄바꿈되므로 고정 높이 축소 시 그래프 영역이 눌려 잘리는 것을 방지 */
    .br-scatter-wrap { height: 400px; }
    .br-radar-wrap { max-width: 280px; }
}
}
