/* =============================================================================
 * 서명전에 — Web App Shell
 * 모바일 우선. 900px 이상에서 사이드바 + 센터 컬럼.
 * ========================================================================== */

.web-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--label);
}

/* ------- Main area ------- */
.web-main {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding-bottom: calc(var(--tabbar-h, 49px) + var(--sa-bottom, 0px));
}
.web-main--nochrome {
  padding-bottom: 0;
}

/* Viewport: 화면 컨테이너. 모바일에서는 풀폭, 데스크톱에서는 520px.
   탭바 wrap 이 `tabbar-h + sa-bottom` 높이를 먹기 때문에 이 값을 제외한 만큼이
   실질 뷰포트. min-height 가 아닌 `height` 로 고정해야 내부 flex 자식(.app,
   .scroll)이 resolved height 를 갖고 overflow-y: auto 가 제대로 발동한다.
   데스크톱(≥900px) 은 아래 미디어 쿼리에서 덮어쓴다. */
.web-viewport {
  width: 100%;
  max-width: 520px;
  height: calc(100dvh - var(--tabbar-h, 49px) - var(--sa-bottom, 0px));
  background: var(--surface);
  position: relative;
  overflow: hidden; /* .app 내부 .scroll이 자체 스크롤 */
  display: flex;
  flex-direction: column;
}

/* ------- Tab bar wrap -------
   웹 shell 에서 탭바는 `.app` 바깥으로 빠져 있기 때문에, iOS용 .tabbar 의
   `position: absolute; bottom: max(34px, sa-bottom)` 플로팅 로직을 그대로
   쓰면 모바일 브라우저(sa-bottom=0)에선 34px 만큼 화면 바닥 위로 둥둥 떠서
   탭바 아래로 본문이 비쳐 보이고, 탭바 윗부분이 본문을 가리는 버그가 난다.
   → wrap 이 화면 바닥에 고정된 채 iOS 홈 인디케이터 영역(sa-bottom)을
   padding 으로 챙기고, 내부 .tabbar 는 flex 로 앉혀서 바닥에 딱 붙인다.
   배경 블러·테두리도 wrap 으로 올려서 safe area 구간까지 연속적으로 보이게. */
.web-tabbar-wrap {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 0.5px solid var(--separator);
  padding-bottom: var(--sa-bottom, 0px);
  /* wrap 자체는 이벤트를 받지 않아 스크롤/탭 제스처가 통과. 배경·블러는 그대로 렌더.
     내부 .tabbar 만 pointer-events: auto 로 터치를 받아 탭 동작 담당. */
  pointer-events: none;
}
.web-tabbar-wrap > .tabbar {
  width: 100%;
  max-width: 520px;
  /* iOS .app 내부에서 쓰던 absolute 떠있기를 웹 shell 에선 무효화 */
  position: relative;
  bottom: auto;
  /* 배경·블러·테두리는 wrap 이 담당 → 본체는 투명 */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 0;
  pointer-events: auto;
}

/* ------- Sidebar (≥900px) ------- */
.sidebar {
  display: none;
}

@media (min-width: 900px) {
  .web-shell {
    flex-direction: row;
  }
  .web-main {
    flex: 1;
    padding: 24px 32px 24px;
    align-items: flex-start;
    padding-bottom: 24px;
  }
  .web-viewport {
    max-width: 440px;
    min-height: calc(100dvh - 48px);
    border-radius: 20px;
    box-shadow: var(--shadow-2);
    border: 1px solid var(--separator);
    overflow: hidden;
  }
  .web-tabbar-wrap { display: none; }

  .sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    min-height: 100dvh;
    padding: 22px 14px 18px;
    background: var(--surface);
    border-right: 1px solid var(--separator);
    position: sticky;
    top: 0;
    gap: 4px;
    transition: width var(--dur-2) var(--ease);
  }
  .sidebar--collapsed {
    width: 72px;
    padding: 22px 10px 18px;
  }
}

.sidebar__brand {
  padding: 4px 10px 16px;
  display: flex;
  align-items: center;
  min-width: 0;       /* flex 자식이 부모 밖으로 밀리지 않게 */
  overflow: hidden;   /* 혹시 워드마크가 남아 있어도 컨테이너 밖으로 삐져나오지 않게 */
}
.sidebar--collapsed .sidebar__brand {
  justify-content: center;
  padding: 4px 0 16px;
}

.sidebar__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  border: 0;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 10px;
  white-space: nowrap;
  transition: background var(--dur-1) var(--ease);
}
.sidebar__cta:hover { background: var(--brand-hover); }
.sidebar__cta:active { background: var(--brand-press); }
.sidebar--collapsed .sidebar__cta {
  padding: 12px 0;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--label);
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-align: left;
  white-space: nowrap;
  transition: background var(--dur-1) var(--ease);
}
.sidebar__link:hover {
  background: var(--fill-4);
}
.sidebar__link.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}
.sidebar--collapsed .sidebar__link {
  justify-content: center;
  padding: 10px 0;
}

.sidebar__wallet {
  padding: 14px 14px 12px;
  background: var(--brand-soft);
  border-radius: 14px;
  margin-bottom: 10px;
}
.sidebar__wallet-label {
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
  opacity: 0.8;
  margin-bottom: 2px;
}
.sidebar__wallet-val {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: var(--brand-ink);
  margin-bottom: 10px;
  font-family: var(--font-rounded);
}
.sidebar__wallet-val > .tnum {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sidebar__wallet-unit { font-size: 14px; font-weight: 500; }
.sidebar__wallet-cta {
  width: 100%;
  padding: 10px;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.01em;
}
.sidebar__wallet-cta:hover { background: var(--brand-hover); }

.sidebar__collapse {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--fill-4);
  border: 0;
  color: var(--label-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  align-self: flex-end;
  margin-top: 4px;
}
.sidebar__collapse:hover { background: var(--fill-3); }
.sidebar--collapsed .sidebar__collapse { align-self: center; }

/* ------- 모바일: iOS .app 컨테이너가 이미 풀뷰포트로 동작하게 덮어쓰기 -------
   flex column 스크롤의 고전 버그 방어:
   - flex item 의 default `min-height: auto` 가 자식 콘텐츠 크기로 잠겨버려
     내부 `.scroll` 의 `overflow-y: auto` 가 발동을 못 한다.
   - height:100% + min-height:100% 을 강제로 쓰면 flex:1 과 충돌해서 일부
     환경(Chrome DevTools 모바일 에뮬 포함)에서 스크롤이 body 로 넘어가
     rubber-band 튕김만 남는다.
   → height/min-height 강제를 모두 빼고 `flex: 1 1 0` 과 `min-height: 0` 만으로
     사이즈를 결정하도록 정리. 내부 .scroll 에도 min-height: 0 을 같이 명시해야
     overflow 가 제대로 산다. */
.web-viewport .app {
  width: 100%;
  min-height: 0;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  padding-top: 0;
  padding-bottom: 0;
}
.web-viewport .scroll {
  flex: 1 1 0;
  min-height: 0;
}

/* ------- Sheet (웹) ------- */
/* 모바일에서는 bottom sheet, 데스크톱에서는 센터 모달 */
@media (min-width: 900px) {
  .sheet-root {
    align-items: center !important;
    justify-content: center;
    display: flex;
  }
  .sheet-root .sheet {
    position: relative;
    max-width: 480px;
    width: 100%;
    margin: 0 auto;
    border-radius: 20px;
    transform: scale(0.96) !important;
    opacity: 0;
    transition: transform var(--dur-2) var(--ease-spring), opacity var(--dur-2) var(--ease);
  }
  .sheet-root.is-open .sheet {
    transform: scale(1) !important;
    opacity: 1;
  }
  .sheet-root .sheet__grabber { display: none; }
}

/* ------- Web-only: 랜딩 · 로그인 ------- */
.web-landing {
  min-height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
.web-landing__nav {
  padding: 20px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.web-landing__nav > :first-child { flex-shrink: 0; white-space: nowrap; }
.web-landing__nav-actions {
  display: flex;
  gap: 8px;
}
.web-landing__nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  color: var(--label);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.web-landing__nav-link:hover { background: var(--fill-4); }
.web-landing__nav-link--primary {
  background: var(--brand);
  color: #fff;
}
.web-landing__nav-link--primary:hover { background: var(--brand-hover); }

.web-landing__hero {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px 60px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
@media (min-width: 900px) {
  .web-landing__hero {
    grid-template-columns: 1.1fr 1fr;
    padding: 80px 40px 100px;
    gap: 80px;
  }
}

.web-landing__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
.web-landing__title {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 20px;
  color: var(--label);
  font-family: var(--font);
  word-break: keep-all;
}
.web-landing__sub {
  font-size: 17px;
  line-height: 1.55;
  color: var(--label-secondary);
  opacity: 0.75;
  margin: 0 0 28px;
  max-width: 520px;
  letter-spacing: -0.01em;
}
.web-landing__cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.web-landing__cta {
  padding: 14px 22px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  border: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.web-landing__cta:hover { background: var(--brand-hover); }
.web-landing__cta:active { transform: translateY(1px); background: var(--brand-press); }
.web-landing__cta--ghost {
  background: var(--fill-4);
  color: var(--label);
}
.web-landing__cta--ghost:hover { background: var(--fill-3); }
.web-landing__trust {
  font-size: 13px;
  color: var(--label-secondary);
  opacity: 0.65;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.web-landing__trust-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  align-self: center;
  opacity: 0.5;
}

/* Hero illustration */
.web-landing__art {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 480px;
  width: 100%;
  justify-self: center;
}
.web-landing__art-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, var(--brand-soft), transparent 60%),
              linear-gradient(135deg, var(--tds-grey-50) 0%, var(--tds-blue-50) 100%);
  border-radius: 32px;
}
.web-landing__art-card {
  position: absolute;
  top: 10%;
  left: 12%;
  right: 12%;
  bottom: 10%;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.web-landing__art-line {
  height: 8px;
  border-radius: 4px;
  background: var(--tds-grey-200);
}
.web-landing__art-line--alert {
  background: var(--alert);
  opacity: 0.6;
}
.web-landing__art-line--warn {
  background: var(--warn);
  opacity: 0.6;
}
.web-landing__art-seal {
  position: absolute;
  bottom: -4%;
  right: 4%;
  width: 110px;
  height: 110px;
  display: grid;
  place-items: center;
  background: var(--brand);
  border-radius: 24px;
  box-shadow: var(--shadow-3);
  transform: rotate(-8deg);
}

.web-landing__section {
  padding: 60px 20px;
  background: var(--bg);
}
.web-landing__section-inner {
  max-width: 1100px;
  margin: 0 auto;
}
.web-landing__section-title {
  font-size: clamp(26px, 3.5vw, 38px);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
  line-height: 1.2;
  color: var(--label);
  word-break: keep-all;
}
.web-landing__section-sub {
  font-size: 16px;
  color: var(--label-secondary);
  opacity: 0.7;
  margin: 0 0 40px;
  max-width: 620px;
}

.web-landing__features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 700px) {
  .web-landing__features { grid-template-columns: repeat(3, 1fr); gap: 20px; }
}

.web-landing__feature {
  padding: 28px;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.web-landing__feature-ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.web-landing__feature-h {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--label);
  margin: 0;
}
.web-landing__feature-p {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--label-secondary);
  opacity: 0.8;
  margin: 0;
  letter-spacing: -0.005em;
}

.web-landing__footer {
  padding: 32px 20px 40px;
  text-align: center;
  color: var(--label-secondary);
  opacity: 0.55;
  font-size: 13px;
  border-top: 1px solid var(--separator);
  background: var(--surface);
}

/* ------- Auth pages ------- */
.web-auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: var(--bg);
}
.web-auth__card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--separator);
}
.web-auth__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}
.web-auth__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  text-align: center;
  margin: 0 0 6px;
}
.web-auth__sub {
  font-size: 14.5px;
  color: var(--label-secondary);
  opacity: 0.7;
  text-align: center;
  margin: 0 0 26px;
}
.web-auth__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.web-auth__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--label-secondary);
  letter-spacing: -0.005em;
}
.web-auth__input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--separator);
  background: var(--surface);
  font-family: inherit;
  font-size: 15px;
  color: var(--label);
  outline: none;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
  letter-spacing: -0.01em;
}
.web-auth__input:focus {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
.web-auth__submit {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  border: 0;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  margin-top: 10px;
  transition: background var(--dur-1) var(--ease);
}
.web-auth__submit:hover { background: var(--brand-hover); }
.web-auth__divider {
  position: relative;
  text-align: center;
  margin: 20px 0;
  font-size: 12px;
  color: var(--label-secondary);
  opacity: 0.55;
}
.web-auth__divider::before,
.web-auth__divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 26px);
  height: 1px;
  background: var(--separator);
}
.web-auth__divider::before { left: 0; }
.web-auth__divider::after { right: 0; }
.web-auth__social {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.web-auth__social-btn {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--separator);
  background: var(--surface);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--label);
}
.web-auth__social-btn:hover { background: var(--fill-4); }
.web-auth__foot {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--label-secondary);
}
.web-auth__foot-link {
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
  text-decoration: none;
}
.web-auth__foot-link:hover { text-decoration: underline; }

/* 앱인토스 비게임 미니앱 정책(디자인): 라이트 모드 전용 → 기존 dark adjustments 제거 */

/* ------- Tweaks panel (재사용) ------- */
.web-tweaks-toggle { /* 필요 시 확장 */ }
