.dragon-hero {
  min-height: auto;
  padding-bottom: 42px;
}

.dragon-emblem {
  flex: 0 1 360px;
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
}

.dragon-emblem::before {
  content: "";
  position: absolute;
  width: min(78vw, 320px);
  aspect-ratio: 1;
  border: 2px solid rgba(120, 255, 154, 0.48);
  transform: rotate(45deg);
  box-shadow: 0 0 42px rgba(120, 255, 154, 0.18), inset 0 0 34px rgba(66, 232, 255, 0.12);
}

.dragon-emblem span {
  position: relative;
  font-size: clamp(120px, 20vw, 190px);
  filter: drop-shadow(0 22px 24px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 26px rgba(120, 255, 154, 0.34));
  animation: dragonFloat 3.6s infinite ease-in-out;
}

@keyframes dragonFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }

  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

.dragon-game {
  width: min(calc(100% - 40px), 980px);
  max-width: 980px;
  margin: 0 auto 92px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)), var(--panel);
  box-shadow: 10px 10px 0 var(--shadow), 0 0 42px rgba(66, 232, 255, 0.12);
}

.dragon-settings {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.dragon-settings label {
  color: var(--cyan);
  font-family: "Press Start 2P", cursive;
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
}

.dragon-select-wrapper {
  position: relative;
  flex: 0 0 176px;
  display: block;
}

.dragon-select-wrapper::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 18px;
  width: 9px;
  height: 9px;
  border-right: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
  filter: drop-shadow(0 0 6px rgba(66, 232, 255, 0.35));
}

#dragon-difficulty {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 100%;
  min-height: 50px;
  padding: 0 48px 0 16px;
  border: 2px solid var(--cyan);
  border-radius: 6px;
  background: linear-gradient(135deg, #111022, #151329);
  color: var(--ink);
  font: 600 15px "Poppins", sans-serif;
  box-shadow: 5px 5px 0 var(--shadow), 0 0 22px rgba(66, 232, 255, 0.18);
  cursor: pointer;
}

#dragon-difficulty:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

#dragon-difficulty:focus {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

#dragon-difficulty option {
  background: #151329;
  color: var(--ink);
}

.dragon-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.hud-tile {
  min-width: 0;
  min-height: 74px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(8, 7, 20, 0.38);
  display: grid;
  place-items: center;
}

.hud-tile span {
  color: var(--cyan);
  font-family: "Press Start 2P", cursive;
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.hud-tile strong {
  color: var(--yellow);
  font-family: "Press Start 2P", cursive;
  font-size: clamp(18px, 3vw, 26px);
  line-height: 1.2;
}

.dragon-arena {
  position: relative;
  width: min(100%, 560px);
  margin: 0 auto;
  aspect-ratio: 1;
  border: 2px solid rgba(66, 232, 255, 0.68);
  border-radius: 8px;
  overflow: hidden;
  background: #0f0e1d;
  box-shadow: 8px 8px 0 var(--shadow), 0 0 28px rgba(66, 232, 255, 0.18);
}

#dragon-board {
  width: 100%;
  height: 100%;
  display: block;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(145deg, #111022, #17152b);
  background-size: 28px 28px, 28px 28px, auto;
}

.game-overlay {
  position: absolute;
  inset: 0;
  padding: clamp(18px, 4vw, 28px);
  display: grid;
  place-content: center;
  gap: 12px;
  background: rgba(8, 7, 20, 0.68);
  backdrop-filter: blur(3px);
  color: var(--muted);
  text-align: center;
}

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

.game-overlay h2 {
  color: var(--yellow);
  font-family: "Press Start 2P", cursive;
  font-size: clamp(20px, 4vw, 34px);
  line-height: 1.3;
  text-shadow: 3px 3px 0 var(--shadow);
}

.game-overlay p {
  max-width: 32ch;
  margin: 0 auto;
  color: var(--muted);
}

.game-overlay .overlay-score {
  color: var(--green);
  font-family: "Press Start 2P", cursive;
  font-size: 13px;
  line-height: 1.5;
}

.dragon-actions {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.dragon-actions .btn {
  margin-top: 0;
}

.btn-secondary {
  border-color: rgba(66, 232, 255, 0.62);
  background: linear-gradient(135deg, rgba(66, 232, 255, 0.3), rgba(255, 255, 255, 0.08));
  color: var(--ink);
}

.btn-secondary::after {
  content: "";
  margin-left: 0;
}

.touch-controls {
  width: min(100%, 260px);
  margin: 24px auto 0;
  display: grid;
  grid-template-columns: repeat(3, 70px);
  grid-template-areas:
    ". up ."
    "left down right";
  justify-content: center;
  gap: 10px;
}

.touch-controls button {
  width: 70px;
  height: 56px;
  border: 2px solid rgba(255, 216, 77, 0.58);
  border-radius: 8px;
  background: rgba(8, 7, 20, 0.58);
  color: var(--ink);
  font-size: 22px;
  box-shadow: 5px 5px 0 var(--shadow), 0 0 18px rgba(255, 216, 77, 0.12);
  cursor: pointer;
}

.touch-controls button:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--shadow);
}

.touch-controls [data-direction="up"] {
  grid-area: up;
}

.touch-controls [data-direction="left"] {
  grid-area: left;
}

.touch-controls [data-direction="down"] {
  grid-area: down;
}

.touch-controls [data-direction="right"] {
  grid-area: right;
}

@media (max-width: 830px) {
  .dragon-hero {
    flex-direction: column;
    padding-top: 44px;
    padding-bottom: 35px;
    gap: 28px;
    text-align: center;
  }

  .dragon-hero .hero-content p:last-child {
    margin-bottom: 0;
  }

  .dragon-emblem {
    width: min(100%, 320px);
    flex-basis: auto;
    min-height: 286px;
  }

  .dragon-emblem::before {
    width: min(46vw, 200px);
  }

  .dragon-emblem span {
    font-size: clamp(82px, 19vw, 122px);
  }

  .dragon-game {
    width: min(calc(100% - 40px), 980px);
    margin-left: auto;
    margin-right: auto;
  }
}

@media (max-width: 560px) {
  .dragon-game {
    width: min(calc(100% - 32px), 980px);
    margin-left: auto;
    margin-right: auto;
    padding: 18px;
  }

  .dragon-hud {
    grid-template-columns: repeat(2, 1fr);
  }

  .dragon-settings {
    align-items: stretch;
    flex-direction: column;
  }

  .dragon-select-wrapper {
    flex-basis: auto;
  }

  .dragon-actions .btn {
    width: 100%;
  }

  .touch-controls {
    grid-template-columns: repeat(3, 64px);
  }

  .touch-controls button {
    width: 64px;
    height: 54px;
  }
}

@media (max-width: 380px) {
  .dragon-hud {
    grid-template-columns: 1fr;
  }
}
