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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: #1a1a2e;
  color: #ffffff;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #1a1a2e;
}

.ui-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 3px solid #f7b731;
}

.ui-header h1 {
  font-size: 1.4rem;
  color: #f7b731;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  letter-spacing: 1px;
}

.stats-panel {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 48px;
}

.stat-item .label {
  font-size: 0.75rem;
  color: #a0a0b0;
  margin-bottom: 2px;
}

.stat-item .value {
  font-size: 1.25rem;
  font-weight: bold;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.game-area {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 10px;
  overflow: hidden;
}

#game {
  background-color: #0f0f1a;
  border: 3px solid #333;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  touch-action: none;
  display: block;
}

.overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26, 26, 46, 0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.overlay-content {
  background: #22223b;
  padding: 24px 20px;
  border-radius: 16px;
  text-align: center;
  border: 2px solid #f7b731;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  max-width: 90%;
  width: 320px;
}

.overlay-content h2 {
  font-size: 1.6rem;
  color: #f7b731;
  margin-bottom: 10px;
}

.overlay-content p {
  font-size: 1rem;
  color: #d0d0e0;
  margin-bottom: 20px;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 14px 28px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.1s ease, filter 0.1s ease;
  margin: 6px;
  min-width: 130px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

.btn-primary {
  background-color: #f7b731;
  color: #1a1a2e;
}

.btn-primary:hover {
  background-color: #e5a520;
}

.btn-secondary {
  background-color: #4a4e69;
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: #5c6180;
}

.touch-controls {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 10px 24px;
  background: rgba(255, 255, 255, 0.05);
  border-top: 2px solid #333;
}

.ctrl-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid #555;
  background: #2a2a40;
  color: #ffffff;
  font-size: 1.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s, transform 0.1s, border-color 0.1s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
}

.ctrl-btn:active {
  background: #f7b731;
  color: #1a1a2e;
  border-color: #f7b731;
  transform: scale(0.92);
}

@media (max-width: 360px) {
  .ui-header h1 { font-size: 1.2rem; }
  .stat-item .value { font-size: 1.1rem; }
  .ctrl-btn { width: 56px; height: 56px; font-size: 1.5rem; }
  .overlay-content { padding: 16px; width: 280px; }
  .btn { padding: 12px 20px; font-size: 1rem; min-width: 110px; }
}