:root {
  --bar-a: #78a834ff;
  --bar-b: #78a834ff;
  --bg: rgb(248, 248, 248);
  --surface: #ffffff;
  --text: #111;
  --muted: #6b7280;
  --ring: rgba(23, 37, 84, .12);
  --radius: 14px;
  --edge-x: clamp(16px, 6vw, 88px);
  --aside-w: clamp(240px, 28%, 360px);
  --shadow-card: 0 1px 0 rgba(0, 0, 0, .03), 0 10px 28px rgba(16, 24, 40, .06);
  --base-font: 16px;
  --hr: #eff2f9;
  --success-bg: #eaffe6;
  --success-border: #c7e7c7;
  --success-text: #126b12;
}

html,
body {
  margin: 0;
  padding: 0
}

html,
body.namu {
  background: var(--bg);
  color: var(--text);
  font-family: 'SUIT', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: var(--base-font);
  text-size-adjust: 100%;
}

.namu a {
  color: #1d4ed8;
  text-decoration: none
}

.namu a:hover {
  text-decoration: underline
}

.topbar {
  background: linear-gradient(90deg, var(--bar-a), var(--bar-b));
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 var(--edge-x);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .05);
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 18px
}

.logo a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  margin-top: 5px;
}

.logo img {
  display: block;
  height: 42px;
  width: auto;
  margin: 0;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 5px;
}

.nav>a,
.nav>.menu {
  color: #eef2ff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px
}

.nav>a,
.nav>.menu>button {
  font-size: 17px
}

.nav>a:hover,
.nav>.menu:hover {
  color: #fff
}

.nav>a {
  text-decoration: none;
}

.nav>a:hover {
  text-decoration: none;
}

.dropdown {
  position: relative
}

.dropdown>button {
  color: #eef2ff;
  font-weight: 700;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0
}

.dropdown-panel {
  position: absolute;
  top: 28px;
  left: 0;
  min-width: 200px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .15);
  padding: 8px;
  display: none;
  z-index: 9999
}

.dropdown-panel a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #111827 !important;
  font-weight: 600 !important
}

.dropdown-panel a:hover {
  background: #f4f6fb;
  text-decoration: none
}

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 0 0 1px var(--ring), 0 8px 22px rgba(0, 0, 0, .06)
}

.search input {
  width: clamp(120px, 16vw, 240px);
  font-size: 14px;
  background: transparent;
  caret-color: #333;
  border: 0 !important;
  border-bottom: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  -webkit-appearance: none;
  appearance: none;
}

.top-icon {
  height: 40px;
  width: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  color: #2e5bff;
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--ring), 0 6px 18px rgba(0, 0, 0, .08)
}

.container {
  max-width: clamp(320px, 92vw, 1320px);
  margin: 24px auto;
  padding: 0 var(--edge-x);
  display: grid;
  grid-template-columns: minmax(0, 80%) minmax(200px, 20%);
  column-gap: 18px;
  row-gap: 18px;
}

main.main,
aside.do_fixed {
  min-width: 0;
}

aside.do_fixed {
  position: static;
  width: 100%;
}

.main {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card)
}

.main__title {
  padding: 22px 30px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  row-gap: 12px;
}

.title h1 {
  margin: 0;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -.01em;
}

.sub {
  color: var(--muted);
  margin-left: 6px;
  font-weight: 600
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  flex-basis: 100%;
}

.actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  color: #374151;
  background: #f6f7fb;
}

.actions a:hover {
  background: #eef1f7;
  text-decoration: none
}

.main__body {
  padding: 0 30px 12px
}

.pre_banner {
  margin-top: 0
}

.meta {
  padding: 12px 30px 18px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  border-top: 1px solid #eef0f3
}

.pre_banner {
  margin-top: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.pre_banner h1,
.pre_banner h2,
.pre_banner h3,
.pre_banner h4,
.pre_banner h5,
.pre_banner h6 {
  border-bottom: 0 !important;
  padding-bottom: 0;
  margin-bottom: 0;
}

.wiki h2,
.wiki h3,
.wiki h4 {
  border-bottom: 1px solid var(--hr);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.wiki h4 {
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.wiki .toc h2,
.wiki .toc h3,
.wiki .toc h4,
.wiki .category h2,
.wiki .category h3,
.wiki .category h4,
.wiki [class*="cate"] h2,
.wiki [class*="cate"] h3,
.wiki [class*="cate"] h4,
.wiki [id*="cate"] h2,
.wiki [id*="cate"] h3,
.wiki [id*="cate"] h4 {
  border-bottom: 0 !important;
  padding-bottom: 0;
  margin-bottom: .5rem;
}

hr,
.opennamu_main hr {
  border: 0;
  height: 1px;
  background: var(--hr);
  margin: 16px 0;
}

.main_hr {
  display: block !important;
  border: 0 !important;
  height: 0 !important;
  background: transparent !important;
  margin: 6px 0 !important;
  padding: 0 !important;
}

.opennamu_main .opennamu_recent_change {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
  margin: 0 !important;
}

.rc_wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.rc_wrap .opennamu_recent_change {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.wiki hr {
  border: 0;
  height: 1px;
  background: var(--hr);
  margin: 16px 0;
}

.wiki .opennamu_main hr {
  border: 0;
  height: 1px;
  background: var(--hr);
  margin: 16px 0;
}

.aside {
  display: flex;
  flex-direction: column;
  gap: 14px
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 14px
}

.recent-box {
  min-height: 360px;
  margin-bottom: 16px
}

.card h3 {
  margin: 4px 8px 10px;
  font-size: 16px;
  color: #111827
}

.card h3 {
  margin: 4px 8px 10px;
  font-size: 16px;
  color: #111827
}

.side_card.rc_box {
  background: var(--surface);
  border: 1px solid #e6eaf2;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .03), 0 10px 28px rgba(16, 24, 40, .06);
  padding: 12px;
}

.rc_wrap {
  margin-top: 8px;
}

.rc_wrap ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.rc_wrap li {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid #e6eaf2;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 8px 2px !important;
}

.rc_wrap li:last-child {
  border-bottom: 0;
}

.main {
  border: 1px solid #e6eaf2;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 20px 0 40px;
  font-size: 13px
}

.footer {
  text-align: center;
  color: var(--muted);
  padding: 20px 0 40px;
  font-size: 13px
}

@media (max-width:640px) {
  .container {
    grid-template-columns: 1fr;
    column-gap: 0;
  }

  aside.do_fixed {
    display: none;
  }

  /* 헤더 요소 간 간격 축소 */
  .topbar, .topbar__left, .nav {
    gap: 8px !important;
  }

  /* 라벨만 숨기고 아이콘은 유지하여 공간 확보 */
  .nav .label {
    display: none !important;
  }

  .topbar__right {
    flex: 1 !important;
    gap: 8px !important;
    margin-left: 8px !important;
  }

  .search {
    flex: 1 !important;
    width: auto !important;
    max-width: none !important;
  }

  .search input {
    width: 100% !important;
    max-width: none !important;
  }

  .actions {
    margin-top: 16px;
  }
}

.icon-random {
  margin-left: 60px;
}

.footer-inner {
  max-width: min(920px, 90%);
  margin: 0 auto;
}

.footer .license-text,
.footer .credit {
  max-width: 68ch;
  margin: 6px auto;
  line-height: 1.6;
  word-break: keep-all;
  text-wrap: pretty;
}

@media (max-width:1024px) {
  :root {
    --edge-x: clamp(12px, 3.5vw, 40px); /* 가로 간격 대폭 축소 */
  }

  .container {
    max-width: 96vw; /* 전체 너비 확장 */
    column-gap: 12px;
  }

  .topbar {
    gap: 12px;
  }

  .actions a {
    transform: scale(0.9);
    transform-origin: left center;
  }

  .icon-random {
    display: none !important;
  }

  .nav .menu .label {
    display: none;
  }

  .nav .menu button .iconify[data-icon="ic:baseline-arrow-drop-down"] {
    display: none;
  }

  .topbar__left {
    flex: 0 0 auto;
  }

  .topbar__right {
    flex: 1 1 auto;
  }

  .logo {
    margin-left: 10px;
  }

  .topbar__right {
    padding-right: 20px;
  }

  .nav {
    margin-left: -15px;
  }

  .main__body {
    padding: 0 15px 12px !important;
  }

  .main__title {
    padding: 20px 20px 0 !important;
  }

  .actions {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    white-space: nowrap;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .actions::-webkit-scrollbar {
    display: none;
  }

  .actions a {
    flex: 0 0 auto;
    padding: 6px 10px;
  }

  /* 1024px 이하에서는 사이드바가 보일 수 있도록 컨테이너 스타일 유지 */
  .main {
    min-height: calc(100vh - 64px);
  }

  .search {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: none !important;
  }

  .search input {
    width: 100% !important;
    max-width: none;
  }
}

/* 스마트폰 등 소형 기기에서만 모바일 UI(화이트 배경, 1열) 적용 */
@media (max-width:640px) {
  :root {
    --bg: #ffffff;
    --edge-x: 0px;
  }

  body.namu {
    background: #ffffff;
  }

  .container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    display: block !important;
  }

  aside.do_fixed {
    display: none !important;
  }
}

@media (max-width: 480px) {
  aside.do_fixed {
    display: none !important;
  }
}

/* User Info Header Styles */
.user-info-header {
  padding: 8px 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0;
  margin-top: -5px;
}

.user-info-label {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 2px;
  font-weight: 500;
  opacity: 0.8;
}

.user-info-name {
  color: var(--text);
  font-weight: 750;
  font-size: 22px;
  line-height: 1.2;
  word-break: break-all;
}
