.shooter-coop-page {
  --coop-accent: #ff3b20;
  --coop-cyan: #70f0d4;
  --coop-gold: #ffd15f;
  --coop-panel: rgba(23, 1, 1, 0.86);
  min-height: 100svh;
}

.coop-shell {
  position: relative;
  z-index: 2;
  width: min(1420px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 8px 0 28px;
}

.coop-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin: 0 0 12px;
}

.coop-header .title {
  line-height: 0.95;
  font-size: clamp(2rem, 5vw, 4.2rem);
  color: var(--coop-accent);
  text-shadow: 3px 3px 0 #1b0000, 0 0 24px rgba(255, 68, 31, 0.7);
}

.coop-header .subtitle {
  margin: 6px 0 0;
  color: var(--coop-gold);
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  letter-spacing: 0;
}

.coop-setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.coop-panel,
.coop-room-bar {
  border: 2px solid rgba(255, 170, 80, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(75, 3, 3, 0.92), rgba(8, 0, 0, 0.92)),
    var(--coop-panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
}

.coop-panel {
  display: grid;
  gap: 10px;
  padding: clamp(14px, 2.4vw, 22px);
}

.coop-panel .devil-button {
  width: 100%;
  margin: 4px 0 0;
}

.coop-status {
  min-height: 24px;
  color: var(--coop-cyan);
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.online-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 2px solid rgba(255, 209, 95, 0.5);
  border-radius: 8px;
  background: rgba(55, 9, 0, 0.9);
  color: #fff7ed;
}

.online-banner code {
  color: var(--coop-cyan);
}

.coop-room {
  display: grid;
  gap: 12px;
}

.coop-room[hidden] {
  display: none;
}

.coop-room-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px;
}

.coop-room-label {
  display: block;
  color: var(--coop-cyan);
  font-family: "Courier New", monospace;
  font-weight: 800;
  text-transform: uppercase;
}

#roomLabel {
  display: block;
  color: #fff7ed;
  font-size: clamp(1.2rem, 4vw, 2rem);
  letter-spacing: 0.08em;
}

.coop-room-actions,
.coop-voice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.coop-arena-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 340px);
  gap: 14px;
  align-items: start;
}

.coop-stage {
  position: relative;
  min-height: 360px;
  height: min(68svh, 720px);
  overflow: hidden;
  border: 3px solid #d52713;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 176, 69, 0.14), transparent 34%),
    linear-gradient(135deg, rgba(7, 32, 35, 0.92), rgba(26, 0, 0, 0.96) 58%, rgba(3, 0, 0, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.58), inset 0 0 38px rgba(255, 44, 20, 0.2);
}

#coopCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.coop-waiting {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  background: linear-gradient(180deg, rgba(7, 0, 0, 0.58), rgba(0, 0, 0, 0.75));
  pointer-events: none;
}

.coop-waiting[hidden] {
  display: none;
}

.coop-waiting strong {
  color: #ff4b2d;
  font-size: clamp(1.7rem, 7vw, 3.6rem);
  line-height: 0.95;
  text-shadow: 3px 3px 0 #170000, 0 0 20px rgba(255, 70, 34, 0.75);
}

.coop-waiting span {
  max-width: 34rem;
  color: #ffe7ba;
  font-family: "Courier New", monospace;
  font-weight: 700;
}

.coop-touch-layer {
  position: absolute;
  z-index: 5;
  inset: auto 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 14px max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  pointer-events: none;
}

.coop-stick {
  position: relative;
  width: 128px;
  height: 128px;
  border: 2px solid rgba(255, 209, 95, 0.5);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(112, 240, 212, 0.18), transparent 44%),
    rgba(7, 0, 0, 0.52);
  box-shadow: inset 0 0 18px rgba(112, 240, 212, 0.18), 0 8px 24px rgba(0, 0, 0, 0.36);
  pointer-events: auto;
  touch-action: none;
}

.coop-stick span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: linear-gradient(145deg, #70f0d4, #0d6f68);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 18px rgba(112, 240, 212, 0.48);
}

.coop-action-stack {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 9px;
  pointer-events: auto;
}

.coop-round-button {
  width: 76px;
  height: 76px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff7ed;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 1px 1px 0 #120000;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  touch-action: none;
}

.coop-round-button.fire {
  background: radial-gradient(circle at 35% 25%, #fff0a6, #ff6b2c 42%, #7c0500 78%);
}

.coop-round-button.roll {
  background: radial-gradient(circle at 35% 25%, #f5d7ff, #b84cff 46%, #30033f 80%);
}

.coop-round-button.shield {
  background: radial-gradient(circle at 35% 25%, #d7fff4, #18a89c 46%, #033a3c 80%);
}

.coop-round-button:disabled {
  opacity: 0.52;
  filter: grayscale(0.35);
}

.coop-side {
  display: grid;
  gap: 12px;
}

.coop-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.coop-stat-grid div {
  min-width: 0;
}

.coop-meter-panel small {
  display: block;
  min-height: 2.4em;
  color: #ffe1ab;
  font-family: "Courier New", monospace;
  font-weight: 700;
  line-height: 1.2;
}

.coop-player-list {
  display: grid;
  gap: 8px;
}

.coop-player {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 8px;
  border: 1px solid rgba(255, 209, 95, 0.28);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.24);
}

.coop-player i {
  width: 12px;
  height: 28px;
  border-radius: 999px;
  background: var(--player-color, #ff3b20);
  box-shadow: 0 0 12px var(--player-color, #ff3b20);
}

.coop-player strong,
.coop-player span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coop-player span {
  color: var(--coop-cyan);
  font-size: 0.8rem;
  font-family: "Courier New", monospace;
}

.coop-voice-panel {
  display: grid;
  gap: 8px;
}

#voiceState {
  color: var(--coop-cyan);
  font-family: "Courier New", monospace;
}

.coop-voice-actions {
  justify-content: flex-start;
}

.shooter-coop-page .run-log {
  max-height: 190px;
}

@media (pointer: fine) {
  .coop-touch-layer {
    opacity: 0.9;
  }
}

@media (max-width: 980px) {
  .coop-shell {
    width: min(100vw - 16px, 760px);
  }

  .coop-header {
    margin-bottom: 8px;
  }

  .coop-setup-grid,
  .coop-arena-grid {
    grid-template-columns: 1fr;
  }

  .coop-stage {
    height: min(62svh, 560px);
    min-height: 360px;
  }

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

@media (max-width: 680px) {
  .mode-nav {
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .mode-nav a {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  .coop-room-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .coop-room-actions {
    justify-content: stretch;
  }

  .coop-room-actions .devil-button {
    flex: 1 1 calc(50% - 8px);
  }

  .coop-stage {
    height: min(64svh, 520px);
    min-height: 340px;
  }

  .coop-side {
    grid-template-columns: 1fr;
  }

  .coop-stick {
    width: 112px;
    height: 112px;
  }

  .coop-stick span {
    width: 42px;
    height: 42px;
  }

  .coop-action-stack {
    grid-template-columns: repeat(3, 62px);
    gap: 7px;
  }

  .coop-round-button {
    width: 62px;
    height: 62px;
    font-size: 0.72rem;
  }
}

@media (max-width: 420px) {
  .coop-shell {
    width: calc(100vw - 10px);
  }

  .coop-stage {
    min-height: 320px;
  }

  .coop-touch-layer {
    gap: 8px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }

  .coop-stick {
    width: 98px;
    height: 98px;
  }

  .coop-action-stack {
    grid-template-columns: repeat(3, 56px);
  }

  .coop-round-button {
    width: 56px;
    height: 56px;
  }
}
