/* ===== Prism — game-specific styles =====
   Generic chrome (bar, glass, modals, toast) comes from shared/css/glass.css.
   This file re-tints the shell to the optics-lab palette and sizes the square
   canvas stage. All board drawing lives in prism.js. */

:root {
  --accent-1: #2ee6ff;
  --accent-2: #66e6c0;
  --on-accent: #03161c;
  --bg-1: #0a1735;
  --bg-2: #04070f;
  --bg-glow-a: rgba(46, 230, 255, .22);
  --bg-glow-b: rgba(102, 230, 192, .13);
}

/* Class-level display rules would beat the UA [hidden] rule otherwise. */
[hidden] { display: none !important; }

.c-app { --fpad: clamp(10px, 3vw, 28px); }
.c-table {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Stage ---------- */
.pr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.pr-stage {
  position: relative;
  /* Square stage: never taller than the viewport budget above the tip line. */
  width: clamp(260px, min(92vw, calc(100dvh - 232px)), 680px);
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  background: rgba(4, 10, 20, .55);
  border: 1px solid var(--glass-line);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .12);
  overflow: hidden;
}
.pr-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  cursor: pointer;
}
.pr-tip {
  margin: 11px 0 0;
  max-width: 60ch;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--c-muted);
}

/* ---------- Chamber cleared ---------- */
.pr-win {
  width: min(94vw, 400px);
  padding: 26px 24px 22px;
  text-align: center;
}
.pr-win__spark svg {
  width: 66px;
  height: 66px;
  display: block;
  margin: 0 auto 2px;
  filter: drop-shadow(0 0 14px rgba(46, 230, 255, .35));
}
.pr-win h2 { margin: 4px 0 2px; font-size: 24px; letter-spacing: -.01em; }
.pr-win__name {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-2);
}
.pr-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.pr-stars svg {
  width: 30px;
  height: 30px;
  fill: transparent;
  stroke: rgba(255, 223, 107, .45);
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: fill .2s ease;
}
.pr-stars svg.is-on {
  fill: var(--gold);
  stroke: #fff3bd;
  filter: drop-shadow(0 0 8px rgba(255, 223, 107, .5));
}
.pr-win__stats { margin: 0; color: var(--c-muted); font-size: 14px; line-height: 1.6; }
.pr-win__stats b { color: #fff; }
.pr-win__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 18px;
}

/* ---------- Chamber picker ---------- */
.pr-levels-panel { width: min(94vw, 560px); }
.pr-levels {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 4px 0 14px;
}
.pr-lvl {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 2px;
  border-radius: 11px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--c-text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.pr-lvl:hover { background: var(--glass-hi); }
.pr-lvl:active { transform: translateY(1px); }
.pr-lvl:focus-visible { outline: none; box-shadow: var(--ring); }
.pr-lvl small {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--c-muted);
}
.pr-lvl.is-done { border-color: rgba(102, 230, 192, .45); }
.pr-lvl.is-done small { color: #8ef0d2; }
.pr-lvl.is-current { box-shadow: inset 0 0 0 2px var(--accent-1); }
.pr-lvl.is-locked { opacity: .34; cursor: not-allowed; }
.pr-lvl.is-locked:hover { background: var(--glass); }
.pr-lock { width: 11px; height: 11px; stroke: var(--c-muted); fill: none; stroke-width: 2; }

/* ---------- Small screens ---------- */
@media (max-width: 520px) {
  .pr-levels { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .pr-win { padding: 22px 16px 18px; }
  .pr-win__actions .c-btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .pr-stars svg, .pr-lvl { transition: none; }
}
