/* はつめいロボバトルDX — battle.css：バトルの HUD・実況・通知・結果・準備・操作・ネオン（2026-12-02 P0 で css/style.css から同じ順番のまま分割。中身は変えていない。持ち主：P4） */

/* Battle & Puzzle HUD */
#battle-hud {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  z-index: 11;
  pointer-events: none;
  display: none;
  flex-direction: column;
  gap: 4px;
}

#battle-hud.active {
  display: flex;
}

.vs-bars {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}

.fighter-card {
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 4px 7px;
  box-shadow: 0 2.5px 0 var(--ink);
  min-width: 0;
}

.fighter-header {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 900;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hp-track {
  width: 100%;
  height: 10px;
  background: #e2e8f0;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #228be6, #38d9a9);
  transition: width 0.12s ease-out;
}

.hp-fill.enemy {
  background: linear-gradient(90deg, #ff4988, #ff8743);
}

.burst-track {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 3px;
}

.burst-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59f00, #ffe066);
  transition: width 0.12s ease-out;
}

.burst-fill.ready {
  background: linear-gradient(90deg, #ff6b2b, #ffd43b, #ffffff);
  box-shadow: 0 0 8px rgba(255, 212, 59, 0.95);
}

.rule-lamps {
  display: flex;
  gap: 3px;
  margin-top: 3px;
}

.rule-lamp {
  font-size: 9px;
  font-weight: 900;
  padding: 0 5px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #f1f5f9;
  color: #64748b;
}

.rule-lamp.lit {
  background: var(--accent-yellow);
  color: var(--ink);
  box-shadow: 0 0 6px rgba(255, 212, 38, 0.9);
}

.rule-lamp.off-slot {
  opacity: 0.36;
  border-style: dashed;
}

.vs-badge {
  background: var(--accent-yellow);
  border: 2px solid var(--ink);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 12px;
  box-shadow: 0 2.5px 0 var(--ink);
}

.hud-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.live-program-pill {
  background: rgba(25, 32, 56, 0.88);
  color: #fff;
  border: 1.5px solid var(--accent-yellow);
  border-radius: 9px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Commentary Subtitle Ticker (#commentary-ticker) — Cleanly above bottom controls */
#commentary-ticker,
.commentary-ticker {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(94%, 440px);
  padding: 5px 11px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: rgba(25, 32, 56, 0.9);
  color: #ffffff;
  box-shadow: 0 3px 0 rgba(15, 23, 42, 0.45);
  pointer-events: none;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  animation: popIn 0.18s ease-out;
}

.commentary-badge {
  flex-shrink: 0;
  background: var(--accent-yellow);
  color: var(--ink);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 9.5px;
  font-weight: 900;
}

.commentary-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Discovery Toast — Non-colliding with #battle-hud & below modals */
#toast-box {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
  pointer-events: none;
  width: 92%;
  max-width: 410px;
}

/* During battle, place toasts in bottom-safe zone above commentary/dock so #battle-hud is never obscured */
.in-battle #toast-box,
body.in-battle #toast-box,
#app.in-battle #toast-box {
  top: auto;
  bottom: 54px;
}

.invention-toast {
  background: linear-gradient(135deg, #fff9db 0%, #ffe066 100%);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 7px 12px;
  box-shadow: 0 4px 0 var(--ink);
  text-align: center;
  animation: popIn 0.25s cubic-bezier(0.18, 1.3, 0.4, 1);
}

.invention-toast-title {
  font-weight: 900;
  font-size: 12.5px;
  color: #c2410c;
}

.invention-toast-desc {
  font-weight: 700;
  font-size: 10.5px;
  color: var(--ink);
  margin-top: 2px;
}

@keyframes popIn {
  0% { transform: scale(0.65) translateY(-10px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Result Modal inside Viewport */
#battle-result {
  position: absolute;
  inset: 0;
  background: rgba(25, 32, 56, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 25;
  padding: 12px;
}

#battle-result.open {
  display: flex;
}

.result-card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  padding: 15px 16px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 7px 0 var(--ink);
  animation: popIn 0.28s ease-out;
}

.result-headline {
  font-size: 21px;
  font-weight: 900;
  margin: 0 0 5px;
}

.result-sub {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 10px;
  line-height: 1.45;
}

.result-metrics {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 11px;
  padding: 7px 9px;
  font-size: 10.5px;
  font-weight: 800;
  margin-bottom: 11px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
}

.result-actions {
  display: flex;
  gap: 7px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Battle Setup Sheet (#battle-prep-shell) — Structured Step-by-Step, No Clipped Scroll */
#battle-prep-shell,
.battle-prep-shell {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: min(46dvh, 330px);
  overflow-y: auto;
  padding: 2px 1px 4px;
}

.prep-section {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 6px 8px;
}

.prep-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 10.5px;
  font-weight: 900;
  color: var(--ink);
}

.prep-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  margin-right: 4px;
}

.class-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  gap: 6px;
}

.class-card {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2.5px 0 var(--ink);
  text-align: left;
  transition: transform 0.08s ease;
}

.class-card:active {
  transform: translateY(2px);
  box-shadow: none;
}

.class-card.selected {
  background: #fff3bf;
  border-color: #d9480f;
  box-shadow: 0 2.5px 0 #d9480f;
}

.class-card.locked {
  opacity: 0.65;
  background: #f1f5f9;
  border-style: dashed;
}

.class-card-name {
  font-size: 11px;
  font-weight: 900;
}

.class-card-spec {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Las Vegas Underground Neon Class Card */
.class-card.vegas,
.class-card[data-wclass="vegas"],
.wclass-pill.vegas {
  background: linear-gradient(135deg, #1b0c38 0%, #2d1254 60%, #441357 100%);
  color: #ffffff;
  border-color: var(--vegas-gold);
  box-shadow: 0 2.5px 0 #090414, 0 0 10px rgba(255, 46, 147, 0.35);
}

.class-card.vegas .class-card-name,
.class-card[data-wclass="vegas"] .class-card-name {
  color: var(--vegas-gold);
  text-shadow: 0 0 6px rgba(255, 212, 38, 0.55);
}

.class-card.vegas .class-card-spec,
.class-card[data-wclass="vegas"] .class-card-spec {
  color: #f5d0fe;
}

.class-card.vegas.selected,
.class-card[data-wclass="vegas"].selected,
.wclass-pill.vegas.active {
  border-color: var(--vegas-magenta);
  box-shadow: 0 2.5px 0 #090414, 0 0 14px rgba(255, 46, 147, 0.72), inset 0 0 0 1.5px var(--vegas-gold);
}

.reg-chip,
.regulation-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #eef2ff;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 900;
  flex-wrap: wrap;
}

.reg-chip.over,
.regulation-chip.over {
  background: #ffe3e3;
  border-color: #c92a2a;
  color: #c92a2a;
}

/* Battle Dock — Wrapped layout so pills are never clipped */
.battle-mode-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 5px 7px;
  margin-bottom: 5px;
}

.vs-mode-switch,
.arena-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.vs-mode-btn,
.arena-pill {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 900;
  padding: 4px 9px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #f1f5f9;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.vs-mode-btn.active {
  background: var(--accent-yellow);
}

.arena-pill.active {
  background: #bae6fd;
  color: #0369a1;
}

.arena-pill.vegas,
.arena-pill[data-arena="vegas"] {
  background: #1b0c38;
  color: var(--vegas-gold);
  border-color: var(--vegas-magenta);
}

.arena-pill.vegas.active,
.arena-pill[data-arena="vegas"].active {
  background: linear-gradient(135deg, #ff2e93, #7950f2);
  color: #fff;
  border-color: var(--vegas-gold);
}

.diff-pill.active-easy { background: #dcfce7; color: #15803d; }
.diff-pill.active-normal { background: #bae6fd; color: #0369a1; }
.diff-pill.active-hard { background: #ffe3e3; color: #c92a2a; border-color: #c92a2a; }

.wclass-pill.active { background: #fef08a; color: #b45309; border-color: var(--ink); }

.stat-pill.clickable-pill,
#btn-hud-wclass.clickable-pill {
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.stat-pill.clickable-pill:hover,
#btn-hud-wclass.clickable-pill:hover {
  background: #fff9db;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--ink);
}
[data-wclass="vegas"] #btn-hud-wclass.clickable-pill:hover {
  background: linear-gradient(135deg, #321068, #5c1870);
}
.stat-pill.clickable-pill:active,
#btn-hud-wclass.clickable-pill:active {
  transform: translateY(1px);
  box-shadow: none;
}

.stage-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.stage-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 240px;
}

.stage-btn {
  font-family: inherit;
  min-width: 106px;
  padding: 5px 8px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2.5px 0 var(--ink);
  text-align: left;
  flex-shrink: 0;
}

.stage-btn.selected {
  background: #ffe8cc;
  border-color: #d9480f;
}

.stage-btn-lvl {
  font-size: 9px;
  font-weight: 900;
  color: #d9480f;
}

.stage-btn-name {
  font-size: 10.5px;
  font-weight: 900;
}

.insp-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: #f1f5f9;
  color: var(--ink);
  font-size: 9px;
  font-weight: 900;
  line-height: 1.3;
  white-space: nowrap;
}

.insp-chip.ok {
  background: #dcfce7;
  border-color: #15803d;
  color: #15803d;
}

.insp-chip.ng {
  background: #ffe3e3;
  border-color: #c92a2a;
  color: #c92a2a;
}

.insp-chip.unlimited {
  background: linear-gradient(135deg, #240b4c, #4a1259);
  border-color: var(--vegas-gold);
  color: var(--vegas-gold);
}

.two-player-prep {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.two-player-prep.active {
  display: flex;
}

.p2-card-box {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  font-size: 10.5px;
  font-weight: 900;
  flex-shrink: 0;
}

.p2-card-box.p1 { background: #e7f5ff; }
.p2-card-box.p2 { background: #fff0f6; }

.p2-select {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 7px;
  border: 1.5px solid var(--ink);
  background: #fff;
  max-width: 125px;
}

.battle-live-controls {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.battle-live-controls.active {
  display: flex;
}

.live-btns {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  flex: 1;
}

.action-pad-btn {
  font-family: inherit;
  padding: 9px 4px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  font-weight: 900;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2.5px 0 var(--ink);
  color: var(--ink);
  white-space: nowrap;
  min-height: 40px;
}

.action-pad-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.pad-dash { background: #a5f3fc; }
.pad-spin { background: #fde047; }
.pad-piston { background: #fda4af; }
.pad-shoot { background: #d8b4fe; }
.pad-turbo { background: #fdba74; }
.pad-burst {
  background: #e2e8f0;
  color: #64748b;
}
.pad-burst.ready {
  background: linear-gradient(180deg, #ffe066 0%, #ff922b 100%);
  color: var(--ink);
  animation: pulseBurst 0.65s infinite alternate;
}
@keyframes pulseBurst {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}

/* 2P Split Live Battle Controls */
#battle-live-2p {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

#battle-live-2p.active {
  display: flex;
}

.dual-pad-group {
  display: flex;
  gap: 4px;
  flex: 1;
  padding: 4px 5px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  align-items: center;
}

.dual-pad-group.p1 { background: #dbeafe; }
.dual-pad-group.p2 { background: #ffe4e6; }

.dual-btn {
  font-family: inherit;
  flex: 1;
  min-height: 38px;
  padding: 6px 3px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: #fff;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  white-space: nowrap;
}

/* Hold-turn pads keep touch-action: none to avoid gesture cancellation while holding */
#p1-pad-left,
#p1-pad-right,
#p2-pad-left,
#p2-pad-right,
.hold-pad,
.turn-pad {
  touch-action: none;
}

.dual-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* Las Vegas Underground HUD & Arena Theme Accents */
.theme-vegas #viewport-wrap,
[data-wclass="vegas"] #viewport-wrap,
[data-arena="vegas"] #viewport-wrap {
  background: radial-gradient(circle at 50% 35%, #3b1368 0%, #170a2e 65%, #090414 100%);
}

.theme-vegas #battle-hud .fighter-card,
[data-wclass="vegas"] #battle-hud .fighter-card,
[data-arena="vegas"] #battle-hud .fighter-card {
  background: var(--vegas-card);
  color: #ffffff;
  border-color: var(--vegas-gold);
  box-shadow: 0 2.5px 0 #090414, 0 0 10px rgba(255, 46, 147, 0.35);
}

.theme-vegas #battle-hud .hp-track,
[data-wclass="vegas"] #battle-hud .hp-track,
[data-arena="vegas"] #battle-hud .hp-track {
  border-color: var(--vegas-gold);
  background: #1a0b33;
}

.theme-vegas #battle-hud .vs-badge,
[data-wclass="vegas"] #battle-hud .vs-badge,
[data-arena="vegas"] #battle-hud .vs-badge {
  background: linear-gradient(135deg, var(--vegas-magenta), #7950f2);
  color: var(--vegas-gold);
  border-color: var(--vegas-gold);
  box-shadow: 0 2.5px 0 #090414, 0 0 12px rgba(255, 46, 147, 0.65);
}

.theme-vegas #battle-hud .live-program-pill,
[data-wclass="vegas"] #battle-hud .live-program-pill,
[data-arena="vegas"] #battle-hud .live-program-pill {
  background: rgba(18, 9, 36, 0.94);
  border-color: var(--vegas-magenta);
  color: var(--vegas-gold);
}

.theme-vegas #commentary-ticker,
[data-wclass="vegas"] #commentary-ticker,
[data-arena="vegas"] #commentary-ticker,
.commentary-ticker.vegas {
  background: rgba(18, 9, 36, 0.95);
  border-color: var(--vegas-magenta);
  box-shadow: 0 3px 0 #090414, 0 0 12px rgba(255, 46, 147, 0.45);
}

.theme-vegas .commentary-badge,
[data-wclass="vegas"] .commentary-badge,
[data-arena="vegas"] .commentary-badge,
.commentary-ticker.vegas .commentary-badge {
  background: linear-gradient(90deg, var(--vegas-gold), #ff922b);
  color: #120924;
}

.theme-vegas .stat-pill.vegas-badge,
[data-wclass="vegas"] #btn-hud-wclass {
  background: linear-gradient(135deg, #240b4c, #4a1259);
  color: var(--vegas-gold);
  border-color: var(--vegas-magenta);
}

/* Mobile Portrait Optimizations (No max-height: 450px landscape override — handled by orient.js) */
@media (max-width: 620px) {
  #battle-live-2p {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .live-btns {
    grid-template-columns: repeat(3, 1fr);
  }
  .action-pad-btn {
    padding: 7px 4px;
    min-height: 36px;
    font-size: 10.5px;
  }
}

/* P0（2026-12-02）：試合中・決着後は上のバーのタブ・タイトル・ずかん等を隠し、ポーズだけ残す（タブで試合が消える導線を断つ） */
#app.in-battle #topbar .brand,
#app.in-battle #topbar .mode-tabs,
#app.in-battle #topbar .top-actions > :not(#btn-pause) {
  display: none !important;
}
#app.in-battle #topbar {
  justify-content: flex-end;
}

@media (prefers-reduced-motion: reduce) {
  .invention-toast,
  .result-card,
  .commentary-ticker,
  .pad-burst.ready {
    animation: none !important;
    transition: none !important;
  }
}
