/* Slice It — a juicy fruit-slicer arcade toy. Full-bleed canvas, self-contained. */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0713;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}

#canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

/* ---------- top controls ---------- */
.controls {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  gap: 10px;
  align-items: center;
}

.best-chip {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: #ffd76a;
  background: rgba(20, 12, 30, 0.6);
  border: 1px solid rgba(255, 215, 106, 0.32);
  padding: 8px 14px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
}

.ctrl-btn {
  appearance: none;
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e9e2f2;
  background: rgba(20, 12, 30, 0.6);
  border: 1px solid rgba(233, 226, 242, 0.22);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 140ms ease, color 140ms ease;
}
.ctrl-btn:hover { border-color: rgba(233, 226, 242, 0.55); }
.ctrl-btn[aria-pressed="false"] { color: #8f86a0; }

/* ---------- start / game-over overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 40%, rgba(13, 8, 22, 0.9), rgba(4, 3, 10, 0.96));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 260ms ease;
}
.overlay.is-hidden { opacity: 0; pointer-events: none; }

.panel {
  text-align: center;
  max-width: 460px;
  padding: 34px 30px 32px;
  border-radius: 24px;
  background: rgba(15, 9, 22, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.72);
  animation: pop 320ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.panel__title {
  margin: 0 0 6px;
  font-size: clamp(2.8rem, 12vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.95;
  padding-bottom: 0.16em;
  background: linear-gradient(176deg, #fff2b8 0%, #ff9e4f 44%, #ff5470 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 6px 30px rgba(255, 94, 112, 0.4));
}

.panel__text {
  margin: 0 0 26px;
  font-size: clamp(0.98rem, 3.4vw, 1.12rem);
  line-height: 1.55;
  font-weight: 500;
  color: #cbc2da;
}
.panel__text strong { color: #ff7a8f; font-weight: 800; }

.play-btn {
  appearance: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #1a0a10;
  background: linear-gradient(180deg, #ffd76a, #ff9e4f);
  border: 0;
  padding: 16px 40px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 30px -6px rgba(255, 158, 79, 0.6);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(255, 158, 79, 0.7); }
.play-btn:active { transform: translateY(0); }

.panel__best {
  margin: 22px 0 0;
  min-height: 1.2em;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffd76a;
}

/* ---------- frame + hint (shared toy chrome) ---------- */
.frame { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(233, 226, 242, 0.5);
}
.frame__corner--tl { top: max(16px, env(safe-area-inset-top)); left: 18px; }
.frame__corner--tr { top: max(16px, env(safe-area-inset-top)); right: 18px; }
.frame__corner--bl { bottom: 16px; left: 18px; }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; }
.frame__corner a:hover { color: #ffd76a; }

.hint {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(233, 226, 242, 0.42);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 300ms ease;
}
.hint.is-gone { opacity: 0; }

@media (max-width: 430px) {
  .frame__corner--bl { font-size: 0.62rem; }
  .hint { font-size: 0.64rem; }
}
