/* finesse · register=h5 · morph=A.1-daily-desk · shell=system-status+five-tab-app · SOUL=7 SPECTACLE=3 DENSITY=6 */
:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--qa-color-bg);
  --shell-bg: var(--qa-color-bg);
  --shell-ink: var(--qa-color-text-main);
  --shell-line: var(--qa-color-line);
  --shell-shadow: var(--qa-shadow-float);
  --shell-ease: var(--qa-ease-standard);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--qa-color-bg);
}

.app-viewport {
  position: relative;
  width: 100%;
  max-width: 375px;
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  overflow: hidden;
  background: var(--shell-bg);
  isolation: isolate;
}

.app-viewport iframe {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--shell-bg);
  opacity: 1;
  transition: opacity 160ms ease;
}

.app-viewport iframe.is-loading { opacity: .7; }

.system-status {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  height: calc(env(safe-area-inset-top) + 44px);
  padding: env(safe-area-inset-top) 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--shell-ink);
  pointer-events: none;
}

body[data-system-status-surface="white"] .system-status {
  background: #fff;
}

body[data-system-status-surface="dark"] .system-status {
  color: #fff;
  text-shadow: 0 1px 3px rgba(16, 10, 34, .35);
}

body[data-system-status-surface="dark"] .home-indicator {
  background: #fff;
  opacity: .94;
}

body[data-system-status-surface="immersive"] :is(.system-status, .home-indicator) {
  visibility: hidden;
}

.system-status time {
  font-size: 14px;
  line-height: 1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.system-status__icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.system-status__icons svg {
  width: 19px;
  height: 14px;
  overflow: visible;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.system-status__icons svg:nth-child(2) { fill: none; }
.system-status__icons svg:nth-child(3) { width: 25px; fill: none; }
.system-status__icons svg:nth-child(3) path:last-child { fill: currentColor; stroke: none; }

.home-indicator {
  position: absolute;
  z-index: 22;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 5px);
  width: 118px;
  height: 4px;
  border-radius: 999px;
  background: var(--shell-ink);
  opacity: .88;
  transform: translateX(-50%);
  pointer-events: none;
}

body[data-hide-home-indicator="true"] .home-indicator {
  display: none !important;
}

.scope-toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px));
  max-width: min(320px, calc(100vw - 36px));
  padding: 11px 16px;
  border-radius: 999px;
  color: var(--qa-color-white);
  background: var(--qa-toast-bg);
  box-shadow: var(--qa-shadow-float);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 220ms ease, transform 220ms var(--shell-ease);
}

.scope-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 560px) {
  body {
    background: var(--qa-color-bg);
  }

  .app-viewport {
    width: 375px;
    height: min(812px, 94vh);
    height: min(812px, 94dvh);
    border: var(--qa-space-2) solid var(--qa-color-line);
    border-radius: var(--qa-radius-sheet);
    box-shadow: var(--qa-shadow-float);
  }

  /* The 100-flip confirmation owns the bottom safe-area surface. Let its
     artwork reach the clipped phone edge without a second shell border. */
  body[data-hide-home-indicator="true"] .app-viewport {
    border-bottom-width: 0;
  }
}

body[data-shell-mode="native"] {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: stretch;
}

body[data-shell-mode="native"] .app-viewport {
  width: 100%;
  max-width: 375px;
  height: 100vh;
  height: 100dvh;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body[data-shell-mode="native"] .app-viewport iframe {
  width: 100%;
  height: 100%;
}

/* 游戏页自身已经包含完整的 90px 底部标签栏。
 * 手机壳层不再重复预留底部安全区，避免标签栏下方露出粉色空带。 */
body[data-shell-mode="native"][data-active-page="user-game"] .app-viewport {
  padding-bottom: 0;
}

body[data-shell-mode="native"] .system-status,
body[data-shell-mode="native"] .home-indicator {
  display: none !important;
}

/* Hide the simulated system chrome before JS runs on touch-only phones. */
@media (max-width: 559px) and (hover: none),
       (max-width: 559px) and (pointer: coarse) {
  .system-status,
  .home-indicator {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
