:root {
  --bg: #050505;
  --text: #f4f4f4;
  --muted: #8a8a8a;
}

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

html, body {
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  color-scheme: dark;
}

.fruit-app {
  height: 100%;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 10px 16px 12px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  gap: 8px;
}

.fruit-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  min-height: 52px;
  flex-wrap: nowrap;
}

.back-link,
.fruit-top h1 {
  font-size: 26px;
  font-weight: 600;
}

.back-link {
  color: #fff;
  text-decoration: none;
  padding: 10px 18px;
  border: 2px solid #fff;
  border-radius: 999px;
  white-space: nowrap;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
}

.back-link:active {
  background: #fff;
  color: #000;
}

.scores {
  display: flex;
  gap: 16px;
  font-size: 20px;
  color: var(--muted);
  white-space: nowrap;
}

.scores b {
  color: #fff;
  font-weight: 600;
}

.fruit-main {
  position: relative;
  min-height: 0;
  background: #0b0b0b;
  border-radius: 20px;
  overflow: hidden;
  touch-action: none;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 8%;
  background: rgba(0, 0, 0, 0.45);
}

.overlay.hidden {
  display: none;
}

#overlay-text {
  font-size: 36px;
  font-weight: 600;
}

@media (max-height: 700px) {
  .fruit-app { padding: 8px 12px 10px; gap: 6px; }
  .fruit-top { min-height: 46px; gap: 12px; }
  .back-link, .fruit-top h1 { font-size: 22px; }
  .back-link { min-height: 44px; padding: 8px 14px; }
  .scores { font-size: 18px; gap: 12px; }
  #overlay-text { font-size: 28px; }
}

@media (max-width: 820px) {
  .fruit-top h1 { display: none; }
}
