:root {
  --bg: #f5f5f7;
  --text: #1f1f25;
  --card: #ffffff;
  --muted: #686873;
  --brand: #ffab40;
  --brand-2: #5b7cff;
  --border: #d8d8e2;
}

body[data-theme='dark'] {
  --bg: #111217;
  --text: #f2f2f5;
  --card: #1a1c24;
  --muted: #a4a4b5;
  --brand: #ffc773;
  --brand-2: #8da0ff;
  --border: #2b2f3a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  z-index: 10;
}
nav { display: flex; gap: 18px; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  min-width: 108px;
  text-align: center;
}
.logo { font-weight: 800; }
.container { width: min(1120px, 92%); margin: 28px auto 80px; display: grid; gap: 34px; }
.hero {
  background: linear-gradient(135deg, #141517 0%, #23283c 55%, #20202a 100%);
  color: #fff;
  border-radius: 22px;
  border: 1px solid #35384a;
  padding: 28px;
  display: grid;
  gap: 22px;
  grid-template-columns: 1fr;
  min-height: 330px;
}
.badge { display: inline-block; border: 1px solid #796956; padding: 5px 10px; border-radius: 999px; color: #ffd59f; font-size: 12px; }
.muted { color: var(--muted); }
section > .muted { min-height: 44px; }
section > h2 { min-height: 38px; margin: 0 0 8px; }
.search-panel { margin-top: 20px; background: #ffffff10; border: 1px solid #ffffff30; border-radius: 14px; padding: 18px; }
.search-panel h2 { min-height: 56px; margin: 0 0 12px; line-height: 1.35; }
.search-grid { display: grid; gap: 12px; grid-template-columns: 180px 180px minmax(260px, 1fr) auto; align-items: end; }
label { display: grid; gap: 6px; font-size: 13px; color: #ddd; }
label.grow { grid-column: auto; }
input, select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #4f4f61;
  background: #101219;
  color: #fff;
  padding: 10px;
}
button, .pill {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
  min-height: 38px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.controls { display: flex; gap: 8px; }
.controls .pill {
  width: 128px;
  text-align: center;
  white-space: nowrap;
}
.cta {
  background: linear-gradient(120deg, var(--brand), #ffcf88);
  color: #2a2012;
  border: 0;
  white-space: nowrap;
}
.category-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.category-cards article, .feed-card, .trend-item, .focus-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}
.category-cards article { height: 118px; }
.trend-item { height: 132px; }
.feed-card { height: 286px; }
.focus-card { height: 372px; }
.analysis-layout { display: grid; gap: 14px; grid-template-columns: 1.05fr 1fr; min-height: 520px; }
.focus-image {
  height: 180px;
  border-radius: 12px;
  margin-top: 12px;
  background: repeating-linear-gradient(45deg, #9ab4d0 0, #9ab4d0 12px, #8ea7c0 12px, #8ea7c0 24px);
}
.trend-list { display: grid; gap: 10px; }
.trend-item h4 { margin: 0 0 8px; }
.tagline { color: var(--brand-2); font-weight: 700; }
.feed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.feed-image {
  height: 140px;
  border-radius: 10px;
  margin-bottom: 10px;
  background: linear-gradient(140deg, #9ba8b2, #6e7f91);
}
.footer {
  width: min(1120px, 92%);
  margin: 0 auto 40px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

@media (max-width: 900px) {
  .hero, .analysis-layout { grid-template-columns: 1fr; }
  .search-grid { grid-template-columns: 1fr 1fr; }
  label.grow { grid-column: 1 / -1; }
  nav a { min-width: auto; }
  .controls .pill { width: auto; }
  .focus-card, .feed-card, .trend-item, .category-cards article { height: auto; }
  .analysis-layout { min-height: auto; }
}

@media (max-width: 640px) {
  .search-grid { grid-template-columns: 1fr; }
  label.grow { grid-column: auto; }
}
