:root {
  color-scheme: light;
  --ink: #111111;
  --muted: #77736e;
  --line: #dedbd5;
  --paper: #ffffff;
  --ground: #f2f1ed;
  --accent: #ef425c;
  --green: #2e9b62;
  --shadow: 0 14px 36px rgba(25, 22, 18, 0.07);
  font-family: Inter, Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--ground); color: var(--ink); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 50; padding: 12px 18px; border-radius: 10px; background: var(--ink); color: white; transition: top .2s; }
.skip-link:focus { top: 16px; }

.app-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; }
.site-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 36px; padding: 48px 0 34px; border-bottom: 1px solid rgba(17,17,17,.12); }
.site-header-copy { min-width: 0; }
.site-header h1 { margin: 0; font-size: clamp(40px, 5.2vw, 72px); letter-spacing: -.065em; line-height: .95; }
.site-header-description { margin: 18px 0 0; color: var(--muted); font-size: 15px; }
.header-summary { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 24px; }
.eyebrow, .section-kicker { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.header-actions { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; font-weight: 700; }
.live-indicator { display: inline-flex; gap: 7px; align-items: center; color: var(--ink); }
.live-indicator span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(46,155,98,.12); }
.icon-button { width: 48px; height: 48px; border: 0; border-radius: 14px; background: var(--ink); color: white; font-size: 24px; box-shadow: var(--shadow); }
.icon-button:hover { background: #333; }
.icon-button:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(239,66,92,.35); outline-offset: 2px; }
.is-spinning { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero-total { flex: 0 0 auto; text-align: right; }
.hero-total strong { display: block; font-size: clamp(42px, 7vw, 92px); letter-spacing: -.07em; line-height: .85; }
.hero-total span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }

.platform-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 28px 0 18px; }
.platform-card { min-width: 0; display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.68); text-align: left; transition: transform .2s, border-color .2s, background .2s; }
.platform-card:hover { transform: translateY(-2px); border-color: #bdb8b0; }
.platform-card.is-active { background: var(--ink); border-color: var(--ink); color: white; }
.platform-mark { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #e8e6e1; color: #55514c; font-size: 11px; font-weight: 900; }
.platform-mark.instagram { background: #ffe4ef; color: #d63872; }
.platform-mark.x { background: #e6e8e9; color: #111; }
.platform-mark.threads { background: #ece9e4; color: #111; }
.is-active .platform-mark { background: white; color: var(--ink); }
.platform-card > span:last-child { min-width: 0; }
.platform-card strong, .platform-card small { display: block; }
.platform-card strong { font-size: 22px; letter-spacing: -.04em; }
.platform-card small { margin-top: 2px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.platform-card.is-active small { color: #c5c2bd; }

.filters { display: grid; grid-template-columns: minmax(240px, 1.7fr) repeat(6, minmax(105px, .7fr)); gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.filters label { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 12px; border-left: 1px solid #ece9e4; }
.filters label > span { color: var(--muted); font-size: 10px; font-weight: 800; }
.filters select, .filters input { width: 100%; min-height: 38px; border: 0; background: transparent; color: var(--ink); font-weight: 700; outline: none; }
.filters .search-field { flex-direction: row; align-items: center; border: 0; border-radius: 11px; background: #f4f3f0; }
.search-field > span[aria-hidden] { color: var(--ink); font-size: 22px; transform: rotate(-20deg); }
.search-field input { font-weight: 600; }

.ranking-panel { margin: 22px 0 54px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 28px 30px 24px; border-bottom: 1px solid #ece9e4; }
.panel-header h2 { margin: 0; font-size: clamp(22px, 3vw, 34px); letter-spacing: -.04em; }
.panel-meta { text-align: right; }
.panel-meta strong, .panel-meta span { display: block; }
.panel-meta strong { font-size: 18px; }
.panel-meta span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.status-message { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.content-list { min-height: 360px; }
.content-card { display: grid; grid-template-columns: 46px 118px minmax(0, 1fr) 80px; gap: 20px; align-items: center; min-width: 0; padding: 16px 28px; border-bottom: 1px solid #ece9e4; transition: background .18s; }
.content-card:hover { background: #faf9f7; }
.rank { align-self: start; padding-top: 7px; color: #86817b; font-size: 17px; font-weight: 900; letter-spacing: -.04em; }
.content-card:nth-child(-n+3) .rank { color: var(--accent); }
.media-frame { width: 118px; height: 92px; overflow: hidden; border-radius: 13px; background: #e9e7e2; }
.media-frame img, .media-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.source-preview, .detail-source-preview { position: relative; width: 100%; height: 100%; overflow: hidden; }
.source-preview .source-thumbnail, .detail-source-preview .source-thumbnail { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s ease; }
.source-preview .source-video, .detail-source-preview .source-video { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .18s ease; background: #171717; }
.source-preview.is-loaded .source-thumbnail, .detail-source-preview.is-loaded .source-thumbnail { opacity: 1; }
.source-video-preview.is-video-ready .source-video { opacity: 1; }
.source-video-preview.is-video-unavailable .source-video { display: none; }
.source-preview.is-loaded .media-placeholder, .detail-source-preview.is-loaded .detail-media-empty { visibility: hidden; }
.preview-origin-badge { position: absolute; z-index: 4; right: 7px; bottom: 7px; display: none; padding: 4px 6px; border-radius: 999px; color: white; background: rgba(17,17,17,.72); font-size: 8px; font-weight: 800; letter-spacing: .02em; backdrop-filter: blur(5px); }
.is-loaded > .preview-origin-badge { display: inline-flex; }
.is-video-ready > .preview-origin-badge { display: inline-flex; background: rgba(239,66,92,.88); }
.media-open { display: block; padding: 0; border: 0; color: inherit; text-align: inherit; }
.media-open img, .media-open video { transition: transform .2s ease; }
.media-open:hover img, .media-open:hover video { transform: scale(1.035); }
.media-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: linear-gradient(145deg,#ddd9d2,#f4f2ee); color: #77716b; text-align: center; }
.media-placeholder.instagram { background: linear-gradient(145deg,#ffe4ef,#fff5f9); color: #c83a70; }
.media-placeholder.x { background: linear-gradient(145deg,#222,#545454); color: white; }
.media-placeholder.threads { background: linear-gradient(145deg,#dcd7d0,#f6f4f1); color: #333; }
.media-placeholder strong { font-size: 15px; letter-spacing: .08em; }
.media-placeholder span { font-size: 9px; font-weight: 800; line-height: 1.3; opacity: .8; }
.card-body { min-width: 0; }
.card-heading { display: flex; align-items: center; gap: 7px; min-width: 0; }
.card-heading > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.platform-pill, .format-pill, .status-pill, .destination-tag, .media-state { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; font-size: 9px; font-weight: 800; }
.platform-pill { padding: 4px 7px; background: #eeeae5; }
.platform-pill.instagram { color: #c83a70; background: #ffe8f1; }
.platform-pill.x { color: white; background: #191919; }
.platform-pill.threads { color: #111; background: #e8e4de; }
.format-pill { padding: 4px 7px; color: #625d56; background: #eeeae5; }
.format-pill.video { color: #b91f39; background: #ffe0e6; }
.status-pill { margin-left: auto; padding: 4px 8px; }
.status-pill.review { color: #a96a00; background: #fff2d4; }
.status-pill.ready { color: #197d4a; background: #ddf5e7; }
.post-copy { display: -webkit-box; margin: 9px 0; overflow: hidden; color: #4b4742; font-size: 13px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: #8b857e; font-size: 10px; }
.destination-tag { padding: 4px 7px; color: #277b4d; background: #e2f3e9; }
.media-state { padding: 4px 7px; }
.media-state.ready { color: #197d4a; background: #ddf5e7; }
.media-state.pending { color: #736d65; background: #eeeae5; }
.media-state.preview { color: #215f99; background: #e1eef9; }
.media-state.video { color: #b91f39; background: #ffe0e6; }
.card-actions { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.detail-button { padding: 0; border: 0; background: none; color: var(--ink); font-size: 10px; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
.card-foot a { margin-left: 0; color: var(--ink); font-weight: 800; text-decoration: none; }
.card-foot a:hover { text-decoration: underline; }
.score { text-align: right; }
.score strong, .score span { display: block; }
.score strong { color: var(--green); font-size: 28px; line-height: 1; letter-spacing: -.05em; }
.score span { margin-top: 5px; color: #9a958e; font-size: 8px; font-weight: 900; letter-spacing: .1em; }

.load-more-wrap { padding: 20px; text-align: center; }
.load-more { min-width: 190px; padding: 13px 22px; border: 1px solid var(--ink); border-radius: 999px; background: white; color: var(--ink); font-weight: 800; }
.load-more:hover { background: var(--ink); color: white; }
.load-more:disabled { opacity: .5; cursor: wait; }
.empty-state { min-height: 330px; display: grid; place-content: center; gap: 8px; padding: 30px; text-align: center; }
.empty-state span { color: var(--muted); font-size: 13px; }

.detail-dialog { width: min(1120px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.detail-dialog::backdrop { background: rgba(16,15,14,.64); backdrop-filter: blur(5px); }
.dialog-shell { min-height: 400px; }
.dialog-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.dialog-toolbar .section-kicker { margin: 0; }
.dialog-toolbar form { margin: 0; }
.dialog-close { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: white; color: var(--ink); font-size: 12px; font-weight: 900; }
.dialog-close span { margin-left: 5px; font-size: 18px; line-height: 0; vertical-align: -1px; }
.detail-layout { display: grid; grid-template-columns: minmax(320px,.9fr) minmax(0,1.25fr); gap: 0; }
.detail-media-column { min-width: 0; padding: 24px; border-right: 1px solid var(--line); background: #f5f3ef; }
.detail-media-grid { display: grid; gap: 12px; }
.detail-media-grid img, .detail-media-grid video { display: block; width: 100%; max-height: 68vh; object-fit: contain; border-radius: 16px; background: #171717; }
.detail-media-empty { min-height: 430px; display: grid; place-content: center; gap: 10px; padding: 36px; border-radius: 18px; background: linear-gradient(145deg,#ddd9d2,#f7f5f1); color: #5e5953; text-align: center; }
.detail-media-empty.x { color: white; background: linear-gradient(145deg,#202020,#545454); }
.detail-media-empty.instagram { color: #a62e5d; background: linear-gradient(145deg,#ffe4ef,#fff7fa); }
.detail-media-empty p { max-width: 330px; margin: 0; font-size: 13px; line-height: 1.6; opacity: .82; }
.detail-source-preview { min-height: 430px; border-radius: 18px; background: #171717; }
.detail-source-preview .source-thumbnail { object-fit: contain; }
.detail-source-preview .source-video { object-fit: contain; }
.detail-source-preview .preview-origin-badge { right: 12px; bottom: 12px; font-size: 10px; }
.detail-platform-mark { width: 58px; height: 58px; display: grid; place-items: center; justify-self: center; border: 1px solid currentColor; border-radius: 18px; font-weight: 900; }
.detail-source { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; padding: 14px 18px; border-radius: 12px; background: var(--ink); color: white; font-size: 13px; font-weight: 900; text-decoration: none; }
.detail-source:hover { background: #343434; }
.detail-copy-column { min-width: 0; padding: 30px; }
.detail-header { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-header h2 { margin: 14px 0 9px; font-size: clamp(25px,4vw,42px); letter-spacing: -.05em; }
.detail-header p { margin: 0; color: #4c4843; font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
.detail-score { flex: 0 0 auto; text-align: right; }
.detail-score strong, .detail-score span { display: block; }
.detail-score strong { color: var(--green); font-size: 46px; line-height: 1; letter-spacing: -.06em; }
.detail-score span { margin-top: 6px; color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.detail-facts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 0; padding: 20px 0; border-bottom: 1px solid var(--line); }
.detail-facts div { min-width: 0; padding: 8px 14px; border-left: 1px solid #ece9e4; }
.detail-facts div:nth-child(3n+1) { border-left: 0; }
.detail-facts dt, .analysis-row dt { color: var(--muted); font-size: 10px; font-weight: 900; }
.detail-facts dd { margin: 5px 0 0; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.analysis-heading { padding: 26px 0 12px; }
.analysis-heading h3 { margin: 0; font-size: 24px; letter-spacing: -.035em; }
.analysis-list { margin: 0; }
.analysis-row { display: grid; grid-template-columns: 140px minmax(0,1fr); gap: 18px; padding: 15px 0; border-top: 1px solid #ece9e4; }
.analysis-row dd { margin: 0; color: #46413c; font-size: 13px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

.skeleton { position: relative; overflow: hidden; border-radius: 8px; background: #eceae6; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg,transparent,rgba(255,255,255,.65),transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.rank-skeleton { width: 30px; height: 20px; }
.media-skeleton { width: 118px; height: 92px; border-radius: 13px; }
.line { height: 12px; margin: 10px 0; }
.line.short { width: 27%; }
.line.medium { width: 64%; }
.score-skeleton { width: 48px; height: 38px; margin-left: auto; }

footer { display: flex; justify-content: space-between; gap: 20px; padding: 0 0 42px; color: #918b84; font-size: 10px; font-weight: 800; letter-spacing: .08em; }

@media (min-width: 1360px) {
  .app-shell { width: min(1680px, calc(100% - 64px)); }
  .site-header { padding: 42px 0 34px; }
  .site-header h1 { font-size: clamp(48px, 4vw, 64px); }
  .hero-total strong { font-size: clamp(54px, 5vw, 78px); }
  .platform-grid { gap: 14px; margin-top: 20px; margin-bottom: 16px; }
  .platform-card { padding: 16px 18px; }
  .filters {
    position: sticky;
    top: 12px;
    z-index: 12;
    grid-template-columns: minmax(320px, 2fr) repeat(6, minmax(120px, .75fr));
    padding: 10px 12px;
    box-shadow: 0 16px 42px rgba(25, 22, 18, .12);
  }
  .ranking-panel { margin-top: 20px; }
  .panel-header { padding: 24px 28px 20px; }
  .content-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .content-card {
    grid-template-columns: 38px 142px minmax(0, 1fr) 58px;
    gap: 14px;
    min-height: 144px;
    padding: 18px 20px;
  }
  .content-card:nth-child(odd) { border-right: 1px solid #ece9e4; }
  .media-frame, .media-skeleton { width: 142px; height: 106px; }
  .post-copy { margin-block: 10px; }
  .card-foot { gap: 8px; }
  .detail-dialog { width: min(1480px, calc(100% - 56px)); }
  .detail-layout { grid-template-columns: minmax(520px, 1.05fr) minmax(0, 1fr); }
  .detail-media-column { padding: 30px; }
  .detail-copy-column { padding: 34px 38px; }
  .detail-media-grid img, .detail-media-grid video { max-height: 76vh; }
  .detail-source-preview { min-height: 560px; }
}

@media (max-width: 980px) {
  .filters { grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(150px, 1fr)); }
  .filters label:nth-child(n+4) { border-top: 1px solid #ece9e4; padding-top: 7px; }
  .content-card { grid-template-columns: 38px 102px minmax(0,1fr) 64px; gap: 14px; padding-inline: 20px; }
  .media-frame, .media-skeleton { width: 102px; height: 86px; }
  .detail-layout { grid-template-columns: minmax(280px,.8fr) minmax(0,1.2fr); }
  .detail-media-column, .detail-copy-column { padding: 20px; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 24px, 640px); }
  .site-header { align-items: flex-start; gap: 18px; padding: 28px 0 24px; }
  .site-header h1 { font-size: clamp(34px, 9vw, 46px); }
  .site-header-description { max-width: 390px; margin-top: 12px; font-size: 13px; line-height: 1.5; }
  .eyebrow { font-size: 9px; }
  .header-summary { gap: 18px; }
  .live-indicator { display: none; }
  .header-actions { gap: 10px; }
  .icon-button { width: 42px; height: 42px; }
  .hero-total strong { font-size: 36px; }
  .platform-grid { margin-top: 20px; }
  .platform-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search-field { grid-column: 1 / -1; min-height: 50px; }
  .filters label { min-height: 54px; border-top: 1px solid #ece9e4; }
  .filters label:nth-child(even) { border-left: 0; }
  .content-card { grid-template-columns: 32px 86px minmax(0,1fr); gap: 11px; padding: 14px 12px; }
  .media-frame, .media-skeleton { width: 86px; height: 86px; }
  .score { grid-column: 3; display: flex; gap: 5px; align-items: baseline; justify-content: flex-end; margin-top: -8px; }
  .score strong { font-size: 18px; }
  .score span { margin: 0; }
  .card-foot span:not(.destination-tag) { display: none; }
  .card-foot .card-actions { display: inline-flex; }
  .detail-dialog { width: min(720px, calc(100% - 20px)); max-height: calc(100dvh - 20px); }
  .detail-layout { grid-template-columns: 1fr; }
  .detail-media-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-media-empty, .detail-source-preview { min-height: 300px; }
  .detail-media-grid img, .detail-media-grid video { max-height: 56vh; }
}

@media (max-width: 480px) {
  .site-header { gap: 12px; }
  .site-header h1 { font-size: 34px; }
  .site-header-description { max-width: 240px; font-size: 12px; }
  .header-actions time { font-size: 11px; }
  .hero-total strong { font-size: 28px; }
  .hero-total span { display: none; }
  .platform-card { padding: 11px; gap: 9px; }
  .platform-mark { width: 36px; height: 36px; }
  .platform-card strong { font-size: 18px; }
  .filters { grid-template-columns: 1fr; }
  .filters label, .filters label:nth-child(even) { border-left: 0; }
  .filters .search-field { grid-column: auto; }
  .panel-header { align-items: end; padding: 22px 16px 18px; }
  .panel-meta span { display: none; }
  .content-card { grid-template-columns: 27px 74px minmax(0,1fr); gap: 9px; }
  .media-frame, .media-skeleton { width: 74px; height: 82px; border-radius: 10px; }
  .rank { font-size: 13px; }
  .status-pill { display: none; }
  .post-copy { font-size: 12px; -webkit-line-clamp: 3; }
  .card-foot a { margin-left: 0; }
  .card-actions { width: 100%; justify-content: space-between; margin-left: 0; }
  .detail-dialog { width: 100%; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .dialog-toolbar { padding: 13px 14px; }
  .detail-media-column, .detail-copy-column { padding: 15px; }
  .detail-media-empty, .detail-source-preview { min-height: 250px; }
  .detail-header { gap: 12px; }
  .detail-score strong { font-size: 34px; }
  .detail-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-facts div:nth-child(3n+1) { border-left: 1px solid #ece9e4; }
  .detail-facts div:nth-child(odd) { border-left: 0; }
  .analysis-row { grid-template-columns: 1fr; gap: 6px; }
  footer { display: block; line-height: 1.8; }
  footer span { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
