* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow: hidden;
  background: #2c1810;
  font-family: 'Nunito', sans-serif;
  touch-action: none;
  user-select: none;
}

#canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
}

#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay * {
  pointer-events: auto;
}

#title-bar {
  text-align: center;
  padding: 8px 0 2px;
  pointer-events: none;
}

#title {
  font-family: 'Lilita One', cursive;
  font-size: clamp(28px, 5vw, 52px);
  color: #f5d76e;
  text-shadow: 
    3px 3px 0 #7b4a12,
    -1px -1px 0 #7b4a12,
    1px -1px 0 #7b4a12,
    -1px 1px 0 #7b4a12,
    0 5px 10px rgba(0,0,0,0.3);
  letter-spacing: 4px;
}

#subtitle {
  font-size: clamp(10px, 1.8vw, 14px);
  color: #d4a56a;
  opacity: 0.8;
  margin-top: -2px;
}

#mode-tabs {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
}

.mode-btn {
  background: rgba(60, 30, 10, 0.75);
  border: 2px solid #7b4a12;
  color: #e8c88a;
  padding: 6px 14px;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: clamp(11px, 1.6vw, 14px);
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.mode-btn:hover { background: rgba(123, 74, 18, 0.8); }
.mode-btn.active {
  background: #b8860b;
  color: #fff;
  border-color: #f5d76e;
  box-shadow: 0 0 12px rgba(245, 215, 110, 0.4);
}

#score-display {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(30, 15, 5, 0.8);
  border: 2px solid #7b4a12;
  border-radius: 12px;
  padding: 8px 14px;
  color: #f5d76e;
  font-weight: 900;
  font-size: clamp(12px, 1.5vw, 16px);
  backdrop-filter: blur(4px);
  line-height: 1.5;
}

#potato-count { color: #d4a56a; font-size: 0.85em; }

#pun-display {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Lilita One', cursive;
  font-size: clamp(32px, 6vw, 72px);
  color: #f5d76e;
  text-shadow: 3px 3px 0 #7b4a12, 0 0 20px rgba(245,215,110,0.5);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none !important;
  white-space: nowrap;
}

#controls-bar {
  position: absolute;
  bottom: 36px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(30, 15, 5, 0.85);
  border-top: 2px solid #5a3510;
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-group label {
  color: #d4a56a;
  font-weight: 700;
  font-size: clamp(10px, 1.3vw, 13px);
}

#potato-selector {
  display: flex;
  gap: 3px;
}

.potato-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #5a3510;
  background: rgba(60, 30, 10, 0.6);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.potato-btn:hover { border-color: #b8860b; }
.potato-btn.active {
  border-color: #f5d76e;
  background: #7b4a12;
  box-shadow: 0 0 8px rgba(245,215,110,0.3);
}

#gravity-slider {
  width: clamp(60px, 10vw, 120px);
  accent-color: #b8860b;
  cursor: pointer;
}

#gravity-label {
  color: #e8c88a;
  font-size: 11px;
  min-width: 45px;
}

.btn-group {
  gap: 4px;
}

.btn-group button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid #5a3510;
  background: rgba(60, 30, 10, 0.6);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-group button:hover {
  background: rgba(123, 74, 18, 0.7);
  border-color: #b8860b;
}

#fact-ticker {
  position: absolute;
  bottom: 82px;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 3px 10px;
  pointer-events: none !important;
}

#fact-text {
  color: #a0784a;
  font-size: clamp(9px, 1.2vw, 12px);
  font-style: italic;
}

#app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 6px;
  background: rgba(20, 10, 5, 0.9);
  z-index: 11;
}

#app-footer a {
  color: #7b4a12;
  text-decoration: none;
  font-size: 11px;
  font-family: 'Nunito', sans-serif;
}

#app-footer a:hover {
  color: #b8860b;
}

@media (max-width: 600px) {
  #controls-bar {
    gap: 6px;
    padding: 6px 6px;
  }
  .control-group label {
    display: none;
  }
  #score-display {
    padding: 5px 8px;
    font-size: 11px;
  }
  #mode-tabs {
    gap: 3px;
    padding: 4px 6px;
  }
  .mode-btn {
    padding: 4px 8px;
    font-size: 10px;
  }
}