body {
  margin: 0;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #ffffff;
  background: #000000;
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.hud {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.hud span {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.exit-button {
  cursor: pointer;
  color: rgba(255, 255, 255, 0.65);
  transition: color 0.2s ease;
}

.exit-button:hover {
  color: #ffffff;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  margin-bottom: 8px;
  margin-left: 32px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.control-group label {
  color: rgba(255, 255, 255, 0.8);
  min-width: 50px;
  font-weight: 500;
}

.control-group input[type="range"] {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.control-group span {
  color: #ffffff;
  min-width: 40px;
  text-align: right;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.game-area {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#gameCanvas {
  width: 100%;
  max-width: 375px;
  height: auto;
  max-height: 812px;
  background: #2a2a2a;
  border: 2px solid #808080;
  border-radius: 12px;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  border-radius: 12px;
}

.overlay.hidden {
  display: none;
}

.start-screen {
  text-align: center;
  color: #ffffff;
  max-width: 360px;
}

.start-screen .copyright {
  margin: 12px 0 0;
  font-size: 15px;
  color: #44cc44;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.title-letter {
  position: relative;
  display: inline-block;
}

.title-letter .letter-ball {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #000000;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.title-space {
  display: inline-block;
  width: 0.3em;
}

.start-screen h1 {
  margin: 0 0 8px;
  font-size: 52px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #ffffff;
  text-shadow:
    0 1px 0 #cccccc,
    0 2px 0 #bbbbbb,
    0 3px 0 #aaaaaa,
    0 4px 0 #999999,
    0 5px 0 #888888,
    0 6px 1px rgba(0,0,0,0.1),
    0 0 5px rgba(0,0,0,0.1),
    0 1px 3px rgba(0,0,0,0.3),
    0 3px 5px rgba(0,0,0,0.2),
    0 5px 10px rgba(0,0,0,0.25),
    0 10px 10px rgba(0,0,0,0.2),
    0 20px 20px rgba(0,0,0,0.15);
}

.start-screen .subtitle {
  margin: 0 0 24px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 300;
}

.start-screen .instructions {
  margin: 0 0 32px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.start-screen button {
  appearance: none;
  border: none;
  cursor: pointer;
  background: #808080;
  color: #000000;
  padding: 16px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
  width: 100%;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.start-screen button:hover {
  background: #a0a0a0;
  transform: translateY(-1px);
}

.start-screen button:active {
  transform: translateY(0);
}

.difficulty-buttons {
  display: grid;
  gap: 6px;
}

.difficulty-buttons .btn-ball {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #000000;
  border-radius: 50%;
  pointer-events: none;
}

#btnEasy {
  background: #6fd46f;
}

#btnStart {
  background: #808080;
}

#btnHard {
  background: #e07070;
}

/* High Score List */
.highscore-screen {
  text-align: center;
  color: #ffffff;
  max-width: 360px;
  width: 100%;
}

.highscore-screen h2 {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: #ffd700;
}

.highscore-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  font-size: 14px;
}

.highscore-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.highscore-list li.current-player {
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 4px;
}

.highscore-list .hs-rank {
  width: 24px;
  text-align: left;
  color: rgba(255,255,255,0.5);
  font-weight: 600;
}

.highscore-list .hs-name {
  flex: 1;
  text-align: left;
  padding: 0 8px;
}

.highscore-list .hs-score {
  width: 60px;
  text-align: right;
  font-weight: 600;
  color: #ffd700;
}

.highscore-list input[type="text"] {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,215,0,0.5);
  border-radius: 4px;
  color: #ffffff;
  font-size: 14px;
  padding: 4px 8px;
  width: 120px;
  outline: none;
  font-family: inherit;
}

.highscore-list input[type="text"]:focus {
  border-color: #ffd700;
  background: rgba(255,255,255,0.15);
}

.highscore-screen button {
  appearance: none;
  border: none;
  cursor: pointer;
  background: #808080;
  color: #000000;
  padding: 14px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
  width: 100%;
  transition: all 0.2s ease;
}

.highscore-screen button:hover {
  background: #a0a0a0;
  transform: translateY(-1px);
}

/* iPhone 13 Pro Max optimizations */
@media (min-width: 375px) {
  .game-container {
    max-width: 375px;
    margin: 0 auto;
  }
  
  #gameCanvas {
    width: 375px;
    height: 812px;
  }
}
