:root {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #cbb98f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#field {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: grab;
}

#field.grabbing {
  cursor: grabbing;
}

#titleCard {
  position: fixed;
  top: 6vh;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  color: #3f3527;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

#titleCard h1 {
  margin: 0;
  font-size: clamp(1.1rem, 3.2vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.01em;
}

#hint {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
  animation: fadeOut 1s ease-in 4.5s forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

#hud {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  color: #3f3527;
  font-size: 0.8rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(3px);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
}

#hud strong {
  font-variant-numeric: tabular-nums;
}

#controls {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  gap: 0.4rem;
}

#controls button {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.35);
  color: #3f3527;
  font-size: 1.2rem;
  line-height: 1;
  backdrop-filter: blur(3px);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#controls button:active {
  background: rgba(255, 255, 255, 0.55);
}

#infoButton {
  margin-left: 0.6rem;
  font-weight: 700;
}

#infoModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(63, 53, 39, 0.35);
  padding: 1.5rem;
}

#infoModal.hidden {
  display: none;
}

#infoModalCard {
  position: relative;
  max-width: 22rem;
  background: #faf3e2;
  color: #3f3527;
  border-radius: 12px;
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  font-size: 0.95rem;
  line-height: 1.5;
}

#infoModalClose {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: #3f3527;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

#infoModalClose:hover {
  background: rgba(63, 53, 39, 0.1);
}

@media (prefers-color-scheme: dark) {
  html, body {
    background: #8f7c53;
  }
}
