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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: #111;
  color: #f0f0f0;
  overflow: hidden;
}

#levelBar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.level-item {
  opacity: 0.3;
  transition: all 0.3s ease;
}

.level-item.active {
  opacity: 1;
  transform: scale(1.2);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}

.level-item.completed {
  opacity: 0.6;
}

.level-separator {
  opacity: 0.3;
  font-size: 0.6em;
}

.level-separator.completed {
  opacity: 0.6;
}

#hud {
  text-align: center;
  padding: 10px;
}

#score {
  font-size: 2em;
  font-weight: bold;
}

#level {
  font-size: 2em;
  text-align: center;
  margin-bottom: 10px;
}

#app {
  height: calc(100% - 55px);
  margin-top: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.hidden { display: none !important; }

h1 {
  font-size: 56px;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

h2 {
  font-size: 36px;
  margin-bottom: 16px;
}

.hint {
  margin-bottom: 24px;
  color: #bbb;
  line-height: 1.6;
}

kbd {
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 2px 8px;
  font-family: monospace;
}

#app button {
  background: #2d8cf0;
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-size: 18px;
  border-radius: 6px;
  cursor: pointer;
  margin: 6px;
  transition: background 0.15s;
}

#app button:hover { background: #1a7ae0; }

.credit {
  position: absolute;
  bottom: 16px;
  font-size: 12px;
  color: #888;
}

.credit a { color: #aaa; }

/* ── Game ── */
#game {
  padding: 0;
  position: relative;
}

#hud {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

#score {
  font-size: 48px;
  font-weight: bold;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

#board {
  position: relative;
  width: min(480px, 100vw);
  height: 100%;
  display: flex;
  background: #1a1a1a;
  overflow: hidden;
  border-left: 1px solid #333;
  border-right: 1px solid #333;
}

.column {
  flex: 1;
  position: relative;
  border-right: 1px solid #2a2a2a;
}

.column:last-child { border-right: none; }

.column.flash {
  background: rgba(45, 140, 240, 0.25);
}

.tile {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 110px;
  background: linear-gradient(180deg, #f0f0f0, #cfcfcf);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.tile.hit {
  background: linear-gradient(180deg, #2d8cf0, #1a5fb4);
}


#keyHints {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  display: flex;
  z-index: 4;
  pointer-events: none;
}

#keyHints span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #444;
  border-right: 1px solid #2a2a2a;
}

#keyHints span:last-child { border-right: none; }

/* ── Leaderboard ── */
#scoreList {
  list-style: none;
  counter-reset: rank;
  width: min(360px, 90%);
  margin-bottom: 24px;
}

#scoreList li {
  counter-increment: rank;
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1f1f1f;
  border-radius: 6px;
  margin-bottom: 6px;
}

#scoreList li::before {
  content: counter(rank) ".";
  color: #888;
  margin-right: 12px;
  width: 28px;
  text-align: right;
}

#scoreList .name {
  flex: 1;
  text-align: left;
  margin-left: 4px;
}

#scoreList .score { font-weight: bold; color: #2d8cf0; }

#scoreList .empty {
  text-align: center;
  color: #666;
  background: transparent;
}

#scoreList .empty::before { content: ""; }

/* ── Game over ── */
#nameEntry input {
  background: #222;
  border: 1px solid #444;
  color: #fff;
  padding: 12px;
  font-size: 18px;
  border-radius: 6px;
  margin: 6px;
  width: 200px;
}

#finalScore { color: #2d8cf0; font-weight: bold; }

/* ── Mobile fixes ── */
@media (max-width: 600px) {

  #app {
    margin-top: 0;
    height: 100dvh;
  }

  #game {
    height: 100dvh;
  }

  #hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 8px 4px;
    background: rgba(17, 17, 17, 0.85);
    z-index: 10;
    pointer-events: none;
  }

  #levelBar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 1px;
    font-size: 0.7em;
    width: 100%;
    overflow: hidden;
    margin-bottom: 0;
  }

  .level-separator {
    font-size: 0.4em;
    letter-spacing: -3px;
    opacity: 0.3;
  }

  #score {
    font-size: 28px;
    line-height: 1;
    text-shadow: none;
  }

  #board {
    width: 100vw;
    height: 100dvh;
  }

  #keyHints {
    height: 80px;
  }

  #hitline {
    bottom: 80px;
  }

  #keyHints span {
    font-size: 18px;
  }
}
