:root {
  --ink: #171220;
  --sub: #5f526f;
  --brand: #db4c1f;
  --brand-2: #8f2f16;
  --accent: #0f7b6f;
  --paper: #f6efe7;
  --surface: #fffdf9;
  --line: #ecdccd;
  --shadow: 0 14px 24px rgba(64, 42, 24, 0.14);
}

body[data-theme='premium'] {
  --ink: #f5f5fa;
  --sub: #bcb7d5;
  --brand: #4b67ff;
  --brand-2: #2738ae;
  --accent: #a35ef5;
  --paper: #0f0b1c;
  --surface: #181229;
  --line: #342a4d;
  --shadow: 0 22px 40px rgba(3, 1, 8, 0.45);
}

body[data-theme='civic'] {
  --ink: #163029;
  --sub: #4d6d61;
  --brand: #1b876b;
  --brand-2: #15614d;
  --accent: #c5a23c;
  --paper: #edf5f2;
  --surface: #fefefe;
  --line: #d4e4df;
  --shadow: 0 12px 20px rgba(20, 52, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 8%, transparent) 0%, transparent 36%),
    radial-gradient(circle at 90% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 35%),
    var(--paper);
  line-height: 1.58;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.24;
  font-family: 'Space Grotesk', sans-serif;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
}

.site-shell,
.nav-inner {
  width: min(1180px, 94vw);
  margin: 0 auto;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.84rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 700;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), var(--accent));
}

.top-links {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.top-links a {
  text-decoration: none;
  color: var(--sub);
  font-size: 0.9rem;
  padding: 0.33rem 0.58rem;
  border-radius: 8px;
  transition: color 180ms ease, background 180ms ease;
}

.top-links a:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}

.site-shell {
  padding: 1.15rem 0 3rem;
}

.ops-strip {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.ops-item {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.66rem 0.76rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.18rem;
}

.ops-item span {
  color: var(--sub);
  font-size: 0.76rem;
}

.ops-item strong {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.98rem;
}

.hero-shell {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0.82rem;
}

.hero-main,
.hero-side,
.panel,
.market-wrap,
.network,
.about {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero-main {
  padding: 1.2rem;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--brand) 12%, transparent), transparent 40%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 100%, transparent), color-mix(in srgb, var(--surface) 96%, transparent));
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--brand-2);
  font-size: 0.77rem;
  font-weight: 700;
}

.hero-main h1 {
  margin-top: 0.55rem;
  font-size: clamp(1.35rem, 4vw, 2.15rem);
  max-width: 24ch;
}

.hero-subtitle {
  margin: 0.7rem 0 0;
  color: var(--sub);
  max-width: 72ch;
}

.design-switch {
  margin-top: 0.9rem;
  display: inline-flex;
  gap: 0.38rem;
  padding: 0.3rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, var(--paper));
}

.mode-btn {
  border: 0;
  min-height: 38px;
  padding: 0.4rem 0.72rem;
  border-radius: 8px;
  background: transparent;
  color: var(--sub);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.is-active {
  color: #fff;
  background: linear-gradient(130deg, var(--brand), var(--brand-2));
}

.hero-side {
  padding: 1rem;
}

.hero-side-title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--sub);
}

.quick-actions {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.52rem;
}

.fallback-banner {
  margin-top: 0.8rem;
  border-left: 4px solid #f59e0b;
  background: #fff7e8;
  border-radius: 10px;
  color: #8b5a00;
  padding: 0.62rem 0.82rem;
  font-size: 0.9rem;
}

.section-head {
  margin: 1.5rem 0 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.section-title {
  font-size: 1.15rem;
}

.section-head p,
.panel-sub,
.market-caption {
  margin: 0;
  color: var(--sub);
  font-size: 0.88rem;
}

.panel-sub {
  margin-top: 0.2rem;
  margin-bottom: 0.55rem;
}

.market-caption {
  margin-top: -0.1rem;
  margin-bottom: 0.65rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.64rem;
}

.kpi-card {
  display: block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, var(--paper));
  padding: 0.78rem;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  box-shadow: 0 12px 22px color-mix(in srgb, var(--brand) 14%, transparent);
}

.kpi-label {
  margin: 0;
  color: var(--sub);
  font-size: 0.76rem;
}

.kpi-value {
  margin: 0.45rem 0 0.33rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
}

.kpi-change {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.is-up {
  color: #0f8f5d;
}

.is-down {
  color: #d14343;
}

.content-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: 1fr 1fr 0.95fr;
  gap: 0.7rem;
}

.panel,
.market-wrap,
.network,
.about {
  padding: 0.9rem;
}

.news-list,
.event-list,
.trend-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.56rem;
}

.news-item,
.event-item,
.trend-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, var(--paper));
  padding: 0.68rem;
}

.news-link,
.event-link {
  text-decoration: none;
  display: block;
}

.news-link h4 {
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}

.news-link p {
  margin: 0;
  color: var(--sub);
  font-size: 0.89rem;
}

.news-meta {
  margin-top: 0.44rem;
  display: flex;
  justify-content: space-between;
  gap: 0.55rem;
  color: var(--sub);
  font-size: 0.74rem;
}

.event-link time {
  display: inline-block;
  margin-bottom: 0.2rem;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--brand-2);
  font-size: 0.79rem;
}

.event-link strong {
  font-size: 0.9rem;
}

.event-link p {
  margin: 0.2rem 0 0;
  color: var(--sub);
  font-size: 0.86rem;
}

.market-wrap {
  margin-top: 1rem;
}

.daily-report {
  margin: 0 0 0.7rem;
  border-left: 3px solid color-mix(in srgb, var(--accent) 62%, var(--brand));
  padding: 0.5rem 0.72rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--sub);
  font-size: 0.88rem;
}

.trend-list {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.trend-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.trend-why,
.trend-action {
  margin: 0.35rem 0 0;
  color: var(--sub);
  font-size: 0.84rem;
}

.trend-chip {
  margin-top: 0.5rem;
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--line));
  padding: 0.35rem 0.72rem;
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  color: color-mix(in srgb, var(--brand-2) 85%, var(--ink));
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
}

.keyword-row {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.keyword-chip {
  min-height: 26px;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--sub);
  background: color-mix(in srgb, var(--surface) 90%, var(--paper));
  font-size: 0.74rem;
  display: inline-flex;
  align-items: center;
}

.is-muted {
  opacity: 0.72;
}

.is-disabled {
  opacity: 0.88;
}

.trend-chip.is-disabled,
.kpi-card.is-disabled {
  cursor: not-allowed;
}

.trend-empty {
  border-style: dashed;
}

.trend-card {
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--accent) 7%, var(--surface)), var(--surface));
}

.network,
.about {
  margin-top: 1rem;
}

.dir-tools {
  margin-top: 0.72rem;
}

label {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--sub);
  font-size: 0.86rem;
}

input[type='search'] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.8rem;
  font-size: 1rem;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 96%, var(--paper));
}

.table-wrap {
  margin-top: 0.62rem;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.58rem;
  border-bottom: 1px solid var(--line);
}

tbody tr:hover {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}

.hero-main,
.hero-side,
.ops-item,
.kpi-card,
.panel,
.market-wrap,
.network,
.about {
  animation: rise-in 420ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

td a {
  color: var(--brand-2);
  text-decoration: none;
}

td a:hover {
  text-decoration: underline;
}

.cta-row {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 170ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(130deg, var(--brand), var(--brand-2));
}

.btn-secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, var(--paper));
}

.about-grid {
  margin-top: 0.66rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.about-grid article {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 95%, var(--paper));
  padding: 0.68rem;
}

.about-grid h3 {
  font-size: 0.92rem;
}

.about-grid p {
  margin: 0.35rem 0 0;
  color: var(--sub);
  font-size: 0.87rem;
}

.footer {
  margin-top: 1.1rem;
  text-align: center;
  font-size: 0.84rem;
  color: var(--sub);
}

.panel-sub,
.market-caption {
  display: none;
}

@media (max-width: 1120px) {
  .hero-shell {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .ops-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
