/* トークプロフィールガチャ（2026-11-24 v2：クイック性別・種族切替＋アイコン化＋呼吸する縦余白）。
   ダークは ai-dark.css の --d-* を使い、ライトは各変数の第2引数（既定値）を使う。ai-dark.css は !important で色を上書きするため、
   ページ側で色を変えたい要素は :not(#_) で詳細度を上げ、必要なものだけ !important を付ける。 */
.profile-app{--tp-text:var(--d-text,#252321);--tp-sub:var(--d-sub,#655e58);--tp-line:var(--d-line,#dfd7d0);--tp-hairline:var(--d-line,#ece5de);--tp-surface:var(--d-surface,#fff);--tp-soft:var(--d-raised,#f7f4f0);--tp-raised:var(--d-raised,#f4eee8);--tp-accent:var(--d-accent,#c0341d);--tp-selected:var(--d-selected,#fdeee9);--tp-fill:#c0341d;--tp-focus:#266bba;--tp-shadow:0 2px 14px rgba(31,29,27,.05);--tp-dock-shadow:0 8px 24px rgba(31,29,27,.12)}
html[data-theme="dark"] .profile-app{--tp-hairline:#433d4b;--tp-soft:#312c38;--tp-focus:#8db8d8;--tp-shadow:0 2px 14px rgba(0,0,0,.28);--tp-dock-shadow:0 8px 28px rgba(0,0,0,.48)}
.profile-app:not(#_){box-sizing:border-box;max-width:720px;margin:0 auto;padding:12px 16px 36px}
.profile-app *{box-sizing:border-box}
.profile-app :is(button,summary,input,a):focus-visible,dialog :focus-visible,dialog textarea:focus-visible{outline:3px solid var(--tp-focus);outline-offset:2px}
[hidden]{display:none!important}
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.ico{display:block;flex:none;width:18px;height:18px;pointer-events:none}

/* 見出しの行：戻りリンクはビルドが上に入れる。ここは題名と対象アプリの印だけ */
.profile-app .title-row{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px 10px;margin:0 0 20px;padding:0}
.profile-app .title-row h1:not(#_){margin:0;font-size:clamp(18px,4.5vw,23px);font-weight:900;line-height:1.35}
.profile-app .badge:not(#_){flex:none;padding:3px 10px;border:1px solid var(--tp-line);border-radius:999px;background:var(--tp-soft);font-size:12px;font-weight:700;line-height:1.5;white-space:nowrap;color:var(--tp-sub)!important}

/* ボタンの共通 */
.profile-app .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 16px;border:1px solid var(--tp-line);border-radius:12px;background:var(--tp-surface);color:var(--tp-text);font:inherit;font-size:15px;font-weight:700;cursor:pointer;transition:background .15s,border-color .15s}
.profile-app .btn:hover{background:var(--tp-raised)}
.profile-app .btn.btn-fill:not(#_){min-height:50px;border-color:var(--tp-fill);background:var(--tp-fill);color:#fff!important;font-size:16px;font-weight:900}
.profile-app .btn.btn-fill:not(#_):hover{background:#a42b18;border-color:#a42b18}
.profile-app .btn .ico{width:19px;height:19px}
.profile-app .small-btn{min-height:44px;padding:0 12px;font-size:13px}

/* 性別・種族・各条件のチップ（1タップ。ラベルは左、チップは右） */
.profile-app .chip-row{display:flex;align-items:flex-start;gap:8px}
.profile-app .chip-row+.chip-row{margin-top:12px}
.profile-app .row-label:not(#_){flex:none;display:flex;align-items:center;width:36px;min-height:44px;font-size:13px;font-weight:700;line-height:1.3;color:var(--tp-sub)!important}
.profile-app .detail .row-label:not(#_){width:52px}
.profile-app .chip-options{display:flex;flex-wrap:wrap;gap:8px;flex:1;min-width:0}
.profile-app .chip-options label{position:relative;display:flex;flex:none;cursor:pointer}
.profile-app .chip-options input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}
.profile-app .chip-options span{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:44px;min-height:44px;padding:0 14px;border:1px solid var(--tp-line);border-radius:22px;background:var(--tp-surface);color:var(--tp-text);font-size:14px;font-weight:700;line-height:1.3;white-space:nowrap}
.profile-app .chip-options span .ico{color:var(--tp-sub)}
.profile-app .chip-options span small{font-size:12px;font-weight:400}
.profile-app .chip-options input:checked+span{border-color:var(--tp-accent);box-shadow:inset 0 0 0 1px var(--tp-accent);background:var(--tp-selected)}
.profile-app .chip-options input:checked+span .ico{color:var(--tp-accent)}
.profile-app .chip-options input:focus-visible+span{outline:3px solid var(--tp-focus);outline-offset:2px}
/* 性別・種族は常時表示するため、少しコンパクトに並べる */
.profile-app .quick .chip-options span{gap:4px;padding:0 9px;font-size:13px}
.profile-app .quick .ico{width:16px;height:16px}
/* 横スクロールのチップ行（スクロールバーは隠し、端の切れで続きを示す） */
.profile-app .chips{flex-wrap:nowrap;overflow-x:auto;padding:2px 2px 2px 2px;margin:-2px;scrollbar-width:none;overscroll-behavior-x:contain}
.profile-app .chips::-webkit-scrollbar{display:none}
/* 続きがある側の端をぼかして、横に送れることを示す（data-more は app.js がスクロール位置から付ける） */
.profile-app .chips[data-more=right]{-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 40px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 40px),transparent)}
.profile-app .chips[data-more=left]{-webkit-mask-image:linear-gradient(90deg,transparent,#000 40px);mask-image:linear-gradient(90deg,transparent,#000 40px)}
.profile-app .chips[data-more=both]{-webkit-mask-image:linear-gradient(90deg,transparent,#000 40px,#000 calc(100% - 40px),transparent);mask-image:linear-gradient(90deg,transparent,#000 40px,#000 calc(100% - 40px),transparent)}
@media(max-width:420px){.profile-app .chips{flex-wrap:wrap;overflow-x:visible;padding:0;margin:0}.profile-app .chips[data-more]{-webkit-mask-image:none;mask-image:none}}

/* 条件の領域：初回も結果表示中も、性別・種族をカード上部に常時置いて1タップで修正可能にする */
.profile-app .conditions{padding:18px;border:1px solid var(--tp-line);border-radius:16px;background:var(--tp-surface);box-shadow:var(--tp-shadow)}
.profile-app .more-row{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;margin-top:16px;padding:0 14px;border:1px solid var(--tp-line);border-radius:12px;background:var(--tp-soft);color:var(--tp-text);font:inherit;font-size:14px;font-weight:700;text-align:left;cursor:pointer}
.profile-app .more-row:hover{background:var(--tp-raised)}
.profile-app .more-row .more-text{flex:1;min-width:0;font-size:14px}
.profile-app .more-row .chev{margin-left:auto;color:var(--tp-sub)}
.profile-app .more-row[aria-expanded=true] .chev{transform:rotate(90deg)}
.profile-app .conditions[data-view=first] .summary-row,.profile-app .conditions[data-view=first] .detail-footer{display:none}
.profile-app .conditions[data-view=first] .detail{display:none;margin-top:16px}
.profile-app .conditions[data-view=first][data-detail=open] .detail{display:block}
.profile-app .conditions[data-view=result] .cond-panel{display:block}
.profile-app .conditions[data-view=result] .detail{display:none;margin-top:16px}
.profile-app .conditions[data-view=result][data-open=true] .detail{display:block}
.profile-app .conditions[data-view=result] #detail-toggle,.profile-app .conditions[data-view=result] .draw-bar{display:none}
.profile-app .summary-row{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;margin-top:14px;padding:0 14px;border:1px solid var(--tp-hairline);border-radius:10px;background:var(--tp-soft);color:var(--tp-text);font:inherit;font-size:13px;font-weight:700;text-align:left;cursor:pointer}
.profile-app .summary-row:hover{background:var(--tp-raised)}
.profile-app .summary-ico{width:15px;height:15px;color:var(--tp-sub)}
.profile-app .summary-text{flex:1;min-width:0;overflow-wrap:anywhere}
.profile-app .pill:not(#_){flex:none;width:8px;height:8px;padding:0;border:0;border-radius:50%;background:var(--tp-accent)}
.profile-app .summary-action:not(#_){flex:none;display:inline-flex;align-items:center;justify-content:center;color:var(--tp-sub)!important}
.profile-app .summary-row[aria-expanded=true] .summary-action .ico{display:block;transform:rotate(180deg)}
.profile-app .group{margin-top:18px;padding-top:16px;border-top:1px solid var(--tp-hairline)}
.profile-app .conditions .detail .group:first-child{margin-top:0}
.profile-app .group-title{display:flex;align-items:center;gap:8px;margin:0 0 10px;font-size:14px;font-weight:700}
.profile-app .group-title .ico{color:var(--tp-accent)}
.profile-app .group .hint:not(#_){margin:10px 0 0;font-size:12px;color:var(--tp-sub)!important}
.profile-app .extras{margin-top:16px;border:1px solid var(--tp-line);border-radius:12px;padding:0 14px}
.profile-app .extras summary{display:flex;align-items:center;min-height:48px;font-size:14px;font-weight:700;cursor:pointer}
.profile-app .checks{display:grid;padding-bottom:6px}
.profile-app .checks label{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;font-size:14px;cursor:pointer}
.profile-app .checks input{flex:none;width:24px;height:24px;accent-color:var(--tp-fill)}
.profile-app .detail-footer{display:flex;gap:8px;margin-top:18px}
.profile-app .detail-footer .btn{flex:0 0 84px;min-width:0;padding:0 10px}
.profile-app .detail-footer .btn-fill{flex:1 1 0;font-size:15px}
.profile-app .draw-bar{margin-top:18px}
.profile-app .draw-bar .btn{width:100%;font-size:17px}

/* カード（出力例・結果）：清潔感のある白カード基調＋上端の3色カラーリボン＋呼吸する縦余白 */
.profile-app .card{padding:0 20px 24px;border:1px solid var(--tp-line);border-radius:16px;background:var(--tp-surface);box-shadow:var(--tp-shadow)}
.profile-app .card-ribbon{margin:0 -20px 4px;border-radius:15px 15px 0 0;overflow:hidden;line-height:0}
.profile-app .palette-ribbon{display:block;width:100%;height:6px}
.profile-app .card.result.ep-result-theme:not(#_){background:var(--tp-surface)!important;border-color:var(--ep-result-border,var(--tp-line))!important}
.profile-app .sample-card:not(#_){padding-bottom:20px;background:var(--tp-surface)!important;border-color:var(--tp-line)!important}
.profile-app .sample{margin-top:32px}
.profile-app .sample-label:not(#_){margin:0 0 10px;font-size:13px;font-weight:700;color:var(--tp-sub)!important}
.profile-app .result{position:relative;margin-top:22px}
.profile-app .card-head{position:relative;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:52px;padding:6px 0;border-bottom:1px solid var(--tp-hairline)}
.profile-app .card-head h2:not(#_){margin:0;font-size:12px;font-weight:700;letter-spacing:.06em;color:var(--tp-sub)!important}
.profile-app .card-actions{display:flex;align-items:center;gap:2px;margin-right:-6px}
.profile-app .act-btn{display:inline-flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;border:0;border-radius:50%;background:transparent;font:inherit;cursor:pointer;transition:background .15s}
.profile-app .act-btn:hover{background:var(--tp-soft)}
.profile-app .act-btn:not(#_){color:var(--tp-sub)!important}
.profile-app .act-btn[aria-pressed=true]:not(#_){color:var(--tp-accent)!important}
.profile-app .act-btn .ico{width:18px;height:18px}
.profile-app .more-menu{position:absolute;z-index:30;right:0;top:calc(100% + 4px);display:grid;gap:6px;width:max-content;max-width:calc(100vw - 48px);padding:8px;border:1px solid var(--tp-line);border-radius:12px;background:var(--tp-surface);box-shadow:0 8px 24px rgba(0,0,0,.16)}
.profile-app .more-menu .btn{min-height:44px;font-size:14px;justify-content:flex-start}

/* 人物ヘッダー */
.profile-app .identity{display:flex;align-items:center;gap:14px;margin-top:18px;padding:16px 18px;border:0;border-radius:14px;background:var(--tp-soft)}
.profile-app .avatar{display:grid;place-items:center;flex:none;width:44px;height:44px;border:1.5px solid var(--tp-line);border-radius:50%;background:var(--tp-surface);color:var(--tp-accent)}
.profile-app .card.result.ep-result-theme .avatar{border-color:var(--ep-result-border,var(--tp-line));color:var(--ep-result-accent,var(--tp-accent))}
.profile-app .avatar .avatar-ico{width:22px;height:22px}
.profile-app .identity-text{min-width:0}
.profile-app .identity-name{margin:0;font-size:17px;font-weight:700;line-height:1.35;overflow-wrap:anywhere}
.profile-app .identity-sub:not(#_){display:flex;align-items:center;gap:6px;margin:3px 0 0;font-size:13px;line-height:1.45;color:var(--tp-sub)!important}
.profile-app .hair-dot{flex:none;width:11px;height:11px;border:1px solid var(--tp-sub);border-radius:50%}

/* セクションとアイコン「引き直す」 */
.profile-app .sec{margin-top:22px;padding-top:20px;border-top:1px solid var(--tp-hairline)}
.profile-app .sec-basic{margin-top:16px;padding-top:0;border-top:0}
.profile-app .sec-head{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:36px;margin-bottom:8px}
.profile-app .sec-title{display:flex;align-items:center;gap:7px;margin:0;font-size:14px;font-weight:700;line-height:1.4}
.profile-app .sec-title:not(#_){color:var(--tp-text)!important}
.profile-app .sec-title .ico{width:16px;height:16px;color:var(--tp-accent)}
.profile-app .card.result.ep-result-theme .sec-title .ico{color:var(--ep-result-accent,var(--tp-accent))}
.profile-app .reroll{position:relative;isolation:isolate;flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;min-height:44px;margin:-4px -6px -4px 0;padding:0;border:0;background:transparent;font:inherit;cursor:pointer}
.profile-app .reroll::before{content:"";position:absolute;inset:5px;z-index:-1;border:1px solid transparent;border-radius:50%;background:transparent;transition:background .15s,border-color .15s}
.profile-app .reroll:not(#_){color:var(--tp-sub)!important}
.profile-app .reroll .reroll-ico{width:17px;height:17px}
.profile-app .reroll:hover::before{background:var(--tp-soft);border-color:var(--tp-hairline)}
.profile-app .reroll:hover:not(#_){color:var(--tp-text)!important}
.profile-app .sec-body{margin:0;font-size:15px;line-height:1.85;white-space:pre-line;overflow-wrap:anywhere}

/* 基本情報のスペックタイル（一人称・二人称を中心に見やすく配置） */
.profile-app .basic{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:4px 0 0;padding:0;list-style:none}
.profile-app .basic-item{display:flex;flex-direction:column;gap:3px;padding:12px 14px;border-radius:12px;background:var(--tp-soft);min-width:0}
.profile-app .basic-k:not(#_){font-size:11px;font-weight:700;line-height:1.3;color:var(--tp-sub)!important}
.profile-app .basic-v:not(#_){font-size:15px;font-weight:700;line-height:1.4;color:var(--tp-text)!important;overflow-wrap:anywhere}

/* カラーパレット */
.profile-app .palette{margin-top:22px;padding-top:20px;border-top:1px solid var(--tp-hairline)}
.profile-app .palette .sec-head{justify-content:flex-start}
.profile-app .palette-name:not(#_){flex:1;min-width:0;font-size:12px;font-weight:700;color:var(--tp-sub)!important;overflow-wrap:anywhere}
.profile-app .swatches{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:10px}
.profile-app .sw{display:grid;gap:4px;justify-items:center}
.profile-app .swatch{display:block;width:100%;height:26px;border:1px solid rgba(0,0,0,.08);border-radius:8px}
html[data-theme="dark"] .profile-app .swatch{border-color:rgba(255,255,255,.12)}
.profile-app .hex:not(#_){font-size:11px;font-variant-numeric:tabular-nums;letter-spacing:.02em;color:var(--tp-sub)!important}
.profile-app .palette-mini .sec-head{min-height:32px;justify-content:flex-start}
.profile-app .palette-mini .strip{display:flex;flex:1;gap:6px;min-width:0}
.profile-app .palette-mini .swatch{flex:1;height:14px;border-radius:6px}
.profile-app .sample-card .sec-head{min-height:32px}
.profile-app .sample-card .sec-body{font-size:13.5px;line-height:1.7}
.profile-app .sample-card .basic-v:not(#_){font-size:14px}
.profile-app .result-edit{margin-top:18px}
.profile-app .edit-text{display:block;width:100%;min-height:180px;padding:14px 16px;border:1px solid var(--tp-line);border-radius:12px;background:var(--tp-soft);color:var(--tp-text);font:inherit;font-size:15px;line-height:1.8;resize:vertical}
.profile-app .edit-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
.profile-app #edit-done:not(#_){border-color:var(--tp-accent)!important;color:var(--tp-accent)!important}
.profile-app .edited-view{margin-top:18px}
.profile-app .edited-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px}
.profile-app .edited-badge:not(#_){padding:2px 10px;border-radius:999px;background:var(--tp-selected);font-size:12px;font-weight:700;color:var(--tp-accent)!important}
.profile-app .edited-reset:not(#_){min-height:44px;padding:0 10px;border:0;border-radius:8px;background:transparent;font:inherit;font-size:13px;font-weight:700;color:var(--tp-sub)!important;cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.profile-app .edited-body{margin:0;padding:16px 18px;border-radius:12px;background:var(--tp-soft);font-size:15px;line-height:1.85;white-space:pre-wrap;overflow-wrap:anywhere}
.profile-app .count:not(#_){margin:16px 0 0;font-size:12px;line-height:1.5;color:var(--tp-sub)!important;text-align:right}
.profile-app .result-reveal{animation:profile-reveal 180ms ease-out}
@keyframes profile-reveal{from{opacity:.65;transform:translateY(4px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.profile-app .result-reveal{animation:none}}

/* 結果の下：常に押しやすいスティッキーバー（コピーともう1回引く／この条件で引く） */
.profile-app .result-bar{position:sticky;bottom:calc(10px + env(safe-area-inset-bottom));z-index:15;display:flex;gap:8px;margin-top:20px;padding:8px;border:1px solid var(--tp-line);border-radius:16px;background:var(--tp-surface);box-shadow:var(--tp-dock-shadow)}
html[data-theme="dark"] .profile-app .result-bar:not(#_){background:var(--d-raised,#36313d);border-color:var(--d-line,#5a5363)}
.profile-app .result-bar .btn{white-space:nowrap;padding:0 12px;font-size:14px}
.profile-app .result-bar #copy{flex:1.15 1 0;min-width:0}
.profile-app .result-bar #again{flex:1 1 0;min-width:0;min-height:50px}
.profile-app .result-bar #again.is-dirty:not(#_){border-color:var(--tp-accent)!important;background:var(--tp-selected)!important;color:var(--tp-accent)!important;box-shadow:inset 0 0 0 1px var(--tp-accent)}
.profile-app .names-slot,.profile-app .saved-block{margin-top:20px}
.profile-app .relation-tip{margin-top:20px;padding:14px 16px;border:1px dashed var(--tp-line);border-radius:12px;font-size:14px;background:var(--tp-surface)}
.profile-app .relation-tip-lead:not(#_){margin:0 0 6px;font-size:12px;color:var(--tp-sub)!important}
.profile-app .relation-text{margin:0 0 10px;font-weight:700;line-height:1.7}
.profile-app .status{margin:12px 0 0;font-size:14px}
.profile-app .status:not(#_){color:var(--tp-accent)!important}
.profile-app .status:empty{display:none}
.profile-app .saved ul{display:grid;gap:10px;margin:10px 0 0;padding:0;list-style:none}
.profile-app .saved li{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:12px 14px;border:1px solid var(--tp-line);border-radius:12px;background:var(--tp-surface)}
.profile-app .saved-name{flex:1 1 100%;min-width:0;font-weight:700;overflow-wrap:anywhere}
.profile-app .saved-summary{display:block;font-size:12px;font-weight:400}
.profile-app .saved li .btn{flex:1 1 auto}
.profile-app .guide{margin-top:32px;font-size:14px;line-height:1.8}
.profile-app .guide summary{display:flex;align-items:center;min-height:44px;font-weight:700;cursor:pointer}
.profile-app .guide p:not(#_){margin:0 0 .8em}

/* 手動コピーのダイアログ */
dialog{box-sizing:border-box;width:min(560px,calc(100% - 32px));max-height:calc(100dvh - 32px);overflow:auto;border:0;border-radius:16px;padding:24px}
dialog::backdrop{background:#211b19a8}
dialog h2{font-size:20px}
dialog label{display:block;font-weight:700}
dialog textarea{box-sizing:border-box;width:100%;padding:10px;border:1px solid #8a837c;border-radius:8px;font:inherit;font-size:16px}
dialog .actions{display:flex;gap:8px;margin-top:12px}
dialog button{min-height:44px;padding:8px 15px;border:1px solid #8a837c;border-radius:8px;font:inherit;font-weight:700;cursor:pointer}

/* 幅が広い画面：同じ構成を720pxの1本の列に置き、チップは折り返して全部見せる */
@media(min-width:700px){
  .profile-app:not(#_){padding:16px 20px 48px}
  .profile-app .conditions{padding:22px 24px}
  .profile-app .quick .chip-options span{gap:5px;padding:0 11px}
  .profile-app .row-label:not(#_){width:44px}
  .profile-app .detail .row-label:not(#_){width:64px}
  .profile-app .chips{flex-wrap:wrap;overflow:visible;margin:0;padding:0}
  .profile-app .basic{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
  .profile-app .card{padding:0 28px 28px}
  .profile-app .card-ribbon{margin:0 -28px 4px}
  .profile-app .result-bar .btn{padding:0 16px;font-size:15px}
  .profile-app .detail-footer{justify-content:flex-end}
  .profile-app .detail-footer .btn,.profile-app .detail-footer .btn-fill{flex:0 1 auto;min-width:160px}
}
