: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;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  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;
}
body > main { flex: 1 0 auto; }
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: 9px;
  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: 33px;
  height: 33px;
  display: block;
  flex: none;
  object-fit: contain;
}
.main-nav {
  position: absolute;
  left: 50%;
  display: flex;
  gap: 32px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.main-nav a {
  padding: 10px 14px;
  border-radius: 6px;
  color: #526177;
  font-size: 14px;
  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 a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  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 a:hover { color: var(--blue); background: var(--blue-soft); }
.auth-profile { position: relative; }
.profile-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 3px 8px;
  border: 1px solid #dce6f3;
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
}
.profile-avatar { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; }
.profile-name { max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { color: #788397; font-size: 13px; }
.profile-popover { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: 188px; padding: 12px; border: 1px solid #e1e8f2; border-radius: 10px; background: #fff; box-shadow: 0 12px 30px rgba(19, 42, 75, .14); }
.profile-popover[hidden], .auth-profile[hidden] { display: none; }
.profile-caption { margin: 0 0 10px; color: #748197; font-size: 11px; }
.profile-feedback { margin: 0 0 9px; color: #c2413a; font-size: 11px; line-height: 1.5; }
.profile-feedback[hidden] { display: none; }
.auth-menu .profile-admin { display: block; min-height: 34px; margin-bottom: 6px; padding: 9px; border: 1px solid #dce6f3; border-radius: 6px; color: var(--blue); font-size: 12px; font-weight: 700; text-align: center; text-decoration: none; }
.auth-menu .profile-admin:hover { background: var(--blue-soft); }
.auth-menu .profile-admin[hidden] { display: none; }
.auth-menu .profile-logout { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 34px; padding: 0 9px; border: 0; border-radius: 6px; background: #f2f6fb; color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; }
.auth-menu .profile-logout:hover { background: var(--blue-soft); color: var(--blue); }
.auth-menu .profile-switch { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 34px; margin-bottom: 6px; padding: 0 9px; border: 1px solid #dce6f3; border-radius: 6px; background: #fff; color: var(--navy); font-size: 12px; font-weight: 700; text-align: center; }
.auth-menu .profile-switch:hover { background: var(--blue-soft); color: var(--blue); }

.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; white-space: pre-line; }
.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; white-space: pre-line; }
.inline-content-image { display: block; max-width: min(100%, 760px); max-height: 620px; margin: 14px 0; border: 1px solid var(--line); border-radius: 8px; object-fit: contain; }
.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-panel h2 { margin-bottom: 5px; color: var(--navy); font-size: 25px; }
.auth-panel > p { margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.social-buttons { display: grid; gap: 10px; }
.social-button {
  position: relative;
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid #dce3ec;
  border-radius: 9px;
  background: #fff;
  color: #25344a;
  font-size: 14px;
  font-weight: 750;
  transition: transform .15s, box-shadow .15s;
}
.social-button:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(30, 54, 85, .1); }
.social-mark {
  position: absolute;
  left: 16px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.google-mark { color: #4285f4; font-size: 20px; }
.naver-mark { border-radius: 4px; background: #03c75a; color: #fff; font-size: 16px; }
.social-naver { border-color: #00843c; background: #00843c; color: #fff; }
.social-naver .naver-mark { background: #fff; color: #00843c; }
.kakao-mark { border-radius: 50%; background: #191919; color: #fee500; font-size: 12px; }
.social-kakao { border-color: #fee500; background: #fee500; color: #191919; }
.auth-consents {
  display: grid;
  gap: 2px;
  margin: 18px 0 0;
  padding: 12px 13px;
  border: 1px solid #e3eaf3;
  border-radius: 9px;
  background: #f8faff;
}
.auth-consents[hidden] { display: none; }
.auth-consents legend {
  padding: 0 5px;
  color: #657389;
  font-size: 12px;
  font-weight: 700;
}
.auth-consent-all {
  display: block;
  margin: 0 0 7px 0;
  padding: 5px 9px;
  border: 1px solid #c8d9f2;
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.auth-consent-all:hover,
.auth-consent-all[aria-pressed="true"] { background: #edf4ff; border-color: var(--blue); }
.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  margin: 0;
  color: #657389;
  font-size: 12px;
}
.auth-check input { flex: 0 0 auto; accent-color: var(--blue); }
.auth-check strong { color: var(--blue); }
.auth-check label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.auth-check a { margin-left: auto; color: var(--blue); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.auth-submit { width: 100%; min-height: 48px; }
.auth-submit {
  margin-top: 20px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}
.auth-submit:disabled { opacity: .65; cursor: wait; }
.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: 88px;
  display: flex;
  align-items: center;
  gap: 44px;
}
.footer-inner strong { font-size: 18px; }
.footer-inner p { margin: 3px 0 0; color: #9daabd; font-size: 12px; }
.footer-inner nav {
  display: flex;
  justify-content: flex-end;
  order: 3;
  gap: 24px;
  margin-left: auto;
  color: #bec8d6;
  font-size: 13px;
  transform: translateY(8px);
}
.footer-inner nav a:hover { color: #fff; }
.footer-inner small { color: #7f8da1; font-size: 11px; }
.footer-inner .footer-admin-meta { order: 2; color: #bfd7fb; font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (max-width: 900px) {
  .brand small { display: none; }
  .main-nav { gap: 18px; }
  .main-nav a { padding-inline: 10px; 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: 20px; gap: 18px 28px; }
  .footer-inner nav { order: 3; width: 100%; margin-left: 0; transform: none; }
  .footer-inner small { margin-left: auto; }
}

@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: 20px; gap: 8px; }
  .brand-mark { width: 29px; height: 29px; }
  .auth-menu { order: 2; margin-left: auto; }
  .main-nav {
    position: static;
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 18px;
    overflow-x: auto;
    transform: none;
    border-top: 1px solid #e6edf7;
  }
  .main-nav a { padding: 8px 10px; font-size: 12px; }
  .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 { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding-block: 18px; }
  .footer-inner strong { font-size: 16px; }
  .footer-inner p { font-size: 11px; }
  .footer-inner nav { order: 1; width: auto; flex-wrap: nowrap; gap: 8px; margin-left: auto; font-size: 11px; white-space: nowrap; transform: translateY(4px); }
  .footer-inner .footer-admin-meta { order: 3; flex-basis: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 분류는 오른쪽 내용 전환과 스크롤 중에도 유지합니다. */
.guide-sidebar.persistent-sidebar,
.standards-sidebar.persistent-sidebar,
.category-panel.persistent-sidebar,
.tool-sidebar.persistent-sidebar {
  position: sticky;
  top: 94px;
  align-self: start;
  max-height: calc(100dvh - 112px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tools-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.tools-content { min-width: 0; }
.tool-sidebar { padding: 20px 15px; }
.tool-sidebar h2 { margin: 0 8px 14px; color: var(--navy); font-size: 18px; }
.tool-sidebar .tool-tabs { display: grid; grid-template-columns: 1fr; gap: 5px; padding: 0; margin: 0; overflow: visible; scroll-snap-type: none; }
.tool-sidebar .tool-tabs button { min-width: 0; text-align: left; }
@media (max-width: 640px) {
  .guide-sidebar.persistent-sidebar,
  .standards-sidebar.persistent-sidebar,
  .category-panel.persistent-sidebar,
  .tool-sidebar.persistent-sidebar {
    top: 116px;
    max-height: min(240px, 34dvh);
  }
  .tools-layout { grid-template-columns: 1fr; gap: 16px; }
  .tool-sidebar { padding: 14px; }
  .tool-sidebar .tool-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Five main menu items stay clear of the logo and account links. */
@media (max-width: 1050px) {
  html { scroll-padding-top: 132px; }
  .header-inner { min-height: 110px; flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; }
  .brand { order: 1; }
  .auth-menu { order: 2; margin-left: auto; }
  .main-nav { position: static; order: 3; width: 100%; transform: none; justify-content: center; gap: 18px; overflow-x: auto; border-top: 1px solid #e6edf7; }
}
@media (max-width: 640px) {
  .main-nav { justify-content: flex-start; gap: 8px; }
  .main-nav a { flex-shrink: 0; }
}

@media (min-width: 641px) and (max-width: 1050px) { .persistent-sidebar { top: 132px !important; max-height: calc(100dvh - 148px) !important; } }
.auth-member-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.auth-member-name[hidden], .auth-menu [hidden] { display: none; }
