* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --accent: #1fd1ff;
  --accent2: #ff2bd6;
}

html, body {
  width: 100%; height: 100%;
  background: #0a0a12;
  overflow: hidden;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#app {
  position: relative;
  width: 100vw; height: 100vh;
  overflow: hidden;
}

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

/* ===== Screens ===== */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: radial-gradient(circle at 50% 40%, rgba(30,40,90,0.55), rgba(6,6,16,0.92));
  backdrop-filter: blur(2px);
}
.hidden { display: none !important; }

.menu-inner {
  text-align: center;
  animation: pop .4s cubic-bezier(.2,1.4,.4,1);
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

.logo {
  font-size: clamp(38px, 9vw, 96px);
  font-weight: 900;
  letter-spacing: 2px;
  line-height: .9;
  text-shadow: 0 0 24px rgba(31,209,255,.55), 4px 4px 0 rgba(0,0,0,.35);
  color: #fff;
}
.logo span {
  display: block;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255,43,214,.5));
}
.logo.win span { background: linear-gradient(90deg,#ffe259,#ffa751); -webkit-background-clip:text; background-clip:text; }

/* ===== Level card ===== */
.level-card {
  margin: 34px auto 26px;
  width: min(440px, 86vw);
  background: linear-gradient(160deg, rgba(40,52,110,.75), rgba(20,24,54,.85));
  border: 2px solid rgba(120,160,255,.35);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.5), inset 0 0 30px rgba(80,120,255,.1);
}
.level-preview {
  width: 96px; height: 96px;
  border-radius: 12px;
  background: linear-gradient(160deg, #2b6dff, #7b2bff);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 0 22px rgba(0,0,0,.4);
}
.cube-demo {
  position: absolute;
  left: 50%; bottom: 16px;
  width: 28px; height: 28px;
  margin-left: -14px;
  background: #ffe259;
  border: 3px solid #111;
  border-radius: 5px;
  animation: hop 1s ease-in-out infinite;
}
.cube-demo::after {
  content: ""; position: absolute; inset: 5px;
  border: 2px solid rgba(0,0,0,.35); border-radius: 2px;
}
@keyframes hop {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-34px) rotate(180deg); }
}
.level-meta { text-align: left; }
.level-name { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.level-diff { margin-top: 8px; opacity: .85; font-size: 14px; }
.level-best { margin-top: 4px; opacity: .75; font-size: 14px; }
.stars { color: #ffe259; }

/* ===== Buttons ===== */
.big-btn {
  margin: 8px 6px 0;
  padding: 15px 46px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #06121f;
  background: linear-gradient(180deg, #57e6ff, #1fb6e6);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 #0e7ea0, 0 10px 24px rgba(0,0,0,.4);
  transition: transform .08s, box-shadow .08s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #0e7ea0, 0 6px 16px rgba(0,0,0,.4); }
.big-btn.ghost {
  color: #fff;
  background: linear-gradient(180deg, #5566aa, #3a4680);
  box-shadow: 0 6px 0 #232a52, 0 10px 24px rgba(0,0,0,.4);
}
.big-btn.ghost:active { box-shadow: 0 2px 0 #232a52; }

.hint { margin-top: 26px; opacity: .7; font-size: 13px; }
.hint b { color: var(--accent); }
.credit { margin-top: 10px; opacity: .4; font-size: 12px; }

/* ===== HUD ===== */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 6;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.progress-wrap {
  width: min(620px, 80vw);
  display: flex; align-items: center; gap: 10px;
}
.progress-bar {
  flex: 1;
  height: 16px;
  background: rgba(0,0,0,.45);
  border: 2px solid rgba(255,255,255,.5);
  border-radius: 10px;
  overflow: hidden;
}
#progressFill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #6dff7b, #1fd1ff);
  border-radius: 8px;
  transition: width .08s linear;
}
#progressPct { font-weight: 800; font-size: 14px; min-width: 42px; text-shadow: 0 2px 4px #000; }
#attempts { font-weight: 700; opacity: .85; text-shadow: 0 2px 4px #000; font-size: 14px; }

.complete-stats { margin: 30px 0; font-size: 20px; line-height: 1.8; }
.complete-stats b { color: var(--accent); }
