/* Sammy's Donkey Toaster — maize & blue arcade theme */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --navy-deep: #001428;
  --navy-mid: #00274c;
  --navy-light: #0a3d7a;
  --maize: #ffcb05;
  --maize-bright: #ffd54f;
  --maize-dark: #c9a000;
  --accent-blue: #6bb5ff;
  --text-light: #f5f7fa;
  --panel-bg: rgba(0, 39, 76, 0.72);
  --panel-border: rgba(255, 203, 5, 0.45);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --glow-maize: 0 0 14px rgba(255, 203, 5, 0.55);
}

html {
  font-size: 22px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-light);
  background:
    radial-gradient(circle at 15% 10%, rgba(107, 181, 255, 0.18) 0%, transparent 42%),
    radial-gradient(circle at 85% 90%, rgba(255, 203, 5, 0.12) 0%, transparent 38%),
    linear-gradient(165deg, var(--navy-deep), var(--navy-mid) 55%, #001f3f);
}

.page {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Header */

.header {
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(1.85rem, 7.5vw, 2.35rem);
  letter-spacing: 0.03em;
  color: var(--maize);
  text-shadow:
    var(--glow-maize),
    3px 3px 0 var(--navy-light);
}

.game-name {
  margin: 0.35rem 0 0;
  font-size: clamp(1.15rem, 5vw, 1.4rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-blue);
}

.tagline {
  margin: 0.4rem 0 0.85rem;
  font-size: clamp(1rem, 4.5vw, 1.15rem);
  color: var(--text-light);
  opacity: 0.92;
}

/* Main — single column on all sizes */

.main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Game panel */

.game-panel {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.status-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.score-casino-panel {
  min-height: 7.75rem;
  padding: 0.65rem 0.75rem 0.7rem;
  border: 2px solid rgba(255, 203, 5, 0.55);
  border-radius: 0.65rem;
  background: linear-gradient(180deg, rgba(10, 61, 122, 0.55), rgba(0, 20, 40, 0.78));
  box-shadow: var(--glow-maize), inset 0 0 18px rgba(255, 203, 5, 0.08);
}

.score-casino-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.15rem;
}

.score-label {
  margin: 0;
  font-size: clamp(0.85rem, 3.6vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-blue);
}

.score-value {
  margin: 0;
  font-size: clamp(2rem, 10vw, 2.85rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.04em;
  color: var(--maize-bright);
  text-shadow:
    0 0 12px rgba(255, 203, 5, 0.85),
    0 0 28px rgba(255, 203, 5, 0.45),
    2px 2px 0 var(--navy-light);
}

.milestone-meter {
  margin-top: 0.45rem;
}

.milestone-meter-label {
  margin: 0 0 0.3rem;
  font-size: clamp(0.78rem, 3.4vw, 0.9rem);
  font-weight: 700;
  color: var(--text-light);
}

.milestone-meter-track {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(0, 20, 40, 0.85);
  border: 1px solid rgba(255, 203, 5, 0.35);
  overflow: hidden;
}

.milestone-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6bb5ff, var(--maize));
  box-shadow: 0 0 10px rgba(255, 203, 5, 0.55);
  transition: width 0.25s ease;
}

.milestone-meter.milestone-warm .milestone-meter-fill {
  box-shadow: 0 0 14px rgba(255, 203, 5, 0.7);
}

.milestone-meter.milestone-hot .milestone-meter-fill {
  background: linear-gradient(90deg, #f97316, var(--maize-bright), #ffe566);
  box-shadow: 0 0 18px rgba(255, 203, 5, 0.9);
  animation: meter-glow 0.8s ease-in-out infinite alternate;
}

@keyframes meter-glow {
  from { filter: brightness(1); }
  to { filter: brightness(1.25); }
}

.jackpot-banner {
  margin: 0.35rem 0 0;
  min-height: 1.35em;
  font-size: clamp(0.88rem, 3.8vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--maize-bright);
  text-shadow: 0 0 12px rgba(255, 203, 5, 0.85);
}

.btn-sound {
  font-family: inherit;
  font-size: clamp(0.72rem, 3.2vw, 0.82rem);
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 203, 5, 0.45);
  background: rgba(255, 203, 5, 0.15);
  color: var(--maize-bright);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-sound-off {
  opacity: 0.65;
  color: var(--text-light);
}

@keyframes score-pulse-hit {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); filter: brightness(1.15); }
  100% { transform: scale(1); }
}

@keyframes score-pulse-ten {
  0% { transform: scale(1); text-shadow: 0 0 12px rgba(255, 203, 5, 0.85); }
  40% { transform: scale(1.14); text-shadow: 0 0 22px rgba(255, 213, 79, 1), 0 0 40px rgba(255, 203, 5, 0.65); }
  100% { transform: scale(1); }
}

@keyframes score-pulse-jackpot {
  0% { transform: scale(1); }
  25% { transform: scale(1.2); filter: brightness(1.35); }
  50% { transform: scale(1.08); }
  75% { transform: scale(1.16); filter: brightness(1.25); }
  100% { transform: scale(1); }
}

.score-casino-panel.score-pulse-hit .score-value {
  animation: score-pulse-hit 0.35s ease;
}

.score-casino-panel.score-pulse-ten .score-value {
  animation: score-pulse-ten 0.45s ease;
}

.score-casino-panel.score-pulse-jackpot .score-value {
  animation: score-pulse-jackpot 0.7s ease;
}

.score-casino-panel.score-pulse-jackpot {
  box-shadow:
    0 0 24px rgba(255, 203, 5, 0.85),
    0 0 48px rgba(255, 107, 53, 0.35),
    inset 0 0 24px rgba(255, 203, 5, 0.15);
}

.game-panel.is-celebrating .score-casino-panel {
  opacity: 0.45;
  pointer-events: none;
}

.message-zone {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 4.35rem;
}

.message-line,
.effect-msg,
.milestone-msg {
  margin: 0;
  min-height: 1.35em;
  line-height: 1.35;
}

.msg-empty {
  visibility: hidden;
}

.status {
  margin: 0;
  font-size: clamp(1rem, 4.5vw, 1.25rem);
  font-weight: 700;
}

#status {
  color: var(--maize);
  text-shadow: var(--glow-maize);
}

/* legacy selector kept harmless if referenced */

#goal {
  color: var(--accent-blue);
  font-weight: 600;
  min-height: 2.7em;
}

.hud-row {
  color: var(--text-light);
  font-size: clamp(0.95rem, 4vw, 1.1rem);
  font-weight: 600;
}

.effect-msg,
.milestone-msg {
  font-size: clamp(0.95rem, 4vw, 1.05rem);
  font-weight: 700;
}

.effect-good {
  color: #4ade80;
}

.effect-bad {
  color: #f87171;
}

.milestone-msg {
  color: var(--maize-bright);
  text-shadow: var(--glow-maize);
}

.hidden {
  display: none !important;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  aspect-ratio: 640 / 480;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 3px solid var(--maize);
  box-shadow:
    inset 0 0 24px rgba(0, 0, 0, 0.4),
    var(--glow-maize);
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--navy-deep);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(0, 20, 40, 0.88);
  padding: 1rem;
  text-align: center;
}

.overlay.hidden {
  display: none;
}

.overlay-text {
  margin: 0;
  font-size: clamp(1.4rem, 6vw, 1.8rem);
  font-weight: 800;
  color: var(--maize);
  text-shadow: var(--glow-maize);
}

.celebration-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  background: rgba(0, 20, 40, 0.93);
  padding: 1rem;
  text-align: center;
  overflow: hidden;
}

.game-panel.is-celebrating .game-controls,
.game-panel.is-celebrating #restartBtnBottom,
.game-panel.is-game-over .game-controls {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.game-panel.is-celebrating .celebration-overlay .btn {
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

@media (max-width: 700px) {
  :root {
    --mobile-chrome: 14.75rem;
  }

  html {
    font-size: 22px;
  }

  body {
    min-height: 100dvh;
    overflow-x: hidden;
  }

  .page {
    width: 100%;
    min-height: 100dvh;
    padding:
      max(0.3rem, env(safe-area-inset-top, 0px))
      0.35rem
      max(0.25rem, env(safe-area-inset-bottom, 0px));
    gap: 0.35rem;
    display: flex;
    flex-direction: column;
  }

  .header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 0.45rem;
    text-align: left;
    flex-shrink: 0;
    padding: 0 0.1rem;
  }

  .title {
    margin: 0;
    grid-column: 1;
    font-size: clamp(1.05rem, 4.8vw, 1.3rem);
    line-height: 1.1;
    text-shadow:
      var(--glow-maize),
      2px 2px 0 var(--navy-light);
  }

  .tagline {
    display: none;
  }

  .btn-help {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin: 0;
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
    white-space: nowrap;
  }

  .main {
    flex: 1;
    min-height: 0;
    gap: 0;
  }

  .game-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.45rem 0.45rem;
    border-radius: 0.65rem;
  }

  .status-bar {
    flex-shrink: 0;
    margin-bottom: 0.3rem;
    gap: 0.15rem;
  }

  .score-casino-panel {
    min-height: 4.85rem;
    padding: 0.35rem 0.45rem 0.4rem;
  }

  .score-casino-top {
    margin-bottom: 0.05rem;
  }

  .score-label {
    font-size: 0.78rem;
  }

  .score-value {
    font-size: clamp(1.65rem, 9vw, 2.15rem);
  }

  .milestone-meter {
    margin-top: 0.25rem;
  }

  .milestone-meter-label {
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
  }

  .milestone-meter-track {
    height: 0.48rem;
  }

  .jackpot-banner {
    margin-top: 0.2rem;
    min-height: 1.2em;
    font-size: 0.82rem;
  }

  .btn-sound {
    font-size: 0.68rem;
    padding: 0.2rem 0.45rem;
  }

  .hud-row {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .message-zone {
    min-height: 1.45rem;
    gap: 0.1rem;
  }

  #goal {
    min-height: 1.25em;
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .effect-msg,
  .milestone-msg {
    font-size: 0.78rem;
    min-height: 1.2em;
    line-height: 1.2;
  }

  .canvas-wrap {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    margin: 0 auto;
    min-height: 10rem;
    aspect-ratio: 640 / 480;
    height: min(
      calc((100vw - 0.7rem) * 480 / 640),
      calc(
        100dvh - var(--mobile-chrome)
        - env(safe-area-inset-top, 0px)
        - env(safe-area-inset-bottom, 0px)
      )
    );
    max-height: calc(
      100dvh - var(--mobile-chrome)
      - env(safe-area-inset-top, 0px)
      - env(safe-area-inset-bottom, 0px)
    );
  }

  .game-controls {
    flex-shrink: 0;
    flex-direction: row;
    align-items: stretch;
    gap: 0.4rem;
    min-height: auto;
    margin-top: 0.35rem;
  }

  .btn-launch {
    flex: 1.35;
    max-width: none;
    min-height: 2.65rem;
    margin: 0;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
  }

  #restartBtnBottom {
    flex: 1;
    max-width: none;
    margin: 0;
    min-height: 2.65rem;
    font-size: 0.85rem;
    padding: 0.5rem 0.65rem;
  }

  .footer {
    display: none;
  }

  .score-casino-panel.score-pulse-hit .score-value,
  .score-casino-panel.score-pulse-ten .score-value,
  .score-casino-panel.score-pulse-jackpot .score-value {
    transform-origin: center center;
  }

  .game-panel.is-celebrating .celebration-overlay:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 95;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding:
      max(0.65rem, env(safe-area-inset-top, 0px))
      0.75rem
      max(1rem, env(safe-area-inset-bottom, 0px));
    gap: 0.4rem;
    justify-content: center;
  }

  .game-panel.is-celebrating .celebration-title {
    font-size: clamp(1.05rem, 4.8vw, 1.3rem);
  }

  .game-panel.is-celebrating .celebration-finale .celebration-title {
    font-size: clamp(1.15rem, 5vw, 1.45rem);
  }

  .game-panel.is-celebrating .celebration-subtitle {
    font-size: clamp(0.82rem, 3.5vw, 0.95rem);
    line-height: 1.3;
  }

  .game-panel.is-celebrating .dance-helpers {
    min-height: 2.5rem;
    max-width: 92vw;
    gap: 0.25rem;
  }

  .game-panel.is-celebrating .dance-helper {
    width: 2rem;
    height: 2.55rem;
  }

  .game-panel.is-celebrating .helper-head {
    width: 1.55rem;
    height: 1.6rem;
    left: 0.18rem;
    top: 0.1rem;
  }

  .game-panel.is-celebrating .helper-goggle {
    left: 0.25rem;
    top: 0.42rem;
    width: 1.4rem;
    height: 0.58rem;
  }

  .game-panel.is-celebrating .helper-goggle::before,
  .game-panel.is-celebrating .helper-goggle::after {
    width: 0.34rem;
    height: 0.34rem;
    top: 0.1rem;
  }

  .game-panel.is-celebrating .helper-body {
    left: 0.32rem;
    top: 1.55rem;
    width: 1.35rem;
    height: 0.82rem;
  }

  .game-panel.is-celebrating .helper-arm {
    top: 1.62rem;
    width: 0.34rem;
    height: 0.62rem;
  }

  .game-panel.is-celebrating .celebration-overlay .btn {
    width: min(100%, 280px);
    min-height: 2.85rem;
    padding: 0.55rem 1rem;
    font-size: clamp(0.95rem, 4vw, 1.05rem);
    margin-top: 0.25rem;
  }

  .game-panel.is-game-over .overlay:not(.hidden) {
    position: fixed;
    inset: 0;
    z-index: 95;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding:
      max(0.75rem, env(safe-area-inset-top, 0px))
      0.75rem
      max(1rem, env(safe-area-inset-bottom, 0px));
  }

  .game-panel.is-game-over #restartBtnBottom {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
  }
}

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

.celebration-title {
  margin: 0;
  font-size: clamp(1.35rem, 5.5vw, 1.75rem);
  font-weight: 800;
  color: var(--maize);
  text-shadow: var(--glow-maize);
}

.celebration-subtitle {
  margin: 0;
  font-size: clamp(0.95rem, 4vw, 1.1rem);
  color: var(--accent-blue);
  font-weight: 600;
}

.celebration-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-fall 2.8s linear infinite;
}

@keyframes confetti-fall {
  to {
    transform: translateY(520px) rotate(720deg);
  }
}

.celebration-lights {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 203, 5, 0.18) 0%, transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(107, 181, 255, 0.16) 0%, transparent 35%);
  animation: lights-pulse 1.4s ease-in-out infinite alternate;
}

@keyframes lights-pulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.celebration-finale .celebration-title {
  font-size: clamp(1.55rem, 6.5vw, 2rem);
}

.celebration-finale .celebration-lights {
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 203, 5, 0.28) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(107, 181, 255, 0.24) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 213, 79, 0.12) 0%, transparent 55%);
}

.dance-helpers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  min-height: 4.75rem;
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.dance-helper {
  width: 2.6rem;
  height: 3.4rem;
  position: relative;
  animation: helper-dance 0.55s ease-in-out infinite alternate;
}

.dance-helper:nth-child(odd) {
  animation-direction: alternate-reverse;
}

@keyframes helper-dance {
  0% { transform: translateY(0) rotate(-5deg) scale(1); }
  100% { transform: translateY(-10px) rotate(5deg) scale(1.04); }
}

.helper-head {
  position: absolute;
  left: 0.25rem;
  top: 0.15rem;
  width: 2.1rem;
  height: 2.15rem;
  background: #ffe135;
  border: 2px solid #c9a000;
  border-radius: 48% 48% 42% 42%;
}

.helper-goggle {
  position: absolute;
  left: 0.35rem;
  top: 0.55rem;
  width: 1.85rem;
  height: 0.75rem;
  background: #4b5563;
  border: 2px solid #1f2937;
  border-radius: 999px;
}

.helper-goggle::before,
.helper-goggle::after {
  content: "";
  position: absolute;
  top: 0.12rem;
  width: 0.45rem;
  height: 0.45rem;
  background: #dbeafe;
  border-radius: 50%;
}

.helper-goggle::before { left: 0.22rem; }
.helper-goggle::after { right: 0.22rem; }

.helper-body {
  position: absolute;
  left: 0.45rem;
  top: 2.05rem;
  width: 1.7rem;
  height: 1.05rem;
  background: #2563eb;
  border: 2px solid #1e3a8a;
  border-radius: 0.25rem 0.25rem 0.45rem 0.45rem;
}

.helper-arm {
  position: absolute;
  top: 2.15rem;
  width: 0.45rem;
  height: 0.85rem;
  background: #ffe135;
  border: 1.5px solid #c9a000;
  border-radius: 999px;
}

.helper-arm-left {
  left: 0.05rem;
  transform: rotate(18deg);
}

.helper-arm-right {
  right: 0.05rem;
  transform: rotate(-18deg);
}

/* Buttons */

.btn {
  font-family: inherit;
  font-size: clamp(1rem, 4.5vw, 1.15rem);
  font-weight: 700;
  padding: 0.65rem 1.4rem;
  border: 2px solid var(--maize-dark);
  border-radius: 999px;
  cursor: pointer;
  color: var(--navy-deep);
  background: linear-gradient(180deg, var(--maize-bright), var(--maize));
  box-shadow: 0 4px 0 var(--maize-dark), var(--glow-maize);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--maize-dark);
}

.btn-secondary {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}

.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-height: 3.4rem;
  margin-top: 0.75rem;
}

.btn-launch {
  display: block;
  width: 100%;
  max-width: 320px;
  min-height: 3rem;
  margin: 0 auto;
}

.btn-launch:disabled,
.btn-launch.btn-soft {
  opacity: 0.55;
  cursor: default;
  box-shadow: 0 2px 0 var(--maize-dark);
}

.btn-launch:disabled:hover,
.btn-launch.btn-soft:hover {
  transform: none;
}

.btn-launch:disabled:active,
.btn-launch.btn-soft:active {
  transform: none;
  box-shadow: 0 2px 0 var(--maize-dark);
}

.btn-help {
  margin-top: 0.15rem;
}

/* Instructions */

.instructions {
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 1rem;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.instructions h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.2rem, 5vw, 1.45rem);
  color: var(--maize);
  text-shadow: var(--glow-maize);
}

.how-to-list {
  margin: 0;
  padding-left: 1.35rem;
  font-size: clamp(1rem, 4.2vw, 1.1rem);
}

.how-to-list li {
  margin-bottom: 0.5rem;
}

.tip {
  margin: 0.85rem 0 0;
  font-size: clamp(0.95rem, 4vw, 1.05rem);
  color: var(--accent-blue);
  font-style: italic;
}

.icon-legend {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--panel-border);
  min-height: 7.5rem;
}

.legend-heading {
  margin: 0 0 0.55rem;
  font-size: clamp(1rem, 4.5vw, 1.12rem);
  color: var(--maize);
  text-shadow: var(--glow-maize);
}

.legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: clamp(0.92rem, 3.8vw, 1rem);
}

.legend-item-donkeys {
  align-items: flex-start;
}

.legend-donkey-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex-shrink: 0;
}

.legend-icon,
.legend-donkey-icon {
  display: block;
  background: rgba(0, 20, 40, 0.45);
  border-radius: 0.35rem;
  border: 1px solid rgba(255, 203, 5, 0.25);
}

/* Help modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 10, 25, 0.78);
}

.modal-card {
  position: relative;
  width: min(100%, 520px);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(160deg, var(--navy-mid), var(--navy-deep));
  border: 2px solid var(--maize);
  border-radius: 1rem;
  padding: 1.15rem 1.2rem 1.25rem;
  box-shadow: var(--shadow), var(--glow-maize);
}

.modal-card h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.2rem, 5vw, 1.45rem);
  color: var(--maize);
  text-shadow: var(--glow-maize);
}

.modal-card .icon-legend {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--panel-border);
  min-height: auto;
}

.modal-card .btn {
  display: block;
  margin: 1rem auto 0;
}

/* Footer */

.footer {
  text-align: center;
  font-size: clamp(0.9rem, 3.8vw, 1rem);
  opacity: 0.9;
}

.footer code {
  background: rgba(255, 203, 5, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
  color: var(--maize-bright);
}
