:root {
  color-scheme: light;
  --paper: #ede3cc;
  --ink: #352d25;
  --muted: #6e5c4d;
  --glass: rgba(212, 236, 228, 0.55);
  --frame: #83653d;
  --frame-dark: #5d4524;
  --leaf: #5a8b44;
  --leaf-dark: #2f5f31;
  --water: #65a8bb;
  --water-deep: #3f7487;
  --accent: #bb5d49;
  --shadow: rgba(53, 45, 37, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(circle at top, rgba(255, 245, 227, 0.92), rgba(237, 227, 204, 0.96) 42%, rgba(224, 210, 180, 0.98) 100%),
    linear-gradient(180deg, #f3ebd8, #dcc8a2);
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--ink);
}

body {
  user-select: none;
}

.shell {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}

.frame {
  position: relative;
  width: min(100vw - 24px, 760px);
  height: min(100dvh - 24px, 980px);
  min-height: 520px;
  border-radius: 26px;
  padding: 18px 18px 14px;
  background:
    linear-gradient(145deg, rgba(255, 248, 236, 0.82), rgba(228, 212, 186, 0.78)),
    repeating-linear-gradient(90deg, rgba(131, 101, 61, 0.04), rgba(131, 101, 61, 0.04) 2px, transparent 2px, transparent 12px);
  box-shadow:
    0 20px 60px rgba(64, 46, 18, 0.18),
    inset 0 0 0 2px rgba(93, 69, 36, 0.22);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 10px;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(250, 247, 240, 0.92), rgba(222, 235, 223, 0.92));
  box-shadow:
    inset 0 0 0 3px rgba(93, 69, 36, 0.28),
    inset 0 18px 36px rgba(255, 255, 255, 0.35);
}

.hud,
.footerStrip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.titleBlock h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.titleBlock p,
.footerStrip {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.controls {
  display: flex;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff7ea;
  background: linear-gradient(180deg, var(--accent), #8d4031);
  box-shadow: 0 4px 12px rgba(141, 64, 49, 0.24);
}

button:active {
  transform: translateY(1px);
}

.toast {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(53, 45, 37, 0.9);
  color: #f6efe0;
  font-size: 0.95rem;
  pointer-events: none;
}

@media (max-width: 640px) {
  .frame {
    width: 100%;
    height: 100%;
    min-height: 100%;
    border-radius: 0;
    padding: 12px;
  }

  .hud {
    align-items: flex-start;
    flex-direction: column;
  }

  .footerStrip {
    flex-direction: column;
    align-items: flex-start;
  }

  .controls {
    width: 100%;
  }

  button {
    flex: 1;
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
  }

  button:active {
    transform: none;
  }
}
