/* Prismbreak: the page around the glass. */

:root {
  --ink: #07030f;
  --text: #f4efff;
  --soft: rgba(244, 239, 255, .68);
  --accent: #7ef9ff;
  --hot: #ff5fd2;
  --display: "Unbounded", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --rainbow: linear-gradient(90deg, #ff5f6d, #ffc371, #f8ff7a, #6dffb1, #7ef9ff, #8f8bff, #ff5fd2, #ff5f6d);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--text);
  font-family: var(--display); font-weight: 500;
  touch-action: none; user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}

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

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

/* ---- corner chips -------------------------------------------------------- */

.corner {
  position: fixed; z-index: 6; display: flex; gap: 8px;
  top: calc(10px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left));
  transition: opacity .3s;
}
.chip {
  width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
  border: 1px solid rgba(244, 239, 255, .22); border-radius: 50%;
  background: rgba(7, 3, 15, .5); color: var(--text); cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.chip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chip:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#sound .mute { display: none; }
#sound[aria-pressed="false"] .wave { display: none; }
#sound[aria-pressed="false"] .mute { display: inline; }

/* ---- HUD ----------------------------------------------------------------- */

.hud {
  position: fixed; z-index: 4; inset: 0; pointer-events: none;
  opacity: 0; transition: opacity .35s;
}
.hud.is-on { opacity: 1; }
.score {
  position: absolute; left: 0; right: 0; text-align: center;
  top: calc(58px + env(safe-area-inset-top));
  font-size: clamp(26px, 8vw, 40px); font-weight: 800; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(126, 249, 255, .55), 0 2px 0 rgba(0, 0, 0, .5);
}
.chain {
  position: absolute; left: 0; right: 0; text-align: center;
  top: calc(106px + env(safe-area-inset-top));
  display: flex; gap: 8px; justify-content: center; align-items: baseline;
  opacity: 0; transform: scale(.8); transition: opacity .2s, transform .2s;
}
.chain.is-on { opacity: 1; transform: none; }
.chain b {
  font-size: 22px; font-weight: 800;
  background: var(--rainbow); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: slide 2.5s linear infinite;
}
.chain span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.chain.bump b { animation: slide 2.5s linear infinite, bump .25s ease-out; }
.side {
  position: absolute; right: calc(14px + env(safe-area-inset-right)); top: calc(14px + env(safe-area-inset-top));
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
.level {
  min-width: 34px; height: 34px; padding: 0 9px; display: grid; place-items: center;
  border: 1px solid rgba(244, 239, 255, .3); border-radius: 17px;
  font-size: 14px; font-weight: 800; background: rgba(7, 3, 15, .5);
}
.shields { display: flex; gap: 5px; }
.shields i {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--accent); opacity: .35; transition: all .25s;
}
.shields i.is-on { background: var(--accent); opacity: 1; box-shadow: 0 0 10px var(--accent); }

@keyframes slide { to { background-position: -200% 0; } }
@keyframes bump { from { transform: scale(1.6); } to { transform: none; } }

/* ---- floating words ------------------------------------------------------ */

.pops { position: fixed; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 13px; font-weight: 800; letter-spacing: .12em; white-space: nowrap;
  text-shadow: 0 0 12px currentColor, 0 1px 0 rgba(0, 0, 0, .6);
  animation: pop .9s ease-out forwards;
}
.pop.big { font-size: 22px; animation-duration: 1.3s; }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}

.banner {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: calc(14% + env(safe-area-inset-bottom));
  text-align: center; pointer-events: none; opacity: 0; transform: translateY(10px);
  transition: opacity .4s, transform .4s;
}
.banner.is-on { opacity: 1; transform: none; }
.banner small { display: block; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); margin-bottom: 4px; }
.banner b { font-size: 20px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

/* ---- title --------------------------------------------------------------- */

.title {
  position: fixed; z-index: 5; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 16px;
  background: radial-gradient(closest-side, rgba(7, 3, 15, .72), rgba(7, 3, 15, .35) 70%, transparent);
  transition: opacity .4s, transform .5s;
}
.title.is-off { opacity: 0; transform: scale(1.25); }
.name {
  margin: 0; display: flex; flex-direction: column; line-height: .95;
  font-size: clamp(44px, 15vw, 96px); font-weight: 800; letter-spacing: -.02em; text-transform: uppercase;
  background: var(--rainbow); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: slide 6s linear infinite;
  filter: drop-shadow(0 0 22px rgba(255, 95, 210, .45));
}
.tagline { margin: 16px 0 0; font-size: 13px; letter-spacing: .26em; text-transform: uppercase; color: var(--soft); }
.title-best { margin: 14px 0 0; font-size: 13px; letter-spacing: .12em; color: var(--soft); }
.title-best b { color: var(--text); font-weight: 800; }

.prompt {
  position: fixed; z-index: 5; left: 0; right: 0; margin: 0; text-align: center; pointer-events: none;
  bottom: calc(9% + env(safe-area-inset-bottom));
  font-size: 14px; font-weight: 800; letter-spacing: .3em; text-transform: uppercase;
  animation: breathe 1.6s ease-in-out infinite; transition: opacity .3s;
}
.prompt.is-off, .corner.is-off { opacity: 0; pointer-events: none; animation: none; }
@keyframes breathe { 50% { opacity: .35; } }

.hint {
  position: fixed; z-index: 5; left: 16px; right: 16px; margin: 0; text-align: center; pointer-events: none;
  bottom: calc(7% + env(safe-area-inset-bottom));
  font-size: 12px; line-height: 1.6; letter-spacing: .1em; text-transform: uppercase; color: var(--soft);
  opacity: 0; transition: opacity .4s;
}
.hint.is-on { opacity: 1; }
.hint b { color: var(--text); font-weight: 800; }

/* ---- game over ----------------------------------------------------------- */

.over, .paused {
  position: fixed; z-index: 7; inset: 0; display: grid; place-items: center; padding: 20px;
  background: rgba(7, 3, 15, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  animation: fade .35s ease-out;
}
@keyframes fade { from { opacity: 0; } }
.card {
  width: min(340px, 100%); padding: 24px 22px 20px; text-align: center;
  border-radius: 26px; background: rgba(14, 8, 30, .88);
  border: 1px solid rgba(244, 239, 255, .16);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 0 60px rgba(143, 139, 255, .25), 0 30px 80px rgba(0, 0, 0, .6);
  animation: rise .45s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes rise { from { transform: translateY(30px) scale(.94); opacity: 0; } }
.over-cause { margin: 0; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--soft); }
.over-new {
  display: inline-block; margin: 12px 0 0; padding: 4px 12px; border-radius: 99px;
  font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--ink);
  background: var(--rainbow); background-size: 200% 100%; animation: slide 2.5s linear infinite;
}
.over-score {
  margin: 8px 0 0; font-size: clamp(44px, 15vw, 60px); font-weight: 800; line-height: 1.05;
  font-variant-numeric: tabular-nums;
  background: var(--rainbow); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: slide 5s linear infinite;
}
.over-best { margin: 2px 0 0; font-size: 12px; letter-spacing: .12em; color: var(--soft); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.stats div { padding: 10px 4px; border-radius: 14px; background: rgba(244, 239, 255, .06); }
.stats dt { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--soft); }
.stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 800; }
.btn {
  display: block; width: 100%; padding: 13px 10px; border-radius: 16px; cursor: pointer;
  border: 1px solid rgba(244, 239, 255, .22); background: rgba(244, 239, 255, .06); color: var(--text);
  font: 800 13px var(--display); letter-spacing: .16em; text-transform: uppercase; text-decoration: none; text-align: center;
}
.btn-main { border: 0; color: var(--ink); font-size: 15px; padding: 16px 10px; background: var(--rainbow); background-size: 200% 100%; animation: slide 4s linear infinite; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

.paused { z-index: 8; align-content: center; gap: 8px; text-align: center; }
.paused b { font-size: 28px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.paused span { font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--soft); }

.fail {
  position: fixed; z-index: 9; inset: 0; margin: 0; display: grid; place-items: center; padding: 30px;
  text-align: center; line-height: 1.6; background: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  .name, .chain b, .btn-main, .over-score, .over-new, .prompt { animation: none; }
}

/* Wide screens have room for the score beside the chips. */
@media (min-width: 620px) {
  .score { top: calc(12px + env(safe-area-inset-top)); }
  .chain { top: calc(60px + env(safe-area-inset-top)); }
}
