/* app-kit.css —— 手机App外壳 (自托管, 零外网). 在 index.html 里 <link rel="stylesheet" href="shared/app-kit.css"> 即可用 */
:root{
  --ak-bg:#0f1117; --ak-surface:#171a23; --ak-card:#1f2330; --ak-text:#eef1f7; --ak-muted:#9aa3b2;
  --ak-primary:#6d6bf6; --ak-primary-2:#9b6bf6; --ak-radius:18px; --ak-gap:14px;
  --ak-safe-t:env(safe-area-inset-top,0px); --ak-safe-b:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei","Segoe UI",sans-serif;
  background:#0a0c12; color:var(--ak-text); -webkit-font-smoothing:antialiased;
}
/* App 外壳: 居中手机宽度, 竖屏单列 */
.app{max-width:430px; margin:0 auto; min-height:100vh; min-height:100dvh; display:flex; flex-direction:column;
  background:linear-gradient(180deg,var(--ak-surface),var(--ak-bg)); position:relative; overflow:hidden;}
/* 假状态栏 (顶部: 真时间 + 满信号 + 5G + 满电池, 一眼像真手机) */
.app-statusbar{display:flex; align-items:center; justify-content:space-between; padding:7px 20px 3px;
  font-size:13px; font-weight:700; color:var(--ak-text); user-select:none; flex:0 0 auto;}
.app-statusbar .ak-sb-time{font-variant-numeric:tabular-nums; letter-spacing:.5px;}
.app-statusbar .ak-sb-icons{display:flex; align-items:center; gap:6px;}
.app-statusbar .ak-sb-batt{position:relative; display:inline-block; width:23px; height:12px;
  border:1.5px solid currentColor; border-radius:3px; opacity:.85;}
.app-statusbar .ak-sb-batt::before{content:""; position:absolute; right:-3.5px; top:3px; width:2px; height:6px; background:currentColor; border-radius:0 2px 2px 0;}
.app-statusbar .ak-sb-batt::after{content:""; position:absolute; left:1.5px; top:1.5px; bottom:1.5px; width:72%; background:currentColor; border-radius:1px;}
.app-header{position:sticky; top:0; z-index:10; padding:6px 18px 14px;
  font-size:19px; font-weight:800; backdrop-filter:blur(8px); background:rgba(15,17,23,.72);
  display:flex; align-items:center; gap:10px;}
.app-main{flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch; padding:16px 16px calc(var(--ak-safe-b) + 84px);}
/* 屏幕: 用 .screen + .screen.active 切换 (配合 app-kit.js 的 AppKit.show) */
.screen{display:none; animation:ak-fade .22s ease;}
.screen.active{display:block;}
/* 底部 Tab 栏 */
.app-tabbar{position:fixed; left:50%; transform:translateX(-50%); bottom:0; width:100%; max-width:430px;
  display:flex; padding:8px 8px calc(var(--ak-safe-b) + 8px); gap:4px;
  background:rgba(20,23,32,.92); backdrop-filter:blur(10px); border-top:1px solid rgba(255,255,255,.06); z-index:20;}
.tab{flex:1; border:0; background:transparent; color:var(--ak-muted); font:inherit; font-size:11px; font-weight:700;
  display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 0; border-radius:12px; cursor:pointer;
  transition:color .15s, background .15s;}
.tab .tab-ico{font-size:21px; line-height:1;}
.tab.active{color:var(--ak-text); background:rgba(109,107,246,.16);}
.tab:active{transform:scale(.94);}
/* 卡片 / 按钮 / 列表 */
.card{background:var(--ak-card); border:1px solid rgba(255,255,255,.06); border-radius:var(--ak-radius);
  padding:16px; margin-bottom:var(--ak-gap); box-shadow:0 6px 20px rgba(0,0,0,.25);}
.btn{appearance:none; border:0; cursor:pointer; font:inherit; font-weight:800; color:#fff; padding:13px 18px;
  border-radius:14px; background:linear-gradient(135deg,var(--ak-primary),var(--ak-primary-2));
  box-shadow:0 8px 20px rgba(109,107,246,.35); transition:transform .12s, filter .12s; min-height:44px;}
.btn:active{transform:scale(.96); filter:brightness(1.05);}
.btn.ghost{background:rgba(255,255,255,.06); box-shadow:none; color:var(--ak-text);}
.list{list-style:none; margin:0; padding:0;}
.list-item{display:flex; align-items:center; gap:12px; padding:13px 4px; border-bottom:1px solid rgba(255,255,255,.06);}
h1,h2,h3{margin:0 0 10px;} .muted{color:var(--ak-muted);}
/* Toast */
.ak-toast{position:fixed; left:50%; transform:translateX(-50%) translateY(20px); bottom:calc(var(--ak-safe-b) + 92px);
  background:#11141d; color:#fff; padding:11px 18px; border-radius:14px; font-weight:700; font-size:14px;
  box-shadow:0 10px 30px rgba(0,0,0,.5); opacity:0; pointer-events:none; z-index:50; transition:opacity .2s, transform .2s; max-width:88%;}
.ak-toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
@keyframes ak-fade{from{opacity:0; transform:translateY(8px);} to{opacity:1; transform:none;}}
/* 骨架屏 (shimmer 流光占位; 配合 AppKit.skeleton / AppKit.loadInto) */
.skeleton{position:relative; overflow:hidden; background:rgba(255,255,255,.07); border-radius:10px;}
.skeleton::after{content:""; position:absolute; inset:0; transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.13),transparent); animation:ak-shimmer 1.25s infinite;}
.skeleton-text{height:11px; margin:7px 0; border-radius:6px;}
.skeleton-title{height:17px; width:55%; margin:6px 0 10px; border-radius:7px;}
.skeleton-avatar{width:46px; height:46px; border-radius:50%; flex:0 0 auto;}
.skeleton-card{height:84px; margin-bottom:12px; border-radius:16px;}
@keyframes ak-shimmer{100%{transform:translateX(100%);}}
/* ── 批二 扩容组件 ── */
/* 开关 (<button class="ak-switch" aria-pressed="true|false">) */
.ak-switch{position:relative; width:46px; height:28px; border:0; border-radius:999px; background:rgba(255,255,255,.18); cursor:pointer; transition:background .2s; flex:0 0 auto; padding:0;}
.ak-switch::after{content:""; position:absolute; top:3px; left:3px; width:22px; height:22px; border-radius:50%; background:#fff; transition:transform .2s; box-shadow:0 1px 3px rgba(0,0,0,.3);}
.ak-switch[aria-pressed="true"]{background:var(--ak-primary);}
.ak-switch[aria-pressed="true"]::after{transform:translateX(18px);}
/* 分段控件 (.segmented > .seg(.active)) */
.segmented{display:flex; background:rgba(255,255,255,.07); border-radius:12px; padding:3px; gap:2px;}
.segmented .seg{flex:1; border:0; background:transparent; color:var(--ak-muted); font:inherit; font-weight:700; font-size:13px; padding:8px 6px; border-radius:9px; cursor:pointer; transition:all .15s;}
.segmented .seg.active{background:var(--ak-card); color:var(--ak-text); box-shadow:0 2px 6px rgba(0,0,0,.25);}
/* 聊天气泡 (.bubble-row > .bubble.me|.them) */
.bubble{max-width:78%; padding:10px 13px; border-radius:16px; margin:5px 0; font-size:14px; line-height:1.42; word-break:break-word;}
.bubble.them{background:var(--ak-card); border-bottom-left-radius:5px;}
.bubble.me{background:linear-gradient(135deg,var(--ak-primary),var(--ak-primary-2)); color:#fff; border-bottom-right-radius:5px; margin-left:auto;}
.bubble-row{display:flex; gap:8px; align-items:flex-end;}
/* 空状态 (.empty > .empty-ico + 文字; .ak-empty 是别名 —— 模型反复幻觉这个名, 容错比纠正省事) */
.empty,.ak-empty{text-align:center; padding:46px 20px; color:var(--ak-muted);}
.empty .empty-ico,.ak-empty .empty-ico{font-size:52px; margin-bottom:10px; opacity:.85;}
/* 徽章 / 标签 */
.badge{display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px; border-radius:999px; background:#ff5a5f; color:#fff; font-size:11px; font-weight:800; line-height:1;}
.chip{display:inline-block; padding:4px 11px; border-radius:999px; background:rgba(255,255,255,.08); color:var(--ak-text); font-size:12px; font-weight:700; margin:2px; cursor:pointer;}
.chip.on{background:var(--ak-primary); color:#fff;}
/* 输入框 */
.field{width:100%; padding:12px 14px; border-radius:12px; border:1px solid rgba(255,255,255,.12); background:rgba(255,255,255,.05); color:var(--ak-text); font:inherit; font-size:15px; outline:none; transition:border .15s;}
.field:focus{border-color:var(--ak-primary);}
/* 浮动按钮 FAB */
.fab{position:fixed; right:18px; bottom:calc(var(--ak-safe-b) + 92px); width:56px; height:56px; border-radius:50%; border:0; background:linear-gradient(135deg,var(--ak-primary),var(--ak-primary-2)); color:#fff; font-size:26px; box-shadow:0 8px 24px rgba(109,107,246,.5); cursor:pointer; z-index:30; display:flex; align-items:center; justify-content:center; transition:transform .12s;}
.fab:active{transform:scale(.92);}
/* 底部抽屉 / 居中弹层 (AppKit.sheet / AppKit.confirm 用) */
.ak-backdrop{position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:60; opacity:0; transition:opacity .2s; backdrop-filter:blur(2px);}
.ak-backdrop.show{opacity:1;}
.ak-sheet{position:fixed; left:0; right:0; bottom:0; max-width:430px; margin:0 auto; background:var(--ak-surface); border-radius:22px 22px 0 0; padding:18px 18px calc(var(--ak-safe-b) + 20px); z-index:61; transform:translateY(100%); transition:transform .28s cubic-bezier(.2,.9,.3,1); max-height:84vh; overflow-y:auto;}
.ak-sheet.show{transform:translateY(0);}
.ak-sheet-grip{width:38px; height:4px; border-radius:999px; background:rgba(255,255,255,.2); margin:0 auto 14px;}
.ak-modal{position:fixed; left:50%; top:50%; transform:translate(-50%,-46%); width:84%; max-width:340px; background:var(--ak-surface); border-radius:20px; padding:22px 20px 16px; z-index:61; opacity:0; transition:opacity .2s, transform .2s; text-align:center;}
.ak-modal.show{opacity:1; transform:translate(-50%,-50%);}
.ak-modal-msg{font-size:15px; margin-bottom:18px; line-height:1.5;}
.ak-modal-btns{display:flex; gap:10px;}
.ak-modal-btns .btn{flex:1;}
/* 自动演示 (AppKit.tour) 高亮 */
.ak-tour-bubble{position:fixed; z-index:81; max-width:260px; background:#fff; color:#1a1a1a; padding:12px 14px; border-radius:14px; font-size:13px; font-weight:600; line-height:1.45; box-shadow:0 12px 40px rgba(0,0,0,.5);}
.ak-tour-spot{position:fixed; z-index:80; border-radius:14px; box-shadow:0 0 0 9999px rgba(0,0,0,.6); transition:all .3s; pointer-events:none;}
/* 屏切换的原生过渡 (支持的浏览器自动用; 不支持自动忽略) */
::view-transition-old(root),::view-transition-new(root){animation-duration:.25s;}
