/* card_edit.css — プレイヤーカードの編集ページ (p/edit.html)。プレビューは上に固定、選ぶものはその下、「適用」は下に固定 */
main.ce { max-width: 520px; margin: 0 auto; padding: 12px 16px 96px; }
.ce-back { display: inline-flex; align-items: center; gap: 4px; color: #374151; text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.ce-back svg { width: 18px; height: 18px; }
.ce-back:hover { color: #111827; }

/* プレビュー: スクロールしても見えるように上に固定 */
.ce-preview { position: sticky; top: 0; z-index: 5; background: #fff; padding: 6px 0 10px; }
.ce-preview .pcard { margin: 0; }
.ce-preview .pcard-flip { cursor: pointer; }

/* 英字名 */


.ce-latin { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1.5px solid #e5e7eb; border-radius: 8px; font: inherit; font-size: 15px; }
.ce-latin:focus { outline: none; border-color: #111827; }
.ce-latin.bad { border-color: #dc2626; }
.ce-latin-note { display: none; margin-top: 6px; font-size: 12px; color: #6b7280; line-height: 1.5; }
.ce-latin-note.open, .ce-latin-note.bad { display: block; }
/* 見出しの横の「?」(押すと説明が開く) */
.ce-help { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 1.5px solid #9ca3af; background: #fff; color: #6b7280;
  font: inherit; font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ce-help[aria-expanded="true"] { border-color: #111827; color: #111827; }
.ce-latin-note.bad { color: #dc2626; }

.ce-sec { margin-top: 18px; }
.ce-sec h2 { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: #6b7280; margin: 0 0 8px; }

/* テンプレート: 小さなカードの絵 */
.ce-templates { display: flex; gap: 8px; }
.ce-tpl {
  position: relative; width: 92px; height: 60px; padding: 0; border: 2px solid #e5e7eb; border-radius: 8px; background: #f3f3f3; cursor: pointer; overflow: hidden;
}
.ce-tpl.on { border-color: #111827; }
.ce-tpl-head { position: absolute; left: 0; top: 0; right: 0; height: 26%; background: var(--c); }
.ce-tpl-box { position: absolute; left: 6%; top: 34%; width: 38%; height: 26%; border: 2px solid var(--c); border-top: 0; box-sizing: border-box; }
.ce-tpl-side { position: absolute; right: 4%; top: 30%; width: 50%; bottom: 6%; background: var(--c); }

/* 色: 丸い見本。選んだものは外側に輪 */
.ce-colors { display: flex; gap: 12px; }
.ce-color {
  width: 34px; height: 34px; border-radius: 50%; padding: 0; cursor: pointer; background: var(--c);
  border: 3px solid #fff; box-shadow: 0 0 0 1px #e5e7eb;
}
.ce-color.on { box-shadow: 0 0 0 2px var(--c); }

/* 実績: 選んだものは色つきで順番の数字。入りきらないものは薄く (押せない) */
.ce-achs { display: flex; flex-wrap: wrap; gap: 6px; }
.ce-ach {
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 10px; border-radius: 16px; cursor: pointer;
  border: 1.5px solid #e5e7eb; background: #fff; color: #374151; font: inherit; font-size: 12px; font-weight: 600; text-align: left;
}
.ce-ach.on { border-color: var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 8%, #fff); }
.ce-ach:disabled { opacity: .35; cursor: default; }
.ce-ach-n {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--c); color: #fff; font-size: 11px; font-weight: 700;
}
.ce-reset { margin-left: auto; display: inline-flex; padding: 4px; border: 0; background: none; color: #9ca3af; cursor: pointer; border-radius: 6px; }
.ce-reset svg { width: 16px; height: 16px; }
.ce-reset:hover { color: #374151; background: #f3f4f6; }

/* 畳める欄 (実績・大会): 見出しの行を押すと開く。右に今の選択と ▼ */
.ce-fold > summary { list-style: none; cursor: pointer; }
.ce-fold > summary::-webkit-details-marker { display: none; }
.ce-fold > summary h2 { margin: 0; padding: 4px 0; }
.ce-fold[open] > summary h2 { margin-bottom: 8px; }
.ce-fold-sum { margin-left: auto; font-weight: 500; color: #9ca3af; font-size: 12px; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ce-caret { width: 16px; height: 16px; color: #9ca3af; flex: none; transition: transform .15s; }
.ce-fold[open] .ce-caret { transform: rotate(180deg); }
.ce-fold .ce-reset { margin-left: 4px; }

/* 大会: 並べ替えのボタン列 + 検索、その下にスクロールする一覧。選んだ大会は色の枠 */
.ce-tour-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.ce-seg { display: inline-flex; border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; }
.ce-seg button { border: 0; background: #fff; color: #6b7280; font: inherit; font-size: 12px; padding: 6px 10px; cursor: pointer; }
.ce-seg button + button { border-left: 1px solid #e5e7eb; }
.ce-seg button.on { background: #111827; color: #fff; }
.ce-tour-q { flex: 1; min-width: 140px; height: 32px; padding: 0 10px; border: 1px solid #e5e7eb; border-radius: 8px; font: inherit; font-size: 13px; }
.ce-tours { max-height: 320px; overflow-y: auto; border: 1px solid #f3f4f6; border-radius: 8px; }
.ce-tour {
  display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: baseline; width: 100%; padding: 8px 10px;
  border: 0; border-bottom: 1px solid #f3f4f6; background: #fff; font: inherit; font-size: 12px; text-align: left; cursor: pointer; color: #374151;
}
.ce-tour:last-child { border-bottom: 0; }
.ce-tour:hover { background: #f9fafb; }
.ce-tour.on { box-shadow: inset 3px 0 0 var(--c); background: color-mix(in srgb, var(--c) 6%, #fff); }
.ce-tour-date { color: #9ca3af; font-size: 11px; font-variant-numeric: tabular-nums; }
.ce-tour-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ce-tour-place { color: #6b7280; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ce-tour-pts { color: #dc2626; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
.ce-tour.auto { grid-template-columns: 1fr; font-weight: 600; }

/* 適用: 下に固定 */
.ce-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(255, 255, 255, .96); border-top: 1px solid #e5e7eb; padding: 10px 16px; display: flex; justify-content: center; gap: 8px; }
/* 表の道具の行 (右にデフォルトに戻す)。裏の道具の行 (.bz-head、高さ 36px) と同じ高さ。下の帯は「適用」だけ (表と裏で同じ) */
.ce-front-head { display: flex; justify-content: flex-end; align-items: center; min-height: 36px; }
.ce-default { flex: none; height: 32px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: #374151; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ce-default:hover { background: #f9fafb; }
.ce-apply {
  flex: 1; max-width: 360px; height: 44px; border: 0; border-radius: 10px; background: #111827; color: #fff; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
}
.ce-discard { flex: none; height: 44px; border: 1px solid #d1d5db; background: #fff; color: #374151; border-radius: 10px; padding: 0 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.ce-discard[hidden] { display: none; }
.ce-apply:disabled { background: #e5e7eb; color: #9ca3af; cursor: default; }

/* 本人確認 (ログイン) */
.ce-gate { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 24px; }
.ce-login { height: 42px; padding: 0 20px; border: 0; border-radius: 10px; background: #111827; color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.ce-login:disabled { opacity: .6; }
.ce-gate-msg { font-size: 13px; color: #b45309; font-weight: 600; text-align: center; }   /* 別の人でログイン中の注意 */
.ce-gate-msg:empty { display: none; }
a.ce-login { display: inline-flex; align-items: center; text-decoration: none; }

/* 二つ名: 前半・後半それぞれ縦に回すリール。1 項目 40px、見えるのは 5 項目 (上下はぼかす)。真ん中の帯に止まったものが選ばれる */
.ce-reels { display: flex; gap: 10px; margin-bottom: 8px; }
.ce-reel-col { flex: 1 1 0; min-width: 0; }
.ce-reel-lbl { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; text-align: center; }
.ce-reel { position: relative; height: 200px; border: 1px solid #e5e7eb; border-radius: 12px; background: #fafafa; overflow: hidden; }
.ce-reel-band { position: absolute; left: 6px; right: 6px; top: 80px; height: 40px; border-radius: 8px; border: 2px solid var(--c, #dc2626); background: #fff; pointer-events: none; }
.ce-reel-scroll {
  position: relative; height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  padding: 80px 0; box-sizing: border-box; scrollbar-width: none; outline: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 30%, #000 70%, transparent 100%);
}
.ce-reel-scroll::-webkit-scrollbar { display: none; }
.ce-reel-item {
  height: 40px; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px;
  font-family: "SPSP Title", inherit; font-size: 15px; color: #9ca3af; overflow: hidden; cursor: pointer; user-select: none;
}
.ce-reel-item.none { font-family: inherit; font-size: 13px; }
.ce-reel-item.on { color: var(--c, #dc2626); }
/* 長い二つ名は「…」で切らずに 2 行に折り返す (行の高さ 40px に 2 行。それでも入らなければ字を小さくする: p_edit.js fitReelText) */
.ce-reel-text { min-width: 0; text-align: center; line-height: 1.15; overflow-wrap: anywhere; word-break: normal; }
.ce-title-new { flex: none; font-family: inherit; font-size: 9px; font-weight: 700; color: #fff; background: #dc2626; border-radius: 4px; padding: 1px 4px; }
.ce-title-note { font-size: 11px; color: #9ca3af; }

/* 表と裏の編集のタブ */
.ce-to-profile { float: right; margin-top: 2px; font-size: 12px; color: #6b7280; text-decoration: underline; text-underline-offset: 2px; }
.ce-to-profile:hover { color: #111827; }
.ce-tabs { display: flex; gap: 4px; margin: 8px 0 6px; padding: 3px; background: #f3f4f6; border-radius: 10px; }
.ce-tabs button { flex: 1 1 0; height: 34px; font: inherit; font-size: 14px; font-weight: 600; border: 0; border-radius: 8px; background: none; color: #6b7280; cursor: pointer; }
.ce-tabs button.on { background: #fff; color: #111827; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
/* 裏: 道具の行 = 左に裏面の名前の欄 (残りの幅いっぱい)、右にボタン */
.ce-pane-back .bz-head { gap: 6px; min-height: 36px; }
.ce-pane-back .bz-latin { flex: 1 1 auto; width: auto; min-width: 0; }
.ce-pane-back .bz-head-btns { margin-left: 0; flex: 0 0 auto; }
/* カードの上の余白を表 (.ce-preview の上 6px) とそろえる */
.ce-pane-back .bz-top { padding-top: 6px; }
