:root {
  --apps-bg: #08090a;
  --apps-surface: #111113;
  --apps-surface-2: #18181c;
  --apps-border: rgba(255, 255, 255, 0.12);
  --apps-text: #f2f2f4;
  --apps-muted: #8e8e98;
  --apps-accent: #5b7cfa;
  --apps-accent-2: #48b888;
  --apps-glow: rgba(91, 124, 250, 0.35);
  --apps-radius: 14px;
  --apps-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

/* 作品查看页：与文章 iframe 内 --copseed-* 对齐，随主题切换 */
.apps-page-view:not([data-viewer-kind="article"]) #apps-copy-article {
  display: none !important;
}

html.apps-viewer-root[data-theme="dark"] {
  color-scheme: dark;
  --viewer-bg: #0a0c12;
  --viewer-fg: #e8eaef;
  --viewer-muted: #9aa3b5;
  --viewer-border: rgba(255, 255, 255, 0.12);
  --viewer-surface: rgba(255, 255, 255, 0.06);
  --viewer-toolbar-bg: rgba(255, 255, 255, 0.05);
  --viewer-toolbar-border: rgba(255, 255, 255, 0.1);
  --viewer-frame-bg: #0a0c12;
}

html.apps-viewer-root[data-theme="light"] {
  color-scheme: light;
  --viewer-bg: #ffffff;
  --viewer-fg: #141820;
  --viewer-muted: #5c6578;
  --viewer-border: rgba(0, 0, 0, 0.1);
  --viewer-surface: rgba(0, 0, 0, 0.04);
  --viewer-toolbar-bg: rgba(0, 0, 0, 0.03);
  --viewer-toolbar-border: rgba(0, 0, 0, 0.08);
  --viewer-frame-bg: #ffffff;
}

/* 小游戏预览：无外框、居中铺满（不用 16:10 画框） */
body[data-viewer-kind="game"] .apps-frame-wrap,
html.apps-viewer-root body[data-viewer-kind="game"] .apps-view-stage--web .apps-frame-wrap {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent !important;
}

body[data-viewer-kind="game"] .apps-frame-wrap iframe {
  background: transparent !important;
  border-radius: 0 !important;
  visibility: visible !important;
  opacity: 1 !important;
}

body[data-viewer-kind="game"] .apps-bg-glow {
  display: none;
}

body[data-viewer-kind="game"] .apps-view-stage--web {
  flex: 1;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  min-height: 0;
}

body[data-viewer-kind="game"] .apps-view-stage--web .apps-frame-outer,
body[data-viewer-kind="game"] .apps-view-stage--web .apps-iphone17,
body[data-viewer-kind="game"] .apps-view-stage--web .apps-iphone17__bezel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: stretch;
  width: 100%;
  min-height: 0;
}

body[data-viewer-kind="game"] .apps-view-stage--web .apps-iphone17 {
  max-width: none;
}

body[data-viewer-kind="game"] .apps-view-stage--web .apps-frame-wrap {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  aspect-ratio: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  height: 100% !important;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-viewer-kind="game"] .apps-view-stage--web .apps-frame-wrap iframe {
  flex: 1 1 auto;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--apps-font);
  background: var(--apps-bg);
  color: var(--apps-text);
  -webkit-font-smoothing: antialiased;
}

.apps-bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(91, 124, 250, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 35% at 0% 100%, rgba(72, 184, 136, 0.08), transparent 50%);
  z-index: 0;
}

.apps-shell {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.apps-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--apps-border);
}

.apps-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.apps-brand-mark {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
}

.apps-brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.apps-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--apps-muted);
}

.apps-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--apps-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--apps-text);
  text-decoration: none;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
}

html.apps-viewer-root .apps-back {
  border-color: var(--viewer-border);
  background: var(--viewer-surface);
  color: var(--viewer-fg);
}

.apps-back:hover {
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.08);
}

.apps-cta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(91, 124, 250, 0.38);
  background: linear-gradient(
    135deg,
    rgba(91, 124, 250, 0.16) 0%,
    rgba(72, 184, 136, 0.08) 100%
  );
  color: var(--apps-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 0 rgba(91, 124, 250, 0);
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s,
    transform 0.2s;
}

.apps-cta:hover {
  border-color: rgba(91, 124, 250, 0.62);
  background: linear-gradient(
    135deg,
    rgba(91, 124, 250, 0.24) 0%,
    rgba(72, 184, 136, 0.12) 100%
  );
  box-shadow: 0 4px 18px rgba(91, 124, 250, 0.22);
  transform: translateY(-1px);
}

.apps-cta:active {
  transform: translateY(0);
  box-shadow: none;
}

.apps-cta-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--apps-accent);
  line-height: 0;
  animation: apps-cta-arrow-pulse 1.8s ease-in-out infinite;
}

.apps-cta-arrow svg {
  display: block;
}

.apps-cta:hover .apps-cta-arrow {
  animation: apps-cta-arrow-go 0.45s ease forwards;
}

@keyframes apps-cta-arrow-pulse {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.75;
  }
  50% {
    transform: translateX(3px);
    opacity: 1;
  }
}

@keyframes apps-cta-arrow-go {
  0% {
    transform: translateX(0);
  }
  60% {
    transform: translateX(5px);
  }
  100% {
    transform: translateX(3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .apps-cta-arrow {
    animation: none;
  }
  .apps-cta:hover .apps-cta-arrow {
    animation: none;
    transform: translateX(2px);
  }
}

.apps-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.apps-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--apps-border);
}

.apps-tab {
  border: none;
  background: transparent;
  color: var(--apps-muted);
  font: inherit;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.apps-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, rgba(91, 124, 250, 0.85), rgba(72, 184, 136, 0.55));
  box-shadow: 0 4px 16px var(--apps-glow);
}

.apps-search {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
  padding: 9px 14px 9px 36px;
  border-radius: 999px;
  border: 1px solid var(--apps-border);
  background: rgba(255, 255, 255, 0.04) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238e8e98' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E") no-repeat 12px center;
  color: var(--apps-text);
  font: inherit;
  font-size: 13px;
}

.apps-search:focus {
  outline: none;
  border-color: rgba(91, 124, 250, 0.5);
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  min-height: 120px;
}

.apps-grid--loading {
  pointer-events: none;
}

/* 首屏骨架（API 返回前立即展示，避免白屏） */
.apps-card--skeleton {
  pointer-events: none;
  cursor: default;
  min-height: 196px;
  border-color: rgba(255, 255, 255, 0.05);
}

.apps-card--skeleton:hover {
  transform: none;
  box-shadow: none;
}

.apps-card--skeleton .apps-card-media {
  background: linear-gradient(
    110deg,
    #141418 0%,
    #1c1c22 40%,
    #24242c 50%,
    #1c1c22 60%,
    #141418 100%
  );
  background-size: 220% 100%;
  animation: apps-shimmer 1.35s ease-in-out infinite;
}

.apps-card--skeleton .apps-card-foot {
  padding: 10px 12px 12px;
}

.apps-card--skeleton .apps-card-title-line {
  height: 11px;
  border-radius: 6px;
  margin-bottom: 7px;
  background: #1a1a1f;
  animation: apps-shimmer 1.35s ease-in-out infinite;
  animation-delay: 0.12s;
}

.apps-card--skeleton .apps-card-title-line--short {
  width: 58%;
}

@keyframes apps-shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

/* 懒加载图片：占位 → 淡入 */
.apps-lazy-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.28s ease;
  background: #0c0c0e;
}

.apps-lazy-img.is-loaded,
.apps-lazy-img.is-error {
  opacity: 1;
}

.apps-lazy-media--pending video {
  opacity: 0;
}

.apps-lazy-media--pending video.is-loaded {
  opacity: 1;
  transition: opacity 0.28s ease;
}

.apps-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 196px;
  padding: 0;
  border: 1px solid var(--apps-border);
  border-radius: var(--apps-radius);
  background: var(--apps-surface);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 2px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}

.apps-card--game {
  border-color: rgba(72, 184, 136, 0.2);
  background:
    linear-gradient(180deg, rgba(72, 184, 136, 0.05) 0%, transparent 36%),
    var(--apps-surface);
}

.apps-card--game:hover {
  border-color: rgba(72, 184, 136, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 12px 32px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(72, 184, 136, 0.1);
}

.apps-card:hover {
  transform: translateY(-3px);
  border-color: rgba(91, 124, 250, 0.35);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 24px rgba(91, 124, 250, 0.12);
}

.apps-card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(165deg, rgba(91, 124, 250, 0.1) 0%, rgba(18, 22, 34, 0.96) 44%, rgba(10, 12, 18, 1) 100%);
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.apps-card--game .apps-card-media {
  background:
    linear-gradient(165deg, rgba(100, 112, 168, 0.08) 0%, rgba(16, 20, 34, 0.96) 44%, rgba(8, 10, 16, 1) 100%);
}

.apps-card-media img:not(.apps-lazy-img),
.apps-card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.apps-card--game .apps-card-media img,
.apps-card--game .apps-lazy-img {
  object-fit: contain;
  object-position: center;
}

.apps-card-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(186, 194, 228, 0.72);
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(120, 132, 188, 0.14), transparent 55%),
    radial-gradient(90% 70% at 75% 65%, rgba(100, 112, 168, 0.1), transparent 50%),
    linear-gradient(165deg, rgba(18, 22, 36, 0.98) 0%, rgba(10, 12, 20, 1) 100%);
}

.apps-card-placeholder svg {
  width: 42px;
  height: 42px;
  opacity: 0.85;
}

.apps-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(232, 236, 250, 0.96);
  background: rgba(18, 22, 38, 0.52);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.apps-card-badge--game { border-color: rgba(172, 182, 220, 0.3); }
.apps-card-badge--app { border-color: rgba(168, 178, 220, 0.28); }
.apps-card-badge--article { border-color: rgba(188, 194, 228, 0.28); }
.apps-card-badge--video { border-color: rgba(196, 181, 253, 0.28); color: rgba(228, 222, 252, 0.96); }
.apps-card-badge--image { border-color: rgba(212, 200, 168, 0.22); color: rgba(236, 232, 220, 0.96); }

.apps-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.apps-card-play svg {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}

.apps-card--html {
  cursor: default;
}

.apps-card--html:hover {
  transform: translateY(-3px);
}

.apps-card-media--hit {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: inherit;
  color: inherit;
  font: inherit;
}

.apps-card-media--hit:focus-visible {
  outline: 2px solid rgba(91, 124, 250, 0.55);
  outline-offset: -2px;
}

.apps-card-media-blur {
  position: absolute;
  inset: -10%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(22px) saturate(1.14) brightness(0.9);
  transform: scale(1.1);
  pointer-events: none;
}

.apps-card-media-blur::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
}

.apps-card-media--hit.has-media-blur,
.apps-card-media--embed.has-media-blur {
  background: #0a0c12;
}

.apps-card--game .apps-card-media--hit.has-media-blur {
  background: #080a10;
}

.apps-card-media--embed.has-media-blur .webpage-preview-scaler {
  z-index: 1;
}

.apps-card-media--embed.has-media-blur img,
.apps-card-media.has-media-blur img,
.apps-card-media.has-media-blur .apps-lazy-img {
  position: relative;
  z-index: 1;
  object-fit: cover;
  object-position: center;
  background: transparent;
}

.apps-card-media--embed {
  position: relative;
  overflow: hidden;
  min-height: 140px;
  background: transparent;
}

.apps-card-media--embed .webpage-preview-scaler {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: transparent;
}

.apps-card-media--embed .webpage-preview-scaler--fit {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 140px;
  overflow: hidden;
  background: #0a0c12;
}

.apps-card-media--embed .game-cover-stage {
  position: absolute;
  inset: 0;
}

.apps-card-media--embed .game-cover-scaler {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.apps-card-media--embed .game-cover-scaler .webpage-preview-frame {
  display: block;
  border: 0;
  pointer-events: none;
  background: #0a0c12;
}

.apps-card-media--embed .webpage-preview-frame--fit {
  border: 0;
  background: #0a0c12;
  pointer-events: none;
}

.apps-card-loading-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.apps-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.apps-card-act {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--apps-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--apps-text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.apps-card-act:hover {
  border-color: rgba(91, 124, 250, 0.4);
  background: rgba(91, 124, 250, 0.1);
}

.apps-card-act--primary {
  border-color: rgba(91, 124, 250, 0.45);
  color: var(--apps-accent);
  background: rgba(91, 124, 250, 0.12);
}

.apps-card-act--primary:hover {
  background: rgba(91, 124, 250, 0.22);
}

.apps-card-foot {
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.apps-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.apps-empty {
  grid-column: 1 / -1;
  padding: 48px 20px;
  text-align: center;
  color: var(--apps-muted);
  font-size: 14px;
}

.apps-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* —— 独立作品页（随机 *.html 路径，壳页 v.html）：顶栏 + 手机/Web 预览 —— */
.apps-page-view {
  min-height: 100dvh;
  background: var(--viewer-bg, var(--apps-bg));
  color: var(--viewer-fg, var(--apps-text));
}

html.apps-viewer-root .apps-page-view {
  background: var(--viewer-bg);
  color: var(--viewer-fg);
}

html.apps-viewer-root .apps-bg-glow {
  opacity: 0.55;
}

html.apps-viewer-root[data-theme="light"] .apps-bg-glow {
  opacity: 0.35;
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(91, 124, 250, 0.08), transparent 55%),
    radial-gradient(ellipse 50% 35% at 0% 100%, rgba(72, 184, 136, 0.06), transparent 50%);
}

.apps-shell--view {
  max-width: none;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--viewer-bg, var(--apps-bg));
}

html.apps-viewer-root .apps-shell--view {
  background: var(--viewer-bg);
}

.apps-view-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--viewer-bg, rgba(8, 9, 10, 0.9));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.06));
  color: var(--viewer-fg, var(--apps-text));
}

html.apps-viewer-root .apps-view-header {
  background: var(--viewer-bg);
}

.apps-view-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 0 4px;
}

.apps-view-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.apps-view-subtitle {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--viewer-muted, var(--apps-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apps-view-center {
  margin: 0;
  padding: 0 6px;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  color: var(--viewer-muted, var(--apps-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.apps-view-center[hidden] {
  display: none !important;
}

.apps-view-title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--viewer-fg, var(--apps-text));
}

.apps-view-kind {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--viewer-muted, rgba(255, 255, 255, 0.82));
  background: var(--viewer-surface, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.12));
}

.apps-view-kind--article {
  color: #6ee7a8;
  background: rgba(46, 188, 108, 0.12);
  border-color: rgba(46, 188, 108, 0.28);
}

.apps-view-kind--game {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.28);
}

.apps-view-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 4px 6px 4px 5px;
  border-radius: 12px;
  background: var(--viewer-toolbar-bg, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--viewer-toolbar-border, rgba(255, 255, 255, 0.09));
}

.apps-view-toolbar-sep {
  width: 1px;
  height: 22px;
  flex-shrink: 0;
  background: var(--viewer-border, rgba(255, 255, 255, 0.1));
}

.apps-view-toolbar .apps-device-toggle {
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.1));
  background: rgba(0, 0, 0, 0.22);
}

html.apps-viewer-root[data-theme="light"] .apps-view-toolbar .apps-device-toggle {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.08);
}

.apps-view-theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  background: var(--viewer-surface, rgba(255, 255, 255, 0.06));
  color: var(--viewer-fg, rgba(255, 255, 255, 0.9));
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.apps-view-theme-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(255, 255, 255, 0.1);
}

.apps-view-theme-btn:active {
  transform: translateY(0);
}

.apps-view-theme-btn:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.55);
  outline-offset: 2px;
}

.apps-view-cast-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  background: var(--viewer-surface, rgba(255, 255, 255, 0.06));
  color: var(--viewer-fg, rgba(255, 255, 255, 0.9));
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s;
}

.apps-view-cast-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(255, 255, 255, 0.1);
}

.apps-view-cast-btn:active {
  transform: translateY(0);
}

.apps-view-cast-btn:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.55);
  outline-offset: 2px;
}

.apps-view-cast-btn.is-casting {
  border-color: rgba(91, 124, 250, 0.55);
  color: #a5b4fc;
}

.apps-view-cast-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
}

.apps-view-cast-ico svg {
  display: block;
  width: 22px;
  height: 22px;
}

.apps-cast-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.apps-cast-overlay[hidden] {
  display: none !important;
}

.apps-cast-dialog {
  position: relative;
  width: min(100%, 380px);
  padding: 22px 20px 18px;
  border-radius: 16px;
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.12));
  background: var(--viewer-bg, #0f1114);
  color: var(--viewer-fg, #f3f4f6);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.apps-cast-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--apps-muted, rgba(255, 255, 255, 0.55));
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.apps-cast-close:hover {
  color: var(--viewer-fg, #fff);
  background: rgba(255, 255, 255, 0.08);
}

.apps-cast-title {
  margin: 0 28px 8px 0;
  font-size: 17px;
  font-weight: 700;
}

.apps-cast-hint {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--apps-muted, rgba(255, 255, 255, 0.62));
}

.apps-cast-qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.apps-cast-qr {
  display: block;
  width: 168px;
  height: 168px;
  border-radius: 10px;
  background: #fff;
}

.apps-cast-url {
  margin: 0 0 14px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--apps-muted, rgba(255, 255, 255, 0.72));
}

body.apps-cast-open {
  overflow: hidden;
}

.apps-cast-toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  z-index: 2147483645;
  max-width: min(92vw, 360px);
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.14));
  background: rgba(12, 14, 20, 0.92);
  color: var(--viewer-fg, #f3f4f6);
  font-size: 13px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.apps-cast-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

html.apps-viewer-root[data-theme="light"] .apps-cast-toast {
  background: rgba(255, 255, 255, 0.96);
  color: #141820;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

.apps-cast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.apps-cast-share-btn {
  border-color: rgba(96, 165, 250, 0.35);
}

.apps-view-theme-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  line-height: 0;
}

.apps-view-theme-ico svg {
  display: block;
  width: 22px;
  height: 22px;
}

.apps-device-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  border: 1px solid var(--apps-border);
  background: rgba(255, 255, 255, 0.05);
}

.apps-device-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--apps-muted);
  font: inherit;
  line-height: 0;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}

.apps-device-toggle-btn:hover:not(.is-active) {
  color: var(--viewer-fg, rgba(255, 255, 255, 0.82));
  background: rgba(255, 255, 255, 0.06);
}

.apps-device-toggle-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
}

.apps-device-toggle-ico svg {
  display: block;
  width: 18px;
  height: 18px;
}

.apps-device-toggle-btn.is-active {
  color: var(--viewer-fg, #f3f4f6);
  background: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

html.apps-viewer-root[data-theme="light"] .apps-device-toggle-btn {
  color: rgba(20, 24, 32, 0.45);
}

html.apps-viewer-root[data-theme="light"] .apps-device-toggle-btn.is-active {
  color: #141820;
  background: #fff;
  box-shadow:
    0 1px 3px rgba(15, 17, 21, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}

html.apps-viewer-root[data-theme="light"] .apps-device-toggle-btn:hover:not(.is-active) {
  background: rgba(0, 0, 0, 0.04);
  color: rgba(20, 24, 32, 0.72);
}

.apps-device-toggle-btn:focus-visible {
  outline: 2px solid rgba(91, 124, 250, 0.65);
  outline-offset: 2px;
}

.apps-btn--compact {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--viewer-surface, rgba(255, 255, 255, 0.06));
  color: var(--viewer-fg, var(--apps-text));
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.apps-btn--compact:hover {
  background: rgba(91, 124, 250, 0.14);
}

.apps-btn--compact.is-copying {
  opacity: 0.72;
  pointer-events: none;
}

.apps-btn--compact.is-copied {
  background: rgba(64, 168, 120, 0.16);
  color: #48b888;
  border-color: rgba(64, 168, 120, 0.45);
  transform: scale(1.02);
}

.apps-btn--compact.is-copy-error {
  background: rgba(240, 120, 96, 0.14);
  color: #e88870;
  border-color: rgba(240, 120, 96, 0.35);
}

html[data-theme='light'] .apps-btn--compact.is-copied {
  background: rgba(40, 140, 96, 0.12);
  color: #208858;
  border-color: rgba(40, 140, 96, 0.35);
}

html[data-theme='light'] .apps-btn--compact.is-copy-error {
  background: rgba(220, 80, 60, 0.1);
  color: #c85040;
  border-color: rgba(220, 80, 60, 0.28);
}

.apps-view-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: 0;
}

.apps-view-qr[hidden] {
  display: none !important;
}

.apps-view-qr-img {
  display: block;
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
}

.apps-view-qr-label {
  display: none;
}

.apps-btn--ghost {
  background: transparent;
}

.apps-view-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 6px 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  background: var(--viewer-bg, var(--apps-bg));
}

html.apps-viewer-root .apps-view-stage {
  background: var(--viewer-bg);
}

.apps-view-stage--web .apps-frame-outer {
  align-items: center;
  justify-content: center;
}

.apps-view-stage--web .apps-iphone17 {
  width: min(100%, 920px);
  margin-left: auto;
  margin-right: auto;
}

.apps-view-stage--web .apps-frame-wrap {
  width: min(920px, calc(100% - 24px));
  max-width: 920px;
  height: auto;
  flex: 0 1 auto;
  aspect-ratio: 16 / 10;
  max-height: min(calc(100dvh - 120px), 576px);
  min-height: min(480px, calc(100dvh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--viewer-frame-bg, var(--viewer-bg, #070714));
}

html.apps-viewer-root .apps-view-stage--web .apps-frame-wrap {
  background: var(--viewer-frame-bg);
  border-color: var(--viewer-border);
  border: 1px solid var(--apps-border);
  border-radius: var(--apps-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.apps-view-stage--web .apps-frame-wrap iframe {
  height: 100%;
  min-height: 0;
  max-height: none;
  width: 100%;
  flex: 1 1 auto;
}

/* Web 模式：隐藏机模，仅保留内容区 */
.apps-view-stage--web .apps-frame-outer {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.apps-view-stage--web .apps-iphone17 {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  filter: none;
}

.apps-view-stage--web .apps-iphone17__btn,
.apps-view-stage--web .apps-iphone17__island,
.apps-view-stage--web .apps-iphone17__home-bar {
  display: none;
}

.apps-view-stage--web .apps-iphone17__bezel {
  display: flex;
  flex: 1;
  flex-direction: column;
  position: static;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  transform: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.apps-view-stage--web .apps-iphone17__bezel::before {
  display: none;
}

.apps-view-stage--web .apps-frame-wrap {
  position: static;
  flex: 0 1 auto;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
}

/* —— iPhone 17 Pro Max 预览框（桌面端「手机」模式）—— */
.apps-view-stage--mobile:not(.apps-view-stage--native) {
  padding: 4px 8px 12px;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-frame-outer {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17 {
  --iphone-w: 430px;
  --iphone-h: 932px;
  --iphone-radius: 55px;
  --iphone-scale: min(
    1,
    calc((100dvh - 64px) / var(--iphone-h)),
    calc((100vw - 28px) / var(--iphone-w))
  );
  position: relative;
  width: calc(var(--iphone-w) * var(--iphone-scale));
  height: calc(var(--iphone-h) * var(--iphone-scale));
  flex-shrink: 0;
  filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.55)) drop-shadow(0 8px 20px rgba(0, 0, 0, 0.38));
}

/* 深色系窄边框：无浅色 padding 白边，屏幕铺满 */
.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__bezel {
  position: absolute;
  inset: 0;
  width: var(--iphone-w);
  height: var(--iphone-h);
  transform: scale(var(--iphone-scale));
  transform-origin: top center;
  left: 50%;
  margin-left: calc(var(--iphone-w) / -2);
  border-radius: var(--iphone-radius);
  padding: 0;
  overflow: hidden;
  background: #000;
  box-shadow:
    0 0 0 1px #3f3f46,
    0 0 0 2px #18181b,
    0 0 0 3px #27272a,
    inset 0 0 0 1px rgba(0, 0, 0, 0.85);
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__island {
  position: absolute;
  top: 13px;
  left: 50%;
  z-index: 4;
  width: 118px;
  height: 32px;
  margin-left: -59px;
  border-radius: 18px;
  background: #000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__island::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #1a2540 0%, #0a0e18 55%, #000 100%);
  box-shadow: inset 0 0 0 0.5px rgba(60, 90, 140, 0.35);
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-frame-wrap {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: auto;
  height: auto;
  margin: 0;
  min-height: 0;
  max-height: none;
  border: none;
  border-radius: var(--iphone-radius);
  overflow: hidden;
  background: #000;
  box-shadow: none;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  background: #000;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__home-bar {
  position: absolute;
  z-index: 5;
  bottom: 10px;
  left: 50%;
  width: 118px;
  height: 4px;
  margin-left: -59px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

/* 侧键：深灰金属，避免亮白高光 */
.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__btn {
  position: absolute;
  z-index: 2;
  display: block;
  border-radius: 2px;
  background: linear-gradient(90deg, #3f3f46 0%, #52525b 50%, #27272a 100%);
  box-shadow: none;
  pointer-events: none;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__btn--action {
  left: -2px;
  top: 172px;
  width: 2.5px;
  height: 28px;
  border-radius: 2px 0 0 2px;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__btn--vol-up {
  left: -2px;
  top: 224px;
  width: 2.5px;
  height: 52px;
  border-radius: 2px 0 0 2px;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__btn--vol-down {
  left: -2px;
  top: 286px;
  width: 2.5px;
  height: 52px;
  border-radius: 2px 0 0 2px;
}

.apps-view-stage--mobile:not(.apps-view-stage--native) .apps-iphone17__btn--power {
  right: -2px;
  top: 252px;
  width: 2.5px;
  height: 76px;
  border-radius: 0 2px 2px 0;
  background: linear-gradient(270deg, #3f3f46 0%, #52525b 50%, #27272a 100%);
}

/* 真机窄屏：全屏预览，不显示机模 */
.apps-view-stage--mobile.apps-view-stage--native {
  padding: 0;
}

.apps-view-stage--mobile.apps-view-stage--native .apps-frame-outer {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.apps-view-stage--mobile.apps-view-stage--native .apps-iphone17 {
  display: contents;
}

.apps-view-stage--mobile.apps-view-stage--native .apps-iphone17__bezel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.apps-view-stage--mobile.apps-view-stage--native .apps-frame-wrap {
  position: static;
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-height: calc(100dvh - 52px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.apps-view-stage--mobile.apps-view-stage--native .apps-frame-wrap iframe {
  height: calc(100dvh - 52px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: 280px;
}

.apps-view-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.apps-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--apps-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--apps-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

.apps-btn:hover {
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.1);
}

.apps-btn--primary {
  border-color: rgba(91, 124, 250, 0.5);
  background: linear-gradient(135deg, rgba(91, 124, 250, 0.85), rgba(72, 184, 136, 0.45));
}

/* compact 按钮在 .apps-btn 之后重申，避免被 --apps-text 浅色覆盖 */
.apps-page-view .apps-view-toolbar .apps-btn.apps-btn--compact {
  color: var(--viewer-fg, #e8eaef);
  background: var(--viewer-surface, rgba(255, 255, 255, 0.08));
  border: 1px solid var(--viewer-border, rgba(255, 255, 255, 0.14));
  font-weight: 600;
}

html.apps-viewer-root[data-theme="light"] .apps-page-view .apps-view-toolbar .apps-btn.apps-btn--compact {
  color: #141820;
  background: #fff;
  border-color: rgba(0, 0, 0, 0.14);
  box-shadow: 0 1px 2px rgba(15, 17, 21, 0.06);
}

html.apps-viewer-root[data-theme="light"] .apps-page-view .apps-view-toolbar .apps-btn.apps-btn--compact:hover {
  color: #0f172a;
  background: rgba(91, 124, 250, 0.1);
  border-color: rgba(91, 124, 250, 0.35);
}

html.apps-viewer-root[data-theme="dark"] .apps-page-view .apps-view-toolbar .apps-btn.apps-btn--compact:hover {
  color: #fff;
  background: rgba(91, 124, 250, 0.18);
  border-color: rgba(91, 124, 250, 0.4);
}

.apps-frame-wrap {
  border: 1px solid var(--viewer-border, var(--apps-border));
  border-radius: var(--apps-radius);
  overflow: hidden;
  background: var(--viewer-frame-bg, #070714);
  min-height: min(78vh, 820px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.apps-frame-wrap iframe {
  display: block;
  width: 100%;
  height: min(78vh, 820px);
  border: none;
  background: var(--viewer-frame-bg, #070714);
}

.apps-page-view .apps-frame-wrap {
  background: var(--viewer-frame-bg, #070714);
}

html.apps-viewer-root .apps-frame-wrap,
html.apps-viewer-root .apps-frame-wrap iframe {
  background: var(--viewer-frame-bg);
  border-color: var(--viewer-border);
}

html.apps-viewer-root[data-theme="light"] .apps-frame-wrap {
  box-shadow: 0 8px 28px rgba(15, 17, 21, 0.08);
}

.apps-page-view .apps-frame-wrap iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.apps-loading {
  padding: 48px;
  text-align: center;
  color: var(--apps-muted);
}

@media (max-width: 640px) {
  .apps-shell:not(.apps-shell--view) { padding: 14px 14px 36px; }
  .apps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .apps-card { min-height: 160px; }
  .apps-frame-wrap iframe { height: min(72vh, 720px); }

  .apps-view-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "back toolbar"
      "heading heading";
    gap: 6px 8px;
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    align-items: center;
  }

  .apps-back {
    grid-area: back;
    font-size: 12px;
    padding: 6px 10px;
    flex-shrink: 0;
  }

  .apps-view-toolbar {
    grid-area: toolbar;
    justify-self: end;
    gap: 4px;
    padding: 3px 5px 3px 4px;
    max-width: 100%;
    flex-wrap: nowrap;
  }

  .apps-view-heading {
    grid-area: heading;
    width: 100%;
    min-width: 0;
    padding: 0 2px 2px;
  }

  .apps-view-heading-row {
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
  }

  .apps-view-center {
    display: none !important;
  }

  .apps-view-title {
    font-size: 13px;
    flex: 1;
    min-width: 0;
  }

  .apps-view-kind {
    flex-shrink: 0;
    max-width: 5.5em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .apps-view-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .apps-view-toolbar-sep {
    height: 18px;
  }

  .apps-view-theme-btn,
  .apps-view-cast-btn {
    width: 32px;
    height: 32px;
  }

  .apps-view-qr {
    flex-shrink: 0;
  }

  .apps-view-qr-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
  }

  .apps-device-toggle-btn {
    padding: 7px 9px;
  }

  .apps-btn--compact {
    padding: 5px 7px;
    font-size: 11px;
    white-space: nowrap;
  }

  /* 小游戏：手机只保留返回 + 工具栏，标题区交给游戏内界面 */
  body[data-viewer-kind="game"] .apps-view-heading {
    display: none !important;
  }

  body[data-viewer-kind="game"] .apps-view-header {
    grid-template-rows: auto;
    grid-template-areas: "back toolbar";
    padding: 6px 8px;
    padding-top: max(6px, env(safe-area-inset-top, 0px));
  }

  body[data-viewer-kind="game"] .apps-view-stage--mobile.apps-view-stage--native .apps-frame-wrap,
  body[data-viewer-kind="game"] .apps-view-stage--mobile.apps-view-stage--native .apps-frame-wrap iframe {
    min-height: calc(100dvh - 46px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    height: calc(100dvh - 46px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  body[data-viewer-kind="game"] .apps-view-stage--mobile.apps-view-stage--native .apps-frame-wrap {
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: #050810;
  }

  body[data-viewer-kind="game"] .apps-view-stage--mobile.apps-view-stage--native .apps-frame-wrap iframe {
    background: #050810;
  }
}

/* 斗地主手机预览：对局时 iframe 整体旋转 90°，隐藏机模铺满视口 */
body[data-viewer-kind="game"]:has(.apps-view-stage--doudizhu.apps-view-stage--mobile-landscape) .apps-view-header {
  display: none !important;
}

body[data-viewer-kind="game"]:has(.apps-view-stage--doudizhu.apps-view-stage--mobile-landscape) .apps-view-stage {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: 0 !important;
  background: #120818 !important;
}

body[data-viewer-kind="game"]:has(.apps-view-stage--doudizhu.apps-view-stage--mobile-landscape) {
  overflow: hidden !important;
  height: 100dvh !important;
  background: #120818 !important;
}

body[data-viewer-kind="game"]:has(.apps-view-stage--doudizhu.apps-view-stage--mobile-landscape) .apps-shell--view {
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background: #120818 !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-iphone17__bezel,
.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-iphone17__btn,
.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-iphone17__island,
.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-iphone17__home-bar {
  display: none !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-iphone17 {
  display: contents !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-frame-outer {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-frame-wrap {
  position: absolute !important;
  inset: 0 !important;
  overflow: hidden !important;
  background: #120818 !important;
  width: 100% !important;
  height: 100% !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--mobile-landscape .apps-frame-wrap iframe {
  background: #120818 !important;
}

/* 真机对局：iframe 横屏铺满 */
body[data-viewer-kind="game"]:has(.apps-view-stage--doudizhu.apps-view-stage--native.apps-view-stage--mobile-landscape) .apps-view-header {
  display: none !important;
}

body[data-viewer-kind="game"]:has(.apps-view-stage--doudizhu.apps-view-stage--native.apps-view-stage--mobile-landscape) .apps-view-stage {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: 0 !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--native.apps-view-stage--mobile-landscape .apps-frame-wrap {
  position: fixed !important;
  inset: 0 !important;
  z-index: 80 !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #120818 !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--native.apps-view-stage--mobile-landscape .apps-frame-wrap iframe {
  background: #120818 !important;
  visibility: visible !important;
}

/* 斗地主专用：真机对局全屏 */
body.apps-viewer-game-landscape.apps-page-view:has(.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape) {
  overflow: hidden !important;
  height: 100dvh !important;
  background: #120818 !important;
}

body.apps-viewer-game-landscape.apps-page-view:has(.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape) .apps-shell--view {
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.apps-viewer-game-landscape.apps-page-view:has(.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape) .apps-view-header {
  display: none !important;
}

body.apps-viewer-game-landscape.apps-page-view:has(.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape) .apps-view-stage {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: 0 !important;
}

.apps-game-float-back {
  position: fixed;
  z-index: 120;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: max(10px, env(safe-area-inset-left, 0px));
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(8, 6, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  text-decoration: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-iphone17__bezel,
.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-iphone17__btn,
.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-iphone17__island,
.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-iphone17__home-bar {
  display: none !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-iphone17 {
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-frame-outer {
  height: 100dvh !important;
  min-height: 0 !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape .apps-frame-wrap {
  position: fixed !important;
  inset: 0 !important;
  z-index: 80 !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  max-height: none !important;
  border: none !important;
  border-radius: 0 !important;
  display: block !important;
  overflow: hidden !important;
  background: #120818 !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--native.apps-view-stage--game-landscape .apps-frame-wrap iframe {
  border: none !important;
  background: #120818 !important;
  visibility: visible !important;
}

.apps-view-stage--doudizhu.apps-view-stage--mobile.apps-view-stage--game-landscape:not(.apps-view-stage--native) .apps-frame-wrap iframe {
  position: static !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  border: none !important;
  transform: none !important;
  -webkit-transform: none !important;
  transform-origin: center center !important;
  background: #120818 !important;
}

@media (max-width: 400px) {
  .apps-view-toolbar .apps-btn--compact {
    padding: 5px 6px;
    font-size: 10px;
  }

  .apps-view-qr-img {
    width: 28px;
    height: 28px;
  }

  #apps-copy-link,
  #apps-copy-article {
    display: none;
  }
}

/* v245: 斗地主对局全屏 — 仅斗地主，避免影响其它游戏 */
body.apps-viewer-game-landscape.apps-viewer-ddz-landscape {
  overflow: hidden !important;
  height: 100vh !important;
  height: 100dvh !important;
  background: #120818 !important;
}

body.apps-viewer-game-landscape.apps-viewer-ddz-landscape .apps-shell--view {
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

body.apps-viewer-game-landscape.apps-viewer-ddz-landscape .apps-view-header {
  display: none !important;
}

body.apps-viewer-game-landscape.apps-viewer-ddz-landscape .apps-view-stage {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  padding: 0 !important;
}

body.apps-viewer-game-landscape.apps-viewer-ddz-landscape .apps-frame-wrap {
  opacity: 1 !important;
  visibility: visible !important;
}

body.apps-viewer-game-landscape.apps-viewer-ddz-landscape .apps-frame-wrap iframe {
  visibility: visible !important;
  opacity: 1 !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
  border: none !important;
  background: #120818 !important;
}

#apps-ddz-boot,
.apps-ddz-boot {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  transform: none !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(900px 520px at 50% -8%, rgba(72, 196, 255, 0.12), transparent 58%), var(--apps-bg, #0a0d14);
}

.apps-ddz-boot.is-show,
.apps-ddz-boot.is-active {
  display: flex !important;
}

.apps-ddz-boot.is-doudizhu {
  background: linear-gradient(180deg, #faf4e8 0%, #f3ead8 48%, #ebe2cf 100%) !important;
}

.apps-ddz-boot-inner,
.apps-ddz-boot-label,
.apps-ddz-boot-track,
.apps-ddz-boot-bar {
  transform: none !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}

.apps-ddz-boot-track {
  width: min(72vw, 320px) !important;
  height: 8px !important;
  min-height: 8px !important;
  max-height: 8px !important;
}

.apps-ddz-boot-bar {
  height: 100% !important;
  min-width: 0 !important;
}

