
@font-face {
    font-family: 'Paperlogy';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-4Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Paperlogy';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-6SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Paperlogy';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --bg: #fbf8fa;
    --surface: #ffffff;
    --surface-2: #f7f4f8;
    --line: #ece7ef;
    --line-hi: #ddd5e2;

    --ink: #2e2740;
    --ink-2: #6d6580;
    --ink-3: #a49cb2;

    --accent: #d94f80;
    --accent-soft: #fdeef4;
    --accent-line: #f4c9da;

    /* 차트 카테고리 색 (플랫폼 고정 배정) */
    --c-aco: #d9407a;
    --c-yahe: #2f6fbf;
    --c-pling: #d97706;

    /* 히트맵 단일 색상 램프 */
    --heat-0: #eeeaf1;
    --heat-1: #fbdde9;
    --heat-2: #f5b3ce;
    --heat-3: #ec83ac;
    --heat-4: #e05189;
    --heat-5: #c02f67;

    --sans: 'Paperlogy', -apple-system, BlinkMacSystemFont,
    'Apple SD Gothic Neo', system-ui, sans-serif;
    --round: 'Paperlogy', -apple-system, sans-serif;
    --rank: 'SUIT Variable', 'Paperlogy', sans-serif;

    --shadow: 0 2px 10px rgba(60, 44, 78, 0.05);
    --shadow-lg: 0 12px 32px rgba(60, 44, 78, 0.10);
}

* {
    box-sizing: border-box;
}

html {
    overflow-anchor: none;
}

body {
    margin: 0;
    background: var(--bg);
    background-image: radial-gradient(900px 460px at 50% -8%, rgba(233, 137, 176, 0.20), transparent 64%),
    radial-gradient(680px 380px at 90% 6%, rgba(129, 173, 232, 0.16), transparent 62%);
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--ink);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

.wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* ---------- 헤더 ---------- */

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 0;
}

.top a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: -9px;
    border-radius: 50%;
    color: var(--ink-3);
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.top a:hover {
    background: var(--surface);
    color: var(--ink);
}

/* ---------- 히어로 ---------- */

.hero {
    padding: 40px 0 30px;
    text-align: center;
}

.hero-eyebrow {
    font-size: 11px;
    letter-spacing: 0.18em;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 16px;
}

.hero h1 {
    font-family: var(--round);
    font-size: 35px;
    line-height: 1.4;
    font-weight: 400;
    margin: 0 0 14px;
    letter-spacing: -0.02em;
}

.hero p {
    font-size: 13px;
    line-height: 1.8;
    color: var(--ink-2);
    margin: 0 auto;
    max-width: 30em;
}

.hero-date {
    display: block;
    margin-top: 14px;
    font-size: 11px;
    color: var(--ink-3);
}

/* ---------- 요약 숫자 ---------- */

.summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.summary-cell {
    padding: 18px 8px;
    text-align: center;
    border-right: 1px solid var(--line);
}

.summary-cell:last-child {
    border-right: none;
}

.summary-value {
    display: block;
    font-family: var(--round);
    font-size: 22px;
    letter-spacing: -0.02em;
}

.summary-label {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    color: var(--ink-3);
}

/* ---------- 탭 ---------- */

.tabs {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    gap: 5px;
    padding: 10px 0;
    margin-bottom: 6px;
    background: linear-gradient(var(--bg) 72%, rgba(251, 248, 250, 0));
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    flex: 0 0 auto;
    padding: 9px 17px;
    border-radius: 999px;
    border: 1px solid var(--line-hi);
    background: var(--surface);
    font-size: 13px;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab:hover {
    border-color: var(--accent-line);
    color: var(--ink);
}

.tab.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

/* ---------- 서브 필터 ---------- */

.chips {
    display: flex;
    gap: 6px;
    margin: 4px 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--line-hi);
    background: var(--surface);
    font-size: 12px;
    color: var(--ink-2);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.chip:hover {
    border-color: var(--accent-line);
}

.chip.active {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}

/* ---------- 카드 ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 22px 20px;
    margin-top: 14px;
    box-shadow: var(--shadow);
}

.card-head {
    margin-bottom: 14px;
}

.card-label {
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.card-title {
    font-family: var(--round);
    font-size: 18px;
    font-weight: 400;
    margin: 0;
    letter-spacing: -0.02em;
}

.card-note,
.note {
    font-size: 11px;
    line-height: 1.7;
    color: var(--ink-3);
    margin: 6px 0 0;
}

.note:empty {
    display: none;
}

.loading,
.empty {
    font-size: 12px;
    color: var(--ink-3);
    text-align: center;
    padding: 40px 0;
}

/* ---------- 랭킹 ---------- */

.rank,
.hero-stat {
    font-family: var(--rank);
}

.rank {
    display: flex;
    flex-direction: column;
}

.rank-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

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

.rank-no {
    flex: 0 0 18px;
    font-family: var(--rank);
    font-size: 13px;
    color: var(--ink-3);
    text-align: center;
}

.rank-row.lead .rank-no {
    color: var(--accent);
}

.rank-main {
    flex: 1 1 auto;
    min-width: 0;
}

.rank-title {
    display: block;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-sub {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-value {
    flex: 0 0 auto;
    font-family: var(--rank);
    font-size: 18px;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.rank-row.lead .rank-value {
    color: var(--accent);
}

.rank-value small {
    font-family: var(--rank);
    font-size: 10px;
    color: var(--ink-3);
    margin-left: 3px;
}

.hero-stat {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 0 16px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}

.hero-stat-no {
    flex: 0 0 18px;
    align-self: flex-start;
    margin-top: 2px;
    font-family: var(--rank);
    font-size: 13px;
    color: var(--accent);
    text-align: center;
}

.hero-stat-main {
    flex: 1 1 auto;
    min-width: 0;
}

.hero-stat-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero-stat-sub {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--ink-3);
}

.hero-stat-value {
    flex: 0 0 auto;
    font-family: var(--rank);
    font-size: 40px;
    line-height: 1.05;
    color: var(--accent);
    letter-spacing: -0.03em;
}

.hero-stat-value small {
    font-family: var(--rank);
    font-size: 12px;
    color: var(--ink-3);
    margin-left: 3px;
    letter-spacing: 0;
}

.sub-line {
    display: block;
}

.sub-line + .sub-line {
    margin-top: 3px;
}

/* 한 줄만 보여주다 눌러서 펼치는 부가 정보 */

.sub-fold {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ink-3);
    text-align: left;
    cursor: default;
}

.sub-fold-text {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 1.5em;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sub-fold-icon {
    flex: 0 0 auto;
    display: none;
    font-size: 9px;
    transition: transform 0.2s ease;
}

.sub-fold.foldable {
    cursor: pointer;
}

.sub-fold.foldable .sub-fold-icon {
    display: block;
}

.sub-fold.foldable:not(.open) .sub-fold-text {
    -webkit-mask-image: linear-gradient(to right, #000 82%, transparent);
    mask-image: linear-gradient(to right, #000 82%, transparent);
}

.sub-fold.open .sub-fold-icon {
    transform: rotate(180deg);
}

/* 접힌 줄이 늘어나도 개수는 오른쪽 위에 고정한다. */
.hero-stat.has-fold {
    align-items: flex-start;
}

.hero-stat.has-fold .hero-stat-value {
    margin-top: 2px;
}

.rank-sub:empty,
.hero-stat-sub:empty {
    display: none;
}

.wrap-sub .rank-sub,
.wrap-sub .hero-stat-sub {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.wrap-title .rank-title,
.wrap-title .hero-stat-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

.value-compact .hero-stat-value {
    font-size: 26px;
}

.value-compact .rank-title,
.value-compact .hero-stat-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: keep-all;
    overflow-wrap: anywhere;
}

/* ---------- 표 ---------- */

.table-scroll {
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    white-space: nowrap;
}

table.data th,
table.data td {
    padding: 9px 8px;
    text-align: right;
    border-bottom: 1px solid var(--line);
}

table.data th {
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    letter-spacing: 0.04em;
}

table.data td {
    color: var(--ink-2);
}

table.data th:first-child,
table.data td:first-child {
    text-align: left;
    color: var(--ink);
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

/* ---------- 히트맵 ---------- */

.heat-scroll {
    overflow-x: auto;
    padding-bottom: 6px;
}

.heat-months {
    display: flex;
    width: max-content;
    margin-bottom: 4px;
    font-size: 9px;
    color: var(--ink-3);
}

.heat-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 11px);
    gap: 2px;
    width: max-content;
}

.heat-cell {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    background: var(--heat-0);
}

.heat-cell.l1 {
    background: var(--heat-1);
}

.heat-cell.l2 {
    background: var(--heat-2);
}

.heat-cell.l3 {
    background: var(--heat-3);
}

.heat-cell.l4 {
    background: var(--heat-4);
}

.heat-cell.l5 {
    background: var(--heat-5);
}

.heat-cell.blank {
    background: transparent;
}

.heat-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 10px;
    font-size: 10px;
    color: var(--ink-3);
}

.heat-tip {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    display: none;
    padding: 7px 10px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
    white-space: nowrap;
    box-shadow: var(--shadow-lg);
}

/* ---------- 콤비 배지 ---------- */

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 9px;
    vertical-align: 2px;
}

/* ---------- 계산기 ---------- */

.calc-field {
    position: relative;
    margin-bottom: 14px;
}

.calc-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line-hi);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}

.calc-input::placeholder {
    color: var(--ink-3);
}

.calc-input:focus {
    border-color: var(--accent-line);
    background: var(--surface);
}

.calc-list {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 230px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line-hi);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.calc-list.open {
    display: block;
}

.calc-option {
    padding: 10px 15px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
}

.calc-option:last-child {
    border-bottom: none;
}

.calc-option:hover {
    background: var(--surface-2);
}

.calc-option-meta {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    color: var(--ink-3);
}

.calc-total {
    display: flex;
    flex-direction: column;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    margin-bottom: 16px;
}

.calc-total-cell {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
}

.calc-total-cell:last-child {
    border-bottom: none;
}

.calc-total-label {
    flex: 0 0 auto;
    font-size: 16px;
    color: var(--ink-2);
}

.info-btn {
    width: 15px;
    height: 15px;
    padding: 0;
    margin-left: 5px;
    border: 1px solid var(--line-hi);
    border-radius: 50%;
    background: none;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 9px;
    line-height: 1;
    cursor: pointer;
    vertical-align: 1px;
}

.info-btn:hover {
    border-color: var(--accent-line);
    color: var(--accent);
}

.info-pop {
    padding: 11px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface);
    font-size: 11px;
    line-height: 1.7;
    color: var(--ink-3);
}

.calc-total-value {
    font-family: var(--round);
    font-size: 20px;
    letter-spacing: -0.02em;
    text-align: right;
}

.calc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--ink-3);
}

.calc-head > span {
    white-space: nowrap;
}

.calc-clear {
    background: none;
    border: none;
    padding: 0;
    color: var(--ink-3);
    font-family: inherit;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
}

.calc-clear:hover {
    color: var(--ink-2);
}

.calc-picked {
    display: flex;
    flex-direction: column;
}

.calc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.calc-item:last-child {
    border-bottom: none;
}

.calc-item-main {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
}

.calc-item-meta {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    color: var(--ink-3);
}

.calc-remove {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: 1px solid var(--line-hi);
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-3);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.calc-remove:hover {
    border-color: var(--accent-line);
    color: var(--accent);
}

/* ---------- 푸터 ---------- */

.foot {
    margin-top: 36px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 11px;
    line-height: 1.9;
    color: var(--ink-3);
}

.foot a {
    color: var(--ink-2);
    text-decoration: none;
}

@media (max-width: 768px) {
    .summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-cell:nth-child(2) {
        border-right: none;
    }

    .summary-cell:nth-child(-n + 2) {
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 400px) {
    .hero h1 {
        font-size: 29px;
    }

    .hero-stat-value {
        font-size: 33px;
    }
}
