﻿:root {
  --bg-deep: #03080f;
  --bg-mid: #0d1f33;
  --bg-warm: #2e1a14;
  --panel: rgba(8, 17, 28, 0.8);
  --panel-border: rgba(132, 188, 224, 0.35);
  --text: #e6f4ff;
  --muted: #9ab6cc;
  --accent: #80dbff;
  --danger: #ff6d57;
  --safe: #68f5b4;
  --qa-dock-w: 336px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  background: radial-gradient(150% 110% at 50% 0%, #1a3b5e 0%, var(--bg-mid) 42%, var(--bg-deep) 78%);
}

.sky-layer {
  position: fixed;
  inset: -15%;
  pointer-events: none;
  opacity: 0.58;
}

.sky-1 {
  background: repeating-linear-gradient(
    110deg,
    transparent 0,
    transparent 15px,
    rgba(128, 185, 224, 0.09) 16px,
    rgba(128, 185, 224, 0.09) 17px
  );
  animation: driftA 11s linear infinite;
}

.sky-2 {
  background: repeating-linear-gradient(
    72deg,
    transparent 0,
    transparent 52px,
    rgba(255, 156, 102, 0.1) 53px,
    rgba(255, 156, 102, 0.1) 54px
  );
  animation: driftB 18s linear infinite;
}

@keyframes driftA {
  from { transform: translateX(0); }
  to { transform: translateX(-240px); }
}

@keyframes driftB {
  from { transform: translateX(0); }
  to { transform: translateX(250px); }
}

.layout {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--qa-dock-w);
  align-items: center;
  justify-items: center;
  column-gap: 10px;
  padding-top: calc(10px + env(safe-area-inset-top));
  padding-right: calc(10px + env(safe-area-inset-right));
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  padding-left: calc(10px + env(safe-area-inset-left));
}

.arena-wrap {
  position: relative;
  width: min(
    calc(100vw - var(--qa-dock-w) - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)),
    calc((100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 1.7778)
  );
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  aspect-ratio: 16 / 9;
  justify-self: center;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(146, 196, 228, 0.45);
  box-shadow: 0 28px 50px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(9, 25, 38, 0.85) inset;
  background: linear-gradient(180deg, #1c2f44, #0d1622);
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.hud-card {
  position: absolute;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 0 1px rgba(8, 18, 27, 0.9) inset;
}

.top-boss-hud {
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 220px));
  border-radius: 14px;
  padding: 10px 12px;
  z-index: 5;
}

.hud-top-left {
  top: 70px;
  left: 14px;
  width: 250px;
  border-radius: 12px;
  padding: 10px;
  z-index: 5;
}

.hud-top-right {
  top: 70px;
  right: 14px;
  width: 176px;
  border-radius: 12px;
  padding: 10px;
  z-index: 5;
  display: grid;
  gap: 8px;
}

.hud-mini + .hud-mini {
  margin-top: 10px;
}

.hud-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

label {
  font-size: 12px;
  letter-spacing: 1.1px;
  color: #95bbd8;
  font-weight: 700;
}

.score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0;
}

.score-item strong {
  font: 700 23px/1 'Rajdhani', sans-serif;
  color: #f1fbff;
}

.bar {
  height: 15px;
  border-radius: 9px;
  overflow: hidden;
  background: #112335;
  border: 1px solid rgba(123, 168, 199, 0.33);
}

.bar > div {
  height: 100%;
  transition: width 120ms linear;
}

.bar.boss > div {
  background: linear-gradient(90deg, #f54f44, #ffa558);
}

.bar.shield > div {
  background: linear-gradient(90deg, #389cff, #74ebff);
}

.bar.hp > div {
  background: linear-gradient(90deg, #5dff98, #2eb36d);
}

.pattern-banner {
  position: absolute;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(8, 20, 31, 0.9);
  border: 1px solid rgba(120, 182, 224, 0.36);
  font-size: 18px;
  letter-spacing: 0.5px;
  z-index: 6;
}

.qa-dock {
  width: var(--qa-dock-w);
  height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  justify-self: end;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
}

.qa-dock.is-collapsed {
  width: 136px;
  grid-template-rows: auto;
}

.qa-toggle {
  z-index: 2;
  height: 34px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(145, 202, 236, 0.6);
  background: rgba(9, 24, 36, 0.9);
  color: #dff2ff;
  font: 700 14px 'Rajdhani', sans-serif;
  cursor: pointer;
}

.qa-panel {
  width: 100%;
  min-height: 0;
  overflow: auto;
  z-index: 1;
  border-radius: 12px;
  border: 1px solid rgba(135, 190, 225, 0.46);
  background: linear-gradient(180deg, rgba(8, 20, 31, 0.95), rgba(5, 13, 21, 0.96));
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.42);
  padding: 10px;
}

.qa-panel.is-collapsed {
  display: none;
}

.qa-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.qa-header h3 {
  margin: 0;
  font-size: 19px;
  color: #d8f3ff;
}

.qa-header span {
  color: #8daec7;
  font-size: 12px;
}

.qa-section {
  border: 1px solid rgba(118, 170, 203, 0.34);
  border-radius: 10px;
  padding: 8px;
  background: rgba(10, 22, 34, 0.65);
}

.qa-section + .qa-section {
  margin-top: 8px;
}

.qa-section h4 {
  margin: 0 0 6px;
  font-size: 15px;
  color: #bfe4fb;
  letter-spacing: 0.5px;
}

.qa-row {
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
}

.qa-help-text {
  font-size: 11px;
  line-height: 1.25;
  color: #8fb5cf;
  white-space: normal;
}

.qa-help-text[data-help-for='qaForcePhase'] {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qa-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.8px;
}

.qa-row select,
.qa-row input[type='range'] {
  width: 100%;
}

.qa-row select {
  height: 28px;
  border-radius: 7px;
  border: 1px solid rgba(123, 173, 205, 0.5);
  background: rgba(11, 27, 40, 0.94);
  color: #e6f5ff;
  font: 600 14px 'Rajdhani', sans-serif;
}

.qa-row input[type='range'] {
  accent-color: #7fd7ff;
}

.qa-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 6px;
}

.qa-btn {
  height: 30px;
  border-radius: 7px;
  border: 1px solid rgba(132, 188, 225, 0.55);
  background: linear-gradient(180deg, #24465f, #132839);
  color: #dff2ff;
  font: 700 12px 'Rajdhani', sans-serif;
  cursor: pointer;
}

.qa-btn.warn {
  border-color: rgba(255, 158, 132, 0.65);
  background: linear-gradient(180deg, #5f2d24, #341711);
}

.qa-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(122, 177, 208, 0.35);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 12px;
  color: #cde6f6;
}

.qa-runtime {
  font-size: 12px;
  color: #bbd7ea;
  border: 1px solid rgba(120, 166, 194, 0.32);
  border-radius: 7px;
  padding: 6px 8px;
  background: rgba(6, 15, 24, 0.75);
  min-height: 31px;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.qa-preset-status {
  font-size: 12px;
  color: #99bdd8;
  min-height: 16px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font: 700 36px/1.1 'Black Ops One', cursive;
  color: #eef9ff;
  text-shadow: 0 9px 20px rgba(0, 0, 0, 0.72);
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 0%, rgba(4, 8, 14, 0.8) 82%);
  opacity: 1;
  transition: opacity 220ms ease;
  z-index: 7;
}

.overlay.hidden {
  opacity: 0;
}

.main-menu {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(22, 47, 72, 0.66) 0%, rgba(3, 7, 12, 0.92) 72%);
  z-index: 12;
}

.main-menu.hidden {
  display: none;
}

.main-menu-panel {
  width: min(560px, calc(100% - 28px));
  border-radius: 16px;
  border: 1px solid rgba(153, 208, 239, 0.5);
  background: linear-gradient(180deg, rgba(15, 34, 51, 0.95), rgba(7, 16, 25, 0.94));
  box-shadow: 0 24px 42px rgba(0, 0, 0, 0.48);
  padding: 22px 22px 20px;
  text-align: center;
}

.main-menu-panel h1 {
  margin: 0;
  font: 700 54px/1 'Black Ops One', cursive;
  letter-spacing: 1px;
  color: #d8f3ff;
}

.menu-subtitle {
  margin: 6px 0 14px;
  color: #92b7d3;
  letter-spacing: 2px;
  font-weight: 700;
}

.menu-desc {
  margin: 0 auto 18px;
  max-width: 440px;
  color: #cadfed;
  font-size: 18px;
}

.menu-btn {
  width: min(250px, 100%);
  height: 52px;
  border: 1px solid rgba(147, 205, 240, 0.64);
  border-radius: 10px;
  background: linear-gradient(180deg, #286387, #16384e);
  color: #eff8ff;
  font: 700 20px 'Rajdhani', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.menu-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.menu-tip {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  background: rgba(3, 8, 13, 0.62);
  backdrop-filter: blur(4px);
}

.pause-overlay.hidden {
  display: none;
}

.pause-panel {
  width: min(700px, calc(100% - 24px));
  max-height: calc(100% - 26px);
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(148, 204, 238, 0.5);
  background: linear-gradient(180deg, rgba(13, 30, 45, 0.96), rgba(7, 17, 28, 0.96));
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.52);
  padding: 18px 18px 16px;
}

.pause-panel h2 {
  margin: 0;
  font: 700 38px/1 'Black Ops One', cursive;
}

.pause-tip {
  margin: 4px 0 14px;
  color: #9ab9cf;
}

.pause-panel section {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid rgba(123, 176, 208, 0.32);
  background: rgba(10, 21, 31, 0.62);
  padding: 10px;
}

.pause-panel h3 {
  margin: 0 0 8px;
  font-size: 19px;
  letter-spacing: 0.5px;
}

.pause-panel ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 5px;
}

.pause-panel li {
  color: #d5e9f6;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

#masterVolumeSlider {
  width: 100%;
  accent-color: #84dcff;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: #b0c8dc;
  cursor: pointer;
}
.setting-toggle input[type="checkbox"] {
  accent-color: #84dcff;
  width: 16px;
  height: 16px;
}

.pause-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pause-btn {
  height: 44px;
  border: 1px solid rgba(147, 199, 231, 0.62);
  color: #dff3ff;
  background: linear-gradient(180deg, #27465f, #172a3a);
  border-radius: 10px;
  font: 700 17px 'Rajdhani', sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
}

.pause-btn.accent {
  background: linear-gradient(180deg, #6b2a1f, #42150f);
  border-color: rgba(255, 148, 120, 0.62);
}

kbd {
  border: 1px solid rgba(152, 198, 226, 0.54);
  border-bottom-width: 2px;
  background: rgba(22, 40, 56, 0.88);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 13px;
}

.mobile-controls {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 10;
}

.dpad {
  width: 146px;
  height: 146px;
  position: relative;
}

.dpad-btn,
.mobile-btn {
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  border: 1px solid rgba(174, 215, 240, 0.45);
  background: rgba(8, 20, 32, 0.78);
  color: #dff5ff;
  font: 700 15px 'Rajdhani', sans-serif;
  border-radius: 12px;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  position: absolute;
}

.dpad-btn.up { left: 47px; top: 0; }
.dpad-btn.left { left: 0; top: 47px; }
.dpad-btn.down { left: 47px; bottom: 0; }
.dpad-btn.right { right: 0; top: 47px; }

.mobile-actions {
  display: grid;
  gap: 8px;
}

.mobile-btn {
  width: 112px;
  height: 40px;
}

.mobile-btn.attack {
  background: rgba(95, 20, 18, 0.82);
  border-color: rgba(255, 124, 112, 0.62);
}

.mobile-btn.start {
  background: rgba(14, 58, 40, 0.82);
  border-color: rgba(117, 244, 168, 0.64);
}

.is-pressed {
  filter: brightness(1.22);
  transform: translateY(1px);
}

@media (max-width: 1100px) {
  :root {
    --qa-dock-w: 304px;
  }

  .top-boss-hud {
    width: calc(100% - 150px);
  }

  .hud-top-left {
    width: 216px;
  }

  .hud-top-right {
    width: 162px;
  }

  .pattern-banner {
    top: 58px;
    font-size: 16px;
  }
}

@media (max-width: 900px) {
  :root {
    --qa-dock-w: 0px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .qa-dock {
    display: none;
  }

  .main-menu-panel h1 {
    font-size: 42px;
  }

  .menu-desc {
    font-size: 16px;
  }

  .top-boss-hud {
    width: calc(100% - 24px);
  }

  .hud-top-left,
  .hud-top-right {
    top: 82px;
  }

  .hud-top-left {
    width: 188px;
    left: 8px;
    padding: 8px;
  }

  .hud-top-right {
    width: 142px;
    right: 8px;
    padding: 8px;
  }

  .score-item strong {
    font-size: 19px;
  }

  .pattern-banner {
    top: 64px;
    font-size: 14px;
    max-width: calc(100% - 16px);
    text-align: center;
  }

  .pause-actions {
    grid-template-columns: 1fr;
  }

  .mobile-controls {
    display: flex;
  }
}

@media (max-width: 620px) {
  .layout {
    padding-top: calc(6px + env(safe-area-inset-top));
    padding-right: calc(6px + env(safe-area-inset-right));
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
    padding-left: calc(6px + env(safe-area-inset-left));
  }

  .arena-wrap {
    width: 100%;
    max-height: calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 12px;
  }

  .top-boss-hud {
    top: 8px;
    padding: 7px 8px;
  }

  .hud-top-left,
  .hud-top-right {
    top: 62px;
  }

  .hud-top-left {
    width: 160px;
  }

  .hud-top-right {
    width: 116px;
  }

  .score-item strong {
    font-size: 16px;
  }

  .bar {
    height: 12px;
  }

  .pattern-banner {
    top: 48px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .overlay {
    font-size: 28px;
  }
}


