/* 内部 WebView：从右侧推入的整页，自带顶栏和返回 */

.inweb {
  position: fixed;
  inset: 0;
  z-index: 1800;
  pointer-events: none;
}

.inweb[hidden] { display: none; }

.inweb.is-on { pointer-events: auto; }

.inweb-stack {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: transparent;
}

.inweb-page {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  transform: translate3d(100%, 0, 0);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.inweb-page.is-in { transform: translate3d(0, 0, 0); }

.inweb-page.is-out { transform: translate3d(100%, 0, 0); }

.inweb-page.is-dragging { transition: none; }

.inweb-bar {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(44px + var(--safe-top));
  padding: var(--safe-top) 56px 0;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: inset 0 -0.5px 0 rgba(60, 60, 67, .16);
}

.inweb-back {
  position: absolute;
  left: 4px;
  bottom: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ios-label);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.inweb-back svg { display: block; }

.inweb-back:active { transform: scale(.92); }

.inweb-title {
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  font-size: var(--t-headline);
  font-weight: 650;
  letter-spacing: -0.024em;
  line-height: 1.2;
  color: var(--ios-label);
  white-space: nowrap;
}

.inweb-title-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
}

.inweb-bar.is-stack {
  height: calc(56px + var(--safe-top));
}

.inweb-bar.is-stack .inweb-back,
.inweb-bar.is-stack .inweb-actions {
  top: var(--safe-top);
  bottom: 0;
  height: auto;
}

.inweb-title.is-stack {
  flex-direction: column;
  gap: 1px;
}

.inweb-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  max-width: calc(100vw - 148px);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  color: rgba(60, 60, 67, .55);
  white-space: nowrap;
}

.inweb-sub.is-on { color: #34c759; }
.inweb-sub.is-type { color: #007AFF; }

.inweb-sub img,
.inweb-sub b {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border-radius: 50%;
}

.inweb-sub img {
  display: block;
  object-fit: cover;
}

.inweb-sub b {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E8F8EF;
  color: #07C160;
  font-size: 9px;
  font-weight: 650;
}

.inweb-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inweb-mark {
  flex: 0 0 auto;
  width: 0;
  height: 22px;
  margin-right: 0;
  overflow: hidden;
  opacity: 0;
  transform: translate3d(0, 10px, 0) scale(.55);
  transform-origin: center center;
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1), margin-right 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.inweb-mark.is-on {
  width: 22px;
  margin-right: 6px;
  opacity: 1;
  transform: none;
}

.inweb-mark svg,
.inweb-mark img {
  width: 22px;
  height: 22px;
  display: block;
}

.inweb-mark img {
  border-radius: 6px;
  object-fit: cover;
}

.inweb-mark img.is-face,
.inweb-mark b.is-letter {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.inweb-mark b.is-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E8F8EF;
  color: #07C160;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}

.inweb-title.is-person .inweb-title-text {
  animation: inweb-name-in 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes inweb-name-in {
  from { opacity: 0; transform: translate3d(0, 12px, 0); }
  to { opacity: 1; transform: none; }
}

.inweb-actions {
  position: absolute;
  right: 8px;
  bottom: 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.inweb-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ios-label);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
}

.inweb-note svg { display: block; }

.inweb-actions:has(.inweb-note) .inweb-top:not(.is-on) {
  width: 0;
  overflow: hidden;
}

.inweb-actions:empty { display: none; }

.inweb-top {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ios-label);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translate3d(8px, 0, 0) scale(.82);
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 220ms ease, transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.inweb-top.is-on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.inweb-top.is-on:active { transform: scale(.92); }

.inweb-top svg { display: block; }

.inweb-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px calc(var(--safe-bottom) + 16px);
  background: var(--ios-bg);
}

.inweb-frame {
  flex: 1 1 0;
  width: 100%;
  height: 0;
  min-height: 0;
  border: 0;
  background: #f7f7f7;
}

body.is-webview { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .inweb-page { transition: none; }
  .inweb-back:active { transform: none; }
  .inweb-mark, .inweb-top { transition: none; }
  .inweb-title.is-person .inweb-title-text { animation: none; }
}
