:root {
  --green: #0f9b8e;
  --green-dark: #08756b;
  --red: #d94f30;
  --yellow: #f6c453;
  --cream: #fff4d6;
  --brown: #4b2e1f;
  --dark: #1d1d1d;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 155, 142, 0.2), rgba(246, 196, 83, 0.25)),
    var(--cream);
  color: var(--brown);
  min-height: 100vh;
}

.app {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.hidden {
  display: none !important;
}

.start-screen,
.game-screen,
.modal-content {
  width: min(95vw, 520px);
  background: rgba(255, 255, 255, 0.88);
  border: 4px solid var(--green);
  border-radius: 24px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.logo {
  font-size: 64px;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-size: 42px;
  color: var(--green-dark);
}

h2 {
  margin-top: 0;
  color: var(--green-dark);
}

p {
  line-height: 1.5;
}

.menu {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

button {
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  background: var(--red);
  color: var(--white);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.95);
}

button.secondary {
  background: var(--green);
}

.record-box {
  font-size: 18px;
  font-weight: bold;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-weight: bold;
}

.game-header button {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 10px;
}

canvas {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  background: #f9df9b;
  border: 4px solid var(--brown);
  border-radius: 18px;
  display: block;
  margin: 0 auto;
}

.mobile-controls {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  justify-content: center;
}

.mobile-controls button {
  width: 62px;
  height: 52px;
  padding: 0;
  background: var(--green-dark);
}

.mobile-controls div {
  display: flex;
  gap: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}

@media (max-width: 480px) {
  .start-screen,
  .game-screen,
  .modal-content {
    padding: 18px;
    border-radius: 18px;
  }

  h1 {
    font-size: 34px;
  }

  .logo {
    font-size: 52px;
  }

  .game-header {
    font-size: 14px;
  }
}