body .pm-analyze {
  width: 100%; min-height: 42px; border: 1px solid #ffd075; background: #1b2a40;
  color: #ffd075; font: 700 16px 'Chakra Petch', sans-serif; cursor: pointer;
}
body .pm-analyze:disabled { opacity: .5; cursor: default; }
body .pm-analysis-status { margin: 2px 0; color: #ffd075; font-size: 14px; }
body .pm-analysis-status:empty { display: none; }
body .pm-stage canvas, body .pm-stage img { pointer-events: none; }
@media (orientation: landscape) and (max-height: 500px) {
  body #online-match-intro.online-prematch {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 40%);
    grid-template-rows: auto minmax(0, 1fr); align-items: stretch;
  }
  body .online-prematch .pm-top { grid-column: 1 / -1; padding: 5px 12px; }
  body .online-prematch .pm-top h1 { margin: 2px 0 0; font-size: 24px; }
  body .online-prematch .pm-faceoff { min-height: 0; }
  body .online-prematch .pm-plate { padding: 5px 8px; }
  body .online-prematch .pm-name { margin: 2px 0; font-size: 20px; }
  body .online-prematch .pm-lcd { font-size: 14px; padding: 2px 4px; }
  body .online-prematch .pm-stage { min-height: 0; }
  body .online-prematch .pm-caption { padding-bottom: 4px; }
  body .online-prematch .pm-dock { position: relative; z-index: 5; align-content: center; gap: 5px; padding: 6px 10px; background: #0a1020; }
  body .online-prematch .pm-toggle { min-height: 44px; padding: 4px 6px; }
  body .online-prematch .pm-note { display: none; }
}


body .pm-analyze { background: #101e32; border: 1px solid #58caff; color: #f2f5fc; min-height: 44px; padding: 8px; cursor: pointer; }
body .pm-analyze:disabled { opacity: .5; cursor: default; }
body .pm-analysis-status { color: #ffd075; font-size: 14px; }
body .pm-analysis-status:empty { display: none; }
body .analysis-overlay {
  position: fixed; inset: 0; z-index: 99999; display: grid; place-items: center;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  background: rgba(4, 9, 19, .94); color: #f2f5fc; box-sizing: border-box;
}
body .analysis-shell {
  display: grid; grid-template-rows: auto minmax(100px, 1fr) auto; gap: 8px;
  width: min(920px, 100%); height: min(720px, 100%); min-width: 0; min-height: 0; box-sizing: border-box;
  padding: clamp(10px, 2vw, 20px); background: #0a1020; border: 1px solid #45657a;
}
body .analysis-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
body .analysis-header > div { min-width: 0; }
body .analysis-header span, body .analysis-kicker { font: 700 12px 'Chakra Petch', sans-serif; color: #58caff; letter-spacing: .08em; }
body .analysis-header h2 { margin: 0; font: 800 clamp(24px, 5vw, 36px)/1 'Barlow Condensed', sans-serif; text-transform: uppercase; }
body .analysis-header button { background: #58caff; color: #0a1020; border: 0; padding: 8px 20px; min-height: 44px; font: 700 16px 'Chakra Petch', sans-serif; cursor: pointer; }
body .analysis-overlay button:focus-visible { outline: 3px solid #ffd075; outline-offset: 2px; }
body .analysis-display { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); min-width: 0; min-height: 0; align-items: stretch; }
body .analysis-stage { --analysis-max-scale: 2; --analysis-model-scale: 1; position: relative; grid-column: 1 / -1; grid-row: 1; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; pointer-events: none; }
body .analysis-stage .select-herostage-canvas,
body .analysis-stage .select-herostage-fallback {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; transform: scale(var(--analysis-model-scale));
}
body .analysis-connector { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
body .analysis-connector line { stroke: #58caff; stroke-width: 1.5; stroke-dasharray: 4 3; }
body .analysis-cards { position: relative; z-index: 2; display: grid; gap: 8px; align-content: center; min-width: 0; }
body .analysis-cards-left { grid-column: 1; grid-row: 1; }
body .analysis-cards-right { grid-column: 3; grid-row: 1; }
body .analysis-empty { color: #a0aec5; font: 400 16px/1.3 sans-serif; }
body .analysis-card { position: relative; z-index: 1; min-width: 0; overflow-wrap: anywhere; padding: clamp(8px, 2vw, 16px); background: #101e32; border: 1px solid #58caff; box-shadow: inset 3px 0 #58caff; }
body .analysis-card strong, body .analysis-card b { display: block; }
body .analysis-part { font: 800 clamp(20px, 3vw, 28px)/1.05 'Barlow Condensed', sans-serif; }
body .analysis-move { margin-top: 3px; font-size: 16px; line-height: 1.1; }
body .analysis-move.is-attack { color: #ff9c67; font-family: 'Barlow Condensed', sans-serif; font-style: italic; font-weight: 900; }
body .analysis-move.is-guard { color: #58caff; font-family: 'Chakra Petch', sans-serif; }
body .analysis-move.is-counter { color: #d9a6ff; font-family: 'Chakra Petch', sans-serif; }
body .analysis-card p, body .analysis-chat p { margin: 4px 0 0; font: 400 16px/1.2 sans-serif; }
body .analysis-chat { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: clamp(12px, 2.8vh, 24px); padding: 8px; border: 1px solid #526a80; background: #122039; }
body .analysis-chat > div { min-width: 0; overflow-wrap: anywhere; }
body .analysis-chat img { flex: 0 0 auto; width: clamp(52px, 10vw, 82px); border: 1px solid #58caff; border-radius: 8px; }
body .analysis-chat strong { color: #ffd075; font: 800 15px 'Chakra Petch', sans-serif; }
body .analysis-chat strong span { color: #a0aec5; font-size: 11px; }
@media (max-height: 570px) { body .analysis-shell { gap: 4px; padding: 7px; } body .analysis-chat img { width: 48px; } }
@media (orientation: landscape) and (max-height: 500px) {
  body .analysis-stage { --analysis-max-scale: 1.7; }
  body .analysis-chat { margin-bottom: 8px; }
  body .analysis-cards { gap: 5px; }
  body .analysis-card { padding: 6px; }
}
@media (max-width: 600px) and (min-height: 600px) {
  body .analysis-overlay { padding: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom)); }
  body .analysis-shell { height: 100%; gap: 6px; padding: 10px; grid-template-rows: auto minmax(0, 1fr) auto; }
  body .analysis-header h2 { font-size: clamp(25px, 7vw, 32px); }
  body .analysis-header button { flex: 0 0 auto; padding-inline: 16px; }
  body .analysis-stage { --analysis-max-scale: 2.5; }
  body .analysis-display:is([data-move-count="3"], [data-move-count="4"]) { grid-template-columns: minmax(0, 1.2fr) minmax(0, .75fr) minmax(0, 1.2fr); }
  body .analysis-cards { gap: 6px; }
  body .analysis-display[data-move-count="2"] .analysis-cards-left { align-content: start; padding-top: min(11vh, 88px); }
  body .analysis-display[data-move-count="2"] .analysis-cards-right { align-content: end; padding-bottom: min(9vh, 72px); }
  body .analysis-card { padding: 6px 8px; }
  body .analysis-chat { align-items: flex-start; }
  body .analysis-chat img { width: 52px; }
}
