:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --soft: #f2f4f6;
  --soft-2: #f1f3f6;
  --text: #121417;
  --muted: #8a8f98;
  --line: #eceff2;
  --dark: #24282c;
  --mint: #28d6bc;
  --cyan: #0eaad5;
  --blue: #3978ff;
  --purple: #7a47ff;
  --radius: 10px;
  --section-x: 21px;
  --shadow: 0 18px 50px rgba(18, 20, 23, 0.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  background: var(--surface);
}
.section-inner { padding-left: var(--section-x); padding-right: var(--section-x); }
.topbar {
  height: 62px;
  display: flex;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #34d7b8, #27cbb3);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.brand-name { font-size: 15px; font-weight: 800; letter-spacing: -0.03em; }

.hero { padding-top: 10px; padding-bottom: 15px; }
.macro-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.macro-card:nth-child(n+4) { display: none; }
.macro-card {
  min-width: 0;
  height: 60px;
  padding: 10px 10px 8px;
  border-radius: 8px;
  background: var(--soft-2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  grid-template-rows: auto auto auto;
  column-gap: 6px;
  align-items: center;
}
.macro-name {
  grid-column: 1;
  color: #6f7680;
  font-size: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.macro-value {
  grid-column: 1;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.1;
}
.macro-change {
  grid-column: 1;
  color: var(--blue);
  font-size: 7.5px;
  line-height: 1;
  white-space: nowrap;
}
.macro-change.up { color: #ea5367; }
.sparkline {
  grid-column: 2;
  grid-row: 1 / 4;
  width: 100%;
  height: 30px;
  overflow: visible;
}
.sparkline polyline { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sparkline.up polyline { stroke: #ea5367; }

.briefing-card {
  width: 100%;
  min-height: 68px;
  margin-top: 12px;
  padding: 13px 34px 13px 12px;
  position: relative;
  text-align: left;
  background: #fff;
  border: 1px solid transparent;
  border-radius: 8px;
  background-image: linear-gradient(#fff, #fff), linear-gradient(100deg, var(--purple), var(--cyan));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  cursor: pointer;
}
.briefing-meta { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.briefing-meta strong { font-size: 11px; font-weight: 800; }
.briefing-meta span { font-size: 8px; color: #858b93; }
.briefing-card p { margin: 0; font-size: 11px; line-height: 1.5; font-weight: 700; letter-spacing: -0.03em; }
.briefing-arrow { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); opacity: 0; transition: .2s ease; }
.briefing-card:hover .briefing-arrow { opacity: 1; transform: translate(2px, -50%); }

.section-divider { height: 10px; background: var(--bg); }
.content-section { padding-top: 29px; padding-bottom: 30px; background: #fff; }
.section-heading { margin-bottom: 14px; }
.section-heading h2 { margin: 0 0 7px; font-size: 18px; line-height: 1.2; font-weight: 800; letter-spacing: -0.045em; }
.section-heading p { margin: 0; font-size: 11px; color: #8d9299; letter-spacing: -0.02em; }
.chip-row {
  display: flex;
  gap: 7px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-width: 57px;
  height: 18px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #f0f2f4;
  color: #8d9299;
  font-size: 9px;
  cursor: pointer;
  transition: .18s ease;
}
.chip.active { background: var(--dark); color: #fff; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th {
  height: 24px;
  padding: 0 5px 6px;
  color: #6f757d;
  font-size: 7px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}
.data-table th:first-child { width: 45%; }
.data-table td {
  height: 34px;
  padding: 4px 5px;
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table td:first-child { text-align: left; }
.data-table tbody tr { border-top: 1px solid transparent; }
.data-table tbody tr:first-child { border-top-color: var(--line); }
.etf-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}
.etf-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dfe2e5;
  color: #fff;
  font-size: 8px;
}
.etf-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.desktop-col { display: none; }

.diagnosis-section { padding-bottom: 68px; }
.upload-zone {
  min-height: 161px;
  margin: 0 3px;
  border: 1px solid #f1f2f3;
  border-radius: 8px;
  background: #f5f5f5;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s ease, transform .2s ease;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--mint); transform: translateY(-1px); }
.upload-idle { display: grid; justify-items: center; gap: 12px; color: #9a9da2; font-size: 10px; text-align: center; padding: 18px; }
.upload-plus { color: #111; font-size: 14px; line-height: 1; }
.upload-progress { width: min(280px, 78%); display: grid; justify-items: center; gap: 9px; text-align: center; }
.upload-progress strong { font-size: 11px; }
.upload-progress span { color: #8a8f98; font-size: 9px; }
.progress-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #dfe5e6; border-top-color: var(--mint); animation: spin .8s linear infinite; }
.progress-track { width: 100%; height: 5px; background: #e4e7e9; border-radius: 999px; overflow: hidden; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--mint), var(--cyan)); transition: width .12s linear; }
@keyframes spin { to { transform: rotate(360deg); } }
.upload-preview { width: 100%; height: 161px; position: relative; }
.upload-preview img { width: 100%; height: 100%; object-fit: cover; filter: brightness(.82); }
.upload-preview span { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 7px 11px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 9px; white-space: nowrap; }

.diagnosis-result { margin-top: 14px; display: grid; gap: 12px; }
.score-box, .allocation-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.score-box { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; }
.score-ring {
  --score: 0deg;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  background: conic-gradient(var(--mint) var(--score), #edf0f2 0);
  position: relative;
}
.score-ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #fff; }
.score-ring span, .score-ring small { position: relative; z-index: 1; text-align: center; }
.score-ring span { font-size: 22px; font-weight: 800; line-height: 1; }
.score-ring small { font-size: 8px; color: var(--muted); }
.eyebrow { display: block; margin-bottom: 5px; color: var(--mint); font-size: 8px; font-weight: 800; }
.score-box h3 { margin: 0 0 6px; font-size: 13px; line-height: 1.4; }
.score-box p { margin: 0; color: #737980; font-size: 9px; line-height: 1.6; }
.allocation-header { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 14px; }
.allocation-header strong { font-size: 12px; }
.allocation-header span { color: var(--muted); font-size: 8px; }
.allocation-chart { display: flex; height: 18px; border-radius: 999px; overflow: hidden; background: #eef1f3; }
.allocation-segment:nth-child(1) { background: #2d7eff; }
.allocation-segment:nth-child(2) { background: #2fceb2; }
.allocation-segment:nth-child(3) { background: #7857e8; }
.allocation-segment:nth-child(4) { background: #f2b84b; }
.allocation-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.legend-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 9px; }
.legend-name { display: flex; align-items: center; gap: 6px; color: #72777e; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-item:nth-child(1) .legend-dot { background: #2d7eff; }
.legend-item:nth-child(2) .legend-dot { background: #2fceb2; }
.legend-item:nth-child(3) .legend-dot { background: #7857e8; }
.legend-item:nth-child(4) .legend-dot { background: #f2b84b; }

.ranking-section { padding-bottom: 90px; }
.diversification-meter {
  height: 33px;
  margin: 21px 0 15px;
  position: relative;
  background: linear-gradient(90deg, #0eaad5 0 50%, #4ac690 50% 100%);
  overflow: visible;
}
.meter-icon { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-size: 32px; line-height: 1; filter: saturate(1.1); }
.meter-label { position: absolute; top: 50%; transform: translateY(-50%); color: rgba(255,255,255,.9); font-size: 8px; font-weight: 700; opacity: 0; }
.meter-label-left { left: 10px; }
.meter-label-right { right: 10px; }
.ranking-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.ranking-item {
  min-height: 59px;
  padding: 9px 13px 9px 72px;
  position: relative;
  border-radius: 7px;
  background: #f1f3f5;
  text-align: center;
}
.rank-number { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: #858a90; font-size: 27px; font-weight: 400; }
.rank-title { margin: 0 0 6px; font-size: 10px; font-weight: 800; }
.rank-description { margin: 0; font-size: 9px; line-height: 1.4; }
.rank-correlation { display: none; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 19, 25, .52); backdrop-filter: blur(3px); }
.modal-dialog {
  width: 100%;
  max-height: 82vh;
  padding: 25px 22px 28px;
  position: relative;
  z-index: 1;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: var(--shadow);
  animation: modalUp .25s ease both;
}
@keyframes modalUp { from { opacity: 0; transform: translateY(22px); } }
.modal-close { position: absolute; right: 16px; top: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f1f3f5; font-size: 22px; cursor: pointer; }
.modal-kicker { margin-bottom: 10px; color: var(--mint); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.modal-dialog h2 { margin: 0 35px 12px 0; font-size: 21px; line-height: 1.45; letter-spacing: -0.04em; }
.modal-summary { margin: 0 0 18px; color: #697079; font-size: 12px; line-height: 1.7; }
.modal-bullets { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.modal-bullets li { padding: 12px 13px 12px 35px; position: relative; border-radius: 10px; background: #f5f7f8; font-size: 11px; line-height: 1.55; }
.modal-bullets li::before { content: "✓"; position: absolute; left: 13px; top: 12px; color: var(--mint); font-weight: 800; }
.modal-note { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); color: #a0a5ab; font-size: 8px; }
body.modal-open { overflow: hidden; }
.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; }

@media (min-width: 720px) {
  :root { --section-x: 36px; }
  .app-shell { max-width: 1180px; margin: 0 auto; box-shadow: 0 0 0 1px rgba(0,0,0,.02); }
  .topbar { height: 76px; }
  .brand-mark { width: 31px; height: 31px; font-size: 12px; }
  .brand-name { font-size: 17px; }
  .hero { padding-top: 18px; padding-bottom: 22px; }
  .macro-grid { grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; }
  .macro-card:nth-child(n+4) { display: grid; }
  .macro-card { height: 76px; padding: 12px; grid-template-columns: minmax(0, 1fr) 46px; }
  .macro-name { font-size: 9px; }
  .macro-value { font-size: 13px; }
  .macro-change { font-size: 8px; }
  .briefing-card { min-height: 80px; padding: 16px 48px 16px 15px; }
  .briefing-meta strong { font-size: 12px; }
  .briefing-meta span { font-size: 9px; }
  .briefing-card p { font-size: 13px; }
  .content-section { padding-top: 42px; padding-bottom: 44px; }
  .section-heading h2 { font-size: 23px; }
  .section-heading p { font-size: 12px; }
  .chip { min-width: 72px; height: 25px; padding: 0 15px; font-size: 10px; }
  .data-table { min-width: 900px; table-layout: auto; }
  .data-table th { height: 32px; padding: 0 10px 8px; font-size: 9px; }
  .data-table th:first-child { width: 30%; }
  .data-table td { height: 42px; padding: 6px 10px; font-size: 11px; }
  .desktop-col { display: table-cell; }
  .etf-icon { width: 22px; height: 22px; flex-basis: 22px; }
  .diagnosis-section { padding-bottom: 58px; }
  .upload-zone { min-height: 220px; margin: 0; }
  .upload-preview { height: 220px; }
  .diagnosis-result { grid-template-columns: 1fr 1fr; }
  .score-box, .allocation-card { padding: 20px; }
  .allocation-legend { grid-template-columns: repeat(4, 1fr); }
  .meter-label { opacity: 1; }
  .ranking-list { grid-template-columns: repeat(3, 1fr); }
  .ranking-item { min-height: 135px; padding: 52px 20px 18px; display: flex; flex-direction: column; justify-content: center; }
  .rank-number { top: 14px; left: 18px; transform: none; font-size: 30px; }
  .rank-title { font-size: 12px; }
  .rank-description { font-size: 10px; }
  .rank-correlation { display: inline-flex; align-self: center; margin-top: 10px; padding: 4px 8px; border-radius: 999px; background: #fff; color: #6f747b; font-size: 9px; }
  .modal { place-items: center; }
  .modal-dialog { width: min(620px, calc(100% - 48px)); border-radius: 20px; padding: 34px; }
}

@media (min-width: 1100px) {
  body { padding: 24px 0; }
  .app-shell { border-radius: 18px; overflow: hidden; }
  .section-inner { padding-left: 50px; padding-right: 50px; }
  .content-section { padding-top: 50px; padding-bottom: 50px; }
}
