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

body {
  background: #12111e;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: #e0d8cc;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

#game:active { cursor: grabbing; }

#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#title {
  margin-top: 1.2rem;
  font-size: clamp(0.9rem, 2.2vw, 1.4rem);
  font-weight: 600;
  color: #b8a080;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

#msg {
  position: absolute;
  bottom: 9%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 6, 4, 0.88);
  border: 1px solid rgba(180, 130, 60, 0.35);
  border-radius: 0.7rem;
  padding: 0.65rem 1.5rem;
  font-size: clamp(0.85rem, 1.9vw, 1.15rem);
  color: #e0cca8;
  text-align: center;
  white-space: nowrap;
  max-width: 92vw;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

#msg.show { opacity: 1; }

#final {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(6, 5, 10, 0.94);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.8rem, 2.5vh, 1.8rem);
  text-align: center;
  padding: 2rem;
  animation: fadeUp 1.2s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

#final h1 {
  font-size: clamp(1.3rem, 3.5vw, 2.2rem);
  font-weight: 300;
  color: #d8c49a;
  letter-spacing: 0.04em;
}

#final p {
  font-size: clamp(0.9rem, 1.8vw, 1.2rem);
  color: #9a8870;
  line-height: 2.3;
}

.final-score {
  font-size: clamp(0.8rem, 1.6vw, 1rem);
  color: #665848;
  font-style: italic;
}

#replay-btn {
  margin-top: 0.3rem;
  padding: 0.75rem 2rem;
  font-size: clamp(0.85rem, 1.7vw, 1.05rem);
  font-family: inherit;
  background: rgba(180, 130, 60, 0.12);
  border: 1px solid rgba(180, 130, 60, 0.35);
  border-radius: 0.5rem;
  color: #c0a060;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

#replay-btn:hover {
  background: rgba(180, 130, 60, 0.22);
  border-color: rgba(180, 130, 60, 0.55);
  color: #d8b878;
}

.replay-sub {
  font-size: 0.78em;
  opacity: 0.6;
}
