.dg-wrapper {
  gap: clamp(1.6rem, 3vw, 2.2rem);
  padding: clamp(1rem, 3vw, 1.6rem);
}

.dg-hero {
  display: grid;
  grid-template-columns: 1.2fr auto;
  gap: 1.4rem;
  align-items: center;
}

.dg-hero__aside {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dg-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.dg-top-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  padding: 1.1rem 1.4rem 1.3rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, rgba(30, 24, 54, 0.6), rgba(12, 18, 40, 0.7));
}

.dg-stat strong {
  display: block;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
}

.dg-layout {
  display: grid;
  grid-template-columns: 1.5fr 0.9fr;
  gap: 1.2rem;
  align-items: flex-start;
}

.dg-board {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(9, 14, 30, 0.6);
}

.dg-canvas-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 15 / 11;
  border-radius: 16px;
  overflow: hidden;
  background: #05070f;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.dg-canvas-shell canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.dg-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dg-dpad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 0.3rem;
}

.dg-dpad button {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #d9ebff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.1s ease;
}

.dg-dpad button:hover {
  background: rgba(79, 223, 255, 0.16);
  transform: translateY(-1px);
}

.dg-dpad__up {
  grid-area: 1 / 2;
}
.dg-dpad__left {
  grid-area: 2 / 1;
}
.dg-dpad__wait {
  grid-area: 2 / 2;
  font-size: 0.75rem;
}
.dg-dpad__right {
  grid-area: 2 / 3;
}
.dg-dpad__down {
  grid-area: 3 / 2;
}

.dg-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.dg-log {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 0.88rem;
}

.dg-log__line {
  padding: 0.12rem 0.2rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  color: #d9ebff;
}
.dg-log__hero {
  color: #9fd0ff;
}
.dg-log__enemy {
  color: #fca5a5;
}
.dg-log__good {
  color: #7ef29b;
}
.dg-log__system {
  color: #cbd5e1;
}
.dg-log__level {
  color: #ffd166;
  font-weight: 700;
}

.dg-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.dg-panel {
  padding: 1rem 1.1rem 1.2rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 20, 44, 0.7);
}

.dg-panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.dg-meter {
  display: grid;
  gap: 0.2rem;
  margin-bottom: 0.6rem;
}

.dg-meter__label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.dg-meter__track {
  height: 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.dg-meter__fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
}

.dg-meter__fill--hp {
  background: linear-gradient(90deg, #34d399, #7ef29b);
}
.dg-meter__fill--xp {
  background: linear-gradient(90deg, #ffd166, #ffb347);
}

.dg-hero-stats {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dg-hero-stats span {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.dg-guide {
  display: grid;
  gap: 0.35rem;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.dg-leaderboard__scroll {
  margin-top: 0.6rem;
  overflow-x: auto;
}

.dg-leaderboard__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.dg-leaderboard__table th,
.dg-leaderboard__table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.dg-leaderboard__table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dg-leaderboard__table td:nth-child(3) {
  font-variant-numeric: tabular-nums;
  color: #c4b5fd;
}

@media (max-width: 1024px) {
  .dg-layout {
    grid-template-columns: 1fr;
  }
  .dg-hero {
    grid-template-columns: 1fr;
  }
}
