:root {
  --tile-size: 72px;
  --gap: 10px;
  --max-width: 760px;
  --accent: #0a61ff;
}

/* RESET */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Trebuchet MS", Arial, sans-serif;
  background: linear-gradient(180deg, #bfe9ff, #9fcaff);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  color: #07223a;
}

/* TOP BAR */
.topbar {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.topbar .center h1 {
  font-size: 22px;
  font-weight: 800;
}

.map-toggle {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* HIDDEN UTILITY */
.hidden { display: none !important; }

/* MAP WRAPPER */
.map-wrapper {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.18);
  margin-bottom: 20px;
  opacity: 0;
  transform: translateY(30px) scale(0.92);
  transition: opacity .35s ease, transform .35s ease;
}

.map-wrapper.show {
  opacity: 1;
  transform: translateY(0px) scale(1);
}

/* CLOSE MAP BUTTON */
.close-map {
  background: #ff3d3d;
  border: 0;
  padding: 6px 14px;
  border-radius: 10px;
  color: white;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 8px;
}

/* CLOUD LAYER */
.cloud-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 120px;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: -20px; /* clouds overlap */
}

.cloud {
  opacity: 0;
  transition: opacity 0.7s ease, transform 1s ease;
  will-change: transform, opacity;
  background-repeat: no-repeat;
  background-size: contain;
}

.c1 { width: 140px; animation: float1 6s ease-in-out infinite; background-image: url('assets/clouds/cloud1.png'); }
.c2 { width: 180px; animation: float2 7s ease-in-out infinite; background-image: url('assets/clouds/cloud2.PNG'); }
.c3 { width: 120px; animation: float3 5s ease-in-out infinite; background-image: url('assets/clouds/cloud3.PNG'); }

@keyframes float1 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes float2 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes float3 { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* MAP SCROLL AREA */
.map-scroll {
  display: flex;
  gap: 40px;
  align-items: center;
  padding: 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  position: relative;
  z-index: 3;
}

/* LEVEL BUBBLE */
.level-bubble {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff, #e4f2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 12px 22px rgba(6,40,120,0.12);
  position: relative;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}

.level-bubble:hover {
  transform: scale(1.07);
  box-shadow: 0 16px 34px rgba(0,0,0,0.25);
}

.level-bubble.locked {
  opacity: 0.45;
  cursor: default;
  filter: grayscale(0.2);
}

.level-bubble.current {
  background: linear-gradient(180deg, #ffd37a, #ffb13d);
  color: #062;
  transform: scale(1.12);
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

/* CHARACTER ICON */
.char-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 4px;
}

/* BUBBLE NUMBER */
.bubble-number {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 16px;
  font-weight: 900;
  color: #012;
}

/* CONNECTING LINE BETWEEN BUBBLES */
.path-line {
  height: 6px;
  width: 40px;
  background: linear-gradient(90deg, #ffd37a, #ffb13d);
  border-radius: 6px;
}

/* MAP BOTTOM HINT */
.map-bottom-hint {
  text-align: center;
  font-size: 14px;
  margin-top: 12px;
  color: #033;
  font-weight: 700;
}

/* GAME AREA */
.game-area {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* BOARD WRAPPER */
#boardWrap {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(235,250,255,0.9));
  padding: 16px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(4,38,86,0.12);
  margin-bottom: 16px;
}

#board {
  position: relative;
  transition: width .18s, height .18s;
}

/* TILE */
.tile {
  position: absolute;
  width: var(--tile-size);
  height: var(--tile-size);
  background: linear-gradient(180deg, #0a61ff, #0744c6);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 26px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
  transition: transform .18s cubic-bezier(.2,.9,.2,1), box-shadow .12s;
}

.tile:hover { transform: translateY(-6px); box-shadow: 0 18px 30px rgba(0,0,0,0.18); }
.tile.empty { background: transparent; border: 2px dashed rgba(0,0,0,0.08); box-shadow: none; color: transparent; }
.tile.locked { background: linear-gradient(180deg, #757575, #555); }
.tile.ice { background: linear-gradient(180deg, #b2ecff, #76d9ff); color: #012a3a; }

.badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
  color: white;
}

/* POWERUP BUTTONS */
.powerups { display: flex; gap: 12px; margin-bottom: 12px; }
.pbtn { background: var(--accent); color: #fff; border: 0; padding: 10px 14px; border-radius: 12px; font-weight: 700; cursor: pointer; box-shadow: 0 8px 18px rgba(0,0,0,0.08); }

/* MAIN BUTTONS */
.controls { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.big { background: #0a47c9; color: white; border: 0; padding: 12px 26px; border-radius: 14px; font-size: 18px; font-weight: 800; cursor: pointer; }

/* TOAST MESSAGE */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
  z-index: 99;
}

/* RESPONSIVE */
@media (max-width:520px) {
  :root { --tile-size: 56px; --gap: 8px; }
  .level-bubble { width: 75px; height: 75px; }
  .char-icon { width: 40px; height: 40px; }
  .bubble-number { font-size: 14px; }
}
