/* ===== 妖怪ウォッチ風バトル（見た目だけ。戦闘のルールは変えていません） =====
   index.html のあとに読み込まれ、戦闘中（.field.in-battle）だけ上書きします。
   色を変えたいときは、すぐ下の変数を書きかえるだけでOKです。 */
@property --rot { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

.field.in-battle {
  --y-navy: #141039;      /* 外枠・影 */
  --y-navy2: #2e2878;     /* パネルの明るい側 */
  --y-cyan: #7fe9ff;      /* ふちのひかり */
  --y-yel: #ffd23f;       /* アクセント（黄） */
  --y-org: #ff9f1c;       /* アクセント（橙） */
}

/* ----- 舞台：夕やけの空 ＋ 足もとのひかる輪 ＋ まわりを少し暗く ----- */
.field.in-battle .b-bg { background: linear-gradient(#1d1760 0%, #5b2fa8 20%, #ff6fa5 35%, #ffc470 40.5%, #6cbc57 45%, #55a746 100%); }
.field.in-battle .battle::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at 50% 56%, transparent 52%, rgba(20, 10, 60, .55) 100%); }
.field.in-battle .b-unit .b-shadow {
  background: radial-gradient(ellipse, rgba(0, 0, 0, .3) 0 55%, transparent 58%);
  box-shadow: 0 0 0 5px var(--rc), 0 0 0 9px rgba(255, 255, 255, .6), 0 0 26px 10px var(--rc);
}
.field.in-battle .b-unit.e { --rc: #ff7a45; }
.field.in-battle .b-unit.p { --rc: #47e3ff; }
.wipe { background: repeating-linear-gradient(115deg, #141039 0 28px, #2e2878 28px 56px); }

/* ----- 名前プレート ----- */
.field.in-battle .plate {
  background: linear-gradient(var(--y-navy2), #15113d); color: #fff;
  border: 3px solid var(--y-cyan); border-radius: 16px;
  box-shadow: 0 0 0 3px var(--y-navy), 0 0 18px rgba(71, 227, 255, .55), 0 6px 14px rgba(0, 0, 0, .4);
}
.field.in-battle .pl-name { font-size: 18px; text-shadow: 0 2px 0 #0b0826; }
.field.in-battle .pl-lv { color: #3a1d00; background: linear-gradient(#ffe27a, #ffa41c); border: 2px solid #fff; border-radius: 999px; padding: 0 9px; font: 700 12px var(--body); }
.field.in-battle .pl-num { color: #cfeaff; text-shadow: 0 1px 0 #0b0826; }
.field.in-battle .hp b { background: linear-gradient(#ffb04a, #e66a00); border: 2px solid #fff; border-radius: 999px; padding: 0 7px; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.field.in-battle .bar { position: relative; height: 15px; background: #0b0826; border: 2px solid #fff; border-radius: 999px; }
.field.in-battle .bar s { position: absolute; inset: 0 auto 0 0; width: 100%; background: #ffe27a; text-decoration: none; transition: width .5s ease .35s; }   /* ダメージの「あとから減る」黄色 */
.field.in-battle .bar i { position: relative; z-index: 1; background: linear-gradient(#9af58a 0 45%, #2fc04a 50%); }
.field.in-battle .bar i::after { content: ""; position: absolute; left: 5px; right: 5px; top: 2px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .55); }
.field.in-battle .bar i.mid { background: linear-gradient(#ffe88a 0 45%, #f0b020 50%); }
.field.in-battle .bar i.low { background: linear-gradient(#ff9a8a 0 45%, #e0423b 50%); }
.field.in-battle .exp { background: #0b0826; border: 1px solid #fff; }
.field.in-battle .exp i { background: linear-gradient(#8fd0ff, #3b9be8); }
.field.in-battle .ab-pop { background: linear-gradient(var(--y-navy2), #15113d); border: 2px solid var(--y-yel); box-shadow: 0 0 14px rgba(255, 210, 63, .55); }

/* ----- メッセージ枠 ----- */
.field.in-battle .dlg { background: linear-gradient(var(--y-navy2), #15113d); border: 3px solid var(--y-cyan); border-radius: 16px; padding: 6px; box-shadow: 0 0 0 3px var(--y-navy), 0 0 18px rgba(71, 227, 255, .5); }
.field.in-battle .dlg.open { clip-path: inset(-30px); }
.field.in-battle .dlg-text { background: transparent; border: 0; color: #fff; text-shadow: 0 2px 0 #0b0826; padding: 10px 34px 10px 14px; }
.field.in-battle .dlg-arrow { color: var(--y-yel); }
.field.in-battle.cmd-open .dlg { width: 56%; }
.field.in-battle.cmd-open .dlg-text { font-size: 15px; padding-right: 26px; }

/* ----- コマンド：まるいボタン ----- */
.field.in-battle .menu { background: rgba(14, 10, 52, .88); border: 3px solid var(--y-cyan); border-radius: 16px; box-shadow: 0 0 0 3px var(--y-navy), 0 0 18px rgba(71, 227, 255, .45); }
.field.in-battle .menu.cmd { background: none; border: 0; box-shadow: none; padding: 0; width: clamp(150px, 40%, 196px); min-width: 0; right: 2%; bottom: 12px; gap: 8px; }
.field.in-battle .menu.cmd .mbtn {
  aspect-ratio: 1 / 1; min-height: 0; padding: 4px; border: 4px solid #fff; border-radius: 50%; color: #fff; font: 700 14px/1.15 var(--head); text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .45);
  background: radial-gradient(circle at 32% 22%, rgba(255, 255, 255, .8) 0 9%, transparent 32%), radial-gradient(circle at 50% 125%, rgba(0, 0, 0, .3), transparent 60%), var(--c);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .35), 0 0 0 3px var(--y-navy);
}
.field.in-battle .menu.cmd .mbtn small { color: #fff; font-size: 10px; text-shadow: 0 1px 0 rgba(0, 0, 0, .5); }
.field.in-battle .menu.cmd .mbtn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 0 3px var(--y-navy); }
/* わざ・リスト */
.field.in-battle .menu.move .mbtn, .field.in-battle .menu.list .mbtn {
  background: linear-gradient(#34308a, #1a1550); color: #fff; border: 2px solid #4b46b0; border-left: 10px solid var(--c); border-radius: 12px; text-shadow: 0 1px 0 #0b0826;
}
.field.in-battle .menu.move .mbtn small, .field.in-battle .menu.list .mbtn small { color: #bfe9ff; }
.field.in-battle .menu.move .mbtn:not(:disabled):hover, .field.in-battle .menu.list .mbtn:not(:disabled):hover { border-color: var(--y-yel); border-left-color: var(--c); }

/* ----- ルーレット（ムラモンを入れかえるときの輪） ----- */
.ywheel { position: absolute; z-index: 12; left: 50%; bottom: 92px; width: min(92%, 340px, 50vh); aspect-ratio: 1; transform: translateX(-50%); animation: yw-in .45s cubic-bezier(.2, .9, .3, 1.15) both; }
@keyframes yw-in { from { transform: translateX(-50%) scale(.3) rotate(-90deg); opacity: 0; } }
.yw-disc { position: absolute; inset: 7%; border-radius: 50%; border: 4px solid var(--y-cyan); background: radial-gradient(circle, #3b36a0 0, #1a1550 62%, #0e0a34 100%); box-shadow: 0 0 0 4px var(--y-navy), 0 0 28px rgba(71, 227, 255, .7), inset 0 0 30px rgba(0, 0, 0, .6); }
.yw-disc::after { content: ""; position: absolute; inset: 22%; border-radius: 50%; border: 2px dashed rgba(127, 233, 255, .45); }
.yw-ring { position: absolute; inset: 0; transform: rotate(var(--rot)); transition: --rot .4s cubic-bezier(.3, .8, .3, 1); }
.yw-slot { position: absolute; left: 50%; top: 50%; width: 27%; aspect-ratio: 1; margin: -13.5% 0 0 -13.5%; padding: 0; border: 0; background: none; cursor: pointer; font-family: var(--head); transform: rotate(var(--a)) translateY(-133%) rotate(calc(var(--a) * -1 - var(--rot))); }
.yw-hp { position: absolute; inset: 0; border-radius: 50%; padding: 5px; background: conic-gradient(var(--hc) calc(var(--p) * 1%), #0b0826 0); box-shadow: 0 0 0 3px #fff, 0 4px 8px rgba(0, 0, 0, .55); }
.yw-hp img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 20%; background: #dbe6ff; }
.yw-name { position: absolute; left: -12%; right: -12%; bottom: -7px; padding: 1px 0; border-radius: 8px; background: rgba(10, 8, 40, .9); color: #fff; font: 700 10px/1.3 var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yw-lv { position: absolute; right: -6%; top: -4%; padding: 0 5px; border: 2px solid #fff; border-radius: 999px; background: linear-gradient(#ffe27a, #ffa41c); color: #3a1d00; font: 700 10px var(--body); }
.yw-slot.cur .yw-hp { box-shadow: 0 0 0 3px var(--y-org), 0 0 14px 4px var(--y-org); }
.yw-slot.cur::after { content: "せんとう中"; position: absolute; left: 50%; top: -14px; transform: translateX(-50%); padding: 0 6px; border-radius: 8px; background: var(--y-org); color: #fff; font: 700 9px var(--body); white-space: nowrap; }
.yw-slot:disabled { cursor: default; }
.yw-slot:disabled:not(.cur) img { filter: grayscale(1) brightness(.6); }
.yw-slot:disabled:not(.cur) { opacity: .75; }
.yw-slot:not(:disabled):hover .yw-hp, .yw-slot:not(:disabled):focus-visible .yw-hp { box-shadow: 0 0 0 3px var(--y-yel), 0 0 16px 5px var(--y-yel); outline: none; }
.yw-slot.pick .yw-hp { box-shadow: 0 0 0 4px var(--y-yel), 0 0 22px 8px var(--y-yel); }
.yw-center { position: absolute; left: 50%; top: 50%; width: 25%; aspect-ratio: 1; margin: -12.5% 0 0 -12.5%; padding: 0; border: 4px solid #fff; border-radius: 50%; color: #fff; font: 700 13px var(--head); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); cursor: pointer;
  background: radial-gradient(circle at 32% 22%, rgba(255, 255, 255, .8) 0 9%, transparent 32%), #3b82d6; box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 0 0 3px var(--y-navy); }
.yw-center:active { transform: translateY(3px); }
.yw-wheel-lock { pointer-events: none; }

/* ----- ひっさつわざのカットイン（いりょく100以上の技） ----- */
.ycut { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; animation: yc-run 1s ease both; }
.ycut::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, transparent 28%, rgba(10, 6, 40, .55) 100%); }
.yc-band { position: absolute; left: -6%; right: -6%; top: 27%; height: 25%; background: linear-gradient(90deg, rgba(14, 10, 52, .97), rgba(46, 40, 120, .96) 65%, rgba(14, 10, 52, .9)); border-top: 5px solid var(--tc); border-bottom: 5px solid var(--tc); box-shadow: 0 0 28px var(--tc), 0 8px 0 rgba(0, 0, 0, .25); transform-origin: 0 50%; }
.ycut.p .yc-band { transform: skewY(-7deg); animation: yc-band-p .22s ease-out both; }
.ycut.e .yc-band { transform: skewY(7deg); transform-origin: 100% 50%; background: linear-gradient(270deg, rgba(14, 10, 52, .97), rgba(46, 40, 120, .96) 65%, rgba(14, 10, 52, .9)); animation: yc-band-e .22s ease-out both; }
@keyframes yc-band-p { from { transform: scaleX(0) skewY(-7deg); } }
@keyframes yc-band-e { from { transform: scaleX(0) skewY(7deg); } }
.yc-lines { position: absolute; left: 0; right: 0; top: 27%; height: 25%; background: repeating-linear-gradient(0deg, transparent 0 9px, rgba(255, 255, 255, .13) 9px 11px); animation: yc-lines .4s linear infinite; }
.ycut.p .yc-lines { transform: skewY(-7deg); }
.ycut.e .yc-lines { transform: skewY(7deg); }
@keyframes yc-lines { to { background-position: 0 22px; } }
.yc-face { position: absolute; top: 10%; height: 46%; max-width: 40%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 6px 10px rgba(0, 0, 0, .55)); }
.ycut.p .yc-face { left: 2%; animation: yc-in-l .3s .05s ease-out both; }
.ycut.e .yc-face { right: 2%; animation: yc-in-r .3s .05s ease-out both; }
.yc-txt { position: absolute; top: 30%; height: 19%; display: flex; flex-direction: column; justify-content: center; font-family: var(--head); color: #fff; }
.ycut.p .yc-txt { left: 36%; right: 4%; transform: rotate(-7deg); animation: yc-in-r .3s .1s ease-out both; }
.ycut.e .yc-txt { left: 4%; right: 36%; text-align: right; transform: rotate(7deg); animation: yc-in-l .3s .1s ease-out both; }
.yc-txt small { font: 700 13px var(--body); letter-spacing: .12em; color: var(--y-yel); text-shadow: 0 1px 0 #0b0826; }
.yc-txt b { font: 700 32px/1.1 var(--head); white-space: nowrap; text-shadow: 0 3px 0 #0b0826, 0 0 14px var(--tc); }
@keyframes yc-run { 0% { opacity: 0; } 8% { opacity: 1; } 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes yc-in-l { from { opacity: 0; translate: -60px 0; } }
@keyframes yc-in-r { from { opacity: 0; translate: 60px 0; } }

/* ----- バトル開始のバナー ----- */
.yintro { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; opacity: 0; animation: yi-run 1.5s .62s ease forwards; }
.yi-flash { position: absolute; inset: 0; background: radial-gradient(circle, #fff 0, rgba(127, 233, 255, .6) 30%, transparent 62%); opacity: 0; animation: yi-flash .5s .62s ease-out forwards; }
.yi-band { position: absolute; left: -10%; right: -10%; top: 40%; height: 16%; transform: skewY(-6deg); display: flex; align-items: center; justify-content: center; background: linear-gradient(90deg, #ff9f1c, #ffd23f 50%, #ff9f1c); border-top: 4px solid #fff; border-bottom: 4px solid #fff; box-shadow: 0 0 24px #ffb62e; animation: yi-slide .3s .62s cubic-bezier(.2, .9, .3, 1.1) both; }
.yi-band b { font: 700 clamp(22px, 8vw, 40px) var(--head); letter-spacing: .08em; color: #2a1100; text-shadow: 0 2px 0 rgba(255, 255, 255, .55); transform: skewY(6deg); }
@keyframes yi-run { 0% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes yi-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes yi-slide { from { transform: translateX(-120%) skewY(-6deg); } }

@media (prefers-reduced-motion: reduce) {
  .ywheel, .ycut, .yintro, .yc-lines { animation: none; }
  .yw-ring { transition: none; }
}
