/* badge_edit.css — カード編集 (p/edit.html) の「裏」タブ: 裏面にシールを貼る (src/pages/card_back_edit.js)。上の段・カード・操作は画面の上に出たまま、
   持っているシールはその下の箱の中だけでスクロールする
   貼る層 .bz-layer / 枠の層 .bz-over はカードに重ねる。位置・大きさは js が表示幅に合わせた px で置く */
main.bz { max-width: 560px; margin: 0 auto; padding: 8px 16px 0; }

/* 上の段 */
.bz-head { display: flex; align-items: center; gap: 6px; min-height: 40px; }
.bz-back { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: -6px;
  color: #374151; text-decoration: none; border-radius: 8px; }
.bz-back:hover { background: #f3f4f6; }
.bz-back svg { width: 20px; height: 20px; }
.bz-title { font-size: 16px; margin: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
.bz-tag { font-size: 10px; font-weight: 600; color: #b45309; background: #fef3c7; border-radius: 6px; padding: 2px 5px; }
.bz-head-btns { margin-left: auto; display: flex; align-items: center; gap: 4px; }

/* 小さいボタン (アイコン・短い文字) */
.bz-ib { font: inherit; font-size: 12px; font-weight: 600; min-width: 32px; height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: 8px;
  background: none; color: #374151; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; list-style: none; }
.bz-ib::-webkit-details-marker { display: none; }
.bz-ib:hover:not(:disabled) { background: #f3f4f6; }
.bz-ib:disabled { opacity: .35; cursor: default; }
.bz-ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bz-menu summary svg { fill: currentColor; stroke: none; }
/* 名前を前に: シールの四角と A。オフは四角が A の手前 (.bz-tt-over)、オンは黒地で A が手前 */
.bz-tt .bz-tt-st { fill: #d1d5db; stroke: none; }
.bz-tt .bz-tt-a { stroke-width: 2.2; }
.bz-tt[aria-pressed="false"] .bz-tt-a { stroke: #9ca3af; }
.bz-tt[aria-pressed="true"] { background: #111827; color: #fff; }
.bz-tt[aria-pressed="true"]:hover { background: #1f2937; }
.bz-tt[aria-pressed="true"] .bz-tt-st { fill: #6b7280; }
.bz-tt[aria-pressed="true"] .bz-tt-over { display: none; }

/* 白フチのシール: 太い線 (縁) の上に細い線 (字)。オフは縁が薄い灰色 */
.bz-sx .bz-sx-out { stroke: #e5e7eb; stroke-width: 7; }
.bz-sx .bz-sx-in { stroke: #9ca3af; stroke-width: 2; }
.bz-sx[aria-pressed="true"] .bz-sx-out { stroke: #fff; }
.bz-sx[aria-pressed="true"] .bz-sx-in { stroke: #111827; }

/* 名前・二つ名・順位の影は js/player_card.js の裏面 (player_card.css の .pcb-outline) */

/* その他のメニュー */
.bz-menu { position: relative; }
.bz-menu-pop { position: absolute; right: 0; top: 36px; z-index: 20; min-width: 200px; padding: 6px; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); display: flex; flex-direction: column; }
.bz-menu-pop button { font: inherit; font-size: 13px; text-align: left; padding: 9px 10px; border: 0; border-radius: 6px; background: none; color: #111827; cursor: pointer; }
.bz-menu-pop button:hover { background: #f3f4f6; }
.bz-menu-pop .bz-danger { color: #dc2626; }
.bz-menu-pop .bz-menu-redo { display: flex; align-items: center; gap: 8px; }
.bz-menu-pop .bz-menu-redo svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bz-menu-pop .bz-menu-redo:disabled { color: #d1d5db; cursor: default; background: none; }
.bz-menu-pop .bz-menu-redo[hidden] { display: none; }
.bz-menu-pop .bz-menu-sub { padding-left: 28px; font-size: .92em; }
.bz-rand { display: flex; align-items: center; gap: 2px; }
.bz-menu-pop .bz-rand-go { flex: 1; }
.bz-menu-pop .bz-rand-step { width: 34px; height: 34px; padding: 0; text-align: center; font-size: 17px; line-height: 1; border: 1px solid #e5e7eb; border-radius: 8px; }
.bz-menu-pop .bz-rand-step:disabled { color: #d1d5db; cursor: default; background: none; }
.bz-menu-note { font-size: 11px; color: #9ca3af; padding: 6px 10px 2px; border-top: 1px solid #f3f4f6; margin-top: 4px; }

.bz-top { padding: 4px 0 6px; }
.bz-stage { position: relative; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.bz-stage.bz-has-sel { touch-action: none; }   /* 選んでいる間は 2 本指を画面の拡大に取られないように */
.bz-stage .pcard { margin: 0; }
.bz-layer, .bz-over { position: absolute; inset: 0; }
.bz-layer { overflow: hidden; z-index: 1; }   /* カードからはみ出した所は切る。シールの重なり順はこの中だけ */
.bz-over { pointer-events: none; z-index: 3; }
/* 名前・二つ名・順位をシールの上に: 裏面の複製のうち文字の列 (.pcb-col) だけを見せる (地の色・線・強制ダークモード用の画像は隠す) */
.bz-stage .bz-text { position: absolute; inset: 0; z-index: 2; pointer-events: none; visibility: hidden; }
.bz-text .pcb-col { visibility: visible; }
.bz-text .pc-img { display: none; }

/* 貼ったシール (left/top = 中心、幅 = 一辺、回転は transform) */
.bz-st { position: absolute; cursor: grab; touch-action: none; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .3)); }
.bz-st:active { cursor: grabbing; }
/* --hb-size (クラスの文字の大きさの基準) はシールの幅 = 自分を入れ物にした cqw。100% だと文字の大きさが親の文字に対する割合になる */
.bz-st > .hb { container-type: size; --hb-size: 100cqw; width: 100%; height: 100%; }
/* 掴めるのは形の内側だけ (.hb の clip-path が当たり判定も切る) */
.bz-st { pointer-events: none; }
.bz-st > .hb { pointer-events: auto; }
/* ポインタで傾くキラキラは、ドラッグと重なるので切る */
.bz-st > .hb, .bz-st > .hb:hover { transform: none !important; transition: none; }
.bz-st .hb-sheen, .bz-st .hb-glare { display: none; }
/* 貼った直後に少し跳ねる (どこに貼られたか分かるように) */
.bz-st.bz-pop > .hb { animation: bz-pop .32s ease-out; }
@keyframes bz-pop { 0% { scale: .6; opacity: .3; } 70% { scale: 1.06; opacity: 1; } 100% { scale: 1; } }
@media (prefers-reduced-motion: reduce) { .bz-st.bz-pop > .hb { animation: none; } }

/* 選んでいるシールの枠とつまみ */
.bz-frame { position: absolute; box-sizing: border-box; border: 1.5px dashed #fff;
  outline: 1px solid rgba(0, 0, 0, .45); }
.bz-h { position: absolute; width: 28px; height: 28px; margin: 0;
  border-radius: 50%; background: #111827; color: #fff; border: 2px solid #fff; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; line-height: 1;
  pointer-events: auto; touch-action: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
/* 指で押しやすいよう、見た目より広く当たる */
.bz-h::after { content: ""; position: absolute; inset: -8px; }
.bz-h-rot { right: 0; bottom: 0; transform: translate(50%, 50%); cursor: nwse-resize; }
.bz-h-del { right: 0; top: 0; transform: translate(50%, -50%); cursor: pointer; background: #dc2626; }

/* 操作の欄 (高さは選んでいてもいなくても同じ。選んでいないときは押せない) */
.bz-tools { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.bz-sel-name { font-size: 12px; line-height: 18px; height: 18px; color: #111827; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bz-sel-name.bz-hint { color: #6b7280; font-weight: 400; }
.bz-row { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.bz-tools.bz-none .bz-row { opacity: .4; pointer-events: none; }
.bz-seg { display: inline-flex; border: 1px solid #d1d5db; border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.bz-seg button { font: inherit; font-size: 12px; height: 30px; min-width: 32px; padding: 0 8px; border: 0; border-left: 1px solid #e5e7eb; background: #fff; color: #374151;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.bz-seg button:first-child { border-left: 0; }
.bz-seg button:hover:not(:disabled) { background: #f9fafb; }
.bz-seg button:disabled { color: #d1d5db; cursor: default; }
.bz-seg button.on { background: #111827; color: #fff; }
.bz-seg svg { width: 16px; height: 16px; }
.bz-shapes button { padding: 0 6px; }
.bz-shapes svg { fill: currentColor; }
.bz-order svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bz-del { margin-left: auto; color: #dc2626; border-color: #fecaca; }
.bz-del:hover { background: #fef2f2 !important; }
.bz-slider { flex: 1 1 auto; min-width: 0; margin: 0; }
.bz-val { flex: 0 0 auto; min-width: 3.4em; font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; padding: 4px 2px;
  border: 0; background: none; color: #374151; cursor: pointer; border-radius: 6px; }
.bz-val:hover { background: #f3f4f6; }
/* 大きさ・回転・左右・上下・切り取りの切り替えとスライダー: 狭い画面では切り替えを 1 行に、スライダーを次の行に */
@media (max-width: 560px) {
  .bz-row-tabs { flex-wrap: wrap; row-gap: 4px; }
  .bz-row-tabs .bz-tabs { flex: 1 0 100%; }
  .bz-row-tabs .bz-tabs button { flex: 1 1 0; }
}
/* 狭い画面: 形の 5 つと重なり順の 4 つが 1 行に入るように詰める */
@media (max-width: 380px) {
  .bz-seg button { min-width: 28px; padding: 0 4px; }
  .bz-row { gap: 6px; }
}

/* 裏面の名前 (英字名)。まだ無い人には、欄の上に枠で囲った「必須」の案内 */
.bz-latin-req { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; padding: 8px 10px; border: 2px solid #dc2626; border-radius: 8px; background: #fef2f2; color: #991b1b; font-size: 13px; font-weight: 600; line-height: 1.5; }
.bz-latin-req[hidden] { display: none; }
.bz-latin-req b { flex: 0 0 auto; padding: 0 7px; border-radius: 4px; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; }
.bz-latin.need { border: 2px solid #dc2626; background: #fef2f2; }
.bz-latin { display: block; width: 100%; height: 34px; box-sizing: border-box; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; font-size: 16px; font-weight: 600; }
.bz-latin:focus { outline: none; border-color: #111827; }
.bz-latin.bad { border-color: #dc2626; }
.bz-latin:disabled { background: #f9fafb; color: #9ca3af; }
.bz-save { flex: 0 0 auto; height: 34px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 600; border: 0; border-radius: 8px; background: #111827; color: #fff; cursor: pointer; }
.bz-save:disabled { background: #e5e7eb; color: #9ca3af; cursor: default; }
.bz-name-note { font-size: 12px; line-height: 1.5; margin: -2px 0 4px; display: none; }
.bz-name-note.bad { display: block; }
.bz-name-note.bad { color: #dc2626; }

/* 持っているシール */
.bz-sec { margin-top: 4px; }
/* 検索・シリーズ・並べ替え (狭い画面では検索が 1 行、選ぶ 2 つが次の行) */
.bz-find { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.bz-q { flex: 1 1 100%; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; }
.bz-q:focus-within { border-color: #111827; }
.bz-q svg { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: #9ca3af; stroke-width: 2; stroke-linecap: round; }
.bz-q input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 16px; background: none; padding: 0; }   /* 16px: iOS で拡大されない */
.bz-find select { flex: 1 1 0; min-width: 0; height: 34px; font: inherit; font-size: 13px; padding: 0 8px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #111827; }
.bz-find select:disabled { color: #9ca3af; }
@media (min-width: 480px) {
  .bz-q { flex: 1 1 200px; }
  .bz-find select { flex: 0 1 auto; max-width: 180px; }
}
.bz-imeta b { color: #111827; font-weight: 700; }
.bz-filters { display: flex; gap: 6px; padding: 2px 0 8px; overflow-x: auto; scrollbar-width: none; }
.bz-filters::-webkit-scrollbar { display: none; }
.bz-filters button { flex: 0 0 auto; font: inherit; font-size: 12px; padding: 4px 10px; border: 1px solid #d1d5db; border-radius: 999px; background: #fff; color: #374151; cursor: pointer; white-space: nowrap; }
.bz-filters button .bz-n { color: #9ca3af; margin-left: 3px; font-variant-numeric: tabular-nums; }
.bz-filters button.on { background: #111827; color: #fff; border-color: #111827; }
.bz-filters button.on .bz-n { color: #9ca3af; }
.bz-scroll { padding: 2px 0 32px; }
.bz-tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px 10px; }
.bz-ev { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bz-thumb { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; border-radius: 10px; overflow: hidden; background: #f3f4f6;
  border: 2px solid transparent; cursor: pointer; }
/* 本物のシールの見た目 (js/holo_badge.js)。地は薄い灰色、カードに貼ったときと同じ影 */
.bz-tb { position: absolute; inset: 12%; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, .3)); }
.bz-tb > .hb { container-type: size; --hb-size: 100cqw; width: 100%; height: 100%; }
.bz-tb .hb-sheen, .bz-tb .hb-glare { display: none; }
.bz-thumb:hover .bz-tb { transform: translateY(-1px); }
.bz-ev.on .bz-thumb { border-color: #111827; }
/* 色の丸 (持っている色だけ。貼っていると印) */
.bz-tiers { display: flex; gap: 3px; }
.bz-tier { flex: 1 1 0; min-width: 0; height: 22px; padding: 0; border-radius: 6px; border: 1px solid transparent; font: inherit; font-size: 11px; font-weight: 700;
  color: #fff; cursor: pointer; position: relative; }
.bz-tier.t0 { background: linear-gradient(90deg, #f43f5e, #f59e0b, #10b981, #3b82f6, #8b5cf6); }
.bz-tier.t1 { background: #c99a1a; }
.bz-tier.t2 { background: #8b95a1; }
.bz-tier.t3 { background: #fff; color: #4b5563; border-color: #d1d5db; }
.bz-tier.on { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #111827; }
.bz-tier.on::after { content: "✓"; position: absolute; right: 2px; top: -1px; font-size: 9px; }
.bz-iname { font-size: 11px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bz-imeta { font-size: 10px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -3px; }
.bz-empty { grid-column: 1 / -1; color: #9ca3af; font-size: 13px; padding: 16px 0; text-align: center; }
.bz-more { display: block; margin: 14px auto 0; font: inherit; font-size: 13px; padding: 8px 24px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; cursor: pointer; }
.bz-note { font-size: 11px; color: #9ca3af; line-height: 1.6; margin-top: 16px; }

/* 一時的なお知らせ (貼れる枚数の上限など) */
.bz-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; background: #111827; color: #fff; font-size: 13px;
  padding: 9px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); pointer-events: none; transition: opacity .2s;
  display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.bz-toast-act { font: inherit; font-size: 13px; font-weight: 700; color: #93c5fd; background: none; border: 0; padding: 0; cursor: pointer; }

/* 狭い画面: 上の段のボタンが 5 つ並ぶので、題を詰める */
@media (max-width: 400px) {
  .bz-tag { display: none; }
  .bz-title { font-size: 15px; }
  .bz-head-btns { gap: 2px; }
}

/* 使い方ガイド (src/pages/card_back_guide.js): 本物の欄を切り抜いて明るく (ほかは暗く)、横に説明 */
.bzg { position: fixed; inset: 0; z-index: 40; touch-action: pan-y; }
.bzg-hole { position: fixed; border-radius: 10px; box-shadow: 0 0 0 200vmax rgba(17, 24, 39, .62); outline: 2px solid #fff; pointer-events: none;
  transition: left .2s, top .2s, width .2s, height .2s; }
.bzg-tip { position: fixed; box-sizing: border-box; background: #fff; color: #111827; border-radius: 12px; padding: 12px 14px 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  font-size: 13px; line-height: 1.6; transition: top .2s, left .2s; }
.bzg-step { font-size: 11px; color: #6b7280; font-variant-numeric: tabular-nums; }
.bzg-title { font-size: 15px; font-weight: 700; margin: 2px 0 4px; }
.bzg-btns { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.bzg-sp { flex: 1; }
.bzg-btns button { font: inherit; font-size: 13px; font-weight: 600; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; color: #374151; cursor: pointer; }
.bzg-btns .bzg-skip { border-color: transparent; color: #6b7280; padding: 0 6px; }
.bzg-btns .bzg-next { background: #111827; border-color: #111827; color: #fff; }
@media (prefers-reduced-motion: reduce) { .bzg-hole, .bzg-tip { transition: none; } }
/* 英字名が無いまま適用を押したとき、案内を揺らして気づかせる */
@keyframes bz-req-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.bz-latin-req.shake { animation: bz-req-shake .4s; }
@media (prefers-reduced-motion: reduce) { .bz-latin-req.shake { animation: none; } }
