[hidden] { display: none !important; }
* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  background: radial-gradient(circle at 50% 20%, #2e7d32, #0b3311);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
}

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(24px + env(safe-area-inset-bottom));
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  padding-top: 8px;
}
.screen.active { display: flex; }

.logo { font-size: 64px; margin-top: 20px; line-height: 1; }
h1 { margin: 0; font-size: 30px; letter-spacing: .5px; }
.sub { margin: 0 0 10px; opacity: .85; }

.menu-buttons { display: flex; flex-direction: column; gap: 12px; width: 100%; }

button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: #fff;
  color: #1b5e20;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: .45; cursor: default; }

button.big {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  font-size: 18px;
  padding: 16px 18px;
  box-shadow: 0 5px 0 #b0bec5;
}
button.big small { font-size: 13px; font-weight: 400; opacity: .75; margin-top: 4px; }
button.big:active { transform: translateY(4px); box-shadow: none; }

button.ghost { background: rgba(255, 255, 255, .15); color: #fff; }
button.small { padding: 8px 12px; font-size: 14px; }

button.primary {
  background: #ffd600;
  color: #1b1b1b;
  font-size: 20px;
  padding: 14px 44px;
  box-shadow: 0 5px 0 #b59b00;
}
button.primary:active { transform: translateY(4px); box-shadow: none; }

#how {
  background: rgba(0, 0, 0, .25);
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}
#how p { margin: 6px 0; }

.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
#modeTitle { font-weight: 800; font-size: 18px; }

.score {
  font-weight: 700;
  font-size: 15px;
  background: rgba(0, 0, 0, .25);
  padding: 6px 14px;
  border-radius: 999px;
}

.pitch-wrap { width: 100%; max-width: 360px; }
#pitch {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  display: block;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  touch-action: none;
}

.msg { min-height: 24px; font-size: 17px; font-weight: 600; }

#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
#matchButtons { display: flex; gap: 10px; width: 100%; }
#matchButtons button { flex: 1; padding: 14px 8px; box-shadow: 0 4px 0 #b0bec5; }
#matchButtons button:active { transform: translateY(3px); box-shadow: none; }

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-height: 120px;
  overflow: auto;
  font-size: 13px;
  opacity: .9;
}
.log li { padding: 6px 10px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
