/* 角色选择页与快速开始（assets/features/roles）。只用设计令牌；薄荷色只给「进入工作台」主按钮与焦点环。 */
/* 盖住工作台但让 Cookie 横幅（z-index 96）留在最上层：同意选择不能被首次选择页挡住。 */
.roles-overlay { z-index: var(--layer-stack-95); }
.roles-panel {
  width: min(920px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: var(--space-6); display: grid; gap: var(--space-4);
}
.roles-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.roles-title { margin: 0; font: 600 var(--text-xl)/1.2 var(--font-ui); letter-spacing: -.01em; color: var(--ink); outline: none; }
.roles-lead { margin: calc(-1 * var(--space-2)) 0 var(--space-2); max-width: 56ch; color: var(--muted); font-size: var(--text-base); }
.roles-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.roles-card { min-height: 188px; align-content: start; padding: var(--space-4); }
.roles-card-name { font: 600 var(--text-md)/1.3 var(--font-ui); }
.roles-card-line { color: var(--muted); font-size: var(--text-sm); line-height: 1.45; }
.roles-more { justify-items: start; }
.roles-more-dots { display: flex; gap: 6px; height: 88px; align-items: center; }
.roles-more-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--n-400); }
.roles-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.roles-choice { min-height: 40px; padding: 0 var(--space-4); }
.roles-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); padding-top: var(--space-2); }
.roles-steps { margin-right: auto; display: flex; gap: 6px; }
.roles-steps i { width: 18px; height: 3px; border-radius: 2px; background: var(--line); transition: background-color var(--motion-fast); }
.roles-steps i.is-on { background: var(--ink); }

/* Three-rendered illustrations, static at first paint and on low-end devices. */
.roles-panel { width:min(980px,calc(100vw - 40px)); padding:36px; gap:20px; border-radius:24px; background:var(--surface); color:var(--ink); }
.roles-title { font-size:28px; font-weight:650; letter-spacing:-.04em; }
.roles-lead { max-width:none; margin:-8px 0 4px; font-size:14px; line-height:1.6; color:var(--muted); }
.roles-grid { gap:12px; }
.roles-card { position:relative; display:grid; grid-template-columns:1fr; min-height:212px; padding:16px 20px 20px; gap:7px; border:1px solid var(--line); border-radius:16px; background:var(--surface-hover); color:var(--ink); text-align:left; transition:background 180ms,border-color 180ms,transform 180ms,box-shadow 180ms; overflow:hidden; }
.roles-card:hover { transform:translateY(-3px); background:var(--n-100); border-color:var(--n-300); }
.roles-card[aria-pressed="true"] { background:var(--state-active-bg); border-color:var(--n-600); box-shadow:inset 0 0 0 1px var(--n-600); }
.roles-card[aria-pressed="true"]::after { content:'✓'; position:absolute; top:12px; right:12px; width:22px; height:22px; border-radius:50%; background:var(--n-700); color:var(--surface); text-align:center; line-height:22px; font-size:12px; }
.roles-card-name { font-size:16px; font-weight:650; }
.roles-card-line { font-size:12px; line-height:1.55; color:var(--muted); }
.role-art { position:relative; display:block; height:112px; width:100%; }
.role-art img,.role-art canvas { width:100%; height:100%; object-fit:contain; display:block; }
.role-art canvas { position:absolute; inset:0; background:transparent; }
.roles-card[aria-pressed="true"] .role-art canvas { background:transparent; }
.roles-more { justify-items:stretch; }
.roles-foot { padding-top:4px; }
.roles-next { min-width:144px; border-radius:10px; }
.roles-next:disabled { border-color:transparent; background:var(--n-100); color:var(--n-400); opacity:1; }

/* ---- 空白画板上的快速开始 ---- */
.roles-quick {
  /* 放在黑板下部，不占书写中心（一审 T4-5：提示语和胶囊正压在书写区中央）；中心只留不接收指针的提示语 */
  position: absolute; left: 50%; top: auto; bottom: max(28px, 13%); transform: translateX(-50%); z-index: var(--layer-stack-6);
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); max-width: min(560px, 90%);
  transition: opacity var(--motion-panel) var(--ease-out), visibility 0s linear;
  /* 胶囊上也能起笔：浏览器不得把这一划当成滚动 / 缩放手势 */
  touch-action: none;
}
/* 在胶囊上起笔写字：立刻让位，不再接收指针，随空板提示一起淡出 */
.roles-quick.is-yielding { opacity: 0; pointer-events: none; transition: opacity var(--motion-fast) var(--ease-out); }
/* 隐藏就彻底不参与合成（3D 动画时不能让透明层每帧重算） */
.roles-quick.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--motion-panel) var(--ease-out), visibility 0s linear var(--motion-panel); }
.roles-quick-item { background: var(--overlay-scrim); border-color: var(--media-muted); color: var(--media-ink); }
.roles-quick-item:hover { background: var(--glass-highlight); }
.roles-quick.on-light .roles-quick-item { background: var(--surface); border-color: var(--line); color: var(--ink); }
.roles-quick.on-light .roles-quick-item:hover { background: var(--surface-hover); }
.roles-menu-entry { width: 100%; justify-content: flex-start; }

@media (max-width: 720px) {
  .roles-panel { width:calc(100vw - 24px); max-height:calc(100dvh - 24px); padding:22px 16px 16px; gap:16px; border-radius:20px; }
  .roles-title { font-size:24px; }
  .roles-head { gap:8px; }
  .roles-lead { font-size:12px; max-width:28ch; }
  .roles-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .roles-card { min-height:164px; padding:8px 12px 12px; gap:4px; }
  .role-art { height:78px; }
  .roles-card-name { font-size:14px; }
  .roles-card-line { font-size:12px; line-height:1.5; }
  .roles-card[aria-pressed="true"]::after { top:6px;right:6px;width:18px;height:18px;line-height:18px;font-size:10px; }
  .roles-foot { position:sticky;bottom:-16px;background:var(--surface);padding:10px 0 0; }
  .roles-next { min-width:128px; }
  .roles-quick { top:15%; bottom:auto; max-width:min(300px,70%); }
}
@media (min-width: 721px) and (max-width: 980px) { .roles-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  .roles-card { transition:none; }
  .roles-quick, .roles-steps i { transition: none; }
}

/* C7：静态角色，不在选择页创建 WebGL 渲染器。 */
.roles-identity { display:grid; gap:12px; }
.roles-card .role-art { height:136px; }
.role-art img { border-radius:10px; }
.roles-selected { display:flex; align-items:center; gap:10px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; }
.roles-selected img { width:40px; height:40px; border-radius:50%; object-fit:cover; }
.roles-selected > span { display:grid; gap:3px; min-width:0; }
.roles-selected strong { font-size:13px; font-weight:600; }
.roles-change { margin-left:auto; flex-shrink:0; font-size:12px; }
.roles-personalities .role-art { height:230px; }
.roles-profile { padding:12px; display:grid; gap:10px; border-bottom:1px solid var(--line); margin-bottom:4px; }
.roles-profile-heading { display:flex; align-items:center; gap:10px; }
.roles-profile-heading img { width:44px; height:44px; object-fit:cover; border-radius:50%; }
.roles-profile-heading strong { display:block; font-size:14px; }
.roles-profile-heading small,.roles-growth-note { display:block; color:var(--muted); font-size:12px; }
.roles-growth-text { display:flex; justify-content:space-between; gap:8px; font-size:12px; }
.roles-growth-track { display:block; height:4px; border-radius:4px; background:var(--line); overflow:hidden; }
.roles-growth-track > span { display:block; height:100%; background:var(--ink); width:var(--growth-progress,0%); }
.roles-demo-toggle { display:flex; align-items:center; gap:8px; min-height:36px; font-size:12px; color:var(--muted); }
.roles-demo-toggle input { accent-color:var(--ink); width:16px; height:16px; }
html body #redesignAvatar.roles-account-capsule { width:auto; min-width:66px; height:36px; padding:3px 7px 3px 3px; display:flex; gap:6px; border:1px solid var(--line); border-radius:24px; }
.roles-account-capsule > img { width:28px; height:28px; border-radius:50%; object-fit:cover; }
.roles-account-capsule .roles-capsule-growth { width:36px; display:grid; gap:3px; text-align:left; }
.roles-capsule-level { font-size:10px; line-height:1.2; white-space:nowrap; }
.roles-capsule-growth .roles-growth-track { height:3px; }
.roles-account-capsule[data-demo="true"] { border-style:dashed; }
.roles-account-capsule[data-demo="true"] .roles-capsule-growth { width:52px; }
.roles-profile .roles-avatar-change { justify-content:center; width:100%; }
@media (max-width:720px) {
  .roles-card .role-art { height:102px; }
  .roles-card { min-height:172px; }
  .roles-personalities { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .roles-personalities .role-art { height:142px; }
  .roles-selected { flex-wrap:wrap; padding:8px; }
  .roles-selected > span { flex:1; }
  .roles-change { padding:6px; }
  .roles-selected .roles-card-line { font-size:11px; }
}
@media (max-width:375px) {
  html body #redesignAvatar.roles-account-capsule { min-width:60px; gap:4px; padding-right:5px; }
  .roles-account-capsule .roles-capsule-growth { width:30px; }
}
/* 账户菜单的通用 div 布局不能覆盖语言列表的收起状态。 */
#redesignAccountMenu #langMenu.hidden { display:none!important; }
#s1TopMenu .roles-mobile-account { display:flex; align-items:center; gap:10px; }
.roles-mobile-account img { width:28px; height:28px; border-radius:50%; object-fit:cover; }
.roles-mobile-account-info { display:grid; gap:4px; flex:1; }

.roles-parent-privacy,.roles-parent-note { font-size:12px; line-height:1.6; color:var(--muted); margin:0; }
.roles-parent-note { flex-basis:100%; text-align:center; max-width:48ch; pointer-events:none; }
@media (max-width:720px) {
  .roles-quick:has(.roles-parent-note) { max-width:80%; }
  .roles-parent-note { font-size:11px; }
}

.roles-quick:not(.on-light) .roles-parent-note { color:var(--media-ink); opacity:.8; }

/* Quick start is visible before the optional onboarding module loads. */
.onboarding-empty #emptyHint { visibility:hidden; }
/* 覆盖旧胶囊定位；卡片仍复用原有起笔转交与空板显隐。 */
.roles-quick.onboard-cards { top:44%; bottom:auto; transform:translate(-50%,-50%) scale(var(--onboard-inv,1)); width:calc(var(--onboard-cols,4) * 200px + (var(--onboard-cols,4) - 1) * 12px); max-width:calc(94% / var(--onboard-inv,1)); display:grid; grid-template-columns:repeat(var(--onboard-cols,4),minmax(0,1fr)); gap:12px; }
.onboard-cards-title { grid-column:1/-1; text-align:center; font:500 19px/1.5 system-ui; color:var(--media-ink,#fff); margin:0 0 10px; pointer-events:none; }
.on-light .onboard-cards-title { color:var(--ink); }
.onboard-cards .roles-quick-item { box-sizing:border-box; position:relative; display:flex; flex-direction:row; align-items:center; gap:10px; padding:12px 10px; border-radius:16px; text-align:left; white-space:normal; min-width:0; min-height:76px; font:14px/1.4 system-ui; }
.onboard-cards .onboard-card-icon { width:32px; height:32px; border-radius:10px; flex:none; display:grid; place-items:center; color:var(--card-color); background:var(--card-bg,color-mix(in srgb,var(--card-color) 18%,transparent)); }
.onboard-card-icon svg { width:20px; height:20px; }
.onboard-card-copy { display:flex; flex-direction:column; min-width:0; gap:3px; }
.onboard-cards .roles-quick-item strong { font:500 14px/20px system-ui; }
.onboard-cards .onboard-card-description { font:400 12px/16px system-ui; color:inherit; opacity:.7; overflow-wrap:anywhere; }
.onboard-cards .roles-parent-note { grid-column:1/-1; justify-self:center; }
@media(max-width:767.98px) {
  .roles-quick.onboard-cards { top:38%; width:calc(100vw - 24px); max-width:calc(96% / var(--onboard-inv,1)); grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .onboard-cards .roles-quick-item { left:0!important; grid-column:auto!important; padding:10px 8px; gap:8px; min-height:76px; }
  .onboard-cards[data-count="5"] .roles-quick-item:last-of-type,.onboard-cards[data-count="7"] .roles-quick-item:last-of-type { grid-column:span 2!important; }
  .onboard-cards-title { font-size:16px; margin-bottom:2px; }
}
