/* 상위 페이지 — 기본은 고정, 탑바가 있으면 탑바 안으로 이동 */
a.upnav {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  box-sizing: border-box;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(255, 252, 245, .92);
  border: 1px solid rgba(90, 70, 40, .14);
  box-shadow: 0 6px 18px rgba(60, 45, 20, .1);
  text-decoration: none;
  color: #1c1a16;
  font-weight: 400;
  line-height: 1;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
a.upnav:hover {
  background: #fff;
  border-color: rgba(42, 90, 140, .35);
  transform: translateY(-1px);
  color: #1c1a16;
}
a.upnav:focus-visible {
  outline: 2px solid #2a5a8c;
  outline-offset: 2px;
}
.upnav-lines {
  position: relative;
  display: block;
  width: 16px;
  height: 2px;
  margin: 0;
  border-radius: 2px;
  background: currentColor;
}
.upnav-lines::before,
.upnav-lines::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.upnav-lines::before { top: -5px; }
.upnav-lines::after { top: 5px; }

/* 상단 바·앱 헤더에 넣을 때 */
a.upnav.upnav--bar,
a.upnav.upnav--inbar {
  position: relative;
  top: auto;
  left: auto;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(90, 70, 40, .06);
  box-shadow: none;
  z-index: 1;
  transform: none;
}
a.upnav.upnav--bar:hover,
a.upnav.upnav--inbar:hover {
  background: rgba(42, 90, 140, .1);
  border-color: rgba(42, 90, 140, .35);
  transform: none;
}

/* 즉시 툴팁 (언어 토글과 동일 패턴) */
a.upnav[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  padding: 6px 9px;
  border-radius: 8px;
  background: #1c1a16;
  color: #fffcf5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1.25;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: none;
  z-index: 230;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}
a.upnav[data-tip]::before {
  content: '';
  position: absolute;
  left: 14px;
  top: calc(100% + 2px);
  border: 5px solid transparent;
  border-bottom-color: #1c1a16;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 231;
}
a.upnav[data-tip]:hover::after,
a.upnav[data-tip]:focus-visible::after,
a.upnav[data-tip]:hover::before,
a.upnav[data-tip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
}

/* 어두운 배경용 */
a.upnav.upnav--dark {
  background: rgba(21, 32, 43, .88);
  border-color: rgba(255, 255, 255, .12);
  color: #f7f3ec;
}
a.upnav.upnav--dark:hover {
  background: rgba(21, 32, 43, .98);
  border-color: rgba(255, 255, 255, .28);
  color: #f7f3ec;
}
