/* Character models (角色模型): the bar under the prompt and the picker sheet.
   Built by characters.js; needs the UI v2 variables, so every rule sits under html.ui-v2. */

/* ----- bar under the prompt ----- */
html.ui-v2 .character-bar { display: flex; align-items: stretch; gap: 8px; margin-top: 12px; }
html.ui-v2 .character-bar[hidden] { display: none; }
html.ui-v2 .character-bar-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 10px 8px 8px; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-raised); color: var(--v2-text); text-align: left; cursor: pointer; box-shadow: none; }
html.ui-v2 .character-bar-main:hover { border-color: var(--v2-line-strong); }
html.ui-v2 .character-bar-main:focus-visible,
html.ui-v2 .character-bar-clear:focus-visible,
html.ui-v2 .character-tile:focus-visible,
html.ui-v2 .character-series button:focus-visible,
html.ui-v2 .character-upsell:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 2px; }
html.ui-v2 .character-bar.has-character .character-bar-main { border-color: rgba(216, 255, 79, .45); }
html.ui-v2 .character-avatar { flex: none; width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: var(--v2-surface); color: var(--v2-muted); }
html.ui-v2 .character-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
html.ui-v2 .character-avatar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
html.ui-v2 .character-avatar b { font-size: 17px; font-weight: 650; color: var(--v2-text); }
html.ui-v2 .character-bar-copy { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
html.ui-v2 .character-bar-copy b { overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .character-bar-copy small { overflow: hidden; color: var(--v2-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .character-bar-chevron { flex: none; display: grid; color: var(--v2-muted); }
html.ui-v2 .character-bar-chevron svg,
html.ui-v2 .character-bar-clear svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html.ui-v2 .character-bar-clear { flex: none; width: 48px; display: grid; place-items: center; padding: 0; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-raised); color: var(--v2-muted); cursor: pointer; box-shadow: none; }
html.ui-v2 .character-bar-clear[hidden] { display: none; }
html.ui-v2 .character-bar-clear:hover { color: var(--v2-text); border-color: var(--v2-line-strong); }
html.ui-v2 body.generating .character-bar,
html.ui-v2 body.generating .style-level { opacity: .6; pointer-events: none; }
/* 画风强度 淡 / 标准 / 浓 under the bar, only while a style is picked. */
html.ui-v2 .style-level { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding-left: 4px; }
html.ui-v2 .style-level[hidden] { display: none; }
html.ui-v2 .style-level-label { flex: none; color: var(--v2-muted); font-size: 13px; }
html.ui-v2 .style-level-options { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 280px; padding: 3px; border: 1px solid var(--v2-line); border-radius: 10px; background: var(--v2-bg); }
html.ui-v2 .style-level-options button { min-height: 36px; padding: 4px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--v2-muted); font-size: 13px; cursor: pointer; box-shadow: none; }
html.ui-v2 .style-level-options button[aria-pressed="true"] { background: var(--v2-raised); color: var(--v2-text); font-weight: 650; }
html.ui-v2 .style-level-options button:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 2px; }

/* ----- picker sheet ----- */
html.ui-v2 #v2CharacterSheet .v2-sheet-body { display: flex; flex-direction: column; gap: 14px; min-height: 240px; }
html.ui-v2 #v2CharacterSheet .v2-sheet-body > * { flex: none; }
@media (min-width: 620px) {
  /* Phones keep the full-width bottom sheet from ui-v2.css. */
  html.ui-v2 #v2CharacterSheet { width: min(640px, calc(100vw - 32px)); }
}
/* 角色 | 画风 switch at the top of the sheet (only when styles are on the shelf). */
html.ui-v2 .character-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-bg); }
html.ui-v2 .character-kinds button { min-height: 40px; padding: 6px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--v2-muted); font-size: 14px; cursor: pointer; box-shadow: none; }
html.ui-v2 .character-kinds button small { margin-left: 6px; font-size: 12px; opacity: .8; }
html.ui-v2 .character-kinds button[aria-pressed="true"] { background: var(--v2-raised); color: var(--v2-text); font-weight: 650; }
html.ui-v2 .character-kinds button.has-pick::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--v2-accent); vertical-align: middle; }
html.ui-v2 .character-kinds button:focus-visible { outline: 2px solid var(--v2-accent); outline-offset: 2px; }
html.ui-v2 .character-intro { margin: 0; color: var(--v2-muted); font-size: 13px; line-height: 1.6; }
html.ui-v2 .character-empty { grid-column: 1 / -1; margin: 32px 0; color: var(--v2-muted); font-size: 14px; text-align: center; }
html.ui-v2 .character-upsell { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 10px 14px; border: 1px solid rgba(216, 255, 79, .35); border-radius: 12px; background: rgba(216, 255, 79, .08); color: var(--v2-text); font-size: 13px; text-align: left; cursor: pointer; box-shadow: none; }
html.ui-v2 .character-upsell b { flex: none; color: var(--v2-accent); font-size: 13px; font-weight: 650; }
html.ui-v2 .character-search { width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--v2-line); border-radius: 12px; background: var(--v2-bg); color: var(--v2-text); font-size: 16px; }
html.ui-v2 .character-search::placeholder { color: var(--v2-muted); }
html.ui-v2 .character-series { display: flex; gap: 8px; margin: 0 -20px; padding: 0 20px 2px; overflow-x: auto; scrollbar-width: none; }
html.ui-v2 .character-series::-webkit-scrollbar { display: none; }
html.ui-v2 .character-series button { flex: none; min-height: 36px; padding: 6px 14px; border: 1px solid var(--v2-line); border-radius: 999px; background: transparent; color: var(--v2-muted); font-size: 13px; white-space: nowrap; cursor: pointer; box-shadow: none; }
html.ui-v2 .character-series button[aria-pressed="true"] { border-color: var(--v2-accent); background: var(--v2-accent); color: var(--v2-accent-ink); font-weight: 650; }
html.ui-v2 .character-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px 10px; }
html.ui-v2 .character-tile { position: relative; display: grid; gap: 6px; min-width: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--v2-text); text-align: center; cursor: pointer; box-shadow: none; }
html.ui-v2 .character-tile-cover { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; border: 2px solid transparent; border-radius: 12px; background: var(--v2-raised); color: var(--v2-muted); }
html.ui-v2 .character-tile-cover img { width: 100%; height: 100%; object-fit: cover; }
html.ui-v2 .character-tile-cover svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
html.ui-v2 .character-tile-cover b { font-size: 30px; font-weight: 650; color: var(--v2-text); opacity: .85; }
html.ui-v2 .character-tile[aria-pressed="true"] .character-tile-cover { border-color: var(--v2-accent); }
html.ui-v2 .character-tile[aria-pressed="true"] .character-tile-name { color: var(--v2-accent); font-weight: 650; }
html.ui-v2 .character-tile-name { overflow: hidden; padding: 0 2px; font-size: 13px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
html.ui-v2 .character-tile.locked .character-tile-cover img,
html.ui-v2 .character-tile.locked .character-tile-cover b { opacity: .45; }
html.ui-v2 .character-tile.locked .character-tile-name { color: var(--v2-muted); }
html.ui-v2 .character-badge { position: absolute; top: 6px; left: 6px; display: inline-flex; align-items: center; gap: 3px; min-height: 20px; padding: 2px 7px; border-radius: 999px; background: rgba(13, 17, 21, .82); color: var(--v2-text); font-size: 11px; line-height: 1; }
html.ui-v2 .character-badge svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.ui-v2 .character-badge.free,
html.ui-v2 .character-badge.mine { background: var(--v2-accent); color: var(--v2-accent-ink); font-weight: 650; }
@media (hover: hover) {
  html.ui-v2 .character-tile:hover .character-tile-cover { border-color: var(--v2-line-strong); }
  html.ui-v2 .character-tile[aria-pressed="true"]:hover .character-tile-cover { border-color: var(--v2-accent); }
}
@media (max-width: 420px) {
  html.ui-v2 .character-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
