/* iPhone 15 Pro–style device + App-accurate screen mocks */

:root {
  --ios-grouped: #f2f2f7;
  --ios-card: #ffffff;
  --ios-label: #1c1c1e;
  --ios-secondary: #8e8e93;
  --ios-separator: rgba(60, 60, 67, 0.12);
  --iphone-w: 280px;
  --iphone-radius: 44px;
  --screen-radius: 38px;
}

.iphone {
  --iphone-scale: 1;
  position: relative;
  width: calc(var(--iphone-w) * var(--iphone-scale));
  margin-inline: auto;
  border-radius: calc(var(--iphone-radius) * var(--iphone-scale));
  padding: calc(11px * var(--iphone-scale));
  background:
    linear-gradient(160deg, #5c5c64 0%, #2c2c30 22%, #1a1a1e 55%, #3a3a40 100%);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.18) inset,
    0 -2px 0 rgba(0, 0, 0, 0.35) inset,
    0 28px 56px rgba(20, 21, 26, 0.28),
    0 8px 16px rgba(20, 21, 26, 0.12);
}
.iphone--sm { --iphone-scale: 0.86; }
.iphone--xs { --iphone-scale: 0.78; }
.iphone--hero { --iphone-scale: 1.05; }

.iphone::before,
.iphone::after {
  content: "";
  position: absolute;
  background: #1c1c1e;
  border-radius: 3px;
  z-index: 3;
}
/* Volume buttons */
.iphone::before {
  left: calc(-2px * var(--iphone-scale));
  top: calc(100px * var(--iphone-scale));
  width: calc(3px * var(--iphone-scale));
  height: calc(72px * var(--iphone-scale));
  box-shadow: 0 calc(90px * var(--iphone-scale)) 0 #1c1c1e;
}
/* Power button */
.iphone::after {
  right: calc(-2px * var(--iphone-scale));
  top: calc(140px * var(--iphone-scale));
  width: calc(3px * var(--iphone-scale));
  height: calc(64px * var(--iphone-scale));
}

.iphone-screen {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--screen-radius) * var(--iphone-scale));
  background: var(--ios-grouped);
  aspect-ratio: 9 / 19.5;
  isolation: isolate;
  contain: paint;
}

.iphone-island {
  position: absolute;
  top: calc(10px * var(--iphone-scale));
  left: 50%;
  z-index: 5;
  width: calc(92px * var(--iphone-scale));
  height: calc(26px * var(--iphone-scale));
  transform: translateX(-50%);
  border-radius: 9999px;
  background: #0a0a0a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
  pointer-events: none;
}

.iphone-screen--photo {
  background: #000;
  line-height: 0;
}
.iphone-screen--photo img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center top;
}

.sf {
  width: 1em;
  height: 1em;
  display: block;
  fill: currentColor;
}
.app-quick-icon .sf {
  width: 18px;
  height: 18px;
}
.app-tab .sf {
  width: 18px;
  height: 18px;
  margin-bottom: 1px;
}
.app-meta .sf {
  width: 11px;
  height: 11px;
  display: inline-block;
  vertical-align: -1px;
}
.app-nav-chat .back .sf {
  width: 18px;
  height: 18px;
  color: #5978fa;
}

/* —— App UI kits (match MainTabView / HomeView) —— */
.app-ui {
  display: flex;
  flex-direction: column;
  height: 100%;
  font-family: -apple-system, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--ios-label);
  background: var(--ios-grouped);
}

.app-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.app-status-icons {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  opacity: 0.85;
}

/* Inline nav bar — matches SwiftUI `.navigationBarTitleDisplayMode(.inline)` */
.app-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 4px 16px 10px;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.18);
  background: rgba(242, 242, 247, 0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.app-title-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-align: center;
}

.app-scroll {
  flex: 1;
  overflow: hidden;
  padding: 0 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-banner {
  position: relative;
  height: 92px;
  border-radius: 16px;
  background:
    linear-gradient(125deg, rgba(20, 21, 26, 0.15), rgba(20, 21, 26, 0.05)),
    linear-gradient(135deg, #5978fa, #8c5cf5);
  overflow: hidden;
  color: #fff;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.app-banner p {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.app-banner span {
  margin-top: 2px;
  font-size: 10px;
  opacity: 0.85;
}
.app-banner-dots {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: flex;
  gap: 4px;
}
.app-banner-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
.app-banner-dots i.on { background: #fff; }

.app-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.app-quick button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: default;
}
.app-quick-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 10px rgba(89, 120, 250, 0.22);
}
.app-quick-icon.blue { background: #5978fa; box-shadow: 0 4px 10px rgba(89, 120, 250, 0.35); }
.app-quick-icon.green { background: #2ec78c; box-shadow: 0 4px 10px rgba(46, 199, 140, 0.35); }
.app-quick-icon.pink { background: #ff2d55; box-shadow: 0 4px 10px rgba(255, 45, 85, 0.32); }
.app-quick-icon.orange { background: #fa9e38; box-shadow: 0 4px 10px rgba(250, 158, 56, 0.35); }
.app-quick span {
  font-size: 10px;
  font-weight: 500;
}

.app-section-label {
  margin: 2px 2px 0;
  font-size: 15px;
  font-weight: 600;
}

.app-card {
  background: var(--ios-card);
  border-radius: 16px;
  padding: 11px;
  box-shadow: 0 1px 0 var(--ios-separator);
}
.app-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.app-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #e0e7ff, #f2d1e6);
  font-size: 13px;
}
.app-card-head strong {
  font-size: 12px;
  font-weight: 600;
}
.app-card-head em {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: var(--ios-secondary);
  font-weight: 400;
}
.app-card-body {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #3a3a3c;
}
.app-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 8px;
}
.app-photo-grid span {
  aspect-ratio: 1;
  border-radius: 6px;
  background: linear-gradient(145deg, #dfe6ff, #f7e8f2);
}
.app-photo-grid span:nth-child(2) {
  background: linear-gradient(145deg, #ffe8d6, #ffd5e3);
}
.app-photo-grid span:nth-child(3) {
  background: linear-gradient(145deg, #d9f5ea, #e0e7ff);
}
.app-meta {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--ios-secondary);
}

.app-tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 6px 4px 0;
  background: rgba(255, 255, 255, 0.92);
  border-top: 0.5px solid var(--ios-separator);
  backdrop-filter: blur(16px);
}
.app-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 2px 0 4px;
  font-size: 9px;
  font-weight: 500;
  color: var(--ios-secondary);
}
.app-tab .glyph {
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  min-height: 18px;
}
.app-tab.active {
  color: #5978fa;
}
.app-home-indicator {
  width: 98px;
  height: 4px;
  margin: 6px auto 8px;
  border-radius: 9999px;
  background: #1c1c1e;
  opacity: 0.85;
}

/* Chat screen */
.app-nav-chat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 10px;
  border-bottom: 0.5px solid var(--ios-separator);
  background: rgba(242, 242, 247, 0.92);
}
.app-nav-chat .back {
  font-size: 18px;
  color: #5978fa;
  font-weight: 500;
}
.app-nav-chat .face {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ccbff5, #ffd5e3, #fce8d5);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #704e78;
}
.app-nav-chat .who strong {
  display: block;
  font-size: 13px;
}
.app-nav-chat .who span {
  font-size: 10px;
  color: var(--ios-secondary);
}
.app-chat {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.app-bubble {
  max-width: 82%;
  padding: 9px 11px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.45;
}
.app-bubble.me {
  align-self: flex-end;
  background: #1c1c1e;
  color: #fff;
  border-bottom-right-radius: 5px;
}
.app-bubble.ai {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(242, 209, 230, 0.9);
  border-bottom-left-radius: 5px;
  color: #3a3a3c;
}
.app-inputbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px 0;
  background: rgba(255, 255, 255, 0.95);
  border-top: 0.5px solid var(--ios-separator);
}
.app-inputbar .field {
  flex: 1;
  height: 32px;
  border-radius: 9999px;
  background: #ebebef;
  color: var(--ios-secondary);
  font-size: 11px;
  display: flex;
  align-items: center;
  padding: 0 12px;
}
.app-inputbar .send {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #5978fa;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

/* Personality Hub — match PersonalityHubCollectionCells */
.app-pers-hub {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 12px 6px;
  overflow: hidden;
  min-height: 0;
}
.app-pers-mod {
  background: #fff;
  border-radius: 16px;
  padding: 10px 11px 10px;
}
.app-pers-mod-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}
.app-pers-mod-head .mod-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.app-pers-mod-head .mod-icon.site { color: #5978fa; }
.app-pers-mod-head .mod-icon.fp { color: #30b0c7; }
.app-pers-mod-head .mod-icon.links { color: #5856d6; }
.app-pers-mod-head .mod-title {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #1c1c1e;
  flex: 1;
  min-width: 0;
}
.app-pers-badge {
  font-size: 9px;
  font-weight: 650;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.app-pers-badge.fp {
  color: #30b0c7;
  background: rgba(48, 176, 199, 0.12);
}
.app-pers-badge.links {
  color: #5856d6;
  background: rgba(88, 86, 214, 0.12);
}
.app-pers-chevron {
  width: 9px;
  height: 9px;
  color: #c7c7cc;
  flex-shrink: 0;
}
.app-pers-url {
  margin: 0 0 8px;
  font-size: 10px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-pers-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 30px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}
.app-pers-btn .sf { width: 12px; height: 12px; }
.app-pers-btn.site {
  background: rgba(89, 120, 250, 0.12);
  color: #5978fa;
}
.app-pers-btn.fp {
  background: rgba(48, 176, 199, 0.12);
  color: #30b0c7;
}
.app-pers-btn.links {
  background: rgba(88, 86, 214, 0.12);
  color: #5856d6;
}
.app-pers-fp-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(60, 60, 67, 0.12);
  background: #f2f2f7;
  margin-bottom: 8px;
}
.app-pers-fp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: rgba(48, 176, 199, 0.1);
}
.app-pers-fp-head .wk {
  font-size: 10px;
  font-weight: 650;
  color: #30b0c7;
}
.app-pers-fp-head .dt {
  font-size: 9px;
  font-weight: 650;
  color: #30b0c7;
  background: rgba(48, 176, 199, 0.12);
  padding: 2px 6px;
  border-radius: 11px;
}
.app-pers-fp-body {
  padding: 7px 8px 8px;
  font-size: 10px;
  color: #3a3a3c;
  line-height: 1.35;
}
.app-pers-fp-loc {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin-bottom: 3px;
}
.app-pers-fp-pin {
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: rgba(48, 176, 199, 0.12);
  color: #30b0c7;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.app-pers-fp-pin .sf {
  width: 10px;
  height: 10px;
}
.app-pers-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.1);
}
.app-pers-link-row:last-of-type { border-bottom: 0; margin-bottom: 4px; }
.app-pers-link-dot {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(88, 86, 214, 0.12);
  color: #5856d6;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.app-pers-link-dot .sf { width: 12px; height: 12px; }
.app-pers-link-txt {
  min-width: 0;
  flex: 1;
}
.app-pers-link-txt strong {
  display: block;
  font-size: 11px;
  font-weight: 650;
}
.app-pers-link-txt span {
  display: block;
  font-size: 9px;
  color: #8e8e93;
}
.app-pers-subbadge {
  font-size: 8px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(88, 86, 214, 0.12);
  color: #5856d6;
  white-space: nowrap;
}

/* Feature visual phone wrap */
.feature-visual {
  overflow: hidden;
  background: linear-gradient(160deg, #eef0f8, #f7f6f3) !important;
}
.feature-visual .iphone {
  filter: drop-shadow(0 18px 28px rgba(20, 21, 26, 0.14));
  max-width: 100%;
}

/* In-phone module screens (A圈 / 文案 / 学习 / 消息) — nav bar title */
.app-module-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 12px 10px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.18);
  background: rgba(242, 242, 247, 0.92);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.app-module-title .sf {
  width: 14px;
  height: 14px;
  color: #5978fa;
}
.app-chip-row {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
}
.app-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 9999px;
  background: #ebebef;
  color: #636366;
}
.app-chip.on {
  background: rgba(89, 120, 250, 0.14);
  color: #5978fa;
}
.app-qa {
  background: #fff;
  border-radius: 14px;
  padding: 10px;
}
.app-qa .tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 45, 85, 0.12);
  color: #ff2d55;
  margin-bottom: 6px;
}
.app-qa h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.app-qa .meta {
  margin-top: 6px;
  font-size: 10px;
  color: var(--ios-secondary);
}
.app-answer {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-top: 8px;
  font-size: 10px;
  color: #3a3a3c;
  line-height: 1.4;
}
.app-answer.ai .dot {
  background: #8c5cf5;
}
.app-answer .dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  margin-top: 4px;
  border-radius: 50%;
  background: #5978fa;
}
.app-learn-cover {
  height: 64px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(135deg, #5978fa, #8c5cf5);
}
.app-learn-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}
.app-learn-card .body {
  padding: 10px;
}
.app-learn-card h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.app-conv {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.app-conv-row {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
}
.app-conv-row .ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #704e78;
  background: linear-gradient(135deg, #ccbff5, #ffd5e3, #fce8d5);
  flex-shrink: 0;
}
.app-conv-row .txt {
  min-width: 0;
  flex: 1;
}
.app-conv-row strong {
  display: block;
  font-size: 11px;
}
.app-conv-row span {
  display: block;
  font-size: 10px;
  color: var(--ios-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-conv-row .time {
  font-size: 9px;
  color: var(--ios-secondary);
  flex-shrink: 0;
}

/* Gallery polish */
.gallery-rail {
  align-items: flex-end;
  gap: 1.25rem 1.75rem;
}
.gallery-phone .iphone {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.gallery-phone:hover .iphone {
  transform: translateY(-6px);
}
.gallery-phone--lift .iphone {
  transform: translateY(-14px) scale(1.03);
}
.gallery-phone--lift:hover .iphone {
  transform: translateY(-20px) scale(1.03);
}

@media (max-width: 640px) {
  .iphone--hero { --iphone-scale: 0.95; }
  .gallery-rail {
    gap: 1.5rem;
  }
  .gallery-phone--lift .iphone {
    transform: none;
  }
}
