/* 月蝕こいこい — 相手のひとこと・役の見せ場・相手えらび・意匠蔵 */

/* タイトル: 対戦するを主に、着せ替えはその下に小さく */
.title-btns { flex-direction: column; align-items: stretch; }
.title-btns .kbtn { flex: none; }
.title-btns .kbtn.sub { align-self: center; min-height: 40px; min-width: 60%; }
.title-btns .kbtn.sub > span { min-height: 38px; font-size: 13px; letter-spacing: .18em; }

/* ---- 音の設定 ---- */
.snd { display: grid; gap: 2px; }
.snd-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 2px;
  border: 0; border-bottom: 1px solid var(--line); margin: 0; font-size: 15px; min-height: 44px; }
.snd-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--kin); }
.snd-row input[type="range"] { flex: 1; max-width: 220px; accent-color: var(--kin); }
.snd-mode { display: grid; gap: 8px; justify-content: stretch; }
.snd-mode legend { font-size: 15px; padding: 0; margin-bottom: 6px; }
.snd-mode label { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; font-size: 14px; cursor: pointer; }
.snd-mode input { width: 18px; height: 18px; accent-color: var(--kin); grid-row: span 2; }
.snd-mode small { grid-column: 2; font-size: 11px; color: var(--sub); line-height: 1.5; }
.opp-song { font-size: 11px; color: var(--kin-hi); padding: 0 8px; }

/* 重ねた手札でも印が隠れないよう左寄せ */
.hand-p .tag { left: 2px; transform: none; }

/* ---- 相手のひとこと ---- */
.side-c { position: relative; }
.bubble {
  position: absolute; left: 50%; top: calc(var(--sw) * 1.5 + 14px); transform: translateX(-50%); z-index: 12;
  width: max-content; max-width: min(92%, 420px); padding: 9px 14px; border-radius: 10px;
  background: rgba(24, 22, 38, .96); box-shadow: 0 6px 18px rgba(0, 0, 0, .55);
  font-size: 13px; line-height: 1.7; color: var(--geppaku); text-align: left; pointer-events: none;
}
.bubble::before { content: ""; position: absolute; left: 50%; top: -6px; width: 12px; height: 12px;
  transform: translateX(-50%) rotate(45deg); background: rgba(24, 22, 38, .96); }
.bubble b { display: block; font-size: 11px; color: var(--kin-hi); letter-spacing: .15em; }
.bubble.show { animation: bubble-in 280ms var(--ease); }
@keyframes bubble-in { from { opacity: 0; transform: translate(-50%, 8px) scale(.96); } }

/* ---- 役の見せ場 ---- */
.cutin { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(ellipse 80% 60% at 50% 42%, rgba(30, 24, 52, .72), rgba(6, 5, 12, .86));
  animation: ci-bg 260ms var(--ease); }
.cutin.tier-1 { background: radial-gradient(ellipse 60% 30% at 50% 42%, rgba(20, 16, 36, .75), rgba(6, 5, 12, 0) 70%); }
.cutin.out { opacity: 0; transition: opacity 240ms var(--ease); }
@keyframes ci-bg { from { opacity: 0; } }
.ci-inner { display: grid; justify-items: center; gap: 6px; padding: 16px; text-align: center; }
.ci-who { margin: 0; font-size: 13px; letter-spacing: .3em; color: var(--sub); animation: ci-rise 300ms var(--ease) both; }
.who-p .ci-who { color: var(--kin-hi); }
.ci-name { margin: 0; font-weight: 800; line-height: 1.2; letter-spacing: .3em; padding-left: .3em;
  font-size: clamp(40px, 12vw, 88px);
  background: linear-gradient(180deg, #FFF9E6, #F2D88E 40%, #CFA040 75%, #96692A);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--kin-hi);
  filter: drop-shadow(0 0 18px rgba(240, 206, 126, .35));
  animation: ci-name 520ms cubic-bezier(.34, 1.4, .64, 1) both; }
.tier-1 .ci-name { font-size: clamp(26px, 7vw, 44px); }
/* 強の役は間(ひと呼吸)を置いてから名前を出す */
.tier-3 .ci-name { animation-delay: 180ms; font-size: clamp(48px, 15vw, 112px); }
.ci-pts { margin: 0; font-size: 14px; color: var(--geppaku); animation: ci-rise 300ms 200ms var(--ease) both; }
.ci-pts b { font-family: var(--num); font-size: 26px; color: var(--kin-hi); margin-right: 3px; }
.ci-cards { display: flex; justify-content: center; margin-top: 12px; }
.ci-cards .card { --cwc: clamp(46px, 13vw, 92px); width: var(--cwc);
  box-shadow: 0 0 0 1px rgba(240, 206, 126, .7), 0 10px 24px rgba(0, 0, 0, .7);
  animation: ci-card 480ms var(--ease) both; animation-delay: calc(260ms + var(--i) * 70ms); }
.ci-cards .card + .card { margin-left: calc(var(--cwc) * -.18); }
.tier-3 .ci-cards .card { animation-delay: calc(440ms + var(--i) * 90ms); }
.ci-sub { margin: 8px 0 0; font-size: 13px; color: var(--sub); }
@keyframes ci-name { from { opacity: 0; transform: scale(.82); letter-spacing: .6em; } }
@keyframes ci-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes ci-card { from { opacity: 0; transform: translateY(24px) rotate(calc((var(--i) - var(--n) / 2) * 4deg)); } }
.sparks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 26; }

/* ---- 相手えらび ---- */
.panel:has(.opps), .panel:has(.designs) { width: min(620px, 100%); }
.opps { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.opp { display: grid; text-align: left; gap: 2px; padding: 0 0 8px; border: 0; border-radius: 8px; overflow: hidden;
  background: rgba(10, 9, 20, .6); color: var(--geppaku); font-family: var(--serif); cursor: pointer;
  box-shadow: 0 0 0 1px var(--line); transition: box-shadow 200ms var(--ease), transform 200ms var(--ease); }
.opp img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: 50% 18%; display: block; pointer-events: none; }
.opp.on { box-shadow: 0 0 0 2px var(--kin-hi), 0 0 14px rgba(240, 206, 126, .35); }
.opp:hover { transform: translateY(-2px); }
.opp:focus-visible, .design:focus-visible, .tab:focus-visible { outline: 2px solid var(--kin-hi); outline-offset: 2px; }
.opp-name { font-weight: 800; font-size: 15px; padding: 4px 8px 0; letter-spacing: .08em; display: flex; align-items: center; gap: 6px; }
.opp-name i { font-style: normal; font-size: 11px; color: var(--yoi); background: var(--kin); border-radius: 3px; padding: 0 4px; letter-spacing: 0; }
.opp-meta { font-size: 11px; color: var(--sub); padding: 0 8px; }
.opp-meta em { font-style: normal; color: var(--kin); letter-spacing: 0; }
.dlg-quote { margin: 12px 0 0; font-size: 14px; line-height: 1.8; color: var(--geppaku); }

/* ---- 意匠蔵 ---- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { font: 700 13px var(--serif); letter-spacing: .15em; color: var(--sub); background: none; border: 1px solid var(--line);
  border-radius: 5px; padding: 6px 14px; cursor: pointer; min-height: 36px; }
.tab.on { color: var(--kin-hi); border-color: rgba(217, 169, 76, .6); }
.designs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.design { display: grid; gap: 4px; align-content: start; text-align: left; padding: 8px; border: 0; border-radius: 8px; cursor: pointer;
  background: rgba(10, 9, 20, .5); color: var(--geppaku); font-family: var(--serif); box-shadow: 0 0 0 1px var(--line); }
.design.on { box-shadow: 0 0 0 2px var(--kin-hi); }
.design.locked { cursor: default; }
.design.locked .design-name { color: var(--sub); }
.design-name { font-weight: 800; font-size: 14px; letter-spacing: .08em; }
.design-cond { font-size: 11px; color: var(--sub); line-height: 1.5; }
.design.on .design-cond { color: var(--kin-hi); }
.design-sw { width: 100%; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .6); }
.design-sw.sw-back { aspect-ratio: 2 / 3; width: 56%; justify-self: center; }
.design-sw.sw-board { aspect-ratio: 16 / 10; }
.design-sw[data-design="locked"] { background: repeating-linear-gradient(135deg, #15131f 0 6px, #1a1726 6px 12px); }
.unlock-preview { display: grid; place-items: center; margin: 6px 0 12px; }
.unlock-preview .sw-back { width: 110px; }
.unlock-preview .sw-board { width: 100%; }

/* 意匠の中身(仮。蒔絵花札の生成画像に差し替える) */
.sw-back[data-design="yoiyami"] {
  background: radial-gradient(circle at 50% 42%, rgba(217, 169, 76, .22) 0 18%, transparent 19%), linear-gradient(160deg, #221c38, #120f20); }
body[data-back="yozakura"] .card.back, .sw-back[data-design="yozakura"] {
  background: radial-gradient(circle at 30% 30%, rgba(142, 107, 158, .55) 0 8%, transparent 9%), radial-gradient(circle at 70% 60%, rgba(142, 107, 158, .45) 0 6%, transparent 7%),
    radial-gradient(circle at 45% 80%, rgba(232, 228, 216, .25) 0 5%, transparent 6%), linear-gradient(160deg, #2a1d3a, #120f20); }
body[data-back="tsukimi"] .card.back, .sw-back[data-design="tsukimi"] {
  background: radial-gradient(circle at 50% 36%, #F0CE7E 0 17%, rgba(240, 206, 126, .2) 18%, transparent 30%), linear-gradient(180deg, #1b1a34, #0f0d1c 70%, #2a2412); }
body[data-back="inoshika"] .card.back, .sw-back[data-design="inoshika"] {
  background: radial-gradient(circle at 50% 50%, rgba(201, 58, 46, .35) 0 14%, transparent 15%), linear-gradient(160deg, #2b2416, #151208); }
body[data-back="amayo"] .card.back, .sw-back[data-design="amayo"] {
  background: repeating-linear-gradient(105deg, rgba(180, 200, 240, .2) 0 1px, transparent 1px 7px), linear-gradient(170deg, #1a2238, #0c0f1c); }
body[data-back="kinbyobu"] .card.back, .sw-back[data-design="kinbyobu"] {
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .25) 0 1px, transparent 1px 25%), linear-gradient(160deg, #caa24f, #8a6628 60%, #5e4218); }

.sw-board[data-design="urushi"] { background: radial-gradient(ellipse 120% 70% at 50% 45%, #1d1a33 0%, #131320 70%); }
body[data-board="hanamushiro"] { background: radial-gradient(ellipse 120% 70% at 50% 45%, #2a1f3a 0%, #151222 70%) fixed, #151222; }
.sw-board[data-design="hanamushiro"] { background: radial-gradient(ellipse 120% 70% at 50% 45%, #2a1f3a 0%, #151222 70%); }
body[data-board="engawa"] { background: radial-gradient(circle at 88% 8%, rgba(232, 228, 216, .22) 0 4%, rgba(232, 228, 216, .06) 12%, transparent 30%) fixed, linear-gradient(180deg, #161a30, #0f0f1c) fixed; }
.sw-board[data-design="engawa"] { background: radial-gradient(circle at 88% 8%, rgba(232, 228, 216, .22) 0 4%, rgba(232, 228, 216, .06) 12%, transparent 30%), linear-gradient(180deg, #161a30, #0f0f1c); }
body[data-board="shokuya"] { background: radial-gradient(circle at 50% -10%, transparent 0 16%, rgba(201, 58, 46, .35) 17%, transparent 22%) fixed, radial-gradient(ellipse 120% 70% at 50% 45%, #1a1428 0%, #0d0b16 70%) fixed; }
.sw-board[data-design="shokuya"] { background: radial-gradient(circle at 50% -10%, transparent 0 16%, rgba(201, 58, 46, .35) 17%, transparent 22%), radial-gradient(ellipse 120% 70% at 50% 45%, #1a1428 0%, #0d0b16 70%); }
body[data-board="makie"] { background: radial-gradient(circle, rgba(240, 206, 126, .18) 0 1px, transparent 1.5px) 0 0 / 22px 22px fixed, radial-gradient(ellipse 120% 70% at 50% 45%, #1d1a2e 0%, #0b0a12 70%) fixed; }
.sw-board[data-design="makie"] { background: radial-gradient(circle, rgba(240, 206, 126, .18) 0 1px, transparent 1.5px) 0 0 / 12px 12px, radial-gradient(ellipse 120% 70% at 50% 45%, #1d1a2e 0%, #0b0a12 70%); }

@media (prefers-reduced-motion: reduce) {
  .ci-name, .ci-who, .ci-pts, .ci-cards .card, .cutin, .bubble.show { animation: none; }
}

/* ---- 対戦相手の顔(公式の顔アイコン) ---- */
.opp img { aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 30%; background: radial-gradient(circle at 50% 40%, #2a2440, #141222); }
.bar-face { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #221d36; align-self: center; }
.bubble { display: flex; gap: 10px; align-items: center; }
.bubble-face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: #221d36; flex: none; }
