/* SlideTiles — phone-first styles. No external fonts or images. */
* { box-sizing: border-box; }
:root { --banner-h: 0px; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  padding-bottom: var(--banner-h);
  min-height: 100vh;
}
.top { text-align: center; padding: 14px 12px 4px; }
.top h1 { margin: 0; font-size: 30px; letter-spacing: 0.5px; color: #fff; }
.tag { margin: 4px 0 0; color: #94a3b8; font-size: 14px; }

.diff { display: flex; gap: 8px; justify-content: center; padding: 12px 12px 4px; }
.diff-btn {
  flex: 1; max-width: 130px; min-height: 48px; border: 2px solid #334155;
  background: #1e293b; color: #e2e8f0; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.diff-btn.active { background: #4f46e5; border-color: #818cf8; color: #fff; }

.stats {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; max-width: 440px; margin: 0 auto;
}
.stat { flex: 1; text-align: center; background: #1e293b; border-radius: 10px; padding: 6px 2px; }
.stat .label { display: block; font-size: 11px; color: #94a3b8; text-transform: uppercase; }
.stat strong { font-size: 18px; color: #fff; }
.new-btn {
  min-height: 48px; padding: 0 14px; border: none; border-radius: 12px;
  background: #059669; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}

.board-wrap {
  width: min(92vw, 420px); margin: 12px auto 0; aspect-ratio: 1 / 1;
  position: relative;
}
#fifteen { position: relative; width: 100%; height: 100%; }
/* Engine tiles: class "slot", inline size/position from the engine. */
#fifteen .slot {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; user-select: none; -webkit-user-select: none;
  font-size: clamp(20px, 8vw, 34px); touch-action: manipulation;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.mode { display: flex; gap: 8px; justify-content: center; padding: 8px 12px 0; }
.mode-btn {
  flex: 1; max-width: 130px; min-height: 48px; border: 2px solid #334155;
  background: #1e293b; color: #e2e8f0; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.mode-btn.active { background: #4f46e5; border-color: #818cf8; color: #fff; }
.load-btn {
  flex: 1; max-width: 130px; min-height: 48px; border: none; border-radius: 12px;
  background: #059669; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.load-btn.hidden, .pic-hint.hidden { display: none; }
.actions { display: flex; gap: 8px; justify-content: center; padding: 10px 12px 0; }
.solve-btn {
  flex: 1; max-width: 200px; min-height: 48px; border: 2px solid #334155;
  background: #1e293b; color: #e2e8f0; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.solve-btn.stop { background: #7f1d1d; border-color: #ef4444; color: #fff; }
.solve-btn.hidden { display: none; }
.peek-btn {
  flex: 1; max-width: 200px; min-height: 48px; border: 2px solid #818cf8;
  background: #4f46e5; color: #fff; border-radius: 12px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.peek-btn.hidden { display: none; }
/* Peek overlay: same fixed backdrop as .overlay, above the win overlay
   (z-60 vs z-50) so it can never sit underneath it. The picture is the
   stored downscaled JPEG — no layout shift, the board stays put below. */
.peek-overlay { z-index: 60; }
.peek-card { text-align: center; width: min(92vw, 420px); }
.peek-img {
  width: 100%; max-height: 70vh; object-fit: contain;
  border-radius: 12px; display: block; margin: 0 auto;
}
.pic-hint { text-align: center; color: #94a3b8; font-size: 13px; padding: 8px 20px 0; margin: 0; }

.hint { text-align: center; color: #94a3b8; font-size: 13px; padding: 10px 20px; margin: 0; }
.bests, .about { max-width: 440px; margin: 0 auto; padding: 4px 16px 16px; }
.bests h2, .about h2 { font-size: 17px; color: #fff; margin: 10px 0 6px; }
.bests ul { list-style: none; margin: 0; padding: 0; color: #cbd5e1; font-size: 14px; }
.bests li { padding: 3px 0; }
.about p { color: #cbd5e1; font-size: 14px; line-height: 1.5; }
.about .credit { color: #64748b; font-size: 12px; }

.overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, 0.82);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.overlay.hidden { display: none; }
.overlay-card {
  background: #1e293b; border-radius: 20px; padding: 28px 24px;
  text-align: center; width: min(92vw, 360px);
}
.overlay-card h2 { margin: 0 0 8px; color: #fff; font-size: 26px; }
.win-stats { font-size: 17px; color: #e2e8f0; }
.win-best { color: #fbbf24; font-size: 14px; min-height: 20px; }
.primary-btn, .secondary-btn {
  display: block; width: 100%; min-height: 52px; margin-top: 12px;
  border-radius: 12px; font-size: 17px; font-weight: 700; cursor: pointer;
}
.primary-btn { background: #4f46e5; color: #fff; border: none; }
.secondary-btn { background: transparent; color: #e2e8f0; border: 2px solid #475569; }
