* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #b8a88f;
}

#pond {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
}

/* Sound and night live in the left inventory dock as smaller flaps. Each
   flap tucks 8px past the screen edge so the hover slide reveals more flap
   instead of opening a gap. */
#soundToggle,
#nightToggle {
  display: block;
  width: 44px;
  height: 44px;
  margin-left: -8px;
  padding-left: 8px;
  border: 2px solid #8a6f4d;
  border-radius: 0 12px 12px 0;
  background: rgba(255, 252, 245, 0.85);
  box-shadow: 0 2px 8px rgba(60, 50, 30, 0.25);
  font-size: 18px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out-strong), background 0.2s ease;
}

/* Press feedback: the interface heard you. Hover only where hover exists. */
#soundToggle:active,
#nightToggle:active {
  transform: translateX(1px) scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  #soundToggle:hover,
  #nightToggle:hover {
    transform: translateX(4px);
    background: rgba(255, 252, 245, 0.98);
  }
}

#actionHint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 252, 245, 0.8);
  color: #5a4f3a;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 14px;
  pointer-events: none;
  z-index: 10;
  opacity: 1;
  transition: opacity 1.2s ease;
}

#actionHint.hidden {
  opacity: 0;
}

/* --- Style selector: a quiet inventory flap on the left edge ------------- */

#styleDock {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

#styleTab {
  display: block;
  width: 44px;
  height: 78px;
  margin-left: -8px;
  padding-left: 8px;
  border: 2px solid #8a6f4d;
  border-radius: 0 14px 14px 0;
  background: rgba(255, 252, 245, 0.85);
  box-shadow: 0 2px 8px rgba(60, 50, 30, 0.25);
  font-size: 18px;
  cursor: pointer;
  transition: transform 160ms var(--ease-out-strong), background 0.2s ease;
}

#styleTab:active {
  transform: translateX(1px) scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  #styleTab:hover {
    transform: translateX(4px);
    background: rgba(255, 252, 245, 0.98);
  }
}

#stylePanel {
  position: absolute;
  left: 44px;
  top: 50%;
  transform: translate(-16px, -50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  /* Exit faster than enter: leaving is a decision already made. */
  transition: transform 160ms var(--ease-out-strong), opacity 120ms ease, visibility 0s 160ms;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px;
  background: rgba(255, 252, 245, 0.92);
  border: 2px solid #8a6f4d;
  border-radius: 12px;
  box-shadow: 0 4px 18px rgba(60, 50, 30, 0.3), inset 0 0 0 1px rgba(138, 111, 77, 0.25);
}

#stylePanel.open {
  transform: translate(0, -50%);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: transform 240ms cubic-bezier(0.25, 1, 0.5, 1), opacity 180ms ease, visibility 0s;
}

.panelTitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 12px;
  color: #5a4f3a;
  text-align: center;
}

.styleCard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 9px 5px;
  border: 2px solid rgba(138, 111, 77, 0.25);
  border-radius: 9px;
  background: rgba(90, 79, 58, 0.05);
  cursor: pointer;
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 12px;
  color: #5a4f3a;
  transition: background 0.15s ease, border-color 0.15s ease, transform 160ms var(--ease-out-strong);
}

.styleCard:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .styleCard:hover {
    background: rgba(90, 79, 58, 0.12);
  }
}

.styleCard[aria-pressed="true"] {
  border-color: #c9a05a;
  background: rgba(201, 160, 90, 0.16);
}

.styleCard canvas {
  display: block;
  width: 64px;
  height: 44px;
  border-radius: 4px;
}

.styleCard[data-style="pixel"] canvas {
  image-rendering: pixelated;
}

#styleTab:focus-visible,
.styleCard:focus-visible,
#soundToggle:focus-visible,
#nightToggle:focus-visible {
  outline: 2px solid #c9a05a;
  outline-offset: 2px;
}

/* --- 8-bit chrome: same whisper, bitmap voice ----------------------------- */

body.pixel-mode #actionHint,
body.pixel-mode .panelTitle,
body.pixel-mode .styleCard {
  font-family: 'Pixelify Sans', 'Courier New', monospace;
  font-style: normal;
}

body.pixel-mode #actionHint {
  border-radius: 3px;
}

body.pixel-mode #styleTab {
  border-radius: 0 6px 6px 0;
}

body.pixel-mode #stylePanel {
  border-radius: 4px;
}

body.pixel-mode .styleCard,
body.pixel-mode .styleCard canvas {
  border-radius: 2px;
}

body.pixel-mode #soundToggle,
body.pixel-mode #nightToggle {
  border-radius: 0 6px 6px 0;
}

/* Reduced motion: keep the fades (they aid comprehension), drop the movement. */
@media (prefers-reduced-motion: reduce) {
  #stylePanel {
    transform: translate(0, -50%);
    transition: opacity 0.15s ease, visibility 0s 0.15s;
  }

  #stylePanel.open {
    transition: opacity 0.15s ease, visibility 0s;
  }

  #styleTab,
  .styleCard,
  #soundToggle,
  #nightToggle {
    transition: background 0.2s ease, border-color 0.15s ease;
  }

  #styleTab:hover,
  #styleTab:active,
  .styleCard:active,
  #soundToggle:hover,
  #soundToggle:active,
  #nightToggle:hover,
  #nightToggle:active {
    transform: none;
  }
}
