* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0f19;
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #ffffff;
}

/* Play Cover Screen Overlay */
#play-cover {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at center, #1e1b4b 0%, #0b0f19 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
}

#play-cover.hidden {
  display: none;
}

.cover-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 450px;
  width: 100%;
}

.cover-icon {
  font-size: 4.5rem;
  margin-bottom: 12px;
  animation: floatBounce 2s infinite ease-in-out;
}

@keyframes floatBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-12px) scale(1.08); }
}

.cover-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.cover-subtitle {
  font-size: 1.05rem;
  color: #94a3b8;
  margin-bottom: 28px;
  line-height: 1.4;
}

.play-cover-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 16px 44px;
  border-radius: 50px;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4), 0 0 15px rgba(16, 185, 129, 0.3);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.play-cover-btn:hover, .play-cover-btn:active {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.6);
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
}

.cover-tip {
  margin-top: 18px;
  font-size: 0.85rem;
  color: #64748b;
}

/* Container & Aspect-Ratio Canvas */
#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1b263b 0%, #0b0f19 100%);
}

#game-canvas {
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}



/* UI Layers & Controls */
#ui-layer {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  gap: 10px;
}

.ui-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ui-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2deg);
}

.ui-btn:active {
  transform: translateY(0);
}

/* Touch Controls Overlay for Mobile */
#mobile-controls {
  position: absolute;
  bottom: 25px;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  padding: 0 40px;
  pointer-events: none;
}

.touch-btn {
  pointer-events: auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.6);
  border: 3px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: 2.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 0 12px rgba(255, 255, 255, 0.15);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s ease;
}

.touch-btn:active {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #34d399;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.3);
  transform: scale(0.92);
}

/* Ad Overlay Modal */
#ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  backdrop-filter: blur(10px);
}

#ad-overlay.hidden {
  display: none;
}

.ad-modal {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 90vh;
  max-height: 500px;
  background: #1e293b;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ad-header {
  height: 52px;
  background: #0f172a;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ad-badge {
  color: #f59e0b;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ad-close-btn {
  background: #334155;
  color: #94a3b8;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: not-allowed;
  transition: all 0.2s ease;
}

.ad-close-btn:not([disabled]) {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.ad-close-btn:not([disabled]):hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1deg);
}

.ad-body {
  flex: 1;
  width: 100%;
  height: calc(100% - 52px);
}

.ad-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}
