:root{
    --bg:#f7f1e6;
    --panel:#fffaf2;
    --accent:#c94b3f;
    --accent-soft:#f4c9b7;
    --line:#e0d0bf;
    --text:#362a24;
    --muted:#8a7b6f;
    --boss:#4b5ea5;
    --ok:#1f7a3a;
    --ng:#a03b2f;
  }
  *{box-sizing:border-box;}
  body{
    margin:0;
    background: #ffe100 url("images/common/background.png") repeat center top / contain fixed content-box;
    background-size: 828px 522px;
    /* background:
      radial-gradient(circle at top left, rgba(255,255,255,.8) 0, transparent 60%),
      radial-gradient(circle at bottom right, rgba(255,225,205,.7) 0, transparent 55%),
      var(--bg); */
      /* background-color: #ffe100; */
    font-family:'Hiragino Sans','Noto Sans JP',system-ui,sans-serif;
    color:var(--text);
    touch-action:manipulation;
    -webkit-tap-highlight-color:transparent;
  }
.app{max-width:720px;margin:0 auto;padding:16px 12px 32px;touch-action:manipulation;-webkit-tap-highlight-color:transparent;}
.sim-app-shell,
.app-shell.sim-app-shell{
  max-width:min(1600px, calc(100vw - 24px));
}

  .header{text-align:center;margin-bottom:8px;}
  .header-title{font-size:22px;letter-spacing:0.08em;}
  .header-ribbon{
    display:inline-block;margin-top:4px;padding:2px 10px;border-radius:999px;
    border:1px solid var(--accent-soft);background:rgba(255,255,255,.7);
    font-size:11px;color:var(--muted);
  }
  
  .view{display:none;}
  .view.active{display:block;}
  
  .card-shell{
    background:rgba(255,250,245,.92);
    border-radius:16px;
    border:1px solid var(--line);
    padding:14px 14px 18px;
    box-shadow:0 6px 18px rgba(0,0,0,.06);
  }
  .section-title{
    font-size:16px;display:flex;align-items:center;gap:8px;margin:0 0 8px;
  }
  .section-title::before{
    content:'';width:6px;height:18px;border-radius:999px;
    background:linear-gradient(180deg,var(--accent),#e08a5c);
  }
  .muted{color:var(--text);font-size:15px;font-weight: 700;}
  
  /* ===== ボタン基本 ===== */
  button{
    background:linear-gradient(90deg,var(--accent),#e28a52);
    color:#fff;border:none;padding:11px 16px;font-size:16px;border-radius:10px;
    width:100%;margin:10px 0 0;box-shadow:0 3px 0 rgba(145,65,47,.7);
  }
  button:active{transform:translateY(2px);box-shadow:0 1px 0 rgba(145,65,47,.6);}
  button:disabled{opacity:.55;box-shadow:none;transform:none;cursor:not-allowed;}
  
  /* ===== 色分け ===== */
  button.primary{ /* キャラ */
    background:linear-gradient(90deg,#c94b3f,#e28a52);
    box-shadow:0 3px 0 rgba(145,65,47,.7);
  }
  button.item{ /* どうぐ */
    background:linear-gradient(90deg,#2f6fd6,#4aa3ff);
    box-shadow:0 3px 0 rgba(25,74,140,.6);
  }
  button.success{ /* たたかう */
    background:linear-gradient(90deg,#1f7a3a,#49b35f);
    box-shadow:0 3px 0 rgba(22,88,42,.55);
  }
  button.danger{ /* けす・停止など */
    background:#fff;
    color:#6f6158;
    border:1px solid #dbc8b4;
    box-shadow:0 2px 0 rgba(180,160,130,.7);
  }
  button.cta{
    font-size:18px;
    padding:14px 16px;
    border-radius:14px;
  }
  
  /* ===== HOME：QR＆カード ===== */
  .qr-layout{display:grid;grid-template-columns:1fr;gap:12px;}
  .qr-preview{
    border-radius:14px;border:1px dashed var(--line);
    background:repeating-linear-gradient(45deg,rgba(255,255,255,.9) 0,rgba(255,255,255,.9) 6px,rgba(255,240,225,.9) 6px,rgba(255,240,225,.9) 12px);
    padding:10px;
  }
  .qr-preview-inner{border-radius:10px;background:#111;overflow:hidden;}
  #qrVideo{width:100%;display:none;}
  .qr-placeholder{padding:26px 10px;text-align:center;color:var(--muted);font-size:13px;}
  
  .owned-wrap{
    border-radius:14px;border:1px solid var(--line);
    padding:10px 10px 12px;
    background:linear-gradient(135deg,rgba(255,255,255,.98),rgba(255,245,232,.96));
  }
  .card-owned{display:flex;gap:10px;align-items:center;}
  .char-img{
    width:86px;height:86px;border-radius:12px;background:#fff;display:flex;align-items:center;justify-content:center;
    overflow:hidden;border:1px solid var(--line);
  }
  .char-img img{width:100%;height:100%;object-fit:cover;}
  .card-owned-main{flex:1;}
  .card-owned-name{font-weight:900;margin-bottom:2px;font-size:16px;}
  .card-owned-tags{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin:6px 0 5px;
  }
  .spec-badge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:24px;
    padding:3px 10px;
    border-radius:999px;
    font-size:12px;
    line-height:1;
    letter-spacing:.04em;
    border:1px solid rgba(0,0,0,.12);
    background:rgba(255,255,255,.78);
    color:#5f4633;
  }
  .rarity-badge{
    background:linear-gradient(180deg, rgba(255,236,184,.95), rgba(255,214,123,.92));
    color:#704500;
    border-color:rgba(182,126,0,.28);
  }
.role-badge{
  background:rgba(255,255,255,.88);
  color:#6a5444;
}
.tribe-spec-badge{
  background:rgba(255,255,255,.88);
  color:#3f4f63;
}
  .card-owned-meta{font-size:13px;color:var(--muted);}
  
  .badge{
    display:inline-flex;align-items:center;gap:6px;
    padding:3px 10px;border-radius:999px;border:1px solid var(--line);
    background:rgba(255,255,255,.7);font-size:12px;color:var(--muted);
  }
  .badge.ok{border-color:rgba(31,122,58,.35); color:var(--ok);}
  .badge.ng{border-color:rgba(160,59,47,.35); color:var(--ng);}
  
  .step-label{
    display:inline-flex;
    align-items:center;
    gap:8px;
    font-weight:900;
    margin:0 0 6px;
  }
  .step-dot{
    width:10px;height:10px;border-radius:999px;
    background:#c94b3f;
    box-shadow:0 0 0 3px rgba(201,75,63,.15);
  }
  .step-dot.item{ background:#2f6fd6; box-shadow:0 0 0 3px rgba(47,111,214,.15); }
  
  .sound-row{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:8px;}
  .sound-row input[type="checkbox"]{width:22px;height:22px;}
  .sound-vol{width:100%;margin-top:6px;}
  
  /* ===== イントロ ===== */
  .intro-shell{
    background:rgba(255,250,245,.96);border-radius:18px;padding:18px 16px 20px;
    border:1px solid var(--line);box-shadow:0 7px 20px rgba(0,0,0,.08);
  }
  .intro-vs{display:flex;align-items:flex-end;justify-content:space-between;gap:8px;margin:8px 0 14px;}
  .intro-side{flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;}
  .intro-bubble{
    max-width:160px;padding:6px 10px;border-radius:18px;background:#fff;border:1px solid var(--line);
    font-size:13px;position:relative;margin-bottom:6px;
  }
  .intro-bubble::before,.intro-bubble::after{content:"";position:absolute;bottom:-10px;}
  .intro-bubble::before{
    border-width:10px 8px 0 8px;border-style:solid;
    border-color:var(--line) transparent transparent transparent;left:24px;
  }
  .intro-bubble::after{
    bottom:-9px;border-width:9px 7px 0 7px;border-style:solid;
    border-color:#fff transparent transparent transparent;left:25px;
  }
  .intro-side.intro-boss .intro-bubble::before{left:auto;right:24px;}
  .intro-side.intro-boss .intro-bubble::after{left:auto;right:25px;}
  .intro-portrait{width:96px;height:96px;border-radius:18px;border:2px solid var(--line);background:#fff;overflow:hidden;display:flex;align-items:center;justify-content:center;}
  .intro-portrait img{width:100%;height:100%;object-fit:contain;}
  .intro-name{font-weight:900;margin-top:2px;}
  .intro-vs-label{font-weight:900;font-size:18px;color:var(--muted);}
  
  /* ===== バトル（迫力） ===== */
  .battle-shell{
    background:
      radial-gradient(circle at 20% 10%, rgba(255,255,255,.55) 0, transparent 55%),
      radial-gradient(circle at 80% 0%, rgba(255,210,180,.35) 0, transparent 60%),
      rgba(255,250,245,.94);
    border-radius:18px;
    padding:14px 14px 18px;
    border:1px solid var(--line);
    box-shadow:0 7px 20px rgba(0,0,0,.08);
  }
  .vs-label{text-align:center;font-size:13px;color:var(--muted);margin-bottom:4px;font-weight:900;letter-spacing:.08em;}
  .units{display:flex;gap:10px;}
  @media(max-width:640px){.units{flex-direction:row;}}
  .unit{flex:1;}
  .unit-inner{
    position:relative;border-radius:14px;background:linear-gradient(135deg,#fff,rgba(255,240,230,.96));
    border:1px solid var(--line);padding:14px 12px 16px;
    display:flex;flex-direction:column;align-items:center;gap:10px;
  }
  .unit.unit-boss .unit-inner{background:linear-gradient(135deg,#f4f6ff,#e5e8ff);}
  .boss-enraged{box-shadow:0 0 0 2px rgba(255,80,80,.4),0 0 16px rgba(255,80,80,.55);}
  .unit-portrait{width:100%;aspect-ratio:1/1;border-radius:14px;overflow:hidden;background:#fff;border:1px solid var(--line);display:flex;align-items:center;justify-content:center;}
  .unit-portrait img{width:100%;height:100%;object-fit:contain;}
  .unit-status{width:100%;display:flex;flex-direction:column;gap:8px;margin-top:4px;}
  .unit-name{font-weight:900;font-size:16px;text-align:center;}
  .battle-role-state{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:6px;
    min-height:26px;
  }
  .battle-role-state.is-empty{
    min-height:0;
  }
  .battle-role-chip{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:24px;
    padding:3px 10px;
    border-radius:999px;
    border:1px solid rgba(0,0,0,.12);
    font-size:12px;
    font-weight:900;
    line-height:1;
    letter-spacing:.03em;
    background:rgba(255,255,255,.86);
    color:#5f4633;
  }
  .battle-role-chip-attack{
    background:linear-gradient(180deg, rgba(255,225,198,.96), rgba(255,183,138,.92));
    color:#8a3b18;
  }
  .battle-role-chip-defense{
    background:linear-gradient(180deg, rgba(220,234,255,.96), rgba(169,198,255,.92));
    color:#264a8a;
  }
  .battle-role-chip-heal{
    background:linear-gradient(180deg, rgba(224,249,214,.96), rgba(176,231,156,.92));
    color:#2d6f2d;
  }
  .hp-row{display:flex;align-items:center;gap:8px;width:100%;}
  .hp-bar{flex:1;height:18px;width:100%;border-radius:999px;background:rgba(0,0,0,.12);overflow:hidden;margin-top:2px;border:1px solid rgba(0,0,0,.18);}
  .hp-bar-inner{height:100%;width:100%;border-radius:999px;background:linear-gradient(90deg,#ff6a4a,#ffd278);transition:width .25s ease;}
  .unit-boss .hp-bar-inner{background:linear-gradient(90deg,#5a78ff,#a9c1ff);}
  .hp-text{font-size:13px;font-weight:900;color:var(--muted);}
  
  /* ログ（読みやすい） */
  .battle-log{
    margin-top:10px;
    background:rgba(20,16,14,.92);
    color:#f5efe8;
    border-radius:14px;
    border:1px solid rgba(255,255,255,.14);
    padding:10px 10px 12px;
    height:170px;
    overflow:auto;
    font-size:13px;
    line-height:1.5;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
  }
  .log-line{
    padding:6px 8px;
    border-radius:10px;
    margin-bottom:6px;
    background:rgba(255,255,255,.06);
  }
  .log-line.turn{
    background:rgba(255,255,255,.10);
    border:1px solid rgba(255,255,255,.12);
    font-weight:900;
  }
  .log-line.player{ border-left:4px solid rgba(255,120,90,.9); }
  .log-line.boss{ border-left:4px solid rgba(120,160,255,.9); }
  .log-line.good{ background:rgba(52,199,89,.18); }
  .log-line.bad{ background:rgba(255,59,48,.18); }
  .log-line.crit{ background:rgba(255,59,48,.28); font-weight:900; }
  .log-pop{ animation:logPop .2s ease-out; }
  @keyframes logPop{ 0%{transform:translateY(6px);opacity:0;} 100%{transform:translateY(0);opacity:1;} }
  
  /* バトル中の一言 */
  .battle-speech{
    position:absolute;top:-6px;left:50%;transform:translateX(-50%) translateY(-10px);
    padding:3px 10px;border-radius:999px;background:#fff;border:1px solid var(--line);
    font-size:11px;opacity:0;pointer-events:none;transition:transform .2s ease, opacity .2s ease;
  }
  .battle-speech.is-show{opacity:1;transform:translateX(-50%) translateY(-16px);}
  
  /* クリティカル */
  .crit-flash{
    position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
    padding:4px 10px;font-size:14px;font-weight:900;background:rgba(255,255,255,.95);
    border-radius:999px;border:2px solid #ff3b30;text-shadow:0 1px 2px rgba(0,0,0,.3);
    animation:critPop .5s ease-out forwards;
  }
  @keyframes critPop{
    0%{transform:translate(-50%,-50%) scale(.5);opacity:0;}
    20%{transform:translate(-50%,-50%) scale(1.1);opacity:1;}
    100%{transform:translate(-50%,-50%) scale(1);opacity:0;}
  }
  
  /* 読み取り演出 */
  .scan-popup{position:fixed;inset:0;display:grid;place-items:center;pointer-events:none;z-index:998;}
  .scan-popup-inner{
    background: rgba(255,248,242,.98);border:2px solid var(--accent);border-radius:16px;padding:16px 20px;
    box-shadow:0 10px 30px rgba(0,0,0,.25);text-align:center;animation: popScan .8s ease-out forwards;
  }
  .scan-popup-inner img{width:120px;border-radius:10px;margin:0 auto 8px;}
  .scan-popup-inner .label{font-size:14px;color:var(--muted);}
  .scan-popup-inner .name{font-size:18px;font-weight:900;}
  @keyframes popScan{
    0%{transform:scale(.7);opacity:0;}
    20%{transform:scale(1.05);opacity:1;}
    100%{transform:scale(1);opacity:0;}
  }
  
  /* バトル演出 */
  .hit-flash{position:absolute;inset:0;background:rgba(255,255,255,.7);mix-blend-mode:screen;pointer-events:none;animation:hitFlash .25s ease-out forwards;}
  @keyframes hitFlash{0%{opacity:.9;}100%{opacity:0;}}
  .unit-shake{animation:unitShake .25s ease-in-out;}
  @keyframes unitShake{
    0%{transform:translateX(0);}25%{transform:translateX(-4px);}
    50%{transform:translateX(3px);}75%{transform:translateX(-2px);}
    100%{transform:translateX(0);}
  }
  .float-dmg,.float-heal{
    position:absolute;right:14px;top:8px;font-weight:900;font-size:16px;text-shadow:0 1px 2px rgba(0,0,0,.35);
    opacity:0;pointer-events:none;animation:floatNum .6s ease-out forwards;
  }
  .float-dmg{color:#ff3b30;}
  .float-heal{color:#34c759;}
  @keyframes floatNum{
    0%{transform:translateY(8px);opacity:0;}
    20%{opacity:1;}
    100%{transform:translateY(-14px);opacity:0;}
  }
  
  /* リザルト勝者画像 */
  .winner-box{width:170px;aspect-ratio:1/1;border-radius:16px;border:1px solid var(--line);background:#fff;overflow:hidden;display:flex;align-items:center;justify-content:center;margin:10px auto 14px;}
  .winner-box img{width:100%;height:100%;object-fit:contain;}

  /* リザルトの「つづける」だけ、位置を下げる */
  #page-result #btnGoHome{
    margin-top: 100px; /* 10px→28pxにして下へ */
  }
  .scanbox{
    margin-top:10px;
    border-radius:12px;
    overflow:hidden;
    border:1px solid rgba(0,0,0,.12);
    background:#111;
    position:relative;
  }
  
  .qr-video{
    width:100%;
    height:220px; /* 好きに */
    object-fit:cover;
    display:none;
  }
  
  .qr-placeholder{
    height:220px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
    opacity:.7;
    font-size:14px;
  }
  
.stop-cam{
  position:absolute;
  right:10px;
  bottom:10px;
  padding:8px 10px;
  font-size:12px;
}

.scanbox-notice{
  position:absolute;
  left:10px;
  right:10px;
  top:10px;
  z-index:3;
  padding:10px 12px;
  border:2px solid rgba(255,255,255,.92);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(30, 178, 84, .96), rgba(19, 146, 66, .96));
  color:#fff;
  text-align:center;
  box-shadow:0 10px 24px rgba(0,0,0,.28);
  opacity:0;
  transform:translateY(-10px) scale(.96);
  pointer-events:none;
}

.scanbox-notice.is-show{
  animation:scanNoticeIn 1.8s ease forwards;
}

.scanbox-notice-title{
  font-size:15px;
  font-weight:900;
  letter-spacing:.03em;
}

.scanbox-notice-name{
  margin-top:2px;
  font-size:13px;
  font-weight:700;
  opacity:.96;
}

@keyframes scanNoticeIn{
  0%{opacity:0;transform:translateY(-10px) scale(.96);}
  12%{opacity:1;transform:translateY(0) scale(1);}
  72%{opacity:1;transform:translateY(0) scale(1);}
  100%{opacity:0;transform:translateY(-4px) scale(.98);}
}
  
.finisher-fx{
      position: fixed;
      inset: 0;
      background:
        radial-gradient(circle at 50% 45%, rgba(255,255,255,.95) 0 10%, rgba(255,245,170,.88) 18%, rgba(255,200,40,.55) 30%, rgba(255,120,0,.18) 48%, rgba(255,255,255,0) 66%),
        radial-gradient(circle at 50% 45%, rgba(255,255,255,.55), rgba(255,255,255,0) 58%),
        linear-gradient(115deg, rgba(255,60,60,.10) 0 30%, rgba(255,255,255,0) 45% 55%, rgba(255,210,40,.22) 70% 100%),
        linear-gradient(180deg, rgba(255,240,120,.34), rgba(255,255,255,0));
      display:flex;
      align-items:center;
      justify-content:center;
      z-index: 9999;
      animation: finFlash 820ms cubic-bezier(.16,.84,.24,1) forwards;
      mix-blend-mode: screen;
      pointer-events: none;
  }
  
  .finisher-fx-text{
    font-size: 22px;
    font-weight: 900;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    letter-spacing: .04em;
    transform: scale(0.95);
    animation: finPop 0.6s ease-out forwards;
  }
  
  @keyframes finFlash{
    0%{ opacity: 0; transform: scale(.92); filter: saturate(1) blur(8px); }
    18%{ opacity: 1; transform: scale(1.04); filter: saturate(1.4) blur(0px); }
    42%{ opacity: .92; transform: scale(1.08); filter: saturate(1.25) blur(0px); }
    100%{ opacity: 0; transform: scale(1.16); filter: saturate(1) blur(2px); }
  }
  
  @keyframes finPop{
    0%{ opacity:0; transform:scale(0.9); }
    20%{ opacity:1; transform:scale(1.03); }
    100%{ opacity:0; transform:scale(1.0); }
  }
  
  body.shake{
    animation: shake 520ms cubic-bezier(.2,.8,.2,1);
  }
  
  @keyframes shake{
    0%{ transform: translate(0,0) scale(1) rotate(0deg); }
    12%{ transform: translate(-12px, 4px) scale(1.01) rotate(-0.7deg); }
    24%{ transform: translate(11px, -5px) scale(1.015) rotate(0.65deg); }
    38%{ transform: translate(-9px, -2px) scale(1.01) rotate(-0.5deg); }
    52%{ transform: translate(9px, 3px) scale(1.012) rotate(0.45deg); }
    68%{ transform: translate(-6px, 2px) scale(1.006) rotate(-0.25deg); }
    84%{ transform: translate(5px, -2px) scale(1.003) rotate(0.15deg); }
    100%{ transform: translate(0,0) scale(1) rotate(0deg); }
  }

  .tribe-badge{
    display:inline-block;
    margin-left:8px;
    padding:2px 10px;
    border-radius:999px;
    font-size:12px;
    line-height:1.6;
    background:#f1f1f1;
    color:#333;
    vertical-align:middle;
  }
  .tribe-burst{
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
    --tribe-rgb: 255,255,255;
  }

  .tribe-flash,
  .tribe-aura,
  .tribe-ring,
  .tribe-particle{
    position: absolute;
    pointer-events: none;
  }

  .tribe-flash{
    inset: 0;
    background:
      radial-gradient(circle at 50% 52%, rgba(var(--tribe-rgb),.78), rgba(var(--tribe-rgb),.2) 34%, rgba(255,255,255,0) 72%),
      linear-gradient(180deg, rgba(255,255,255,.18), rgba(var(--tribe-rgb),.28));
    mix-blend-mode: screen;
    animation: tribeFlash 1400ms ease-out forwards;
  }

  .tribe-aura{
    left: 50%;
    top: 52%;
    width: min(68vw, 680px);
    aspect-ratio: 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--tribe-rgb),.65) 0%, rgba(var(--tribe-rgb),.12) 42%, rgba(255,255,255,0) 72%);
    filter: blur(14px);
    animation: tribeAura 1800ms ease-out forwards;
  }

  .tribe-ring{
    left: 50%;
    top: 52%;
    width: min(16vw, 180px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 4px solid rgba(var(--tribe-rgb), .95);
    box-shadow:
      0 0 0 6px rgba(255,255,255,.12),
      0 0 26px rgba(var(--tribe-rgb), .55),
      inset 0 0 18px rgba(255,255,255,.25);
    transform: translate(-50%, -50%) scale(.35);
    opacity: 0;
    mix-blend-mode: screen;
  }

  .tribe-ring-1{ animation: tribeRing 1500ms cubic-bezier(.12,.8,.2,1) forwards; }
  .tribe-ring-2{ animation: tribeRing 1500ms cubic-bezier(.12,.8,.2,1) .12s forwards; }
  .tribe-ring-3{ animation: tribeRing 1500ms cubic-bezier(.12,.8,.2,1) .24s forwards; }

  .tribe-particle{
    left: 50%;
    top: 54%;
    width: var(--size);
    height: var(--size);
    border-radius: 999px;
    background:
      radial-gradient(circle at 30% 30%, rgba(255,255,255,.98), rgba(var(--tribe-rgb),.88) 40%, rgba(var(--tribe-rgb),0) 74%);
    box-shadow: 0 0 20px rgba(var(--tribe-rgb), .55);
    opacity: 0;
    transform: translate(var(--sx), var(--sy)) scale(.3) rotate(0deg);
    animation: tribeParticle 1700ms cubic-bezier(.16,.8,.22,1) var(--delay) forwards;
  }

  @keyframes tribeFlash{
    0%   { opacity: 0; }
    14%  { opacity: 0.92; }
    38%  { opacity: 0.62; }
    100% { opacity: 0; }
  }

  @keyframes tribeAura{
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
    20%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    65%  { opacity: .88; transform: translate(-50%, -50%) scale(1.18); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
  }

  @keyframes tribeRing{
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(.25); }
    18%  { opacity: 1; }
    72%  { opacity: .72; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(5.4); }
  }

  @keyframes tribeParticle{
    0%   { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(.2) rotate(0deg); }
    18%  { opacity: 1; }
    68%  { opacity: .92; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.15) rotate(220deg); }
  }

  .tribe-kaiju  { --tribe-rgb: 255, 77, 79; }
  .tribe-oni    { --tribe-rgb: 255, 159, 10; }
  .tribe-mech   { --tribe-rgb: 10, 132, 255; }
  .tribe-spirit { --tribe-rgb: 52, 199, 89; }
  .tribe-yokai  { --tribe-rgb: 175, 82, 222; }

  .synergy-text{
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:4px;
    opacity: 0;
    pointer-events: none;
    animation: synergyText 2.1s cubic-bezier(.14,.84,.22,1) forwards;
  }

  .synergy-text-kicker{
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .42em;
    color: rgba(255,255,255,.95);
    text-shadow: 0 0 12px rgba(255,255,255,.7);
  }

  .synergy-text-main{
    font-size: clamp(30px, 4vw, 52px);
    font-weight: 900;
    letter-spacing: .08em;
    color: #fff7bf;
    text-shadow:
      0 0 8px rgba(255,255,255,.95),
      0 0 18px rgba(255,208,0,.95),
      0 0 34px rgba(255,136,0,.8),
      0 6px 18px rgba(0,0,0,.38);
    -webkit-text-stroke: 1px rgba(115,48,0,.45);
  }

  @keyframes synergyText{
    0%   { opacity: 0; transform: translate(-50%,-66%) scale(.7) rotate(-4deg); filter: blur(12px); }
    22%  { opacity: 1; transform: translate(-50%,-50%) scale(1.16) rotate(1deg); filter: blur(0); }
    72%  { opacity: 1; transform: translate(-50%,-50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%,-42%) scale(1.08); filter: blur(1px); }
  }

  body.synergy-shake{
    animation: synergyShake 560ms cubic-bezier(.18,.82,.2,1);
  }

  @keyframes synergyShake{
    0%{ transform: translate(0,0) scale(1); }
    18%{ transform: translate(-8px, 2px) scale(1.01); }
    36%{ transform: translate(8px, -3px) scale(1.014); }
    54%{ transform: translate(-6px, 2px) scale(1.01); }
    72%{ transform: translate(4px, -1px) scale(1.004); }
    100%{ transform: translate(0,0) scale(1); }
  }

/* 道具発動（任意） */
.item-proc{
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.35));
}

/* =========================
   HOME(準備)ページ：3色ブロック配色
   ========================= */

/* 3ブロック共通 */
#page-home .prep-card{
  border: none;
  border-radius: 0;
  padding: 18px 16px;
  box-shadow: none;
}

/* 背景色（画像っぽいトーン） */
#page-home .prep-char{  background: #FFF4A8; }  /* 黄 */
#page-home .prep-item{  background: #CFEFFF; }  /* 水色 */
#page-home .prep-buddy{ background: #D9D2F2; }  /* 薄紫 */

/* 見出し（①②③） */
#page-home .prep-card .step-label{
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 10px;
}

/* スキャン窓（黒） */
#page-home .prep-card .scanbox{
  border-radius: 0;
  border: 2px solid rgba(0,0,0,0.8);
  background: #111;
}

/* スキャン窓の高さ（画像の比率寄せ） */
#page-home .prep-card .qr-video,
#page-home .prep-card .qr-placeholder{
  height: 210px;
}

/* =========================
   HOME(準備)ページ：ボタンをボタンっぽくする（上書き）
   ========================= */

   #page-home .prep-card button{
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.18);
    padding: 16px 14px;
    font-weight: 900;
    letter-spacing: .02em;
    box-shadow:
      0 2px 0 rgba(0,0,0,0.18),
      0 10px 18px rgba(0,0,0,0.10);
    transition: transform .06s ease, box-shadow .06s ease, filter .06s ease;
  }
  
  /* 押した感（沈む） */
  #page-home .prep-card button:active{
    transform: translateY(2px);
    box-shadow:
      0 1px 0 rgba(0,0,0,0.18),
      0 6px 10px rgba(0,0,0,0.10);
    filter: brightness(0.98);
  }
  
  /* ホバー（PC用） */
  @media (hover:hover){
    #page-home .prep-card button:hover{
      filter: brightness(1.03);
    }
  }
  
  /* disabled はちゃんと “押せない” 感 */
  #page-home .prep-card button:disabled{
    opacity: 0.55;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
  }
  
  /* “はずす”ボタン（白）もボタン感を持たせる */
  #page-home .prep-card .danger{
    background: #fff;
    color: #111;
    border: 1px solid rgba(0,0,0,0.22);
    box-shadow:
      0 2px 0 rgba(0,0,0,0.10),
      0 10px 18px rgba(0,0,0,0.06);
  }
  #page-home .prep-card .danger:active{
    transform: translateY(2px);
    box-shadow:
      0 1px 0 rgba(0,0,0,0.10),
      0 6px 10px rgba(0,0,0,0.06);
  }
  
/* =========================
   HOME(準備)ページ：各枠をカード化
   ========================= */

   #page-home .prep-card{
    border-radius: 14px;
    border: 2px solid rgba(0,0,0,0.25);
    box-shadow:
      0 4px 0 rgba(0,0,0,0.18),
      0 14px 24px rgba(0,0,0,0.18);
    margin-bottom: 18px;
  }
  
  /* 色ごとに枠線トーンを少し変える（地味だけど効く） */
  #page-home .prep-char{
    border-color: rgba(180,140,0,0.55);
  }
  #page-home .prep-item{
    border-color: rgba(0,110,160,0.55);
  }
  #page-home .prep-buddy{
    border-color: rgba(90,60,160,0.55);
  }
  
  /* 押し込まれた感（カード全体が少し沈む） */
  #page-home .prep-card:active{
    transform: translateY(2px);
    box-shadow:
      0 2px 0 rgba(0,0,0,0.18),
      0 8px 14px rgba(0,0,0,0.18);
  }

  #page-home .prep-card .scanbox{
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.06),
                0 6px 12px rgba(0,0,0,0.35);
  }
/* =========================
   ヘッダーロゴ
   ========================= */

   .header-title{
    width: 100%;
    padding-top: 50px;        /* 画面端ベタ付き防止。いらなければ0 */
    box-sizing: border-box;
  }
  
  .header-logo{
    width: 100%;               /* ← 横幅ぴったり */
    height: auto;              /* 縦は比率維持 */
    display: block;
  }
  

  /* ===== ダメージ/回復 数値フロート ===== */
.float-num{
  position:absolute;
  left:50%;
  top:40%;
  transform:translate(-50%,-50%);
  font-weight:900;
  font-size:30px;
  letter-spacing:.02em;
  pointer-events:none;
  opacity:0;
  text-shadow:0 3px 0 rgba(0,0,0,.35),0 10px 18px rgba(0,0,0,.35);
  animation: floatUp 900ms ease-out forwards;
  z-index:50;
  /* 白フチ（iOS/Safariに強い） */
  -webkit-text-stroke: 2px #fff;

  /* 念のための縁取り（全ブラウザ向け） */
  text-shadow:
    -2px -2px 0 #fff,
     2px -2px 0 #fff,
    -2px  2px 0 #fff,
     2px  2px 0 #fff,
     0   3px 0 rgba(0,0,0,.35),
     0  10px 18px rgba(0,0,0,.35);
}
.float-num.damage{ color:#ff3b30; }
.float-num.heal{ color:#2ecc71; }
.float-num.miss{ color:#f5efe8; font-size:26px; letter-spacing:.12em; }

@keyframes floatUp{
  0%{ opacity:0; transform:translate(-50%,-10%) scale(.88); filter:blur(.2px); }
  15%{ opacity:1; transform:translate(-50%,-40%) scale(1.08); }
  65%{ opacity:1; transform:translate(-50%,-85%) scale(1.02); }
  100%{ opacity:0; transform:translate(-50%,-110%) scale(.98); }
}

/* =========================
   必殺技演出レイヤー
========================= */
.finisher-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none; /* 演出中にボタン押させない */
  display: none;
}

.finisher-layer.is-show {
  display: block;
}

.finisher-scrim,
.finisher-fade {
  display: none !important;
}

.finisher-layer.is-step1 .finisher-scrim {
  opacity: 1;
}

/* ③ フェードアウト */
.finisher-layer.is-fade .finisher-fade {
  opacity: 1;
}

.finisher-cutin{
  position: fixed;
  left: var(--fx, 50vw);
  top:  var(--fy, 30vh);
  transform: translate(-50%, -110%); /* 頭上に出す */
  opacity: 0;
  transition: transform 520ms cubic-bezier(.2,.9,.2,1), opacity 520ms ease;

  width: min(360px, calc(100vw - 24px));
  pointer-events: none;

  --dx: 0px;
  --dy: 0px;
}

/* ① 出現 */
.finisher-layer.is-step1 .finisher-cutin{
  opacity: 1;
  transform: translate(-50%, -110%);
}

/* ② 相手に向かって移動（相手方向ベクトル） */
.finisher-layer.is-hit .finisher-cutin{
  opacity: 1;
  transform: translate(calc(-50% + var(--dx)), calc(-110% + var(--dy)));
}

/* ③ 暗転なしでフェードアウト */
.finisher-layer.is-out .finisher-cutin{
  opacity: 0;
  transform: translate(calc(-50% + var(--dx)), calc(-110% + var(--dy)));
}

/* スプライト枠（イラストっぽい余白） */
.finisher-sprite-wrap {
  position: absolute;
  left: 8%;
  bottom: 8%;
  width: 64%;
  height: 70%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#finisherSprite { display: none !important; }

.finisher-bubble {
  position: absolute;
  left: 0%;
  top: 0%;
  width: min(360px, 70vw);
  padding: 18px 20px 16px;

  background: #ffe100;

  /* フチ構成：内側赤／外側黒 */
  border: 3px solid #d10000;          /* 赤フチ */
  box-shadow:
    0 0 0 3px #111,                   /* 黒フチ（外側） */
    0 10px 0 rgba(0,0,0,0.15);         /* 影 */

  border-radius: 16px;

  clip-path: polygon(
    5% 12%, 10% 4%, 16% 10%, 22% 3%, 30% 10%, 38% 2%, 46% 10%,
    55% 3%, 64% 11%, 73% 4%, 82% 12%, 90% 6%, 95% 14%,
    96% 24%, 98% 34%, 96% 44%, 99% 54%, 96% 64%, 98% 74%,
    95% 86%, 90% 92%, 82% 88%, 74% 96%, 66% 88%, 56% 96%,
    46% 88%, 36% 96%, 26% 88%, 18% 96%, 10% 88%, 5% 92%,
    2% 80%, 4% 70%, 1% 60%, 4% 50%, 1% 40%, 4% 30%, 2% 20%
  );
}

.finisher-bubble-title {
  font-weight: 900;
  font-size: 18px;
  color: #d10000;
  -webkit-text-stroke: 1px #111;
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.finisher-bubble-name {
  font-weight: 900;
  font-size: 22px;
  color: #d10000;
  -webkit-text-stroke: 1px #111;
  text-shadow: 0 2px 0 rgba(0,0,0,0.2);
  line-height: 1.2;
}

/* 小さい端末は少し上に寄せる */
@media (max-width: 480px){
  .finisher-cutin {
    top: 12%;
    left: 6%;
    height: 50vh;
  }
}
/* =========================
   必殺技 吹き出しフォント
   ========================= */

/* デフォルト（SP想定） */
.finisher-bubble {
  --fin-title: 13px;
  --fin-name: 18px;
  will-change: transform, opacity;
  transform: translate3d(0,0,0); /* GPUレイヤー化のきっかけ */
  backface-visibility: hidden;
}

/* タブレット */
@media (min-width: 481px) {
  .finisher-bubble {
    --fin-title: 14px;
    --fin-name: 22px;
  }
}

/* PC */
@media (min-width: 901px) {
  .finisher-bubble {
    --fin-title: 16px;
    --fin-name: 28px;
  }
}

/* =========================
   イベント用：非常口ボタン
   ========================= */
/* iOS 連打ズーム防止 */
button,
.cta,
.primary,
.success,
.danger {
  touch-action: manipulation;
}
.official-link {
  position: static;
  font-size: 18px;
  font-weight: 600;
  color: #111;
  text-decoration: underline;
  z-index: 10;
}

@media (max-width: 600px) {
  .official-link {
    font-size: 20px;
    top: 16px;
  }
}

.official-link:hover {
  opacity: 1;
}

/* =========================
   PVP UI override
   ========================= */
:root{
  --pvp-yellow:#ffe100;
  --pvp-yellow-deep:#ffcc00;
  --pvp-red:#ef3d23;
  --pvp-blue:#43b9ff;
  --pvp-purple:#c9b7ff;
  --pvp-ink:#161616;
  --pvp-paper:#fffef2;
  --pvp-shadow:0 5px 0 rgba(0,0,0,.2), 0 14px 28px rgba(0,0,0,.16);
}

body{
  min-height:100vh;
  background:
    radial-gradient(circle at top, rgba(255,255,255,.35), transparent 28%),
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.22), transparent 18%),
    radial-gradient(circle at 85% 12%, rgba(255,255,255,.18), transparent 16%),
    #ffe100 url("images/common/background.png") repeat center top / 828px 522px fixed;
  color:var(--pvp-ink);
}

.app-shell{
  max-width:920px;
  padding:18px 14px 36px;
}

.header{
  margin-bottom:18px;
}

.topbar-links{
  max-width:920px;
  margin:0 auto;
  padding:12px 14px 0;
  display:flex;
  justify-content:flex-end;
}

.brand-marquee{
  display:inline-block;
  margin:32px auto 10px;
  padding:7px 16px 8px;
  border:2px solid var(--pvp-ink);
  border-radius:999px;
  background:rgba(255,255,255,.82);
  box-shadow:0 4px 0 rgba(0,0,0,.16);
  font-size:12px;
  font-weight:900;
  letter-spacing:.18em;
}

.header-title{
  padding-top:0;
}

.header-logo{
  max-width:min(100%, 560px);
  margin:0 auto;
}

.header-lead{
  margin:8px 0 0;
  font-size:16px;
  font-weight:900;
  text-align:center;
  text-shadow:0 1px 0 rgba(255,255,255,.6);
}

.official-link{
  padding:8px 12px;
  border:2px solid var(--pvp-ink);
  border-radius:999px;
  background:rgba(255,255,255,.92);
  box-shadow:0 4px 0 rgba(0,0,0,.16);
  font-size:14px;
  font-weight:900;
  text-decoration:none;
}

.boss-select-shell,
.intro-shell,
.battle-shell,
#page-result .card-shell{
  position:relative;
  border:3px solid var(--pvp-ink);
  border-radius:24px;
  box-shadow:var(--pvp-shadow);
}

.boss-select-shell{
  padding:20px 18px 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.58), rgba(255,255,255,0) 40%),
    var(--pvp-paper);
}

.mode-select-shell{
  position:relative;
  padding:22px 18px 24px;
  border:3px solid var(--pvp-ink);
  border-radius:24px;
  background:
    radial-gradient(circle at 15% 18%, rgba(255,211,92,.26) 0, rgba(255,211,92,0) 28%),
    radial-gradient(circle at 82% 12%, rgba(76,180,255,.18) 0, rgba(76,180,255,0) 26%),
    linear-gradient(135deg, rgba(255,255,255,.58), rgba(255,255,255,0) 40%),
    var(--pvp-paper);
  box-shadow:var(--pvp-shadow);
}

.mode-select-hero{
  text-align:center;
}

.mode-select-title{
  margin:12px 0 8px;
  font-size:clamp(34px, 6vw, 50px);
  font-weight:700;
  letter-spacing:.02em;
}

.mode-select-copy{
  margin:0 auto;
  max-width:560px;
  font-size:15px;
  line-height:1.6;
  font-weight:700;
}

.mode-select-subactions{
  display:flex;
  justify-content:center;
  flex-wrap:wrap;
  gap:14px;
  margin-top:14px;
}

.mode-select-subaction{
  width:auto;
  min-width:180px;
}

.mode-select-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
  margin-top:22px;
}

.mode-select-card{
  display:flex;
  flex-direction:column;
  gap:12px;
  min-width:0;
  padding:18px 16px 16px;
  border:3px solid var(--pvp-ink);
  border-radius:24px;
  box-shadow:var(--pvp-shadow);
}

.mode-select-card-media{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:190px;
  padding:8px 10px 2px;
}

.mode-select-card-visual{
  display:block;
  width:min(100%, 250px);
  height:auto;
  object-fit:contain;
  filter:drop-shadow(0 8px 16px rgba(14, 30, 58, .16));
}

.mode-select-card-boss{
  background:linear-gradient(180deg, #fff6b6, #ffd96f);
}

.mode-select-card-pvp{
  background:linear-gradient(180deg, #d8f3ff, #93d9ff);
}

.mode-select-card-kicker{
  display:inline-flex;
  align-self:flex-start;
  padding:5px 10px;
  border:2px solid var(--pvp-ink);
  border-radius:999px;
  background:rgba(255,255,255,.72);
  font-size:12px;
  font-weight:900;
  letter-spacing:.14em;
}

.mode-select-card-title{
  margin:0;
  font-size:clamp(28px, 4vw, 38px);
  font-weight:700;
}

.mode-select-card-copy{
  margin:0;
  font-size:14px;
  line-height:1.6;
  font-weight:700;
}

.mode-select-action{
  margin-top:auto;
}

.mode-notice{
  margin-top:22px;
  padding:18px 16px;
  border:3px solid var(--pvp-ink);
  border-radius:24px;
  background:rgba(255,255,255,.92);
  box-shadow:var(--pvp-shadow);
}

.mode-notice-title{
  margin:0 0 14px;
  font-size:clamp(24px, 4vw, 34px);
  font-weight:700;
}

.mode-notice-grid{
  display:grid;
  grid-template-columns:180px minmax(0, 1fr);
  gap:12px 16px;
  align-items:start;
}

.mode-notice-label{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:88px;
  padding:10px 12px;
  border:3px solid rgba(31,28,24,.72);
  border-radius:18px;
  background:#fffdf7;
  text-align:center;
  font-size:18px;
  font-weight:700;
  line-height:1.35;
}

.mode-notice-body{
  min-width:0;
  padding-top:4px;
}

.mode-notice-list{
  margin:0;
  padding-left:1.4em;
  font-size:15px;
  line-height:1.75;
  font-weight:700;
}

.mode-notice-list li + li{
  margin-top:2px;
}

.howto-shell{
  padding:20px 18px 22px;
}

.howto-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.howto-title{
  margin:12px 0 6px;
  font-size:clamp(32px, 5vw, 44px);
  font-weight:700;
}

.howto-copy{
  margin:0;
  font-size:15px;
  line-height:1.6;
  font-weight:700;
}

.howto-steps{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
  margin-top:18px;
}

.howto-step-card{
  padding:16px 14px;
  border:3px solid var(--pvp-ink);
  border-radius:22px;
  background:linear-gradient(180deg, rgba(255,255,255,.96), #fff6e7);
  box-shadow:var(--pvp-shadow);
}

.howto-step-num{
  display:grid;
  place-items:center;
  width:42px;
  height:42px;
  border-radius:999px;
  margin-bottom:10px;
  border:3px solid var(--pvp-ink);
  background:linear-gradient(180deg, #fff0a6, #ffd260);
  font-size:20px;
  font-weight:900;
}

.howto-step-title{
  margin:0 0 8px;
  font-size:22px;
  font-weight:700;
}

.howto-step-copy{
  margin:0;
  font-size:14px;
  line-height:1.7;
  font-weight:700;
}

.howto-tips{
  margin-top:18px;
  padding:18px 16px;
  border:3px solid var(--pvp-ink);
  border-radius:22px;
  background:rgba(255,255,255,.94);
  box-shadow:var(--pvp-shadow);
}

.howto-section-title{
  margin:0 0 10px;
  font-size:24px;
  font-weight:700;
}

.howto-list{
  margin:0;
  padding-left:1.4em;
  font-size:15px;
  line-height:1.75;
  font-weight:700;
}

.howto-list li + li{
  margin-top:4px;
}

.boss-select-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.boss-select-back{
  width:auto;
  min-width:156px;
  margin:0;
  padding:10px 14px;
}

.boss-select-copy{
  margin:6px 0 0;
  font-size:15px;
  font-weight:700;
}

.boss-select-grid{
  display:grid;
  gap:18px;
  margin-top:16px;
}

.boss-select-actions{
  margin-top:18px;
}

.boss-select-back-secondary{
  width:100%;
}

.boss-group{
  display:grid;
  gap:12px;
}

.boss-group-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 18px;
  border:3px solid #c98a00;
  border-radius:20px;
  background:linear-gradient(180deg, #ffd54d, #ffbe00);
  box-shadow:0 7px 0 rgba(168,106,0,.22);
}

.boss-group-label{
  font-size:clamp(24px, 4vw, 34px);
  font-weight:500;
  letter-spacing:.01em;
}

.boss-group-stars{
  font-size:clamp(24px, 4.2vw, 36px);
  font-weight:500;
  line-height:1;
  letter-spacing:.03em;
}

.difficulty-star{
  display:inline-block;
}

.difficulty-star.is-on{
  color:#d92d20;
}

.difficulty-star.is-off{
  color:inherit;
}

.boss-group-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:14px;
}

.boss-card{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:0;
  padding:12px;
  border:3px solid var(--pvp-ink);
  border-radius:22px;
  background:linear-gradient(180deg, #fff7bd, #ffe67f);
  box-shadow:var(--pvp-shadow);
}

.boss-card-logo-wrap{
  display:flex;
  justify-content:center;
}

.boss-card-logo{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:68px;
  padding:0;
}

.boss-card-logo img{
  display:block;
  width:auto;
  max-width:min(96%, 320px);
  height:70px;
  object-fit:contain;
}

.boss-card-challenge{
  display:grid;
  place-items:center;
  min-height:92px;
  padding:12px 14px;
  border:1px solid rgba(168,75,0,.28);
  border-radius:10px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,0) 42%),
    linear-gradient(180deg, #ff973f, #f07a22);
  color:#1b0d02;
  font-size:clamp(18px, 3vw, 28px);
  font-weight:500;
  line-height:1.2;
  text-align:center;
  letter-spacing:.01em;
  text-wrap:balance;
  overflow-wrap:anywhere;
}

.boss-card-media{
  aspect-ratio:1 / 1;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  border-radius:18px;
}

.boss-card-media img{
  width:100%;
  height:100%;
  object-fit:contain;
  border-radius:18px;
}

.boss-card-placeholder{
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
  color:#6c6c6c;
  font-size:28px;
  font-weight:900;
  letter-spacing:.12em;
  line-height:1.2;
  text-align:center;
  background:
    repeating-linear-gradient(135deg, rgba(0,0,0,.05) 0 14px, rgba(255,255,255,.18) 14px 28px),
    linear-gradient(180deg, #f8f8f8, #e4e4e4);
}

.boss-card-name{
  font-size:clamp(17px, 2.8vw, 20px);
  font-weight:900;
  line-height:1.2;
}

.boss-owned-tags{
  margin:0;
}

.boss-card-meta,
.boss-card-desc{
  font-size:13px;
  font-weight:700;
  line-height:1.45;
}

.boss-card-action{
  margin-top:auto;
}

.selected-boss-summary{
  margin-bottom:16px;
}

.selected-boss-card{
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px 14px;
  border:3px solid var(--pvp-ink);
  border-radius:22px;
  background:linear-gradient(135deg, rgba(255,255,255,.6), rgba(255,255,255,0) 40%), #fff7bd;
  box-shadow:var(--pvp-shadow);
}

.selected-boss-thumb{
  width:82px;
  height:82px;
  flex:0 0 auto;
  border:3px solid var(--pvp-ink);
  border-radius:18px;
  background:#fff;
  overflow:hidden;
}

.selected-boss-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
}

.selected-boss-label{
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
}

.selected-boss-name{
  margin-top:4px;
  font-size:22px;
  font-weight:900;
}

.selected-boss-stats{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:6px;
}

.selected-boss-stat{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:28px;
  padding:4px 10px;
  border:1px solid rgba(0,0,0,.12);
  border-radius:999px;
  background:rgba(255,255,255,.76);
  font-size:12px;
  font-weight:900;
  letter-spacing:.04em;
  color:#5f4633;
}

.selected-boss-meta{
  margin-top:6px;
  font-size:14px;
  font-weight:700;
  line-height:1.5;
  color:#5f4633;
}

.selected-boss-change{
  width:auto;
  min-width:180px;
  margin-top:10px;
}

.home-grid{
  display:block;
}

.prep-stack{
  display:flex;
  flex-direction:column;
  gap:14px;
}

#page-home .prep-card{
  position:relative;
  overflow:hidden;
  margin:0;
  padding:18px 16px 16px;
  border-width:3px;
  border-color:var(--pvp-ink);
  border-radius:24px;
  box-shadow:var(--pvp-shadow);
}

#page-home .prep-card::before{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(135deg, rgba(255,255,255,.26), rgba(255,255,255,0) 42%);
  pointer-events:none;
}

#page-home .prep-char{
  background:linear-gradient(180deg, #fff4a8, #ffe36a);
}

#page-home .prep-item{
  background:linear-gradient(180deg, #d5f1ff, #8bd8ff);
}

#page-home .prep-buddy{
  background:linear-gradient(180deg, #e5dcff, #c8b7ff);
}

#page-home .prep-card > *{
  position:relative;
  z-index:1;
}

#page-home .prep-card .step-label{
  font-size:22px;
  line-height:1.2;
  margin-bottom:12px;
}

.step-dot{
  width:14px;
  height:14px;
  box-shadow:0 0 0 5px rgba(0,0,0,.08);
}

#page-home .prep-card .scanbox{
  border:3px solid var(--pvp-ink);
  border-radius:20px;
}

#page-home .prep-card .qr-video,
#page-home .prep-card .qr-placeholder{
  height:190px;
}

.qr-placeholder{
  font-weight:900;
  letter-spacing:.08em;
}

#page-home .prep-card button{
  margin-top:12px;
  border:2px solid var(--pvp-ink);
  border-radius:16px;
  font-size:17px;
  font-weight:900;
  box-shadow:0 4px 0 rgba(0,0,0,.18);
}

#page-home .prep-card .danger{
  background:#fffef8;
}

.owned-wrap{
  border-width:2px;
  border-color:rgba(0,0,0,.14);
}

.card-owned-name{
  font-size:18px;
}

.tribe-badge{
  border:1px solid rgba(0,0,0,.14);
  background:rgba(255,255,255,.72);
  font-weight:900;
}

.home-start{
  margin-top:2px;
  background:linear-gradient(180deg, #ff6b39, #ef3d23);
  letter-spacing:.06em;
}

.home-start:disabled{
  background:linear-gradient(180deg, #cfcfcf, #a9a9a9) !important;
  color:#f7f7f7;
  border-color:rgba(0,0,0,.28) !important;
  box-shadow:none !important;
  filter:none !important;
}

.section-title{
  font-size:22px;
  font-weight:900;
}

.section-title::before{
  width:10px;
  height:24px;
  background:var(--pvp-red);
}

.intro-shell,
.battle-shell,
#page-result .card-shell{
  background:
    linear-gradient(135deg, rgba(255,255,255,.58), rgba(255,255,255,0) 40%),
    var(--pvp-paper);
}

.intro-shell{
  padding:20px 18px 22px;
}

.intro-vs-label{
  font-size:28px;
  color:var(--pvp-red);
}

.intro-portrait{
  border:3px solid var(--pvp-ink);
  box-shadow:0 5px 0 rgba(0,0,0,.14);
}

.battle-shell{
  padding:20px 18px 22px;
}

.vs-label{
  font-size:15px;
  color:var(--pvp-ink);
}

.battle-turn-banner{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  margin:10px 0 14px;
  padding:10px 14px;
  border:3px solid var(--pvp-ink);
  border-radius:18px;
  background:linear-gradient(180deg, #fff6bf, #ffd560);
  box-shadow:0 5px 0 rgba(122,89,0,.24), 0 12px 22px rgba(255,192,54,.18);
  text-align:center;
}

.battle-turn-main{
  font-size:24px;
  font-weight:900;
  line-height:1;
  color:#5c2200;
  letter-spacing:.04em;
}

.battle-turn-sub{
  min-height:1.2em;
  font-size:12px;
  font-weight:900;
  line-height:1.2;
  color:rgba(92,34,0,.8);
  letter-spacing:.08em;
}

.battle-turn-banner.is-sudden{
  background:linear-gradient(180deg, #ff9b63, #ff5722);
  box-shadow:0 5px 0 rgba(132,44,16,.30), 0 12px 22px rgba(219,77,34,.24);
}

.battle-turn-banner.is-sudden .battle-turn-main,
.battle-turn-banner.is-sudden .battle-turn-sub{
  color:#fff7ef;
  text-shadow:0 1px 0 rgba(92,34,0,.22);
}

.unit-inner{
  border:3px solid var(--pvp-ink);
  border-radius:22px;
  box-shadow:0 5px 0 rgba(0,0,0,.14);
  background:linear-gradient(180deg, rgba(255,255,255,.95), #fff4df);
}

.unit.unit-boss .unit-inner{
  background:linear-gradient(180deg, #eef4ff, #dce6ff);
}

.attack-slash{
  position:absolute;
  inset:8% 2%;
  border-radius:22px;
  background:
    linear-gradient(120deg, rgba(255,255,255,0) 12%, rgba(255,255,255,.98) 28%, rgba(255,238,140,.98) 40%, rgba(255,120,60,.96) 52%, rgba(255,40,20,.82) 60%, rgba(255,255,255,0) 82%);
  mix-blend-mode:screen;
  opacity:0;
  transform:skewX(-18deg) scale(.68) rotate(-12deg);
  pointer-events:none;
  box-shadow:0 0 22px rgba(255,122,69,.45);
  animation:attackSlash 360ms cubic-bezier(.16,.88,.22,1) forwards;
}

@keyframes attackSlash{
  0%{ opacity:0; transform:translateX(-12%) skewX(-18deg) scale(.68) rotate(-12deg); }
  24%{ opacity:1; transform:translateX(0) skewX(-18deg) scale(1.04) rotate(-12deg); }
  100%{ opacity:0; transform:translateX(14%) skewX(-18deg) scale(1.1) rotate(-12deg); }
}

.attack-burst{
  position:absolute;
  left:50%;
  top:50%;
  width:54%;
  aspect-ratio:1 / 1;
  border-radius:999px;
  background:
    radial-gradient(circle, rgba(255,255,255,.96) 0 10%, rgba(255,230,120,.88) 18%, rgba(255,120,60,.45) 36%, rgba(255,120,60,0) 62%);
  transform:translate(-50%, -50%) scale(.45);
  opacity:0;
  pointer-events:none;
  mix-blend-mode:screen;
  animation:attackBurst 320ms ease-out forwards;
}

@keyframes attackBurst{
  0%{ opacity:0; transform:translate(-50%, -50%) scale(.45); }
  18%{ opacity:1; }
  100%{ opacity:0; transform:translate(-50%, -50%) scale(1.08); }
}

.heal-ring{
  position:absolute;
  left:50%;
  top:50%;
  width:56%;
  aspect-ratio:1 / 1;
  border-radius:999px;
  border:4px solid rgba(132,255,173,.82);
  box-shadow:0 0 24px rgba(90,224,139,.35), inset 0 0 12px rgba(255,255,255,.24);
  transform:translate(-50%, -50%) scale(.65);
  opacity:0;
  pointer-events:none;
  animation:healRing 520ms ease-out forwards;
}

@keyframes healRing{
  0%{ opacity:0; transform:translate(-50%, -50%) scale(.65); }
  20%{ opacity:1; }
  100%{ opacity:0; transform:translate(-50%, -50%) scale(1.12); }
}

.heal-spark{
  position:absolute;
  bottom:20%;
  width:10px;
  height:10px;
  border-radius:999px;
  background:radial-gradient(circle, rgba(255,255,255,.96), rgba(123,255,176,.94) 55%, rgba(123,255,176,0) 72%);
  box-shadow:0 0 14px rgba(123,255,176,.45);
  opacity:0;
  pointer-events:none;
  animation:healSpark 620ms ease-out forwards;
}

@keyframes healSpark{
  0%{ opacity:0; transform:translateY(0) scale(.7); }
  20%{ opacity:1; }
  100%{ opacity:0; transform:translateY(-34px) scale(1.06); }
}

.battle-log{
  border:3px solid var(--pvp-ink);
  background:#1f1a16;
}

.battle-actions{
  display:grid;
  gap:10px;
  margin-top:14px;
}

.battle-command{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  min-height:76px;
  width:100%;
  padding:12px 16px;
  border-style:solid;
  border-width:3px;
  border-color:var(--pvp-ink);
  border-radius:18px;
  font-weight:900;
  font-size:18px;
  letter-spacing:.04em;
  margin:0;
  box-shadow:0 5px 0 rgba(15, 22, 31, .28), 0 14px 24px rgba(15, 22, 31, .14);
  touch-action:manipulation;
  -webkit-user-select:none;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}

.battle-command-icon{
  display:grid;
  place-items:center;
  width:54px;
  height:54px;
  line-height:1;
  flex:0 0 auto;
}

.battle-command-icon img{
  width:100%;
  height:100%;
  display:block;
  object-fit:contain;
  filter:brightness(0) invert(1);
}

.battle-command-label{
  font-size:18px;
  line-height:1.1;
}

.battle-command-attack,
button.battle-command-attack{
  background:linear-gradient(180deg, #ffef7a, #ffb300);
  color:#5c2200;
  border-color:var(--pvp-ink);
  border-width:3px;
  box-shadow:0 5px 0 rgba(122,47,0,.35), 0 14px 24px rgba(255,168,0,.22);
}

.battle-command-attack .battle-command-icon img{
  filter:none;
}

.battle-command-heal,
button.battle-command-heal{
  background:linear-gradient(180deg, #5ad07f, #1f8a46);
  color:#fff;
  border-color:var(--pvp-ink);
  border-width:3px;
  box-shadow:0 5px 0 rgba(21,98,49,.38), 0 14px 24px rgba(31,138,70,.20);
}

.battle-command-finisher,
button.battle-command-finisher{
  background:linear-gradient(180deg, #ff7a45, #db4d22) !important;
  color:#fff !important;
  border-color:var(--pvp-ink) !important;
  border-width:3px !important;
  box-shadow:0 5px 0 rgba(132,44,16,.35), 0 14px 24px rgba(219,77,34,.22) !important;
}

.battle-command-finisher .battle-command-icon img{
  filter:brightness(0) invert(1);
}

#page-result .card-shell{
  padding:22px 18px 24px;
}

.winner-box{
  border:3px solid var(--pvp-ink);
  box-shadow:0 5px 0 rgba(0,0,0,.14);
}

@media (max-width: 820px){
  .topbar-links{
    padding:10px 10px 0;
  }
}

@media (max-width: 600px){
  .app-shell{
    padding:14px 10px 28px;
  }

  .mode-select-shell{
    padding:18px 12px 20px;
  }

  .mode-select-grid{
    grid-template-columns:1fr;
    gap:12px;
    margin-top:18px;
  }


  .howto-head{
    flex-direction:column;
  }

  .mode-select-subactions{
    gap:10px;
  }

  .howto-steps{
    grid-template-columns:1fr;
    gap:12px;
  }

  .mode-notice-grid{
    grid-template-columns:1fr;
    gap:10px;
  }

  .mode-notice-label{
    min-height:auto;
    justify-content:flex-start;
    text-align:left;
    padding:10px 14px;
  }

  .mode-select-title{
    font-size:32px;
  }

  .mode-select-card{
    padding:16px 14px 14px;
    border-radius:20px;
  }

  .mode-select-card-media{
    min-height:152px;
    padding:4px 6px 0;
  }

  .mode-select-card-visual{
    width:min(100%, 200px);
  }

  .boss-select-head{
    flex-direction:column;
  }

  .boss-select-back{
    width:100%;
  }

  .boss-select-shell{
    padding:16px 12px 18px;
  }

  .boss-group-header{
    padding:10px 12px;
    border-radius:18px;
  }

  .boss-group-grid{
    gap:10px;
  }

  .boss-card{
    padding:10px;
    border-radius:18px;
  }

  .boss-card-logo{
    min-height:50px;
    padding:0;
  }

  .boss-card-logo img{
    max-width:100%;
    height:46px;
  }

  .boss-card-challenge{
    min-height:62px;
    padding:8px 10px;
    border-radius:8px;
    font-size:14px;
    line-height:1.15;
  }

  .boss-card-media{
    border-radius:14px;
  }

  .boss-card-name{
    font-size:15px;
  }

  .boss-card-meta,
  .boss-card-desc{
    font-size:11px;
    line-height:1.35;
  }

  .boss-card-action{
    padding:10px 8px;
    font-size:12px;
  }

  .brand-marquee{
    margin-top:18px;
  }

  .selected-boss-card{
    align-items:flex-start;
  }

  .selected-boss-thumb{
    width:70px;
    height:70px;
  }

  #page-home .prep-card .step-label{
    font-size:19px;
  }

  #page-home .prep-card .qr-video,
  #page-home .prep-card .qr-placeholder{
    height:168px;
  }

  .official-link{
    font-size:13px;
  }
}

/* =========================
   PVP boss battle UI
   ========================= */
.mode-hero{
  position:relative;
  overflow:hidden;
  margin:4px 0 16px;
  padding:18px 16px 16px;
  border-radius:24px;
  color:#fff9f4;
  box-shadow:0 18px 28px rgba(55,28,12,.18);
}

.mode-hero::before{
  content:"";
  position:absolute;
  inset:auto -40px -55px auto;
  width:180px;
  height:180px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,255,255,.18), rgba(255,255,255,0) 72%);
  pointer-events:none;
}

.boss-mode-hero{
  background:
    radial-gradient(circle at 100% 0%, rgba(255,221,150,.34), rgba(255,221,150,0) 34%),
    linear-gradient(135deg, #8a3b25, #d75a3b 55%, #efab54);
}

.mode-pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:108px;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.22);
  font-size:11px;
  font-weight:900;
  letter-spacing:.16em;
}

.mode-hero-title{
  margin:12px 0 6px;
  font-size:28px;
  line-height:1.15;
  font-weight:900;
}

.mode-hero-text{
  max-width:34em;
  font-size:14px;
  line-height:1.55;
  font-weight:800;
  color:rgba(255,249,244,.92);
}

.flow-board{
  margin:10px 0 14px;
  padding:14px;
  border-radius:22px;
  background:
    radial-gradient(circle at 0% 0%, rgba(255,243,220,.92), rgba(255,243,220,0) 35%),
    linear-gradient(135deg, rgba(255,250,239,.98), rgba(255,235,210,.96));
  border:1px solid rgba(145,96,53,.18);
  box-shadow:0 14px 28px rgba(93,55,17,.10);
}

.advanced-options{
  margin-top:10px;
}

.advanced-summary{
  list-style:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:16px 18px;
  border-radius:24px;
  background:
    radial-gradient(circle at 12% 30%, rgba(255,255,255,.92), rgba(255,255,255,0) 28%),
    linear-gradient(135deg, rgba(255,249,229,.98), rgba(255,227,160,.92));
  border:2px solid rgba(145,96,53,.28);
  box-shadow:
    0 10px 22px rgba(145,96,53,.14),
    inset 0 1px 0 rgba(255,255,255,.85);
  color:#6a5143;
  font-size:14px;
  font-weight:900;
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease, filter .18s ease;
}

.advanced-summary::-webkit-details-marker{
  display:none;
}

.advanced-summary-copy{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.advanced-summary-step{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-size:11px;
  letter-spacing:.12em;
  color:#a15c1a;
}

.advanced-summary-step::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background:#ff8f1f;
  box-shadow:0 0 0 5px rgba(255,143,31,.18);
}

.advanced-summary-title{
  font-size:clamp(18px, 3.6vw, 24px);
  line-height:1.2;
  color:#5d3a12;
  text-shadow:0 1px 0 rgba(255,255,255,.6);
}

.advanced-summary-note{
  font-size:13px;
  line-height:1.45;
  color:#7d644d;
}

.advanced-summary-side{
  display:flex;
  align-items:center;
  gap:10px;
  flex-shrink:0;
}

.advanced-summary-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:86px;
  padding:8px 12px;
  border-radius:999px;
  background:linear-gradient(180deg, #ff8e2b, #ffb547);
  color:#fffdf5;
  font-size:11px;
  letter-spacing:.12em;
  box-shadow:0 6px 12px rgba(179,93,7,.22);
}

.advanced-summary-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:50%;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(145,96,53,.22);
  font-size:28px;
  line-height:1;
  color:#7c4e1d;
  box-shadow:0 4px 10px rgba(145,96,53,.12);
}

.advanced-options[open] .advanced-summary{
  border-color:rgba(255,138,44,.58);
  box-shadow:
    0 12px 26px rgba(145,96,53,.18),
    0 0 0 4px rgba(255,176,67,.18),
    inset 0 1px 0 rgba(255,255,255,.88);
}

.advanced-options[open] .advanced-summary .advanced-summary-toggle{
  transform:rotate(45deg);
}

.advanced-options.attention .advanced-summary{
  border-color:rgba(255,132,0,.72);
  box-shadow:
    0 16px 28px rgba(145,96,53,.2),
    0 0 0 5px rgba(255,196,92,.22),
    inset 0 1px 0 rgba(255,255,255,.88);
  animation:advancedSummaryPulse 1.6s ease-in-out infinite;
}

.advanced-options.attention .advanced-summary-badge{
  background:linear-gradient(180deg, #ff5a36, #ff9f1c);
}

@media (hover:hover){
  .advanced-summary:hover{
    transform:translateY(-2px);
    filter:brightness(1.02);
  }
}

@keyframes advancedSummaryPulse{
  0%, 100%{
    transform:translateY(0) scale(1);
    box-shadow:
      0 16px 28px rgba(145,96,53,.2),
      0 0 0 0 rgba(255,176,67,.34),
      inset 0 1px 0 rgba(255,255,255,.88);
  }
  50%{
    transform:translateY(-1px) scale(1.012);
    box-shadow:
      0 18px 32px rgba(145,96,53,.22),
      0 0 0 8px rgba(255,176,67,0),
      inset 0 1px 0 rgba(255,255,255,.88);
  }
}

@media (max-width:640px){
  .advanced-summary{
    align-items:flex-start;
    padding:15px 16px;
  }

  .advanced-summary-side{
    flex-direction:column;
    align-items:flex-end;
    gap:8px;
  }

  .advanced-summary-badge{
    min-width:78px;
    padding:7px 10px;
  }

  .advanced-summary-toggle{
    width:34px;
    height:34px;
    font-size:24px;
  }
}

.flow-board-title{
  font-size:13px;
  font-weight:900;
  letter-spacing:.16em;
  color:#9b5b3f;
  margin-bottom:10px;
}

.flow-steps{
  display:grid;
  gap:10px;
}

.flow-step{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:16px;
  background:rgba(255,255,255,.68);
  border:1px solid rgba(145,96,53,.12);
  color:#7c6859;
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.flow-step.active{
  background:linear-gradient(90deg, rgba(201,75,63,.14), rgba(255,197,102,.26));
  color:#4a2a1b;
  box-shadow:0 8px 16px rgba(201,75,63,.10);
}

.flow-step.done{
  background:linear-gradient(90deg, rgba(31,122,58,.14), rgba(102,206,123,.18));
  color:#214429;
}

.flow-step-num{
  width:28px;
  height:28px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-size:14px;
  font-weight:900;
  background:#f7dfcd;
  color:#84452a;
  flex:0 0 auto;
}

.flow-step.done .flow-step-num{
  background:#d8f0de;
  color:#1f7a3a;
}

.flow-step-text{
  font-size:14px;
  font-weight:900;
  line-height:1.35;
}

.next-action-card{
  margin-top:12px;
  padding:12px 14px;
  border-radius:16px;
  background:#2e241e;
  color:#fff7ef;
  box-shadow:0 12px 18px rgba(30,19,12,.18);
}

.next-action-label{
  font-size:11px;
  letter-spacing:.14em;
  font-weight:900;
  color:#ffc98c;
}

.next-action-state{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:84px;
  margin-top:8px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.28);
  background:rgba(255,255,255,.12);
  font-size:12px;
  font-weight:900;
}

.next-action-state.ok{
  color:#c6ffd2;
  border-color:rgba(157,255,178,.5);
}

.next-action-state.ng{
  color:#ffe2c0;
  border-color:rgba(255,204,153,.5);
}

.next-action-text{
  margin-top:4px;
  font-size:16px;
  font-weight:900;
  line-height:1.4;
}

.battle-shell{
  position:relative;
  overflow:hidden;
}

.battle-shell.is-finishing{
  animation:battleFinishFade 1800ms ease forwards;
}

@keyframes battleFinishFade{
  0%{ filter:saturate(1) brightness(1); transform:scale(1); }
  55%{ filter:saturate(.9) brightness(.92); transform:scale(.995); }
  100%{ filter:saturate(.76) brightness(.82); transform:scale(.99); }
}

.battle-finish-overlay{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:20px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,248,221,.18), rgba(255,248,221,0) 36%),
    linear-gradient(180deg, rgba(44,26,18,0) 0%, rgba(44,26,18,.16) 45%, rgba(44,26,18,.48) 100%);
  opacity:0;
  pointer-events:none;
  z-index:3;
}

.battle-finish-text{
  padding:16px 22px;
  border-radius:20px;
  background:rgba(34,20,13,.68);
  border:1px solid rgba(255,236,195,.28);
  color:#fff7ea;
  font-size:clamp(28px, 6vw, 40px);
  font-weight:900;
  letter-spacing:.14em;
  text-shadow:0 3px 10px rgba(0,0,0,.34);
  box-shadow:0 18px 26px rgba(0,0,0,.22);
}

.result-shell{
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.85) 0, rgba(255,255,255,0) 42%),
    radial-gradient(circle at 20% 20%, rgba(255,222,120,.42) 0, rgba(255,222,120,0) 34%),
    radial-gradient(circle at 80% 18%, rgba(255,144,103,.28) 0, rgba(255,144,103,0) 30%),
    linear-gradient(180deg, rgba(255,251,235,.98), rgba(255,239,213,.96));
  border:1px solid rgba(138,104,61,.25);
  border-radius:24px;
  box-shadow:0 16px 36px rgba(72,37,16,.16);
  padding:24px 18px 28px;
  text-align:center;
}

.result-shell.win{
  border-color:rgba(174,111,49,.30);
}

.result-shell.lose{
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.62) 0, rgba(255,255,255,0) 42%),
    radial-gradient(circle at 18% 18%, rgba(186,215,255,.24) 0, rgba(186,215,255,0) 34%),
    radial-gradient(circle at 82% 18%, rgba(120,155,212,.18) 0, rgba(120,155,212,0) 30%),
    linear-gradient(180deg, rgba(244,248,255,.98), rgba(223,233,248,.98));
  border-color:rgba(84,112,156,.26);
  box-shadow:0 16px 36px rgba(45,63,94,.16);
}

.result-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:98px;
  padding:6px 14px;
  border-radius:999px;
  background:linear-gradient(90deg,#d94f41,#f1ad54);
  color:#fffdf8;
  font-size:12px;
  font-weight:900;
  letter-spacing:.18em;
  box-shadow:0 8px 16px rgba(201,75,63,.22);
}

.result-shell.lose .result-badge{
  background:linear-gradient(90deg,#46658d,#7da6dd);
  color:#f4f8ff;
}

.result-title{
  margin:14px 0 4px;
  font-size:30px;
  line-height:1.1;
  font-weight:900;
  color:#6f260d;
}

.result-shell.lose .result-title{
  color:#2c4263;
}

.result-sub{
  font-size:14px;
  color:#8a5f44;
  font-weight:700;
}

.result-shell.lose .result-sub{
  color:#5a6e89;
}

.result-winner-name{
  font-size:28px;
  line-height:1.15;
  font-weight:900;
  color:#442319;
  margin-bottom:16px;
}

.result-shell.lose .result-winner-name{
  color:#23344f;
}

.result-versus{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  gap:10px;
  align-items:center;
  margin-top:14px;
  padding:14px 12px;
  border-radius:18px;
  background:rgba(255,255,255,.6);
  border:1px solid rgba(138,104,61,.16);
}

.result-shell.lose .result-versus{
  background:rgba(245,249,255,.76);
  border-color:rgba(84,112,156,.18);
}

.result-side{
  padding:10px 8px;
  border-radius:14px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(138,104,61,.12);
}

.result-side-label{
  font-size:11px;
  font-weight:900;
  letter-spacing:.14em;
  color:#a06a4f;
}

.result-shell.lose .result-side-label{
  color:#6b86aa;
}

.result-side-name{
  margin-top:4px;
  font-size:17px;
  font-weight:900;
  color:#3a241b;
}

.result-shell.lose .result-side-name{
  color:#22344f;
}

.result-side-hp{
  margin-top:4px;
  font-size:13px;
  color:#7f675b;
  font-weight:700;
}

.result-shell.lose .result-side-hp{
  color:#657990;
}

.result-vs-mark{
  font-size:18px;
  font-weight:900;
  color:#b84f3a;
  letter-spacing:.16em;
}

.result-shell.lose .result-vs-mark{
  color:#5073a6;
}

.result-hint{
  min-height:1.4em;
  margin-top:12px;
  font-size:14px;
  font-weight:800;
  color:#7f675b;
}

.result-shell.lose .result-hint{
  color:#657990;
}

#page-result #btnGoHome{
  margin-top:22px;
}

@media (max-width:640px){
  .mode-hero-title{ font-size:24px; }
  .result-title{ font-size:26px; }
  .result-winner-name{ font-size:24px; }
  .result-versus{ grid-template-columns:1fr; }
  .battle-actions{
    grid-template-columns:1fr;
    gap:6px;
  }
  .battle-command{
    min-height:50px;
    gap:8px;
    padding:8px 10px;
    border-radius:14px;
  }
  .battle-command-icon{
    width:28px;
    height:28px;
  }
  .battle-command-finisher .battle-command-icon{
    width:32px;
    height:32px;
  }
  .battle-command-label{
    font-size:15px;
    letter-spacing:0;
  }
  .battle-command-finisher .battle-command-label{
    font-size:15px;
  }
}

/* =========================
   Consistency pass
   ========================= */
.intro-shell,
.battle-shell,
.result-shell,
.boss-select-shell,
.selected-boss-card{
  border-radius:24px;
  border:3px solid var(--pvp-ink);
  box-shadow:var(--pvp-shadow);
}

.intro-shell{
  position:relative;
  overflow:hidden;
  padding:22px 18px 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.82) 0, rgba(255,255,255,0) 42%),
    radial-gradient(circle at 18% 22%, rgba(255,222,120,.22) 0, rgba(255,222,120,0) 32%),
    radial-gradient(circle at 82% 18%, rgba(255,144,103,.16) 0, rgba(255,144,103,0) 28%),
    linear-gradient(180deg, rgba(255,251,235,.98), rgba(255,239,213,.96));
}

.intro-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:116px;
  padding:6px 14px;
  border-radius:999px;
  background:linear-gradient(90deg,#d94f41,#f1ad54);
  color:#fffdf8;
  font-size:12px;
  font-weight:900;
  letter-spacing:.18em;
  box-shadow:0 8px 16px rgba(201,75,63,.22);
}

.intro-vs{
  align-items:stretch;
  gap:14px;
  margin:14px 0 16px;
}

.intro-side{
  padding:12px 10px 10px;
}

.intro-bubble{
  max-width:180px;
  padding:8px 12px;
  border-radius:18px;
  border:2px solid rgba(0,0,0,.12);
  box-shadow:0 5px 10px rgba(0,0,0,.06);
}

.intro-bubble::before{
  border-color:rgba(0,0,0,.12) transparent transparent transparent;
}

.intro-portrait{
  width:112px;
  height:112px;
  border-width:3px;
  box-shadow:0 5px 0 rgba(0,0,0,.14);
}

.intro-name{
  font-size:18px;
}

.intro-vs-label{
  display:grid;
  place-items:center;
  min-width:56px;
  font-size:26px;
  color:var(--pvp-red);
}

.intro-shell .owned-wrap{
  border:2px solid rgba(0,0,0,.12);
  border-radius:20px;
  background:rgba(255,255,255,.66);
}

.intro-actions{
  display:grid;
  gap:10px;
  margin-top:14px;
}

.battle-command{
  border:3px solid var(--pvp-ink);
  box-shadow:0 5px 0 rgba(0,0,0,.20), 0 14px 24px rgba(0,0,0,.14);
}

.battle-command-label{
  font-weight:900;
}

@media (max-width:640px){
  .intro-vs{
    gap:10px;
  }
  .intro-side{
    padding:10px 8px 8px;
  }
  .intro-portrait{
    width:88px;
    height:88px;
  }
  .intro-name{
    font-size:15px;
  }
  .intro-vs-label{
    min-width:42px;
    font-size:22px;
  }
}

.boss-defeated{
  animation:bossDefeatUnit 980ms cubic-bezier(.18,.88,.22,1) forwards;
}

.boss-defeat-sprite{
  animation:bossDefeatSprite 980ms cubic-bezier(.18,.88,.22,1) forwards;
}

.boss-defeat-burst{
  position:fixed;
  inset:0;
  background:
    radial-gradient(circle at 72% 42%, rgba(255,255,255,.98) 0 4%, rgba(255,238,140,.94) 10%, rgba(255,154,54,.76) 22%, rgba(255,70,40,.42) 36%, rgba(255,255,255,0) 56%);
  mix-blend-mode:screen;
  pointer-events:none;
  z-index:10002;
  animation:bossDefeatBurst 760ms ease-out forwards;
}

.boss-defeat-shock{
  position:fixed;
  left:72%;
  top:42%;
  width:min(44vw, 420px);
  aspect-ratio:1 / 1;
  transform:translate(-50%, -50%) scale(.25);
  border-radius:999px;
  border:10px solid rgba(255,247,186,.92);
  box-shadow:0 0 40px rgba(255,184,63,.45), inset 0 0 26px rgba(255,255,255,.3);
  pointer-events:none;
  z-index:10003;
  animation:bossDefeatShock 820ms ease-out forwards;
}

.boss-defeat-particle{
  position:fixed;
  width:16px;
  height:16px;
  border-radius:4px;
  background:linear-gradient(180deg, #fff5b0, #ff7c39);
  box-shadow:0 0 18px rgba(255,145,60,.45);
  pointer-events:none;
  z-index:10004;
  animation:bossDefeatParticle 900ms cubic-bezier(.18,.88,.22,1) forwards;
}

@keyframes bossDefeatUnit{
  0%{ filter:brightness(1) saturate(1); transform:scale(1) rotate(0deg); opacity:1; }
  18%{ filter:brightness(1.25) saturate(1.35); transform:scale(1.03) rotate(-1deg); }
  46%{ filter:brightness(1.1) saturate(1.1); transform:scale(.98) rotate(2deg) translateY(-4px); }
  100%{ filter:brightness(.8) saturate(.7); transform:scale(.94) rotate(4deg) translateY(-18px); opacity:.15; }
}

@keyframes bossDefeatSprite{
  0%{ transform:scale(1) rotate(0deg); filter:brightness(1); opacity:1; }
  20%{ transform:scale(1.18) rotate(-4deg); filter:brightness(1.45); }
  48%{ transform:scale(.94) rotate(6deg) translateY(-10px); filter:brightness(1.08); }
  100%{ transform:scale(.68) rotate(14deg) translateY(-56px); filter:brightness(.92); opacity:0; }
}

@keyframes bossDefeatBurst{
  0%{ opacity:0; }
  18%{ opacity:1; }
  100%{ opacity:0; }
}

@keyframes bossDefeatShock{
  0%{ opacity:0; transform:translate(-50%, -50%) scale(.25); }
  22%{ opacity:1; }
  100%{ opacity:0; transform:translate(-50%, -50%) scale(1.45); }
}

@keyframes bossDefeatParticle{
  0%{ opacity:0; transform:translate(0, 0) scale(.7) rotate(0deg); }
  18%{ opacity:1; }
  100%{ opacity:0; transform:translate(var(--dx), var(--dy)) scale(1.1) rotate(220deg); }
}

.sim-nav-button{
  width:auto;
  min-width:140px;
  margin:0;
}

.sim-nav-button-home{
  margin-top:14px;
  align-self:flex-start;
}

.sim-shell{
  background:rgba(255,250,245,.95);
  border:1px solid var(--line);
  border-radius:20px;
  padding:16px;
  box-shadow:0 10px 28px rgba(0,0,0,.1);
}

.sim-login-shell{
  display:flex;
  justify-content:center;
  margin:0 auto;
}

.sim-login-card{
  width:min(520px, 100%);
  padding:20px;
  border-radius:20px;
  border:1px solid var(--line);
  background:rgba(255,250,245,.97);
  box-shadow:0 10px 28px rgba(0,0,0,.1);
}

.sim-login-field{
  margin-top:16px;
}

.sim-login-actions{
  margin-top:16px;
}

.sim-login-message{
  margin-top:14px;
  text-align:center;
  font-size:14px;
  color:var(--muted);
  font-weight:700;
}

.sim-login-message.is-error{
  color:var(--ng);
}

.is-hidden{
  display:none !important;
}

.sim-hero{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.sim-pill{
  background:rgba(47,111,214,.12);
  color:#2257a5;
}

.sim-title{
  margin:8px 0 6px;
  font-size:24px;
}

.sim-copy{
  margin:0;
  color:var(--muted);
  line-height:1.6;
}

.sim-link-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:140px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid #dbc8b4;
  background:#fff;
  color:#6f6158;
  text-decoration:none;
  font-weight:900;
  box-shadow:0 2px 0 rgba(180,160,130,.7);
}

.sim-controls{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
  margin-top:16px;
}

.sim-field{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:12px;
  border-radius:14px;
  background:rgba(255,255,255,.78);
  border:1px solid var(--line);
  font-weight:900;
}

.sim-field span{
  font-size:13px;
}

.sim-field input{
  width:100%;
  border:1px solid #d8c6b1;
  border-radius:10px;
  padding:10px 12px;
  font-size:16px;
  font-family:inherit;
  color:var(--text);
  background:#fff;
}

.sim-actions{
  display:flex;
  flex-direction:row;
  justify-content:center;
  align-items:center;
  gap:10px;
  grid-column:1 / -1;
  justify-self:center;
  width:max-content;
}

.sim-actions button{
  margin:0;
  width:auto;
  min-width:220px;
}

.sim-inline-field{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:13px;
  font-weight:900;
}

.sim-inline-field select{
  border:1px solid #d8c6b1;
  border-radius:10px;
  padding:8px 10px;
  font-size:14px;
  font-family:inherit;
  color:var(--text);
  background:#fff;
}

.sim-status-card{
  margin-top:14px;
  padding:14px;
  border-radius:16px;
  border:1px solid var(--line);
  background:linear-gradient(135deg,rgba(255,255,255,.96),rgba(240,247,255,.94));
}

.sim-status-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:10px;
}

.sim-status-label{
  font-size:12px;
  font-weight:900;
  letter-spacing:.08em;
  color:var(--muted);
}

.sim-status-text{
  font-weight:900;
}

.sim-progress{
  height:14px;
  border-radius:999px;
  background:rgba(0,0,0,.08);
  overflow:hidden;
  border:1px solid rgba(0,0,0,.08);
}

.sim-progress-bar{
  width:0;
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,#2f6fd6,#49b35f);
  transition:width .15s ease;
}

.sim-meta-text{
  margin-top:10px;
  color:var(--muted);
  font-size:13px;
}

.sim-summary-grid{
  display:grid;
  grid-template-columns:repeat(5, minmax(0, 1fr));
  gap:10px;
  margin-top:14px;
}

.sim-summary-card{
  padding:12px;
  border-radius:14px;
  background:rgba(255,255,255,.84);
  border:1px solid var(--line);
}

.sim-summary-label{
  font-size:12px;
  font-weight:900;
  color:var(--muted);
  margin-bottom:6px;
}

.sim-summary-value{
  font-size:24px;
  font-weight:900;
}

.sim-summary-value-small{
  font-size:16px;
}

.sim-panels{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
  margin-top:16px;
}

.sim-panel{
  padding:14px;
  border-radius:16px;
  background:rgba(255,255,255,.84);
  border:1px solid var(--line);
}

.sim-panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:10px;
}

.sim-table-wrap,
.sim-matrix-wrap{
  overflow:auto;
}

.sim-table{
  width:100%;
  border-collapse:collapse;
  min-width:640px;
}

.sim-table th,
.sim-table td{
  padding:10px 12px;
  border-bottom:1px solid #eadccc;
  text-align:left;
  font-size:14px;
  white-space:nowrap;
}

.sim-comment-cell{
  white-space:normal;
  min-width:260px;
  line-height:1.5;
}

.sim-delta-up{
  color:var(--ok);
  font-weight:900;
}

.sim-delta-down{
  color:var(--ng);
  font-weight:900;
}

.sim-table thead th{
  position:sticky;
  top:0;
  background:#fffaf2;
  z-index:1;
}

.sim-matrix-table{
  min-width:1320px;
  table-layout:fixed;
}

.sim-sticky-col{
  position:sticky;
  left:0;
  background:#fffaf2;
  z-index:2;
}

.sim-matrix-table tbody .sim-sticky-col{
  background:#fff;
}

.sim-corner-cell{
  min-width:160px;
}

.sim-matrix-viewport{
  overflow:auto;
  border:1px solid #eadccc;
  border-radius:14px;
  background:#fff;
}

.sim-matrix-legend{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(140px, 1fr));
  gap:8px;
  margin-bottom:12px;
}

.sim-legend-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(255,255,255,.8);
  border:1px solid #eadccc;
}

.sim-legend-name{
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sim-matrix-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  min-width:28px;
  height:28px;
  border-radius:999px;
  background:#efe3d4;
  color:#6a4f3a;
  font-size:12px;
  font-weight:900;
  border:1px solid #dbc8b4;
}

.sim-sticky-name{
  display:inline-block;
  margin-left:8px;
  max-width:118px;
  overflow:hidden;
  text-overflow:ellipsis;
  vertical-align:middle;
}

.sim-matrix-table thead th{
  text-align:center;
}

.sim-matrix-table th,
.sim-matrix-table td{
  min-width:42px;
  width:42px;
  text-align:center;
  padding:8px 6px;
  font-size:12px;
}

.sim-matrix-table .sim-sticky-col{
  width:200px;
  min-width:200px;
  text-align:left;
}

.sim-matrix-table td{
  font-weight:800;
}

.sim-matrix-table td.is-diag{
  background:#f4eee7;
  color:#8a7b6f;
}

.sim-empty{
  text-align:center;
  color:var(--muted);
  padding:22px 12px;
}

.sim-matrix-note{
  font-size:12px;
  color:var(--muted);
  margin-bottom:10px;
}

.sim-matrix-table td.is-strong{ background:rgba(73,179,95,.22); }
.sim-matrix-table td.is-good{ background:rgba(73,179,95,.12); }
.sim-matrix-table td.is-bad{ background:rgba(201,75,63,.12); }
.sim-matrix-table td.is-weak{ background:rgba(201,75,63,.22); }

@media (max-width: 720px){
  .sim-hero{
    flex-direction:column;
  }

  .sim-nav-button{
    width:100%;
  }

  .sim-controls{
    grid-template-columns:1fr;
  }

  .sim-actions{
    flex-direction:column;
  }

  .sim-actions button{
    width:100%;
    min-width:0;
  }

  .sim-summary-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .sim-inline-field{
    width:100%;
    flex-direction:column;
    align-items:stretch;
  }

  .sim-matrix-legend{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .sim-matrix-table .sim-sticky-col{
    width:136px;
    min-width:136px;
  }

  .sim-sticky-name{
    max-width:92px;
  }

  .battle-turn-banner{
    margin:8px 0 12px;
    padding:9px 12px;
    border-radius:16px;
  }

  .battle-turn-main{
    font-size:20px;
  }

  .battle-turn-sub{
    font-size:11px;
  }
}
