/* css/play.css - play HUD, hint caption, results card, celebration, chapter banner, info/tip cards.
   Owner: WP-shell (SPEC section 14.4). The tray and board are canvas; nothing of them lives here. */

/* ---------------------------------------------------------------- HUD (SPEC 1.6: bar 56 px + safe inset; 44 px compact) */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: var(--z-hud); pointer-events: auto;
  height: calc(56px + var(--sat)); padding: var(--sat) calc(8px + var(--sar)) 0 calc(8px + var(--sal));
  display: flex; align-items: center; gap: 4px;
  background: linear-gradient(180deg, rgba(4, 6, 16, .9) 0%, rgba(4, 6, 16, .62) 68%, rgba(4, 6, 16, 0) 100%);
}
.hud-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 0 6px; }
/* the level name wraps onto a second line instead of being cut ("Fork in the ..."); only a third line would be clamped */
.hud-line1 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; font-size: 15px; font-weight: 650; line-height: 1.15; overflow: hidden; overflow-wrap: break-word; }
.hud-label { color: rgb(var(--ch-rgb)); font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-levelname { color: var(--ink); }
/* the sub-row (pieces, moves, best stars) wraps instead of running on under the hint button: its items are flex: none */
.hud-line2 { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px; min-width: 0; max-width: 100%; font-size: 12px; line-height: 1.2; color: var(--ink-dim); }
.hud-pieces { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }       /* the numbers are never ellipsized */
.hud-pieces.is-par { color: var(--gold); text-shadow: 0 0 12px rgb(var(--gold-rgb) / .5); }
.hp-short { display: none; align-items: center; gap: 3px; }
.hp-short .ic { width: 14px; height: 14px; opacity: .9; }
.hud-best { display: inline-flex; flex: none; gap: 1px; color: var(--gold); }
.hud-best .ic { width: 13px; height: 13px; }
.hud-best .ic:nth-child(n) { color: rgba(255, 255, 255, .2); }
.hud-best svg path[fill="currentColor"] { fill: var(--gold); }
.hud-btn .ic { width: 24px; height: 24px; }
.hint-pips { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; justify-content: center; gap: 3px; pointer-events: none; }
.hint-pips i { width: 4px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .22); }
.hint-pips i.on { background: var(--gold); box-shadow: 0 0 6px rgb(var(--gold-rgb) / .9); }
#hud-hint.is-armed { color: var(--gold); border-color: rgb(var(--gold-rgb) / .55); }
.btn-icon.is-pulse::after {
  content: ''; position: absolute; inset: -3px; border-radius: 17px; border: 2px solid var(--danger); pointer-events: none;
  animation: ringPulse 1.1s ease-out infinite;
}
@keyframes ringPulse { from { opacity: .95; transform: scale(.94); } to { opacity: 0; transform: scale(1.28); } }

/* ---------------------------------------------------------------- hint caption */
.hint-bubble {
  position: absolute; left: 50%; top: calc(var(--hud-bar) + 6px); z-index: calc(var(--z-hud) + 1); pointer-events: auto; cursor: pointer;
  display: none; align-items: center; gap: 10px; width: max-content; max-width: min(92vw, 460px); padding: 11px 16px 11px 12px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(40, 52, 108, .97), rgba(16, 24, 58, .98)); border: 1px solid rgb(var(--gold-rgb) / .5);
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .9), 0 0 30px -10px rgb(var(--gold-rgb) / .5);
  opacity: 0; transform: translate3d(-50%, -10px, 0) scale(.97); transition: opacity .22s ease, transform .34s var(--ease-back);
}
.hint-bubble.is-shown { display: flex; flex-wrap: wrap; }
.hint-bubble.is-open { opacity: 1; transform: translate3d(-50%, 0, 0); }
.hb-icon { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: rgb(var(--gold-rgb) / .16); color: var(--gold); }
.hb-icon .ic { width: 20px; height: 20px; }
.hb-text { flex: 1 1 0; min-width: 0; font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.hb-next { flex: 1 1 100%; padding-left: 40px; font-size: 12px; font-weight: 650; color: var(--gold); letter-spacing: .02em; margin-top: -4px; }

/* ---------------------------------------------------------------- results card (SPEC 1.5: slides up 280 ms easeOutCubic) */
.results { position: fixed; inset: 0; z-index: var(--z-results); display: none; pointer-events: none; }
.results.is-shown { display: flex; align-items: flex-end; justify-content: center; }
.results::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: linear-gradient(0deg, rgba(3, 4, 12, .78), rgba(3, 4, 12, .45) 55%, rgba(3, 4, 12, 0)); opacity: 0; transition: opacity .3s ease; } /* integration: short scrim, the solved board stays bright above the card */
.results.is-open::before { opacity: 1; }
.res-card {
  position: relative; width: min(100% - 24px, 440px); margin: 0 12px calc(var(--sab) + 12px); padding: 18px 18px 12px; border-radius: 28px; text-align: center; pointer-events: auto;
  background: linear-gradient(180deg, rgba(24, 36, 80, .97), rgba(9, 14, 36, .98)); border: 1px solid rgb(var(--ch-rgb) / .5);
  box-shadow: 0 -12px 70px -14px rgb(var(--ch-rgb) / .5), 0 24px 60px rgba(0, 0, 0, .6);
  transform: translate3d(0, 112%, 0); transition: transform .28s cubic-bezier(.215, .61, .355, 1);
  max-height: calc(100vh - 16px - var(--sab)); overflow: hidden;
}
.results.is-open .res-card { transform: none; }
.res-title { margin: 0 0 6px; font-size: 28px; font-weight: 850; letter-spacing: .02em; color: #fff; text-shadow: 0 0 22px rgb(var(--ch-rgb) / .8); }
.res-stars { display: flex; justify-content: center; gap: 8px; margin: 0 0 8px; }
.res-star { position: relative; width: 56px; height: 56px; display: block; }
.res-star .ic { position: absolute; inset: 0; width: 56px; height: 56px; }
.res-star .ic:first-child { color: rgba(255, 255, 255, .2); }
.res-star .ic:last-child { color: var(--gold); opacity: 0; filter: drop-shadow(0 0 10px rgb(var(--gold-rgb) / .85)); transform-origin: 50% 55%; }
.res-star.fly .ic:last-child { animation: starFly .38s var(--ease-back) both; }
@keyframes starFly {
  0% { opacity: 0; transform: translate3d(0, -90px, 0) scale(2.6) rotate(-28deg); }
  55% { opacity: 1; transform: translate3d(0, 5px, 0) scale(1.2) rotate(5deg); }
  100% { opacity: 1; transform: none; }
}
.res-line { margin: 2px 0 0; font-size: 14.5px; font-weight: 600; color: var(--ink-dim); min-height: 20px; font-variant-numeric: tabular-nums; }
.res-pieces.is-good { color: var(--gold); }
.res-crystal { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--ink-faint); }
.res-crystal .ic { width: 20px; height: 20px; opacity: .55; }
.res-crystal.is-lit { color: var(--crystal); }
.res-crystal.is-lit .ic { opacity: 1; filter: drop-shadow(0 0 8px rgb(var(--crystal-rgb) / .9)); }
.res-crystal.pop .ic { animation: popIn .5s var(--ease-back) both; }
@keyframes popIn { from { transform: scale(.2) rotate(-40deg); opacity: 0; } to { transform: none; opacity: 1; } }
.res-note { color: var(--gold); font-size: 13px; }
.res-note.is-hint { color: var(--ink-dim); }
#res-next { margin-top: 12px; min-height: 56px; }
.res-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.res-row.is-two { grid-template-columns: 1fr 1fr; }
.res-row .btn[hidden] { display: none; }
.res-row .btn { padding: 0 6px; min-height: 50px; font-size: 13px; gap: 6px; flex-direction: column; justify-content: center; }
.res-row .btn .ic { width: 20px; height: 20px; }
.res-row .bl { line-height: 1.1; text-align: center; }
.res-banner {
  margin: -18px -18px 12px; padding: 16px 16px 14px; border-radius: 28px 28px 0 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: linear-gradient(180deg, rgb(var(--ch-rgb) / .3), rgba(0, 0, 0, 0)); border-bottom: 1px solid rgb(var(--ch-rgb) / .3);
  opacity: 0; transform: scale(.94); transition: opacity .4s ease, transform .5s var(--ease-back);
}
.res-banner[hidden] { display: none; }
.res-banner.is-on { opacity: 1; transform: none; }
.rb-world { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgb(var(--ch-rgb)); }
.rb-title { font-size: 20px; font-weight: 820; }
.rb-stars { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650; }
.rb-stars .ic { width: 16px; height: 16px; color: var(--gold); }
.rb-status { margin-top: 4px; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .08); color: var(--ink-dim); }
.rb-status.is-open { background: rgba(107, 255, 176, .16); color: var(--ok); }

/* ---------------------------------------------------------------- play menu (sheet from style.css) */
.menu-list { display: flex; flex-direction: column; gap: 10px; padding: 6px 18px 20px; }
.btn-menu { justify-content: flex-start; min-height: 56px; gap: 14px; padding: 0 18px; width: 100%; }
.btn-menu.btn-primary { margin-bottom: 4px; }
.btn-menu.menu-redo { display: none; }
.btn-menu[disabled] { opacity: .4; }

/* ---------------------------------------------------------------- info / tip card */
.card-overlay { position: fixed; inset: 0; z-index: var(--z-sheet); display: none; align-items: center; justify-content: center; background: rgba(2, 4, 12, .6); cursor: pointer; opacity: 0; transition: opacity .25s ease; padding: calc(var(--sat) + 16px) 16px calc(var(--sab) + 16px); }
.card-overlay.is-shown { display: flex; }
.card-overlay.is-open { opacity: 1; pointer-events: auto; }
.info-card {
  width: min(100%, 380px); padding: 18px 18px 14px; border-radius: 26px; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #172250, var(--panel-solid)); border: 1px solid rgb(var(--ch-rgb) / .55);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .95), 0 0 50px -14px rgb(var(--ch-rgb) / .55);
  transform: translate3d(0, 24px, 0) scale(.94); transition: transform .38s var(--ease-back);
}
.card-overlay.is-open .info-card { transform: none; }
.card-eyebrow { display: inline-block; padding: 3px 11px; border-radius: 11px; background: rgb(var(--ch-rgb) / .16); color: rgb(var(--ch-rgb)); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.card-demo { display: block; width: 100%; aspect-ratio: 8 / 5; margin: 12px 0 12px; border-radius: 18px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); }
.card-title { margin: 0 0 6px; font-size: 22px; font-weight: 800; }
.card-text { margin: 10px 0 0; font-size: 15.5px; line-height: 1.4; color: var(--ink); }
.card-title + .card-text { margin-top: 0; }
.card-dismiss { display: block; margin-top: 14px; font-size: 12px; color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; font-weight: 650; }
