.duel-page {
  width: min(1400px, 95vw);
}

.duel-hero {
  background:
    radial-gradient(1200px 420px at 0% 0%, rgba(167, 243, 208, 0.44), transparent 58%),
    radial-gradient(980px 420px at 100% 0%, rgba(196, 181, 253, 0.42), transparent 56%),
    linear-gradient(120deg, rgba(255, 245, 231, 0.92), rgba(239, 246, 255, 0.86));
}

.duel-back-link {
  margin: 10px 0 0;
}

.duel-back-link a {
  color: #0f766e;
  text-decoration: none;
  font-weight: 700;
}

.duel-layout {
  margin-top: 18px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
}

.duel-stage-wrap {
  position: relative;
  align-self: start;
  justify-self: start;
  width: min(100%, 1200px);
  border: 1px solid rgba(71, 85, 105, 0.26);
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 1200 / 700;
  min-height: 0;
  background:
    radial-gradient(circle at 25% 10%, rgba(167, 243, 208, 0.24), transparent 38%),
    radial-gradient(circle at 80% 10%, rgba(196, 181, 253, 0.2), transparent 42%),
    linear-gradient(135deg, rgba(2, 6, 23, 0.96), rgba(15, 23, 42, 0.94));
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28);
}

#duelCanvas {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 0;
}

.duel-touch-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  pointer-events: none;
}

.duel-move-pad {
  position: absolute;
  left: 14px;
  bottom: 74px;
  width: 126px;
  height: 126px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.35);
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.36);
  pointer-events: auto;
  touch-action: none;
}

.duel-move-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin-left: -27px;
  margin-top: -27px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.74);
  border: 1px solid rgba(224, 242, 254, 0.9);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.55);
  transition: transform 30ms linear;
}

.duel-aim-pad {
  position: absolute;
  right: 14px;
  bottom: 74px;
  width: 126px;
  height: 126px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.52);
  background: rgba(120, 53, 15, 0.22);
  box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
}

.duel-aim-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin-left: -27px;
  margin-top: -27px;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.82);
  border: 1px solid rgba(255, 237, 213, 0.95);
  box-shadow: 0 0 14px rgba(251, 146, 60, 0.58);
  transition: transform 30ms linear;
}

.duel-aim-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(254, 243, 199, 0.9);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.duel-overlay-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.hp-group {
  min-width: 210px;
  display: grid;
  gap: 4px;
  color: #e2e8f0;
}

.hp-group span {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.8);
}

.hp-group strong {
  justify-self: end;
  font-size: 0.94rem;
}

.hp-bar {
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.7);
  overflow: hidden;
}

.hp-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22d3ee, #2dd4bf);
  transition: width 120ms linear;
}

.hp-group-ai .hp-bar i {
  background: linear-gradient(90deg, #f97316, #fb7185);
}

.hp-group-ai2 .hp-bar i {
  background: linear-gradient(90deg, #c084fc, #818cf8);
}

.duel-overlay-bottom {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(15, 23, 42, 0.58);
  color: #e2e8f0;
  padding: 9px 12px;
  display: grid;
  gap: 4px;
  pointer-events: none;
}

.duel-model-strip {
  position: absolute;
  top: 78px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  z-index: 3;
  pointer-events: none;
}

.duel-model-now {
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.64);
  color: rgba(224, 242, 254, 0.95);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 12px;
  letter-spacing: 0.05em;
}

.duel-model-state {
  border: 1px solid rgba(148, 163, 184, 0.36);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.56);
  color: rgba(226, 232, 240, 0.92);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 5px 10px;
  letter-spacing: 0.03em;
}

.duel-model-toggle {
  border: 1px solid rgba(56, 189, 248, 0.52);
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.38);
  color: rgba(240, 249, 255, 0.96);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  cursor: pointer;
  pointer-events: auto;
}

.duel-overlay-bottom strong {
  font-size: 0.9rem;
}

.duel-overlay-bottom span {
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.82);
}

.duel-side-panel {
  display: grid;
  gap: 12px;
  align-content: start;
}

.duel-panel-card {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.duel-panel-card h2 {
  margin: 0 0 10px;
  color: #334155;
  font-size: 1rem;
}

.duel-control-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.duel-control-row label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 0.82rem;
  font-weight: 700;
}

.duel-control-row select {
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.82);
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 8px 10px;
}

.duel-control-row button {
  flex: 1;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.82);
  color: #0f172a;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
}

.duel-join-row button {
  flex: 1 1 30%;
}

.duel-join-row button.is-active {
  border-color: rgba(13, 148, 136, 0.62);
  background: rgba(204, 251, 241, 0.9);
  color: #0f766e;
}

.duel-join-state {
  margin: -2px 0 10px;
  color: #0f766e;
  font-size: 0.82rem;
  font-weight: 700;
}

.duel-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
}

.duel-round-result {
  margin: 0;
  color: #0f766e;
  font-size: 0.84rem;
}

.duel-config-state {
  margin: 0 0 8px;
  color: #334155;
  font-size: 0.78rem;
}

.duel-profile-list,
.duel-leaderboard-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.duel-profile-list li,
.duel-leaderboard-list li {
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.84);
  padding: 8px 10px;
  display: grid;
  gap: 2px;
  color: #334155;
  font-size: 0.82rem;
}

.duel-leaderboard-list li strong {
  color: #0f172a;
  font-size: 0.86rem;
}

.duel-leaderboard-list li.is-me {
  border-color: rgba(13, 148, 136, 0.52);
  background: rgba(204, 251, 241, 0.72);
}

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

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

  .duel-side-panel .duel-panel-card:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .duel-side-panel {
    grid-template-columns: 1fr;
  }

  .hp-group {
    min-width: 110px;
  }

  .duel-stage-wrap {
    aspect-ratio: 1200 / 700;
  }

  #duelCanvas {
    min-height: 0;
  }

  .duel-model-strip {
    top: 64px;
    justify-content: flex-start;
    overflow-x: auto;
    padding-right: 8px;
  }

  .duel-overlay-bottom {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 7px 10px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .duel-touch-layer {
    display: block;
  }
}
