/* 查手机·公共样式（状态栏 / 弹层 / 头像 / toast）+ iOS 主屏。
   各 app 页面（.pos-app）由 ta-phone-kit.js 挂载，自己的样式在 ta-phone-wechat.css / ta-phone-system.css。 */

.pos-app { position: absolute; inset: 0; z-index: 9; display: flex; flex-direction: column; overflow: hidden; background: #fff; color: #000; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; }
.pos-app[hidden] { display: none; }
.pos-app button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
.pos-scroll { flex: 1 1 auto; min-height: 0; overflow: hidden auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; scrollbar-width: none; }
.pos-scroll::-webkit-scrollbar { display: none; }

/* ---------- 状态栏：只占安全区（系统自己的状态栏会叠在上面） ---------- */
.pos-statusbar { flex: 0 0 auto; height: calc(var(--safe-top) + 6px); pointer-events: none; }

/* ---------- 头像 ---------- */
.pos-avatar { --av: #b8bcc6; flex: none; width: 44px; height: 44px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; color: #fff; background: var(--av); font-size: 18px; font-weight: 600; }
.pos-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- toast / 弹层 ---------- */
.pos-toast { position: absolute; left: 50%; top: 46%; z-index: 60; max-width: 70%; padding: 11px 18px; border-radius: 12px; color: #fff; background: rgb(30 30 32 / 82%); font-size: 14px; text-align: center; opacity: 0; transform: translate(-50%, -50%) scale(.96); transition: opacity .2s, transform .2s; pointer-events: none; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.pos-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.pos-sheet-shade { position: absolute; inset: 0; z-index: 50; display: flex; align-items: flex-end; background: rgb(0 0 0 / 32%); animation: pos-fade .18s ease; }
@keyframes pos-fade { from { opacity: 0; } }
@keyframes pos-rise { from { transform: translateY(40px); opacity: .6; } }
.pos-sheet { width: 100%; padding: 0 16px calc(var(--safe-bottom) + 16px); display: grid; gap: 10px; border-radius: 22px 22px 0 0; background: #f2f2f7; color: #000; animation: pos-rise .22s ease; }
.pos-sheet header { height: 54px; display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; }
.pos-sheet header strong { text-align: center; font-size: 17px; font-weight: 600; }
.pos-sheet header button { padding: 0; border: 0; background: none; color: #007aff; font-size: 17px; text-align: left; }
.pos-sheet header button[type="submit"] { text-align: right; font-weight: 600; }
.pos-sheet input, .pos-sheet textarea { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 0; border-radius: 12px; outline: none; background: #fff; color: #000; font: 16px/1.45 inherit; resize: none; }
.pos-actions { width: 100%; padding: 0 10px calc(var(--safe-bottom) + 10px); display: grid; animation: pos-rise .22s ease; }
.pos-actions p { margin: 0; padding: 14px; border-radius: 14px 14px 0 0; background: rgb(250 250 252 / 94%); color: #8e8e93; font-size: 13px; text-align: center; }
.pos-actions button { height: 56px; border: 0; border-top: .5px solid rgb(60 60 67 / 22%); background: rgb(250 250 252 / 94%); color: #007aff; font-size: 19px; }
.pos-actions p + button, .pos-actions > button:first-child { border-top: 0; }
.pos-actions > button:first-child { border-radius: 14px 14px 0 0; }
.pos-actions button:nth-last-child(2) { border-radius: 0 0 14px 14px; }
.pos-actions > button:first-child:nth-last-child(2) { border-radius: 14px; }
.pos-actions button.danger { color: #ff3b30; }
.pos-actions button.cancel { margin-top: 8px; border: 0; border-radius: 14px; background: #fff; font-weight: 600; }

/* =================== iOS 主屏 =================== */
/* 默认壁纸是 0661 那种浅灰磨砂，图标标签用深色；角色设了主屏壁纸（applyPhoneWallpaper 写 inline 背景）就换白字 */
.home-screen {
  --icon: 62px;
  --label: #1c1c1e;
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--label);
  background:
    radial-gradient(60% 34% at 22% 30%, rgb(255 255 255 / 85%), transparent 70%),
    radial-gradient(55% 30% at 85% 62%, rgb(255 255 255 / 70%), transparent 70%),
    radial-gradient(70% 40% at 30% 92%, rgb(150 152 158 / 45%), transparent 70%),
    linear-gradient(170deg, #e9e9eb 0%, #d4d5d9 48%, #c9cacf 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.home-screen.has-wallpaper { --label: #fff; }
.home-screen.has-wallpaper .ios-label { text-shadow: 0 1px 4px rgb(0 0 0 / 45%); }

.ios-home-pager { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.ios-home-track { display: flex; height: 100%; transition: transform .34s cubic-bezier(.22,.61,.36,1); }
.ios-home-track.no-anim { transition: none; }
.ios-page { flex: 0 0 100%; min-width: 0; height: 100%; box-sizing: border-box; padding: 14px 18px 4px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); row-gap: 10px; }

.ios-item { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px; }
.ios-label { max-width: 100%; overflow: hidden; color: var(--label); font-size: 12px; font-weight: 500; line-height: 15px; letter-spacing: -.1px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }

.ios-icon { position: relative; flex: none; width: var(--icon); height: var(--icon); display: grid; place-items: center; overflow: hidden; border-radius: 22.5%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 10%), inset 0 0 0 .5px rgb(0 0 0 / 6%); transition: transform .15s; }
.ios-icon > svg { width: 100%; height: 100%; display: block; }
.ios-app:active .ios-icon { filter: brightness(.86); }
.ios-icon[data-icon="wechat"] { background: linear-gradient(180deg, #2fe07d, #07c160); }
.ios-icon[data-icon="wechat"] svg { width: 82%; height: 82%; }
.ios-icon[data-icon="sms"] { background: linear-gradient(180deg, #67f87e, #0dbe2c); }
.ios-icon[data-icon="sms"] svg { width: 78%; height: 78%; }
.ios-icon[data-icon="contacts"] { background: linear-gradient(180deg, #f4f4f6, #d6d6db); }
.ios-icon[data-icon="music"] { background: linear-gradient(180deg, #fd6a80, #fa2a45); }
.ios-icon[data-icon="music"] svg { width: 80%; height: 80%; }
.ios-icon[data-icon="wallet"] { background: #000; }
.ios-icon[data-icon="settings"] { background: linear-gradient(180deg, #e9e9ee, #a8a8ae); }
.ios-icon[data-icon="camera"] { background: linear-gradient(160deg, #ececef, #9fa0a6); }
.ios-icon[data-icon="weather"] { background: linear-gradient(180deg, #4aa5f2, #1c5fc6); }
.ios-icon[data-icon="calculator"] { background: #1c1c1e; }
.ios-icon[data-icon="calculator"] svg { width: 92%; height: 92%; }
.ios-cal-icon { width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr; justify-items: center; color: #1c1c1e; }
.ios-cal-icon small { margin-top: 7px; color: #ff3b30; font-size: 12px; font-weight: 600; line-height: 1; }
.ios-cal-icon b { margin-top: -1px; font-size: 38px; font-weight: 300; line-height: 1.05; letter-spacing: -1px; }
.ios-clock-svg .nums { fill: #1c1c1e; font: 600 7px -apple-system, sans-serif; text-anchor: middle; }

/* 小组件：盒子撑满格子，标签在下面 */
.ios-widget-box { position: relative; flex: 1 1 auto; align-self: stretch; min-height: 0; margin-inline: calc((100% / var(--cols, 2) - var(--icon)) / 2); overflow: hidden; border-radius: 22px; box-shadow: 0 2px 10px rgb(0 0 0 / 12%); }
.ios-widget.size-s { --cols: 2; }
.ios-widget.size-m, .ios-widget.size-l { --cols: 4; }

.ios-w-cal { display: flex; gap: 10px; padding: 14px 16px; box-sizing: border-box; background: #1f1f21; color: #fff; }
.ios-w-cal .left { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.ios-w-cal.s { flex-direction: column; gap: 0; }
.ios-w-cal .dow { color: #ff453a; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.ios-w-cal .date { font-size: 34px; font-weight: 400; line-height: 1.08; }
.ios-w-cal .lunar { color: rgb(235 235 245 / 55%); font-size: 11px; }
.ios-w-cal .none { margin: auto 0 4px; color: rgb(235 235 245 / 60%); font-size: 13.5px; }
.ios-w-cal .ev { margin: 7px 0 0; display: flex; gap: 6px; min-width: 0; font-size: 12px; line-height: 1.25; }
.ios-w-cal .ev i { flex: none; width: 3px; border-radius: 2px; background: #ff9f0a; }
.ios-w-cal .ev span { min-width: 0; display: grid; }
.ios-w-cal .ev b, .ios-w-cal .ev small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-w-cal .ev b { font-weight: 600; }
.ios-w-cal .ev small { color: rgb(235 235 245 / 60%); font-size: 11px; }
.ios-w-cal .ev:first-of-type { margin-top: auto; }
.ios-mini-month { flex: 0 0 52%; display: flex; flex-direction: column; font-size: 10.5px; font-weight: 600; }
.ios-mini-month > b { color: #ff453a; font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.ios-mini-month .dow, .ios-mini-month .days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.ios-mini-month .dow i { color: rgb(235 235 245 / 55%); font-style: normal; font-size: 9.5px; }
.ios-mini-month .days { flex: 1; align-content: space-between; }
.ios-mini-month .days i { height: 15px; display: grid; place-items: center; font-style: normal; line-height: 1; }
.ios-mini-month .days i.weekend { color: rgb(235 235 245 / 55%); }
.ios-mini-month .days i.today { color: #fff; }
.ios-mini-month .days i.today::before { content: ""; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: #ff453a; z-index: -1; }
.ios-mini-month .days i { position: relative; z-index: 0; }
.ios-w-cal.l { flex-direction: column; }
.ios-w-cal.l .ios-mini-month { flex: 1 1 auto; font-size: 13px; }
.ios-w-cal.l .ios-mini-month .days i { height: 22px; }
.ios-w-cal.l .ios-mini-month .days i.today::before { width: 24px; height: 24px; }

.ios-w-photo { background: linear-gradient(160deg, #f4f4f6, #d9dade); }
.ios-w-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ios-w-photo .ph { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 6px; color: #8e8e93; }
.ios-w-photo .ph svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.ios-w-photo .ph small { font-size: 11px; }

.ios-w-clock { background: #1f1f21; color: #fff; }
.ios-w-clock.s { display: grid; place-items: center; background: #fff; }
.ios-w-clock.s svg { width: 92%; height: 92%; }
.ios-w-clock.m { display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; padding: 0 8px; }
.ios-w-clock .city { display: grid; justify-items: center; gap: 3px; }
.ios-w-clock .city svg { width: 54px; height: 54px; }
.ios-w-clock .city circle:first-child { fill: #fff; }
.ios-w-clock .city line { stroke: #1c1c1e; stroke-width: 2; stroke-linecap: round; }
.ios-w-clock .city circle:last-child { fill: #ff9f0a; }
.ios-w-clock .city.night circle:first-child { fill: #3a3a3c; }
.ios-w-clock .city.night line { stroke: #fff; }
.ios-w-clock .city b { font-size: 12px; font-weight: 600; }
.ios-w-clock .city small { color: rgb(235 235 245 / 60%); font-size: 11px; }

/* 搜索胶囊 / 翻页点 / dock */
.ios-home-search { position: relative; flex: none; align-self: center; height: 30px; min-width: 76px; margin: 6px 0 12px; padding: 0 12px; border: 0; border-radius: 15px; color: rgb(60 60 67 / 75%); background: rgb(120 120 128 / 22%); font: 500 14px -apple-system, sans-serif; -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
.has-wallpaper .ios-home-search { color: rgb(255 255 255 / 92%); background: rgb(255 255 255 / 22%); }
.ios-home-search .label { display: flex; align-items: center; gap: 4px; transition: opacity .2s; }
.ios-home-search .label svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ios-home-search .dots { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; opacity: 0; transition: opacity .2s; }
.ios-home-search .dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .35; }
.ios-home-search .dots i.on { opacity: 1; }
.ios-home-search.show-dots .label, .editing .ios-home-search .label { opacity: 0; }
.ios-home-search.show-dots .dots, .editing .ios-home-search .dots { opacity: 1; }

.ios-home-dock { flex: none; position: relative; height: 92px; margin: 0 12px calc(var(--safe-bottom) + 8px); padding: 0 6px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; border-radius: 38px; background: rgb(255 255 255 / 30%); box-shadow: inset 0 0 0 .5px rgb(255 255 255 / 45%); -webkit-backdrop-filter: blur(28px) saturate(1.6); backdrop-filter: blur(28px) saturate(1.6); }
.home-screen:not(.has-wallpaper) .ios-home-dock { background: rgb(160 160 166 / 38%); }
.ios-home-dock .ios-label { display: none; }
.ios-home-indicator { position: absolute; left: 50%; bottom: max(6px, calc(var(--safe-bottom) - 14px)); z-index: 4; width: 140px; height: 18px; padding: 0; transform: translateX(-50%); border: 0; background: none; }
.ios-home-indicator::after { content: ""; display: block; width: 134px; height: 5px; margin: 6px auto 0; border-radius: 3px; background: currentColor; opacity: .75; }
.ios-home-dock { margin-bottom: calc(var(--safe-bottom) + 16px); }

/* 编辑态：抖动、减号、顶部“＋ / 完成” */
.ios-edit-bar { position: absolute; z-index: 5; top: calc(var(--safe-top) + 6px); left: 14px; right: 14px; display: none; justify-content: space-between; }
.editing .ios-edit-bar { display: flex; }
.ios-edit-bar button { height: 32px; min-width: 32px; padding: 0 14px; border: 0; border-radius: 16px; color: #1c1c1e; background: rgb(250 250 252 / 78%); font: 600 15px -apple-system, sans-serif; box-shadow: 0 1px 4px rgb(0 0 0 / 12%); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.ios-edit-bar #ios-home-add { padding: 0; width: 32px; font-size: 22px; font-weight: 400; line-height: 1; }
.ios-remove { position: absolute; z-index: 2; top: -7px; left: max(0px, calc((100% / var(--cols, 1) - var(--icon)) / 2 - 7px)); width: 22px; height: 22px; padding: 0; display: none; place-items: center; border: 0; border-radius: 50%; color: #1c1c1e; background: rgb(235 235 240 / 92%); font: 600 18px/1 -apple-system, sans-serif; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); }
.editing .ios-remove { display: grid; }
.editing .ios-item:not(.is-dragging) { animation: ios-jiggle .26s ease-in-out infinite alternate; }
.editing .ios-item:nth-child(2n) { animation-delay: -.13s; animation-direction: alternate-reverse; }
@keyframes ios-jiggle { from { transform: rotate(-1.4deg); } to { transform: rotate(1.4deg); } }
.ios-item.is-dragging { opacity: 0; }
.ios-ghost { position: absolute; left: 0; top: 0; z-index: 30; pointer-events: none; opacity: .95; filter: drop-shadow(0 10px 18px rgb(0 0 0 / 22%)); }
.ios-ghost .ios-remove { display: none !important; }

/* 添加小组件面板 */
.ios-widget-gallery-shade { align-items: flex-end; }
.ios-widget-gallery { width: 100%; max-height: 78%; display: flex; flex-direction: column; border-radius: 26px 26px 0 0; background: #f2f2f7; color: #000; animation: pos-rise .22s ease; }
.ios-widget-gallery header { flex: none; height: 56px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; }
.ios-widget-gallery header strong { font-size: 19px; font-weight: 700; }
.ios-widget-gallery header button { height: 32px; padding: 0 14px; border: 0; border-radius: 16px; color: #007aff; background: #fff; font: 600 15px -apple-system, sans-serif; }
.ios-widget-gallery .grid { --icon: 54px; flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 18px calc(var(--safe-bottom) + 20px); display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.ios-widget-gallery .choice { padding: 0; display: grid; gap: 7px; border: 0; background: none; text-align: center; }
.ios-widget-gallery .choice.size-m, .ios-widget-gallery .choice.size-l { grid-column: span 2; }
.ios-widget-gallery .preview { display: flex; height: 140px; }
.ios-widget-gallery .choice.size-l .preview { height: 260px; }
.ios-widget-gallery .preview .ios-widget-box { margin: 0; flex: 1; }
.ios-widget-gallery .choice small { color: #3c3c43; font-size: 13px; }

@media (max-height: 740px) {
  .home-screen { --icon: 56px; }
  .ios-page { row-gap: 6px; padding-top: 8px; }
  .ios-home-dock { height: 80px; border-radius: 32px; }
  .ios-home-search { margin: 4px 0 8px; }
}
@media (max-width: 360px) {
  .home-screen { --icon: 54px; }
  .ios-page { padding-inline: 12px; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ios-home-dock { background: rgb(190 190 196 / 85%); }
}

/* app 底部的横条：点一下回主屏（每个 app 主页面都放一个） */
.pos-home-bar { position: absolute; left: 50%; bottom: max(2px, calc(var(--safe-bottom) - 18px)); z-index: 20; width: 150px; height: 20px; padding: 0; transform: translateX(-50%); border: 0; background: none; color: #000; }
.pos-home-bar::after { content: ""; display: block; width: 134px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: currentColor; opacity: .8; }
.pos-home-bar.light { color: #fff; }

/* 被 TA 发现偷看手机时顶部滑下的消息通知（ta-phone-guard.js） */
.phone-notify { position: absolute; left: 10px; right: 10px; top: calc(var(--safe-top, 0px) + 8px); z-index: 70; display: flex; gap: 10px; align-items: center; padding: 11px 14px; border: 0; border-radius: 18px; text-align: left; color: #1c1c1e; background: rgb(245 245 247 / 86%); -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6); box-shadow: 0 10px 28px rgb(0 0 0 / 22%); transform: translateY(calc(-100% - 40px)); transition: transform .34s cubic-bezier(.2,1,.3,1); cursor: pointer; font: inherit; }
.phone-notify.show { transform: translateY(0); }
.phone-notify-avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 9px; background: #e5e5ea; font-size: 16px; }
.phone-notify-avatar img { width: 100%; height: 100%; object-fit: cover; }
.phone-notify-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.phone-notify-head { display: flex; justify-content: space-between; gap: 8px; }
.phone-notify-head strong { font-size: 14px; }
.phone-notify-head small { font-size: 12px; color: #8e8e93; }
.phone-notify-text { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
