:root {
  --proton-color: #63e1ff;
  --electron-color: #ffb37a;
  --radiation-color: #7bf0aa;
  --trap-color: #ff8ea3;
}

.chess-hero {
  align-items: flex-start;
}

.chess-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}

.chess-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.95fr);
  gap: clamp(1.8rem, 3vw, 2.4rem);
  align-items: start;
}

.chess-lobby {
  position: relative;
  overflow: hidden;
}

.chess-lobby::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 20%, rgba(99, 225, 255, 0.08), transparent 45%),
    radial-gradient(circle at 85% 18%, rgba(255, 179, 122, 0.12), transparent 42%);
  pointer-events: none;
}

.chess-lobby__actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.chess-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.chess-hud__status {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.chess-hud__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .chess-hud {
    flex-direction: column;
    align-items: flex-start;
  }

  .chess-hud__actions {
    width: 100%;
  }
}

.chess-toast {
  margin: 0.6rem 0;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-weight: 600;
}

.chess-toast[data-variant="warning"] {
  border-color: rgba(255, 179, 122, 0.4);
  background: rgba(255, 179, 122, 0.12);
  color: #ffb37a;
}

.chess-toast[data-variant="success"] {
  border-color: rgba(123, 240, 170, 0.5);
  background: rgba(123, 240, 170, 0.12);
  color: #7bf0aa;
}

.chess-toast[data-variant="error"] {
  border-color: rgba(255, 142, 163, 0.5);
  background: rgba(255, 142, 163, 0.12);
  color: #ff8ea3;
}

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

.chess-panel {
  padding: clamp(1.5rem, 3vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
  max-width: 100%;
}

.chess-board-frame {
  width: 100%;
  max-width: min(1080px, 100%);
  margin: 0 auto;
}

.chess-board {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: clamp(0.42rem, 1vw, 0.55rem);
  background:
    radial-gradient(circle at 20% 20%, rgba(79, 223, 255, 0.08), transparent 60%),
    radial-gradient(circle at 80% 30%, rgba(255, 179, 122, 0.08), transparent 60%),
    rgba(4, 9, 32, 0.7);
  border-radius: 24px;
  padding: clamp(0.7rem, 2vw, 0.95rem);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 40px rgba(5, 12, 42, 0.45);
  box-sizing: border-box;
}

.chess-square {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  min-width: 0;
}

.chess-square--light {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
}

.chess-square--dark {
  background: linear-gradient(160deg, rgba(6, 16, 48, 0.95), rgba(3, 7, 28, 0.85));
}

.chess-square:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 223, 255, 0.7);
}

.chess-square:focus-visible {
  outline: 2px solid rgba(79, 223, 255, 0.95);
  outline-offset: 2px;
}

.chess-square__coord {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.42);
  pointer-events: none;
}

.chess-square--selected {
  border-color: rgba(79, 223, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(79, 223, 255, 0.2);
}

.chess-square--highlight::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 55%, rgba(79, 223, 255, 0.28), transparent 65%);
  pointer-events: none;
}

.chess-square--aoe::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 10px;
  border: 1px dashed rgba(123, 240, 170, 0.7);
  box-shadow: 0 0 18px rgba(123, 240, 170, 0.25);
  pointer-events: none;
}

.chess-square--trap {
  border-color: rgba(255, 142, 163, 0.85);
  box-shadow: 0 0 0 2px rgba(255, 142, 163, 0.25);
}

.chess-square--hazard::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 10px;
  border: 1px dotted rgba(123, 240, 170, 0.8);
  box-shadow: 0 0 16px rgba(123, 240, 170, 0.35);
  pointer-events: none;
}

.chess-piece {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.16rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 18px 30px rgba(0, 0, 0, 0.35);
  text-align: center;
  text-transform: uppercase;
  padding: 0.18rem;
  box-sizing: border-box;
}

.chess-piece__symbol {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.1;
}

.chess-piece__number {
  font-size: clamp(0.76rem, 1.6vw, 0.9rem);
  letter-spacing: 0.08em;
  opacity: 0.9;
  white-space: nowrap;
}

.chess-piece[data-team="proton"] {
  background: linear-gradient(145deg, rgba(99, 225, 255, 0.9), rgba(10, 38, 80, 0.9));
  border-color: rgba(99, 225, 255, 0.65);
  color: #021426;
}

.chess-piece[data-team="electron"] {
  background: linear-gradient(145deg, rgba(255, 179, 122, 0.92), rgba(45, 14, 6, 0.9));
  border-color: rgba(255, 179, 122, 0.6);
  color: #1b0b05;
}

.chess-piece.is-trapped {
  box-shadow: 0 0 0 2px rgba(255, 142, 163, 0.35), inset 0 0 0 1px rgba(255, 142, 163, 0.6);
}

.chess-piece.is-inactive-turn {
  filter: grayscale(0.78);
  opacity: 0.78;
}

.chess-piece.is-stunned {
  background: linear-gradient(145deg, rgba(123, 240, 170, 0.95), rgba(21, 80, 51, 0.92));
  border-color: rgba(123, 240, 170, 0.75);
  color: #0c2616;
  box-shadow: 0 0 0 2px rgba(123, 240, 170, 0.45), 0 0 18px rgba(123, 240, 170, 0.32);
  filter: none;
  opacity: 1;
}

.chess-piece.has-catalyst {
  box-shadow: 0 0 0 2px rgba(99, 225, 255, 0.35), 0 0 18px rgba(99, 225, 255, 0.35);
}

.chess-wrapper {
  max-width: 1400px;
  width: min(100%, 1400px);
  padding: clamp(2.4rem, 5vw, 3.2rem);
}

.chess-board-note {
  margin: 0;
  color: var(--text-muted);
}

.chess-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}

.legend-card {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.legend-card strong {
  display: block;
  margin-bottom: 0.25rem;
}

.team-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.team-pill--proton {
  border-color: rgba(99, 225, 255, 0.6);
  color: var(--proton-color);
}

.team-pill--electron {
  border-color: rgba(255, 179, 122, 0.6);
  color: var(--electron-color);
}

.chess-team-key {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

[data-turn-label] {
  border-radius: 14px;
  padding: 0.45rem 1rem;
}

[data-turn-label][data-team="proton"] {
  border-color: rgba(99, 225, 255, 0.65);
  color: var(--proton-color);
}

[data-turn-label][data-team="electron"] {
  border-color: rgba(255, 179, 122, 0.65);
  color: var(--electron-color);
}

.chess-panel--info header h3 {
  margin: 0;
}
.chess-panel--info {
  margin-top: 350px; /* 원하는 만큼 숫자 조정 */
}
.selected-piece {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.piece-sigil {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.24), transparent 60%),
    rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
}

.selected-piece__name {
  margin: 0;
}

.chess-ability {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.9rem 1rem;
  color: var(--text-muted);
}

.unit-grid,
.rule-grid,
.dev-grid {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.6rem);
}

.unit-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.rule-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dev-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.unit-card,
.rule-card,
.dev-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: clamp(1rem, 3vw, 1.3rem);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.rule-card .status-badge {
  align-self: flex-start;
}

.rule-points {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.4rem;
  color: var(--text-muted);
}

.rule-points li {
  list-style: disc;
}

.code-block {
  margin: 0;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 12, 35, 0.85);
  overflow-x: auto;
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chess-mp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1.1rem, 2.5vw, 1.6rem);
}

.chess-mp-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  padding: clamp(1.1rem, 3vw, 1.4rem);
  display: grid;
  gap: 0.8rem;
}

.mp-form {
  display: grid;
  gap: 0.7rem;
}

.mp-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.mp-form input {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.7rem 0.9rem;
  color: var(--text-primary);
}

.mp-status {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.mp-status dt {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.mp-status dd {
  margin: 0;
  font-weight: 700;
}

.mp-players {
  margin: 0.3rem 0 0 0;
  padding-left: 1rem;
  color: var(--text-muted);
}

.mp-players li {
  list-style: disc;
  margin-bottom: 0.25rem;
}

.mp-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mp-message {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 0.8rem;
}

.mp-practice {
  display: grid;
  gap: 0.4rem;
}
