/* 연산마스터 공통 상단바 · 로그인 */
body.has-ym-topbar {
  padding-top: 56px;
}
body.has-ym-topbar.has-ym-progress {
  padding-top: 78px;
}

.ym-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 190;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 14px;
  margin: 0;
  background: rgba(255, 252, 245, .92);
  border-bottom: 1px solid rgba(90, 70, 40, .12);
  backdrop-filter: blur(12px);
  font-family: "Pretendard Variable", Pretendard, "Malgun Gothic", sans-serif;
  color: #1c1a16;
}

.ym-topbar-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ym-topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.ym-topbar-brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}
.ym-topbar-brand span {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.ym-topbar-edition {
  display: inline-block;
  margin-left: 2px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -.01em;
  color: var(--vol, #c44b3c);
  white-space: nowrap;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: baseline;
}
.ym-topbar-edition:not([hidden])::before {
  content: "·";
  margin-right: 5px;
  color: rgba(90, 70, 40, .35);
  font-weight: 600;
}

/* 앱 진행 요약 — 두 번째 바가 아니라 탑바 아래 한 줄 텍스트 */
.ym-topbar-progress {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  z-index: 189;
  box-sizing: border-box;
  margin: 0;
  padding: 5px 16px 6px;
  font-family: "Pretendard Variable", Pretendard, "Malgun Gothic", sans-serif;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  color: #7a7366;
  text-align: right;
  background: transparent;
  border: 0;
  pointer-events: none;
}
.ym-topbar-progress[hidden] {
  display: none !important;
}
@media (max-width: 720px) {
  .ym-topbar-edition {
    max-width: 28vw;
    font-size: 11px;
  }
  .ym-topbar-progress {
    text-align: center;
    padding-left: 54px;
    padding-right: 12px;
  }
}

/* 로고 오른쪽 KR | EN | JP — 클릭 전환, 호버 즉시 툴팁 */
.ym-lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  user-select: none;
}
.ym-lang-btn {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px 5px;
  margin: 0;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  color: #8a8174;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1;
}
.ym-lang-btn:hover {
  color: #1c1a16;
  background: rgba(90, 70, 40, .06);
}
.ym-lang-btn.is-on {
  color: #1c1a16;
  font-weight: 850;
}
.ym-lang-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%) translateY(-2px);
  padding: 5px 8px;
  border-radius: 7px;
  background: #1c1a16;
  color: #fffcf5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1.2;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: none;
  z-index: 220;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}
.ym-lang-btn[data-tip]::before {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-bottom-color: #1c1a16;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  z-index: 221;
}
.ym-lang-btn[data-tip]:hover::after,
.ym-lang-btn[data-tip]:focus-visible::after,
.ym-lang-btn[data-tip]:hover::before,
.ym-lang-btn[data-tip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
}
.ym-lang-sep {
  font-size: 11px;
  color: rgba(90, 70, 40, .35);
  line-height: 1;
}

html[data-ym-lang="en"] .ym-topbar-brand span,
html[data-ym-lang="jp"] .ym-topbar-brand span {
  font-size: 13px;
}

.ym-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 0;
}

.ym-topbar-hub {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(21, 27, 36, .12);
  background: #151b24;
  color: #f3efe7;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(15, 18, 24, .12);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ym-topbar-hub img {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: block;
}
.ym-topbar-hub span {
  font-family: Hahmlet, "Nanum Myeongjo", Georgia, serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1;
  padding-right: 4px;
}
.ym-topbar-hub:hover,
.ym-topbar-hub:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(232, 192, 122, .45);
  box-shadow: 0 8px 18px rgba(15, 18, 24, .18);
  outline: none;
}

.ym-topbar-auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.ym-topbar-name {
  font-size: 13px;
  font-weight: 700;
  color: #3a3228;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ym-topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(90, 70, 40, .16);
  background: #fff;
  color: #1c1a16;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
}
.ym-topbar-btn:hover { border-color: rgba(42, 90, 140, .35); }
.ym-topbar-btn.is-primary {
  background: #1c1a16;
  border-color: #1c1a16;
  color: #fff8e8;
}
.ym-topbar-btn.is-ghost {
  background: transparent;
  border-color: transparent;
  color: #6a5a40;
}
.ym-topbar-btn.is-ghost:hover { color: #1c1a16; background: rgba(90, 70, 40, .06); }

.ym-topbar-paid {
  font-size: 11px;
  font-weight: 800;
  color: #2f6b45;
  background: rgba(47, 107, 69, .1);
  padding: 3px 8px;
  border-radius: 999px;
}

/* 간단 로그인 모달 (전 페이지) */
.ym-login-modal {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}
.ym-login-modal.is-on {
  opacity: 1;
  pointer-events: auto;
}
.ym-login-modal[hidden] { display: none !important; }
.ym-login-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 26, 22, .45);
  backdrop-filter: blur(3px);
}
.ym-login-card {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: #fffcf5;
  border: 1px solid rgba(90, 70, 40, .14);
  box-shadow: 0 22px 50px rgba(30, 24, 16, .28);
}
.ym-login-card h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}
.ym-login-card .ym-login-lead {
  margin: 6px 0 14px;
  font-size: 13px;
  color: #6a5a40;
  font-weight: 600;
}
.ym-login-x {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #6a5a40;
}
.ym-login-field {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}
.ym-login-field span {
  font-size: 12px;
  font-weight: 700;
  color: #6a5a40;
}
.ym-login-field input {
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(90, 70, 40, .18);
  background: #fff;
  font: inherit;
  font-size: 14px;
}
.ym-login-error {
  min-height: 18px;
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 650;
  color: #c62828;
}
.ym-login-submit {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #1c1a16;
  color: #fff8e8;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}
.ym-login-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #6a5a40;
}
.ym-login-foot button {
  border: 0;
  background: transparent;
  color: #2a5a8c;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 페이지 자체 auth-bar는 상단바로 통합 */
body.has-ym-topbar #authBar {
  display: none !important;
}

/* upnav는 탑바 안으로 편입 — 본문과 겹치지 않음 */
body.has-ym-topbar a.upnav:not(.upnav--inbar):not(.upnav--bar) {
  top: 66px;
}
body.has-ym-topbar.has-ym-progress a.upnav:not(.upnav--inbar):not(.upnav--bar) {
  top: 88px;
}

@media (max-width: 720px) {
  .ym-topbar-brand span { display: none; }
  .ym-topbar { padding: 8px 10px; }
  .ym-topbar-right { gap: 6px; }
  .ym-topbar-hub { padding: 3px 6px 3px 3px; }
  .ym-topbar-hub span { font-size: 12px; }
}
