:root {
  --bg: #060417;
  --panel: rgba(17, 12, 44, 0.82);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f4f2ff;
  --muted: #a8a2c8;
  --accent: #ffc41f;
  --cta: #22a06b;
  --cpu: #ff8fa3;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(6, 4, 23, 0.55), rgba(6, 4, 23, 0.78)),
    url("./art/stage-bg.jpg") center / cover no-repeat,
    radial-gradient(900px 520px at 50% -10%, rgba(122, 66, 214, 0.35), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Noto Sans TC", "PingFang TC", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.back-to-menu {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  background: rgba(128, 128, 128, 0.15);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 999px;
  touch-action: manipulation;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 56px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.page-header,
.title-group,
.header-actions,
.player-card-header,
.controls-list,
.touch-row,
.stat-row,
.result-stats > div {
  display: flex;
}

.page-header {
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.title-group {
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

h1,
h2,
h3,
.result-card h2 {
  margin: 0;
}

h1 {
  font-size: 20px;
  letter-spacing: -0.01em;
}

.badge,
.player-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
}

.cpu-badge {
  color: #ffd6de;
  border-color: rgba(255, 143, 163, 0.35);
}

.header-actions {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ghost-button,
.primary-button,
.touch-button,
.select-field select {
  font-family: inherit;
}

.ghost-button {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

.juice-settings {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  min-width: 0;
}

.juice-settings-legend {
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: inherit;
  opacity: 0.85;
}

.juice-haptics-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  font-size: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.juice-haptics-label input {
  width: 16px;
  height: 16px;
}

.juice-fx-field {
  margin: 0;
}

.ghost-button:hover,
.primary-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ghost-button:disabled:hover {
  background: rgba(255, 255, 255, 0.07);
}

.select-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.select-field select {
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 5px 8px;
}

.match-status,
.tip,
.result-summary {
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.match-status {
  max-width: 760px;
  font-size: 13px;
}

.versus-layout {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.player-card,
.panel,
.result-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
}

.player-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-card-p2 {
  box-shadow: inset 0 0 0 1px rgba(255, 143, 163, 0.12);
}

.ojama-tray {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.ojama-tray:empty::after {
  content: '無垃圾預告';
  font-size: 11px;
  color: var(--muted);
}

.ojama-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #1b1430;
  background: #c9d1dc;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.ojama-icon[data-kind="large"] {
  width: 28px;
  height: 28px;
  font-size: 15px;
  background: #dfe6ef;
}

.ojama-icon[data-kind="rock"] {
  border-radius: 7px;
  background: #8b93a3;
  color: #f4f6fb;
}

.ojama-icon[data-kind="star"] {
  background: #ffd76a;
  color: #7a4d00;
}

.ojama-icon[data-kind="moon"] {
  background: #9ec5ff;
  color: #16386f;
}

.ojama-icon[data-kind="crown"] {
  background: #ffb347;
  color: #6a3200;
}

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

.controls-grid h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 720px) {
  .controls-grid {
    grid-template-columns: 1fr;
  }
}

.player-card-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.player-card-header h2 {
  font-size: 18px;
}

.status-text {
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.field-wrap {
  display: flex;
  justify-content: center;
}

.field-frame {
  position: relative;
  padding: 8px;
  border-radius: 18px;
  background: rgba(9, 6, 26, 0.9);
  border: 1px solid var(--panel-border);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

canvas[id$="field"] {
  display: block;
  width: min(32vw, 264px);
  height: auto;
  border-radius: 10px;
}

.player-info-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  align-items: stretch;
}

.panel {
  padding: 12px;
}

.panel h2,
.panel h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-row {
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.next-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

canvas[id$="next"] {
  width: 46px;
  height: auto;
}

.controls-panel {
  width: 100%;
  max-width: 820px;
}

.controls-list {
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--muted);
}

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 11px;
  text-align: center;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--panel-border);
  border-radius: 5px;
}

.chain-popup {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, 0) scale(0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(9, 6, 26, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.chain-popup strong {
  font-size: 20px;
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(255, 196, 31, 0.5);
}

.chain-popup span {
  font-size: 12px;
  color: var(--muted);
}

.chain-popup[data-intensity="3"] strong {
  color: #ff9f45;
}

.chain-popup[data-intensity="4"] strong {
  color: #ff6b8a;
}

.chain-popup[data-intensity="5"] strong {
  color: #b56bff;
  font-size: 24px;
}

.chain-popup.is-visible {
  animation: chain-pop 1.1s ease-out forwards;
}

.chain-popup.reduced-motion.is-visible {
  animation: chain-pop-reduced 0.55s ease-out forwards;
}

.chain-count {
  display: inline-block;
  min-width: 1.2em;
  font-variant-numeric: tabular-nums;
}

@keyframes chain-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -6px) scale(1.12); }
  32% { transform: translate(-50%, 0) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(0.95); }
}

@keyframes chain-pop-reduced {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

.field-frame.garbage-flash {
  animation: garbage-flash 0.55s ease-out;
  box-shadow: 0 0 0 3px rgba(201, 209, 220, 0.85), 0 0 28px rgba(201, 209, 220, 0.45);
}

@keyframes garbage-flash {
  0% { filter: brightness(1.55); }
  100% { filter: brightness(1); }
}

body.all-clear-flash {
  animation: all-clear-flash 0.85s ease-out;
}

@keyframes all-clear-flash {
  0% { filter: saturate(1.4) brightness(1.2); }
  40% { filter: saturate(1.15) brightness(1.08); }
  100% { filter: none; }
}

.quest-panel {
  width: 100%;
  max-width: 720px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quest-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.quest-blurb {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.quest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.daily-meta {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.daily-meta[hidden] {
  display: none !important;
}

body[data-board-theme='sunset'] {
  --panel: rgba(44, 18, 12, 0.82);
  --accent: #ffb347;
  --cta: #e07040;
}

body[data-board-theme='aurora'] {
  --panel: rgba(8, 28, 32, 0.82);
  --accent: #5dffc8;
  --cta: #2a9d8f;
}

body[data-board-theme='candy'] {
  --panel: rgba(40, 16, 44, 0.82);
  --accent: #ff8ec8;
  --cta: #c45a9e;
}

.versus-layout.solo-layout {
  grid-template-columns: minmax(0, 420px);
  justify-content: center;
}

/* Author flex/grid rules must not defeat the HTML hidden attribute. */
.player-card-p2[hidden],
.quest-panel[hidden],
#mission-field[hidden],
#difficulty-field[hidden],
#theme-field[hidden],
#btn-daily-share[hidden],
#btn-quest-skip[hidden],
#strategy-modal[hidden],
#radar-fuse-box[hidden] {
  display: none !important;
}

body.solo-mode .player-card-p1 {
  max-width: 420px;
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  .chain-popup.is-visible {
    animation: chain-pop-reduced 0.55s ease-out forwards;
  }

  .field-frame.garbage-flash,
  body.all-clear-flash {
    animation: none;
  }

  .field-frame.garbage-flash {
    box-shadow: 0 0 0 2px rgba(201, 209, 220, 0.7);
  }
}

.touch-controls {
  display: none;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}

.touch-row {
  gap: 8px;
  justify-content: center;
}

.touch-button {
  flex: 1;
  min-width: 56px;
  min-height: 52px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: #33285e;
  border: none;
  border-radius: 12px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

.touch-button.accent,
.primary-button {
  background: var(--cta);
}

.tip {
  max-width: 700px;
  font-size: 12px;
}

.tip strong {
  color: var(--text);
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.result-overlay[hidden] {
  display: none;
}

.result-card {
  width: 100%;
  max-width: 360px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.result-card h2 {
  font-size: 26px;
  color: #ff8fa3;
}

.result-summary {
  margin-top: 10px;
  font-size: 13px;
}

.career-stats {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.result-career {
  margin: 0 0 16px;
  color: var(--accent);
}

.result-stats {
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-stats > div {
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-stats dt {
  color: var(--muted);
}

.result-stats dd {
  margin: 0;
}

.primary-button {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

/* Dual-Wing Arcade Station Layout */
.arcade-station {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
}

.arcade-wing {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.arcade-wing-right {
  width: 320px;
}

/* Mobile & Mid-screen Tactical Quick Strip */
.tactical-quick-strip {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.quick-strip-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.quick-strip-card.highlight {
  border-color: rgba(255, 196, 31, 0.35);
  background: rgba(255, 196, 31, 0.08);
}

.quick-strip-icon {
  font-size: 18px;
}

.quick-strip-body {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.quick-strip-tag {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.quick-strip-val {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.quick-handbook-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #7a42d6, #b56bff);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(122, 66, 214, 0.4);
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.quick-handbook-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(122, 66, 214, 0.6);
}

/* Wing Header & Badges */
.wing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}

.wing-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wing-title h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f4f2ff;
}

.wing-icon {
  font-size: 18px;
}

.wing-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.wing-badge.live-indicator {
  background: rgba(34, 160, 107, 0.2);
  color: #49cf5b;
  border: 1px solid rgba(73, 207, 91, 0.4);
  box-shadow: 0 0 8px rgba(73, 207, 91, 0.3);
}

.wing-badge.pro-badge {
  background: rgba(255, 196, 31, 0.18);
  color: #ffc41f;
  border: 1px solid rgba(255, 196, 31, 0.35);
}

.radar-card,
.strategy-card,
.damage-matrix-card,
.arcade-hud-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radar-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.radar-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #ddd;
}

.chain-potency-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 196, 31, 0.15);
  color: #ffc41f;
  border: 1px solid rgba(255, 196, 31, 0.3);
}

.radar-chain-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
}

.chain-num-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.chain-num {
  font-size: 34px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #fff;
  line-height: 1;
}

.chain-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.chain-impact-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  font-size: 11px;
}

.impact-stat {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.impact-stat strong {
  color: #fff;
}

.chain-gauge-bar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.gauge-step {
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.gauge-step.active {
  color: #110c2c;
  background: #ffc41f;
  font-weight: 800;
  box-shadow: 0 0 8px #ffc41f;
}

.gauge-step.active[data-step="1"] { background: #49cf5b; box-shadow: 0 0 8px #49cf5b; }
.gauge-step.active[data-step="2"] { background: #3f9dff; box-shadow: 0 0 8px #3f9dff; }
.gauge-step.active[data-step="3"] { background: #ffc41f; box-shadow: 0 0 8px #ffc41f; }
.gauge-step.active[data-step="4"] { background: #ff9142; box-shadow: 0 0 8px #ff9142; }
.gauge-step.active[data-step="5"] { background: #ff4d5e; box-shadow: 0 0 10px #ff4d5e; color: #fff; }
.gauge-step.active[data-step="6"] { background: #b56bff; box-shadow: 0 0 10px #b56bff; color: #fff; }
.gauge-step.active[data-step="7"] { background: linear-gradient(135deg, #ff4d5e, #ffc41f); box-shadow: 0 0 12px #ffc41f; color: #110c2c; }

.radar-tip {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}

.probe-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.probe-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.probe-label {
  color: var(--muted);
}

.probe-value {
  font-weight: 700;
  color: #ffc41f;
}

.color-bars-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.color-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.color-dot.red { background: #ff4d5e; box-shadow: 0 0 5px #ff4d5e; }
.color-dot.green { background: #49cf5b; box-shadow: 0 0 5px #49cf5b; }
.color-dot.blue { background: #3f9dff; box-shadow: 0 0 5px #3f9dff; }
.color-dot.yellow { background: #ffc41f; box-shadow: 0 0 5px #ffc41f; }
.color-dot.purple { background: #b56bff; box-shadow: 0 0 5px #b56bff; }
.color-dot.garbage { background: #c9d1dc; box-shadow: 0 0 5px #c9d1dc; }

.color-label {
  width: 28px;
  color: var(--muted);
}

.color-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.color-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.color-fill.red { background: #ff4d5e; }
.color-fill.green { background: #49cf5b; }
.color-fill.blue { background: #3f9dff; }
.color-fill.yellow { background: #ffc41f; }
.color-fill.purple { background: #b56bff; }
.color-fill.garbage { background: #c9d1dc; }

.color-count {
  width: 22px;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.fuse-warning-box {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255, 77, 94, 0.15);
  border: 1px solid rgba(255, 77, 94, 0.4);
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #ffa8b0;
  animation: fusePulse 1.4s infinite ease-in-out;
}

@keyframes fusePulse {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.threat-meter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.threat-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.threat-stat-row strong {
  font-size: 14px;
}

.threat-status-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(34, 160, 107, 0.2);
  color: #49cf5b;
}

.threat-status-tag.warning {
  background: rgba(255, 196, 31, 0.2);
  color: #ffc41f;
}

.threat-status-tag.danger,
.threat-status-tag.critical {
  background: rgba(255, 77, 94, 0.2);
  color: #ff4d5e;
}

.threat-desc {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}

/* Right Wing: Strategy & Damage Table & Key HUD */
.strategy-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: 8px;
}

.strat-tab,
.modal-strat-tab {
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.strat-tab.active,
.modal-strat-tab.active {
  color: #110c2c;
  background: #ffc41f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.strategy-detail-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strat-hero {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}

.strat-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.strat-tag {
  font-size: 10px;
  color: #ffc41f;
  font-weight: 600;
}

.strat-motto {
  margin: 0;
  font-size: 11px;
  font-style: italic;
  color: #a6eeae;
  line-height: 1.35;
}

.blueprint-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
}

.blueprint-grid {
  display: grid;
  grid-template-columns: repeat(6, 24px);
  grid-template-rows: repeat(6, 24px);
  gap: 3px;
}

.blueprint-cell {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.blueprint-cell.puyo-empty {
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.blueprint-cell.puyo-red { background: radial-gradient(circle at 35% 35%, #ffa8b0, #ff4d5e 60%, #b8122a); box-shadow: 0 0 6px rgba(255, 77, 94, 0.5); }
.blueprint-cell.puyo-green { background: radial-gradient(circle at 35% 35%, #a6eeae, #49cf5b 60%, #1c8730); box-shadow: 0 0 6px rgba(73, 207, 91, 0.5); }
.blueprint-cell.puyo-blue { background: radial-gradient(circle at 35% 35%, #a3ccff, #3f9dff 60%, #1152b4); box-shadow: 0 0 6px rgba(63, 157, 255, 0.5); }
.blueprint-cell.puyo-yellow { background: radial-gradient(circle at 35% 35%, #ffe694, #ffc41f 60%, #bd8400); box-shadow: 0 0 6px rgba(255, 196, 31, 0.5); }

.blueprint-cell.trigger-cell::after {
  content: '🎯';
  font-size: 13px;
  position: absolute;
  filter: drop-shadow(0 0 4px #fff);
  animation: triggerBounce 1s infinite alternate ease-in-out;
}

@keyframes triggerBounce {
  0% { transform: scale(0.9); }
  100% { transform: scale(1.2); }
}

.strat-steps-list {
  margin: 0;
  padding-left: 18px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.damage-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.damage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.damage-table th,
.damage-table td {
  padding: 4px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.damage-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
}

.damage-table td {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.damage-table tr.tier-active {
  background: rgba(255, 196, 31, 0.2);
  color: #ffc41f;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 196, 31, 0.5);
  animation: rowPulse 1s infinite alternate ease-in-out;
}

@keyframes rowPulse {
  0% { background: rgba(255, 196, 31, 0.15); }
  100% { background: rgba(255, 196, 31, 0.3); }
}

.damage-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
}

.damage-badge.tier-1 { background: rgba(255, 255, 255, 0.1); color: #ccc; }
.damage-badge.tier-2 { background: rgba(73, 207, 91, 0.25); color: #a6eeae; }
.damage-badge.tier-3 { background: rgba(63, 157, 255, 0.25); color: #a3ccff; }
.damage-badge.tier-4 { background: rgba(255, 196, 31, 0.25); color: #ffe694; }
.damage-badge.tier-5 { background: rgba(255, 77, 94, 0.25); color: #ffa8b0; }
.damage-badge.tier-6 { background: rgba(181, 107, 255, 0.25); color: #ddb9ff; }
.damage-badge.tier-7 { background: linear-gradient(135deg, #ff4d5e, #ffc41f); color: #110c2c; }

.arcade-key-hud {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.key-cluster {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.arcade-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #ddd;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: all 0.08s ease;
}

.arcade-key.space-key {
  width: 100%;
}

.arcade-key.active-pressed {
  background: #ffc41f;
  color: #110c2c;
  box-shadow: 0 0 12px #ffc41f, 0 1px 0 rgba(0, 0, 0, 0.6);
  transform: translateY(2px);
}

.hud-indicator {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(73, 207, 91, 0.2);
  color: #49cf5b;
}

/* Modal Handbook */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 2, 14, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card.strategy-modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 16px;
  border-radius: 50%;
}

.strategy-modal-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-section h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--muted);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 1220px) {
  .arcade-station {
    flex-direction: column;
    align-items: center;
  }

  .arcade-wing {
    width: 100%;
    max-width: 600px;
  }

  .tactical-quick-strip {
    display: flex;
  }
}

@media (min-width: 1221px) {
  .tactical-quick-strip {
    display: none;
  }
}

@media (max-width: 920px) {
  .versus-layout {
    grid-template-columns: 1fr;
  }

  canvas[id$="field"] {
    width: min(52vw, 264px);
  }

  .arcade-wing {
    display: none;
  }
}

@media (max-width: 720px) {
  .page {
    padding-top: 52px;
    gap: 12px;
  }

  .player-info-grid {
    grid-template-columns: 1fr;
  }

  canvas[id$="field"] {
    width: min(58vw, 240px);
  }

  .controls-panel {
    display: none;
  }

  .touch-controls {
    display: flex;
  }
}
