:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #f1d8c8;
  color: #f7e7b2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(247, 219, 200, 0.42), rgba(157, 111, 88, 0.58)),
    url("./assets/sprites/data4/levelview/tiles/bg_texture.png?v=goose-garden-20260716-8") center top / min(760px, 100vw) auto repeat-y,
    #e7c0aa;
  overflow-x: hidden;
}

.shell {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(6px, 1.5vw, 14px);
  display: block;
  align-items: center;
}

.game-surface {
  position: relative;
  width: min(100%, calc(100vh * 0.75));
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  min-height: 0;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  user-select: none;
  border: 3px solid rgba(255, 227, 156, 0.55);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.45);
  background: #f0d6c4;
}

.canvas-actions {
  position: absolute;
  left: 50%;
  top: 88.8%;
  transform: translateX(-50%);
  width: min(80%, 560px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  z-index: 2;
}

.gm-panel {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  width: min(78%, 430px);
  padding: 14px;
  z-index: 4;
  color: #fff1c2;
  background: rgba(52, 34, 29, 0.94);
  border: 2px solid rgba(255, 223, 159, 0.55);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.gm-panel.hidden {
  display: none;
}

.gm-title {
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

.gm-panel label {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-weight: 800;
}

.gm-panel input {
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border: 2px solid rgba(255, 223, 159, 0.45);
  color: #2b1608;
  background: #fff3d4;
  font-size: 18px;
  font-weight: 800;
}

.gm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.gm-actions button {
  min-height: 40px;
  font-size: 15px;
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 20, 13, 0.86);
  color: #ffe8a1;
  font-size: 20px;
}

.loader.hidden {
  display: none;
}

.panel {
  display: none;
}

.logo {
  width: min(100%, 320px);
  align-self: center;
  image-rendering: auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stats div,
.status {
  border: 2px solid rgba(255, 227, 156, 0.35);
  background: rgba(35, 24, 12, 0.76);
}

.stats div {
  padding: 12px 8px;
  text-align: center;
}

.stats span {
  display: block;
  color: #c8f0b0;
  font-size: 12px;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 48px;
  border: 2px solid rgba(128, 69, 72, 0.68);
  border-radius: 8px;
  color: #5a2a25;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 36%),
    linear-gradient(180deg, #fff0c8 0%, #f4c979 57%, #d88d45 100%);
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  text-shadow: 0 1px rgba(255, 247, 215, 0.82);
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.58),
    inset 0 -2px rgba(138, 74, 42, 0.18),
    0 5px 0 #9f4b2e,
    0 8px 18px rgba(58, 24, 18, 0.24);
}

.canvas-actions button {
  position: relative;
  min-height: 58px;
  padding: 7px 8px 8px;
  overflow: hidden;
}

.canvas-actions button::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.canvas-actions button::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 2px;
  border-radius: 999px;
  background: rgba(119, 60, 48, 0.2);
}

.canvas-actions button:hover {
  filter: brightness(1.04) saturate(1.04);
}

.canvas-actions button:focus-visible {
  outline: 3px solid rgba(255, 244, 190, 0.95);
  outline-offset: 2px;
}

#shop {
  border-color: rgba(145, 86, 56, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 36%),
    linear-gradient(180deg, #fff4cf 0%, #efc268 56%, #c9813f 100%);
}

#gm {
  border-color: rgba(139, 78, 105, 0.76);
  color: #582947;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), transparent 36%),
    linear-gradient(180deg, #ffe3e9 0%, #f0adc0 56%, #c97986 100%);
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.58),
    inset 0 -2px rgba(111, 52, 83, 0.18),
    0 5px 0 #8e4967,
    0 8px 18px rgba(58, 24, 18, 0.24);
}

#music {
  border-color: rgba(105, 102, 63, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 36%),
    linear-gradient(180deg, #fff4cb 0%, #d9cf77 56%, #a6a24f 100%);
}

button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 2px rgba(255, 255, 255, 0.35),
    inset 0 -1px rgba(138, 74, 42, 0.16),
    0 2px 0 #8f4229,
    0 5px 12px rgba(58, 24, 18, 0.2);
}

.status {
  min-height: 88px;
  margin: 0;
  padding: 16px;
  line-height: 1.45;
  color: #f7e7b2;
}

@media (max-width: 860px) {
  .shell {
    padding: 0;
  }

  .game-surface {
    width: min(100vw, calc(100dvh * 0.75));
    min-height: min(100dvh, calc(100vw * 1.3334));
  }

  canvas {
    border: 0;
    box-shadow: none;
  }

  .canvas-actions {
    top: 94.8%;
    width: min(92%, 500px);
    gap: 6px;
  }

  button {
    min-height: 34px;
    font-size: 13px;
    border-radius: 7px;
    box-shadow:
      inset 0 2px rgba(255, 255, 255, 0.5),
      inset 0 -1px rgba(138, 74, 42, 0.16),
      0 3px 0 #9f4b2e,
      0 5px 12px rgba(58, 24, 18, 0.2);
  }

  .canvas-actions button {
    min-height: 42px;
    padding: 4px 4px 5px;
  }

  .gm-panel {
    width: min(90%, 430px);
  }
}
