:root {
  --navy: #0b1e38;
  --ink: #14233a;
  --muted: #647188;
  --blue: #0b63d8;
  --blue-dark: #0752b7;
  --blue-soft: #eef5ff;
  --page: #f6f8fc;
  --panel: #fff;
  --line: #dce5f2;
  --shadow: 0 16px 40px rgba(26, 64, 114, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, Pretendard, Arial, "Malgun Gothic", sans-serif;
  line-height: 1.6;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid #78aef2;
  outline-offset: 3px;
}
.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;
  top: -70px;
  left: 18px;
  z-index: 100;
  padding: 11px 16px;
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
}
.skip-link:focus { top: 12px; }
.shell {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #e6edf7;
  backdrop-filter: blur(12px);
}
.header-inner {
  position: relative;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
}
.brand b, .site-footer strong span { color: var(--blue); }
.brand small {
  display: block;
  margin-top: 5px;
  color: #788397;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .08em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.8;
  stroke-linejoin: round;
}
.main-nav {
  position: absolute;
  left: 50%;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.main-nav a {
  padding: 9px 13px;
  border-radius: 6px;
  color: #526177;
  font-size: 13px;
  font-weight: 700;
  transition: color .2s, background .2s;
}
.main-nav a:hover { color: var(--blue); background: var(--blue-soft); }
.main-nav a.is-active { color: #fff; background: var(--blue); }
.auth-menu {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.auth-menu button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #66748a;
  font-size: 11px;
  font-weight: 700;
}
.auth-menu button:hover { color: var(--blue); background: var(--blue-soft); }

.page-hero {
  background-color: #fff;
  background-image:
    linear-gradient(rgba(33, 103, 190, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(33, 103, 190, .045) 1px, transparent 1px);
  background-size: 36px 36px;
  border-bottom: 1px solid #e4ebf5;
}
.hero-content {
  padding: 62px 0 54px;
  text-align: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}
.eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}
.page-hero h1 {
  margin-bottom: 12px;
  color: var(--navy);
  font-size: clamp(38px, 5vw, 54px);
  line-height: 1.15;
  letter-spacing: -.055em;
}
.page-hero p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 15px;
}
.page-main { padding: 54px 0 82px; }
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 24px;
}
.section-title h2 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 28px;
  letter-spacing: -.035em;
}
.section-title p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
}
.surface {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.notice {
  display: flex;
  gap: 9px;
  margin: 22px 0 0;
  color: #728096;
  font-size: 12px;
}
.notice strong { color: var(--blue); }

.search-panel { padding: 24px; margin-bottom: 26px; }
.portal-search {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 7px 6px 16px;
  border: 1px solid #a9c6eb;
  border-radius: 11px;
  background: #fff;
}
.portal-search svg {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
}
.portal-search input {
  min-width: 0;
  flex: 1;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}
.primary-button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.primary-button:hover { background: var(--blue-dark); }
.quick-terms {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  color: #7b8798;
  font-size: 12px;
}
.quick-terms button {
  padding: 5px 10px;
  border: 0;
  border-radius: 999px;
  background: #edf2f8;
  color: #56667d;
  font-size: 12px;
}
.quick-terms button:hover { color: var(--blue); background: #dfeafb; }

.dictionary-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.category-panel {
  position: sticky;
  top: 94px;
  padding: 18px;
}
.category-panel h2 {
  margin-bottom: 14px;
  font-size: 15px;
}
.category-list {
  display: grid;
  gap: 5px;
}
.category-list button {
  min-height: 40px;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #617087;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}
.category-list button:hover { color: var(--blue); background: var(--blue-soft); }
.category-list button[aria-pressed="true"] { color: #fff; background: var(--blue); }
.result-panel { min-width: 0; }
.result-summary {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}
.result-summary strong { color: var(--blue); }
.term-list { display: grid; gap: 12px; }
.term-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.term-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.term-card h3 { margin-bottom: 3px; font-size: 20px; }
.term-card header p { margin-bottom: 0; color: #7b8799; font-size: 12px; }
.term-badge {
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 800;
}
.term-description { margin: 16px 0; color: #536279; font-size: 14px; }
.term-meta {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 12px;
  margin: 0;
  padding-top: 15px;
  border-top: 1px solid #e7edf5;
  font-size: 12px;
}
.term-meta dt { color: #8490a1; }
.term-meta dd { margin: 0; color: #42536b; }
.empty-state {
  padding: 60px 24px;
  text-align: center;
}
.empty-state strong { display: block; margin-bottom: 7px; color: var(--navy); font-size: 18px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }

.trade-page-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.trade-page-card {
  min-width: 0;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  transition: border-color .2s, background .2s, color .2s, transform .2s, box-shadow .2s;
}
.trade-page-card:hover {
  border-color: #9fc2ee;
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(23, 71, 133, .08);
}
.trade-page-card[aria-pressed="true"] {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 28px rgba(11, 99, 216, .2);
}
.trade-card-number {
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
}
.trade-page-card strong {
  margin-top: 6px;
  font-size: 17px;
}
.trade-card-preview {
  margin-top: auto;
  padding-top: 13px;
  color: #758297;
  font-size: 11px;
  line-height: 1.45;
}
.trade-page-card[aria-pressed="true"] .trade-card-number,
.trade-page-card[aria-pressed="true"] .trade-card-preview { color: rgba(255, 255, 255, .82); }
.trade-empty-state { grid-column: 1 / -1; }
.trade-detail-panel {
  margin-top: 22px;
  padding: 28px;
}
.trade-detail-heading {
  padding-bottom: 22px;
  border-bottom: 1px solid #e7edf5;
}
.trade-detail-number {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .1em;
}
.trade-detail-heading h3 {
  margin-bottom: 5px;
  color: var(--navy);
  font-size: 25px;
  letter-spacing: -.03em;
}
.trade-detail-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.trade-detail-content {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 36px;
  padding-top: 23px;
}
.trade-detail-content h4 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 14px;
}
.trade-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.trade-item-tags span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}
.trade-detail-content ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.trade-detail-content li {
  position: relative;
  padding-left: 19px;
  color: #536279;
  font-size: 13px;
}
.trade-detail-content li::before {
  position: absolute;
  top: .55em;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.tool-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 22px;
  padding: 8px;
}
.tool-tabs button {
  min-height: 48px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #627087;
  font-size: 13px;
  font-weight: 800;
}
.tool-tabs button:hover { color: var(--blue); background: var(--blue-soft); }
.tool-tabs button[aria-selected="true"] { color: #fff; background: var(--blue); }
.tool-panel { padding: 28px; }
.tool-panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}
.tool-panel-heading h2 { margin-bottom: 3px; color: var(--navy); font-size: 24px; }
.tool-panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.tool-status {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}
.calculator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.calculator-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid #e1e9f4;
  border-radius: 12px;
  background: #f4f7fc;
}
.calculator-card h3 { margin-bottom: 18px; font-size: 17px; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}
.field { display: block; min-width: 0; }
.field > span {
  display: block;
  margin-bottom: 6px;
  color: #647289;
  font-size: 12px;
  font-weight: 700;
}
.field input, .field select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #ccd8e8;
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
}
.result-box {
  margin-top: 18px;
  padding: 17px;
  border: 1px solid #d7e5f7;
  border-radius: 9px;
  background: #fff;
}
.result-box > span { display: block; color: #748197; font-size: 11px; }
.result-box strong {
  display: block;
  margin-top: 3px;
  color: var(--blue);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}
.result-box small { color: #68768a; font-size: 11px; }
.formula-note {
  margin: 15px 0 0;
  color: #728096;
  font-size: 11px;
}

.auth-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--ink);
}
.auth-dialog::backdrop { background: rgba(6, 19, 38, .55); backdrop-filter: blur(3px); }
.auth-card {
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(5, 25, 55, .25);
}
.auth-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #718096;
  font-size: 24px;
}
.auth-close:hover { background: #edf2f8; color: var(--navy); }
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 24px;
  padding: 5px;
  border-radius: 10px;
  background: #edf2f8;
}
.auth-tabs button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #68768a;
  font-size: 14px;
  font-weight: 800;
}
.auth-tabs button[aria-selected="true"] { background: #fff; color: var(--blue); }
.auth-panel h2 { margin-bottom: 5px; color: var(--navy); font-size: 25px; }
.auth-panel > p { margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.auth-panel > label:not(.auth-check) {
  display: block;
  margin: 13px 0 6px;
  color: #526177;
  font-size: 12px;
  font-weight: 800;
}
.auth-panel > input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid #ccd8e8;
  border-radius: 8px;
}
.auth-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0;
  color: #657389;
  font-size: 12px;
}
.auth-check input { margin-top: 3px; accent-color: var(--blue); }
.auth-submit { width: 100%; min-height: 48px; }
.auth-feedback {
  min-height: 20px;
  margin: 13px 0 0;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.site-footer { background: #101d33; color: #fff; }
.footer-inner {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 34px;
}
.footer-inner strong { font-size: 18px; }
.footer-inner p { margin: 3px 0 0; color: #9daabd; font-size: 12px; }
.footer-inner nav {
  display: flex;
  gap: 22px;
  margin-left: auto;
  color: #bec8d6;
  font-size: 12px;
}
.footer-inner nav a:hover { color: #fff; }
.footer-inner small { color: #7f8da1; font-size: 11px; }

@media (max-width: 900px) {
  .brand small { display: none; }
  .main-nav a { padding-inline: 9px; font-size: 12px; }
  .dictionary-layout { grid-template-columns: 1fr; }
  .category-panel { position: static; }
  .category-list { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .category-list button { text-align: center; }
  .calculator-grid { grid-template-columns: 1fr; }
  .trade-page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { flex-wrap: wrap; padding-block: 26px; }
  .footer-inner nav { order: 3; width: 100%; margin-left: 0; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 116px; }
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 106px; flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; }
  .brand { order: 1; font-size: 16px; }
  .brand-mark { width: 30px; height: 30px; }
  .auth-menu { order: 2; margin-left: auto; }
  .main-nav {
    position: static;
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 4px;
    overflow-x: auto;
    transform: none;
    border-top: 1px solid #e6edf7;
  }
  .main-nav a { padding: 8px 9px; font-size: 11px; }
  .hero-content { padding: 46px 0 40px; }
  .page-hero h1 { font-size: 36px; }
  .page-hero p { font-size: 13px; }
  .page-main { padding: 38px 0 58px; }
  .section-title { align-items: flex-start; flex-direction: column; gap: 6px; }
  .section-title h2 { font-size: 24px; }
  .search-panel { padding: 16px; }
  .portal-search { padding-left: 12px; }
  .portal-search input { font-size: 12px; }
  .portal-search .primary-button { min-width: 58px; padding-inline: 12px; }
  .quick-terms > span { width: 100%; }
  .category-list { display: flex; overflow-x: auto; }
  .category-list button { min-width: max-content; }
  .term-card { padding: 18px; }
  .term-meta { grid-template-columns: 70px 1fr; }
  .trade-page-grid { gap: 9px; }
  .trade-page-card { min-height: 118px; padding: 15px; }
  .trade-page-card strong { font-size: 15px; }
  .trade-detail-panel { padding: 20px; }
  .trade-detail-content { grid-template-columns: 1fr; gap: 22px; }
  .tool-tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .tool-tabs button { min-width: 42%; scroll-snap-align: start; }
  .tool-panel { padding: 18px; }
  .tool-panel-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .field-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 20px; }
  .footer-inner { align-items: flex-start; flex-direction: column; }
  .footer-inner nav { flex-wrap: wrap; gap: 10px 18px; }
}

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