:root { --ink:#20385c; --muted:#6b7890; --paper:#fffdf8; --purple:#6d4cc7; --line:#e7dfd1; --shadow:0 10px 30px #402b1014; font-family:"Nunito","PingFang SC","Microsoft YaHei",system-ui,sans-serif; color:var(--ink); background:#fff9ee; }
* { box-sizing:border-box; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
body { margin:0; min-width:320px; background:radial-gradient(circle at 85% 0,#dff6ff 0,transparent 28%),radial-gradient(circle at 5% 18%,#fff0bd 0,transparent 24%),#fff9ee; }
button,input,a { font:inherit; }
button { cursor:pointer; }
button:focus-visible,a:focus-visible { outline:3px solid #9d84ed; outline-offset:3px; }

/* ---------- 顶栏 ---------- */
.nav { width:min(960px,calc(100% - 32px)); height:68px; margin:auto; display:flex; align-items:center; gap:10px; }
.logo { display:flex; align-items:center; gap:10px; margin-right:auto; color:var(--ink); text-decoration:none; font-weight:950; white-space:nowrap; }
.logo span { width:40px; height:40px; display:grid; place-items:center; border-radius:13px; background:var(--purple); color:white; font-size:.9rem; box-shadow:0 8px 18px #6d4cc744; }
#accountButton { border:1px solid var(--line); border-radius:999px; padding:8px 14px; background:#ffffffcc; color:var(--ink); font-weight:800; }
main { width:min(960px,calc(100% - 32px)); min-height:calc(100vh - 68px); margin:auto; padding:8px 0 40px; }
.loading { min-height:65vh; display:grid; place-items:center; align-content:center; text-align:center; }
.loading span { font-size:4rem; }
.loading h1 { font-size:1.2rem; }

/* ---------- 通用按钮 / 提示 ---------- */
.primary,.switch { width:100%; border:0; border-radius:16px; padding:14px; font-weight:900; }
.primary { background:var(--purple); color:white; box-shadow:0 8px 18px #6d4cc733; }
.primary:disabled { opacity:.7; }
.switch { margin-top:6px; background:transparent; color:var(--purple); }
.primary.compact { width:auto; padding:10px 18px; border-radius:14px; }
.error { min-height:20px; margin:0 0 8px; color:#b64a3d; font-size:.88rem; }
.notice { margin:0 0 16px; padding:14px 16px; display:flex; gap:12px; align-items:flex-start; border:1px solid #f3c9a0; border-radius:18px; background:#fff4e6; }
.notice span { font-size:1.4rem; line-height:1; }
.notice p { margin:4px 0 0; color:var(--muted); font-size:.9rem; line-height:1.5; }

/* ---------- 未登录：吉祥物预览 + 表单 ---------- */
.auth { max-width:420px; margin:12px auto 0; }
.auth-intro { text-align:center; margin-bottom:16px; }
.preview { display:flex; justify-content:center; gap:12px; }
.preview article { width:132px; padding:12px 10px 10px; border-radius:22px; text-align:center; box-shadow:var(--shadow); }
.preview article.blue { background:#e7f5ff; }
.preview article.yellow { background:#fff1b7; }
.preview img { display:block; width:64px; height:64px; margin:0 auto 4px; object-fit:contain; }
.preview h3 { margin:0; font-size:.95rem; }
.auth-tagline { margin:14px 0 0; color:var(--muted); font-size:.95rem; font-weight:700; }
.login-card { padding:22px 20px 16px; border:1px solid var(--line); border-radius:26px; background:#ffffffee; box-shadow:0 20px 50px #4f3b1b14; }
.login-card h1 { margin:0 0 16px; font-size:1.5rem; }
.login-card input { width:100%; height:50px; margin-bottom:10px; padding:0 16px; border:1px solid var(--line); border-radius:14px; background:white; color:var(--ink); font-size:1rem; }
.login-card input:focus { outline:3px solid #d8cafb; border-color:var(--purple); }

/* ---------- 登录后：问候 + 乐园卡片 ---------- */
.greeting { margin:4px 0 14px; }
.greeting h1 { margin:0; font-size:1.45rem; letter-spacing:-.01em; }
.category { margin-bottom:22px; }
.category-title { margin:0 0 10px; font-size:1rem; color:var(--muted); }
.product-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.product { position:relative; min-height:218px; padding:16px 14px 14px; display:flex; flex-direction:column; border-radius:24px; box-shadow:var(--shadow); transition:transform .12s ease; }
.product:active { transform:scale(.98); }
.product.blue { background:#e7f5ff; }.product.yellow { background:#fff1b7; }.product.orange { background:#fff0df; }.product.pink { background:#ffe9ec; }
.product.locked { background:#f2efe9; filter:saturate(.4); }
.product-icon { width:84px; height:84px; display:grid; place-items:center; border-radius:24px; background:#fff; font-size:1.8rem; font-weight:950; }
.product-icon.has-mascot { overflow:hidden; }
.product-icon.has-mascot img { width:100%; height:100%; object-fit:contain; transform:scale(1.18); }
.product-text { margin:12px 0 10px; }
.product h2 { margin:0; font-size:1.25rem; }
.product-desc { margin:4px 0 0; color:var(--muted); font-size:.85rem; line-height:1.45; }
.product .state { display:inline-block; margin:8px 0 0; padding:3px 9px; border-radius:999px; background:#ffffffaa; color:var(--muted); font-size:.75rem; font-weight:900; }
.product .state.warn { background:#fff; color:#a0560d; }
.product-go,.product button { margin-top:auto; display:flex; justify-content:space-between; align-items:center; border:0; border-radius:14px; padding:11px 14px; background:var(--ink); color:white; text-decoration:none; font-weight:900; font-size:.92rem; }
.product-go::after { content:""; position:absolute; inset:0; border-radius:inherit; }
.product button:disabled { background:#c4beb4; cursor:not-allowed; font-size:.82rem; }

/* 其他分区（实验 / 工具）：一行一个的紧凑条目 */
.product-grid.compact { grid-template-columns:1fr; gap:8px; }
.product-grid.compact .product { min-height:0; flex-direction:row; align-items:center; gap:12px; padding:10px 12px; border-radius:18px; }
.product-grid.compact .product-icon { width:44px; height:44px; border-radius:14px; font-size:1.2rem; flex:none; }
.product-grid.compact .product-text { flex:1; min-width:0; margin:0; }
.product-grid.compact .product h2 { font-size:1rem; }
.product-grid.compact .product-desc { margin-top:2px; font-size:.8rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.product-grid.compact .product-go,.product-grid.compact .product button { margin:0; flex:none; padding:8px 12px; border-radius:12px; font-size:.82rem; }

/* 0 孩子引导卡 */
.child-guide { display:flex; align-items:center; gap:12px; margin:0 0 16px; padding:14px 16px; border:1px dashed var(--line); border-radius:20px; background:#ffffffcc; }
.child-guide-emoji { font-size:2rem; }
.child-guide-copy { flex:1; min-width:0; }
.child-guide-copy h2 { margin:0 0 2px; font-size:1.05rem; }
.child-guide-copy p { margin:0; color:var(--muted); font-size:.85rem; }

/* ---------- 当前孩子 chip ---------- */
.child-chip { display:inline-flex; align-items:center; gap:7px; border:1px solid var(--line); border-radius:999px; padding:5px 12px 5px 6px; background:#ffffffcc; color:var(--ink); font-weight:800; font-size:.9rem; line-height:1; }
.child-chip[hidden] { display:none; }
.child-chip .chip-avatar { width:28px; height:28px; display:grid; place-items:center; border-radius:50%; background:#fff4d6; font-size:1.1rem; overflow:hidden; }
.child-chip .chip-name { max-width:6rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.child-chip .chip-caret { color:var(--muted); font-size:.72rem; }
.child-chip .chip-plus { font-weight:950; color:var(--purple); }

/* ---------- 账号面板 ---------- */
.account-overlay { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:20px; background:#20385c88; backdrop-filter:blur(7px); }
.account-panel { position:relative; width:min(420px,100%); max-height:calc(100vh - 40px); overflow:auto; padding:26px 22px 18px; border:1px solid var(--line); border-radius:26px; background:var(--paper); box-shadow:0 30px 90px #17294355; }
.account-panel h2 { margin:0; font-size:1.4rem; }
.account-phone { margin:4px 0 16px; color:var(--muted); }
.account-close { position:absolute; top:14px; right:14px; width:36px; height:36px; border:0; border-radius:50%; background:#eee8dd; color:var(--ink); font-size:1.4rem; line-height:1; }
.account-list { display:grid; gap:8px; }
.account-link { width:100%; display:flex; justify-content:space-between; align-items:center; margin:0; padding:14px 16px; border:1px solid var(--line); border-radius:16px; background:#fff; color:var(--ink); font-weight:900; }
.account-link:hover { border-color:var(--purple); }
.account-link-meta { display:flex; align-items:center; gap:8px; color:var(--muted); font-weight:800; }
.account-link-caret { color:var(--muted); font-weight:900; transition:transform .15s ease; }
.account-link.is-open .account-link-caret { transform:rotate(90deg); }
.password-form { padding:4px 4px 8px; }
.password-form label { display:block; margin:10px 0; color:var(--ink); font-size:.88rem; font-weight:900; }
.password-form input { width:100%; height:48px; margin-top:6px; padding:0 14px; border:1px solid var(--line); border-radius:14px; background:#fff; color:var(--ink); }
.password-form input:focus { outline:3px solid #d8cafb; border-color:var(--purple); }
.account-panel .error.success { color:#277a4b; }
.account-logout { margin-top:12px; color:#a44239; }

/* ---------- 轻提示 toast ---------- */
.toast-host { position:fixed; left:0; right:0; bottom:calc(24px + env(safe-area-inset-bottom,0px)); z-index:9500; display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none; }
.toast { padding:12px 20px; border-radius:999px; background:#20385ceb; color:#fff; font-weight:800; font-size:.92rem; box-shadow:0 12px 30px #20385c44; opacity:1; transition:opacity .24s ease,transform .24s ease; }
.toast.is-hide { opacity:0; transform:translateY(8px); }

/* ---------- 窄屏 ---------- */
@media (max-width:560px) {
  #accountButton { width:38px; height:38px; padding:0; }
  #accountButton .account-label { display:none; }
  #accountButton::before { content:"👤"; font-size:1.05rem; }
  .child-chip .chip-name { max-width:4.5rem; }
}
@media (max-width:400px) {
  .logo { font-size:.92rem; gap:8px; }
  .logo span { width:36px; height:36px; }
}
@media (max-width:350px) {
  .product-grid:not(.compact) { grid-template-columns:1fr; }
  .product { min-height:0; }
}

/* ---------- 宽屏 ---------- */
@media (min-width:761px) {
  main { padding-top:24px; }
  .greeting h1 { font-size:2rem; }
  .product-grid { gap:18px; }
  .product { min-height:280px; padding:24px; border-radius:28px; }
  .product-icon { width:110px; height:110px; border-radius:30px; }
  .product h2 { font-size:1.6rem; }
  .product-desc { font-size:.95rem; }
  .product-grid.compact { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .auth { margin-top:40px; }
}
