@view-transition {
  navigation: auto;
}

html {
  scrollbar-gutter: stable;
}

:root {
  color-scheme: light;
  --bg-light: #f8fafc;
  --bg-dark: #0b0f19;
  --fg-light: #0f172a;
  --fg-dark: #f1f5f9;
  --card-light: #ffffff;
  --card-dark: #111827;
  --sec-light: #f1f5f9;
  --sec-dark: #1e293b;
  --muted-light: #475569;
  --muted-dark: #94a3b8;
  --border-light: #e2e8f0;
  --border-dark: #1f2937;
  --accent: #2563eb;

  --background: var(--bg-light);
  --foreground: var(--fg-light);
  --card: var(--card-light);
  --secondary: var(--sec-light);
  --muted-foreground: var(--muted-light);
  --border: var(--border-light);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: var(--bg-dark);
  --foreground: var(--fg-dark);
  --card: var(--card-dark);
  --secondary: var(--sec-dark);
  --muted-foreground: var(--muted-dark);
  --border: var(--border-dark);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.site-container {
  max-width: 90rem;
  min-width: 0;
  margin-inline: auto;
  padding: 0 1rem 3rem;
}

@media (min-width: 768px) {
  .site-container {
    padding: 0 1.5rem 3.5rem;
  }
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  min-height: 68px;
  line-height: 1.7;
  margin-inline: -1rem;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  background-color: var(--background);
  background-color: color-mix(in srgb, var(--background) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

@media (min-width: 768px) {
  .site-header {
    margin-inline: -1.5rem;
    padding: 0.72rem 1.5rem;
  }
}

.site-header.header-scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.site-header.header-hidden {
  transform: translateY(calc(-100% - 4px));
}

.site-header:focus-within {
  transform: translateY(0);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.38rem;
  font-weight: 900;
  color: #0f172a;
  text-decoration: none;
  letter-spacing: -0.04em;
  line-height: 1;
  flex-shrink: 0;
}

:root[data-theme="dark"] .site-brand {
  color: #ffffff;
}

.site-brand-wordmark {
  display: block;
  height: 36px;
  width: auto;
  flex-shrink: 0;
}

:root[data-theme="dark"] .site-header.header-scrolled {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.site-nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.2rem 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.4rem 0.72rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  color: var(--muted-foreground);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.site-nav a:hover {
  color: var(--foreground);
  background-color: var(--secondary);
}

.site-nav a[aria-current="page"] {
  color: #2563eb;
  background-color: rgba(37, 99, 235, 0.11);
  font-weight: 800;
}

:root[data-theme="dark"] .site-nav a[aria-current="page"] {
  color: #60a5fa;
  background-color: rgba(59, 130, 246, 0.2);
}

.theme-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background-color: var(--secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: border-color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

.theme-toggle .theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 1.85rem;
  border-radius: 0.5rem;
  font-size: 0.96rem;
  opacity: 0.55;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.theme-toggle .theme-icon[data-active="true"] {
  background-color: var(--accent);
  color: #ffffff;
  opacity: 1;
}

.article-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: clamp(1rem, 3vw, 2.25rem);
  min-width: 0;
}

.article-body {
  max-width: none;
  width: 100%;
  min-width: 0;
}

.guide-hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
  margin: 1rem 0 1.6rem;
}

@media (min-width: 1024px) {
  .guide-hero-split {
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: 1.75rem;
  }
}

.guide-hero-split > *,
.guide-two-col > * {
  min-width: 0;
}

.guide-hero-split .guide-hero-figure,
.guide-hero-split .guide-hero-visual {
  margin: 0;
}

.guide-two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin-block: 1rem;
}

@media (min-width: 1024px) {
  .guide-two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.article-body h1 {
  font-size: clamp(1.45rem, 2.5vw, 1.9rem);
  line-height: 1.3;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.article-body h2 {
  font-size: 1.2rem;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 1.02rem;
  margin-top: 1.35rem;
  margin-bottom: 0.4rem;
}

.article-body p,
.article-body li {
  color: var(--foreground);
  font-size: 0.96rem;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

.info-box {
  background-color: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.15rem;
  margin-block: 1.25rem;
}

.cta-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.65rem;
  background-color: var(--accent);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-block: 1rem;
  border-radius: 0.65rem;
}

.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  margin-block: 0;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.62rem 0.78rem;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background-color: var(--secondary);
  font-weight: 700;
  white-space: nowrap;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.guide-hero-figure {
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  overflow: hidden;
  background-color: #0b1120;
}

.guide-hero-figure img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 300px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.guide-hero-figure figcaption {
  padding: 0.65rem 1rem;
  background-color: var(--secondary);
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 0.83rem;
}

.visual-card {
  border: 1px solid var(--border);
  background-color: var(--secondary);
  border-radius: 0.9rem;
  padding: 1.05rem 1.15rem;
  margin-block: 1.35rem;
}

.visual-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-bottom: 0.75rem;
}

.visual-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--foreground);
  margin: 0;
}

.visual-card-sub {
  font-size: 0.78rem;
  color: var(--muted-foreground);
}

.visual-card-note {
  margin: 0.65rem 0 0;
  font-size: 0.78rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.svg-chart {
  display: block;
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
  height: auto;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.15rem;
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 0.2rem;
  display: inline-block;
}

.glossary-term {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border: 0;
  background: transparent;
  padding: 0 0.15rem;
  margin: 0;
  font: inherit;
  font-weight: 700;
  color: #1d4ed8;
  border-bottom: 1.5px dashed rgba(29, 78, 216, 0.65);
  cursor: help;
  border-radius: 0.25rem;
  transition: background-color 0.15s, color 0.15s;
}

:root[data-theme="dark"] .glossary-term {
  color: #60a5fa;
  border-bottom-color: rgba(96, 165, 250, 0.7);
}

.glossary-term:hover,
.glossary-term:focus-visible {
  background-color: rgba(59, 130, 246, 0.14);
}

.glossary-icon {
  font-size: 0.78em;
  opacity: 0.85;
}

.glossary-details {
  margin-block: 0.9rem 1.25rem;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  border-radius: 0.75rem;
  padding: 0.7rem 1rem;
  font-size: 0.86rem;
}

.glossary-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--foreground);
  list-style: none;
}

.glossary-details summary::-webkit-details-marker {
  display: none;
}

.glossary-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.glossary-popover {
  position: fixed;
  z-index: 90;
  width: min(360px, calc(100vw - 24px));
  background-color: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  font-size: 0.83rem;
  line-height: 1.55;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.glossary-popover[hidden] {
  display: none;
}

.glossary-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.45rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.glossary-popover-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--foreground);
}

.glossary-popover-close {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
}

.glossary-popover-body p {
  margin: 0 0 0.45rem;
}

.glossary-popover-body p:last-child {
  margin-bottom: 0;
}

.site-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
  color: var(--foreground);
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background-color: var(--secondary);
  color: var(--foreground);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mobile-bottom-nav,
.mobile-more-backdrop {
  display: none;
}

@media (max-width: 1023px) {
  .site-container {
    padding-bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px));
  }
  .site-header {
    padding: 0.52rem 1rem;
    min-height: 58px;
    margin-bottom: 1rem;
    gap: 0.6rem;
  }
  .site-brand {
    font-size: 0.96rem;
  }
  .mobile-menu-toggle,
  .site-header .site-nav {
    display: none !important;
  }
  .site-header .theme-toggle {
    display: inline-flex;
  }
  .mobile-bottom-nav {
    position: fixed;
    left: 0.65rem;
    right: 0.65rem;
    bottom: max(0.95rem, calc(0.5rem + env(safe-area-inset-bottom, 0px)));
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.2rem;
    padding: 0.38rem 0.42rem;
    border: 1px solid var(--border);
    border-radius: 1.2rem;
    background-color: var(--card);
    background-color: color-mix(in srgb, var(--card) 93%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  }
  :root[data-theme="dark"] .mobile-bottom-nav {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  }
  .mobile-bottom-item {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
    padding: 0.35rem 0.2rem;
    border-radius: 0.72rem;
    min-height: 46px;
    line-height: 1.15;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.08s ease, background-color 0.12s ease, color 0.12s ease;
  }
  .mobile-bottom-item:active,
  .mobile-bottom-item.is-pressing {
    transform: scale(0.92);
    background-color: rgba(37, 99, 235, 0.14);
    color: #2563eb;
  }
  :root[data-theme="dark"] .mobile-bottom-item:active,
  :root[data-theme="dark"] .mobile-bottom-item.is-pressing {
    background-color: rgba(59, 130, 246, 0.24);
    color: #60a5fa;
  }
  .mobile-bottom-icon {
    font-size: 1.06rem;
    line-height: 1;
  }
  .mobile-bottom-item[aria-current="page"],
  .mobile-bottom-item.is-active {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.11);
    font-weight: 800;
  }
  :root[data-theme="dark"] .mobile-bottom-item[aria-current="page"],
  :root[data-theme="dark"] .mobile-bottom-item.is-active {
    color: #60a5fa;
    background-color: rgba(59, 130, 246, 0.2);
  }
  .mobile-more-backdrop.is-open {
    position: fixed;
    inset: 0;
    z-index: 79;
    display: flex;
    align-items: flex-end;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
  }
  .mobile-more-sheet {
    width: 100%;
    background-color: var(--card);
    border-top: 1px solid var(--border);
    border-radius: 1.1rem 1.1rem 0 0;
    padding: 1rem 1.1rem calc(6.2rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.24);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
  }
  .mobile-more-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.45rem;
    margin-bottom: 0.2rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--foreground);
  }
  .mobile-more-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.72rem 0.85rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--foreground);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
  }
  .mobile-more-link[aria-current="page"] {
    border-color: #2563eb;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
  }
  .pwa-install-hint {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(5.2rem + env(safe-area-inset-bottom, 0px));
    z-index: 78;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.58rem 0.78rem;
    border: 1px solid var(--border);
    border-radius: 0.95rem;
    background-color: color-mix(in srgb, var(--card) 96%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    font-size: 0.78rem;
    color: var(--foreground);
  }
  :root[data-theme="dark"] .pwa-install-hint {
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.48);
  }
  .pwa-install-hint-btn {
    appearance: none;
    border: 0;
    border-radius: 0.55rem;
    background: #2563eb;
    color: #ffffff;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 800;
    padding: 0.34rem 0.65rem;
    cursor: pointer;
    white-space: nowrap;
  }
  .pwa-install-hint-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted-foreground);
    font: inherit;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.25rem;
    cursor: pointer;
  }
  .visual-card,
  .chart-figure {
    padding: 0.9rem;
  }
}

@media (min-width: 1024px) {
  .pwa-install-hint {
    display: none !important;
  }
}

.nav-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2.5px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, #2563eb, #059669);
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.15s ease;
}

.desktop-only-svg {
  display: block;
}

.mobile-only-cards {
  display: none;
}

@media (max-width: 639px) {
  .desktop-only-svg {
    display: none !important;
  }
  .mobile-only-cards {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }
}

.m-card {
  border: 1px solid var(--border);
  background-color: var(--card);
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem;
  font-size: 0.86rem;
}

.m-card-accent {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
}

.m-card-danger {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.09);
}

.m-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.m-badge {
  display: inline-block;
  padding: 0.12rem 0.45rem;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.m-badge-blue { background: rgba(59, 130, 246, 0.18); color: #1d4ed8; }
.m-badge-green { background: rgba(16, 185, 129, 0.18); color: #047857; }
.m-badge-amber { background: rgba(245, 158, 11, 0.2); color: #b45309; }
.m-badge-red { background: rgba(239, 68, 68, 0.18); color: #b91c1c; }
:root[data-theme="dark"] .m-badge-blue { color: #60a5fa; }
:root[data-theme="dark"] .m-badge-green { color: #34d399; }
:root[data-theme="dark"] .m-badge-amber { color: #fbbf24; }
:root[data-theme="dark"] .m-badge-red { color: #f87171; }

.m-bar-track {
  width: 100%;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--secondary);
  overflow: hidden;
  margin: 0.4rem 0 0.25rem;
}

.m-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.m-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.m-muted {
  font-size: 0.78rem;
  color: var(--muted-foreground);
  margin: 0;
}
