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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0f1a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e8f0ff;
}

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* ===== LOADING ===== */
#loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #0a0f1a 0%, #111827 50%, #0c1525 100%);
  z-index: 100;
}

.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.logo-text {
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  font-weight: 800;
  letter-spacing: 4px;
  background: linear-gradient(135deg, #00e5ff, #7c3aed, #00e5ff);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 4s ease infinite;
}

.version-tag {
  margin-top: 8px;
  font-size: 0.9rem;
  color: #64748b;
  letter-spacing: 2px;
}

.loading-bar {
  width: min(280px, 70vw);
  height: 6px;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.loading-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e5ff, #7c3aed);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.loading-text {
  font-size: 0.85rem;
  color: #94a3b8;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== MAIN MENU ===== */
#main-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0f1a;
}

.menu-bg {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(0, 229, 255, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
    linear-gradient(180deg, #0a0f1a 0%, #111827 100%);
}

.menu-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  width: min(400px, 92vw);
}

.title-logo h1 {
  font-size: clamp(2.6rem, 9vw, 3.8rem);
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #00e5ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.tagline {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 36px;
  letter-spacing: 1px;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-btn {
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}

.menu-btn:hover, .menu-btn:active {
  background: #334155;
  transform: translateY(-1px);
}

.menu-btn.primary {
  background: linear-gradient(135deg, #00b4d8, #7c3aed);
  border: none;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 180, 216, 0.3);
}

.menu-btn.primary:hover {
  box-shadow: 0 6px 25px rgba(0, 180, 216, 0.45);
}

.menu-btn.secondary {
  background: transparent;
  border: 1px solid #475569;
  color: #94a3b8;
  font-size: 0.9rem;
}

.menu-btn.danger {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}

.menu-footer {
  margin-top: 32px;
  font-size: 0.75rem;
  color: #475569;
}

/* ===== GAME SCREEN ===== */
#game-screen {
  background: #000;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px;
  pointer-events: none;
  z-index: 20;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.score-box, .combo-box {
  background: rgba(10, 15, 26, 0.75);
  backdrop-filter: blur(8px);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  min-width: 90px;
}

.score-box .label, .combo-box .label {
  display: block;
  font-size: 0.65rem;
  color: #64748b;
  letter-spacing: 1px;
}

.score-box span:last-child, .combo-box span:last-child {
  font-size: 1.4rem;
  font-weight: 700;
  color: #00e5ff;
}

#trick-display {
  text-align: center;
  margin-top: 20px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 12px rgba(0, 229, 255, 0.8);
  min-height: 32px;
  transition: opacity 0.3s;
}

.zone-name {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 15, 26, 0.7);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #94a3b8;
  letter-spacing: 1px;
}

#btn-pause {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(30, 41, 59, 0.85);
  color: white;
  font-size: 1.2rem;
  z-index: 25;
  cursor: pointer;
}

/* ===== TOUCH CONTROLS ===== */
#touch-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}

#joystick-zone {
  position: absolute;
  bottom: 30px;
  left: 20px;
  width: 140px;
  height: 140px;
  pointer-events: auto;
}

#joystick-base {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.55);
  border: 2px solid rgba(0, 229, 255, 0.35);
  position: relative;
  margin: 15px;
}

#joystick-knob {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.85);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.5);
}

#action-buttons {
  position: absolute;
  bottom: 30px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.action-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(0, 229, 255, 0.4);
  background: rgba(30, 41, 59, 0.7);
  color: #e2e8f0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
}

.action-btn:active {
  background: rgba(0, 229, 255, 0.35);
  transform: scale(0.94);
}

.action-btn.secondary {
  width: 58px;
  height: 58px;
  font-size: 0.65rem;
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.55);
}

/* ===== PANELS (menus) ===== */
.panel {
  max-width: 480px;
  width: 92%;
  margin: 40px auto;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #1e293b;
  border-radius: 20px;
  padding: 28px 24px;
  max-height: 90vh;
  overflow-y: auto;
}

.panel h2 {
  font-size: 1.6rem;
  margin-bottom: 24px;
  text-align: center;
  background: linear-gradient(135deg, #00e5ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: #1e293b;
  color: #94a3b8;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: #00b4d8;
  color: white;
}

.color-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 24px;
}

.color-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #334155;
  cursor: pointer;
}

.color-btn:hover {
  border-color: #00e5ff;
}

.map-zones {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.zone-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 14px 16px;
  border-left: 4px solid #00e5ff;
}

.zone-card.locked {
  opacity: 0.55;
  border-left-color: #475569;
}

.zone-card h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.zone-card p {
  font-size: 0.85rem;
  color: #94a3b8;
}

.zone-card .status {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.75rem;
  color: #00e5ff;
  font-weight: 600;
}

.zone-card.locked .status {
  color: #64748b;
}

.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}

.challenge-item {
  background: #1e293b;
  border-radius: 12px;
  padding: 14px 16px;
}

.challenge-item.locked {
  opacity: 0.5;
}

.challenge-item h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.challenge-item p {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 10px;
}

.progress {
  height: 6px;
  background: #0f172a;
  border-radius: 4px;
  overflow: hidden;
}

.progress .bar {
  height: 100%;
  background: linear-gradient(90deg, #00e5ff, #7c3aed);
  border-radius: 4px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
}

.setting-row label {
  font-size: 0.95rem;
  color: #cbd5e1;
}

.setting-row select, .setting-row input[type="range"] {
  background: #1e293b;
  border: 1px solid #334155;
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  min-width: 120px;
}

.version-header {
  text-align: center;
  margin-bottom: 24px;
}

.current-version {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.update-name {
  color: #00e5ff;
  font-weight: 600;
}

.changelog h3 {
  font-size: 1rem;
  color: #a78bfa;
  margin: 18px 0 10px;
}

.changelog ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.changelog li {
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.about-panel {
  text-align: center;
}

.about-logo {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #00e5ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.about-tagline {
  color: #64748b;
  margin-bottom: 28px;
}

.about-section {
  text-align: left;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #1e293b;
}

.about-section h3 {
  font-size: 0.95rem;
  color: #00e5ff;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.about-section p {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
}

.about-section .note {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 8px;
  font-style: italic;
}

/* Responsive */
@media (max-width: 480px) {
  .action-btn {
    width: 62px;
    height: 62px;
    font-size: 0.65rem;
  }
  #joystick-zone {
    width: 120px;
    height: 120px;
  }
  #joystick-base {
    width: 95px;
    height: 95px;
  }
}