/* Snake Uncoil: the app's night-sky page instead of the card games' felt. */

.su-page {
  --su-ink: #0b0e16;
  --su-accent: #ffc24b;
  background:
    radial-gradient(900px 420px at 50% 18%, rgba(90, 120, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #161c2c 0%, #0b0e16 100%);
}
.su-page .deal-pill { color: #2b1d02; background: linear-gradient(180deg, #ffd97a, var(--su-accent)); }

.su-hud { gap: 10px; }
.su-narrow { display: none; }
.su-hud-stars { display: inline-flex; gap: 1px; font-size: 16px; line-height: 1; letter-spacing: 0; }
.su-hud-stars span { color: rgba(255, 255, 255, 0.22); transition: color 300ms ease, transform 300ms ease; }
.su-hud-stars span.on { color: var(--su-accent); text-shadow: 0 0 10px rgba(255, 194, 75, 0.45); }

.su-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 4px;
  color: #2b1d02;
  background: var(--su-accent);
  border-radius: 999px;
  font: 800 11.5px/1 var(--display);
}
.bar-btn:disabled .su-count { background: rgba(255, 255, 255, 0.35); }

/* ---------- Stage ---------- */
/* The stage takes the board's own shape (--su-ar, set per level) up to the height of the
   window, so a tall board on a phone isn't floating in an empty box. */
.su-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--su-ar, 1);
  min-height: 300px;
  max-height: clamp(380px, calc(100vh - 70px - 64px - var(--strip, 0px) - 36px), 900px);
  max-height: clamp(380px, calc(100svh - 70px - 64px - var(--strip, 0px) - 36px), 900px);
  border-radius: 22px;
  background: radial-gradient(70% 60% at 50% 45%, rgba(120, 150, 255, 0.08), transparent 75%);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.su-board { display: block; width: 100%; height: 100%; touch-action: manipulation; cursor: pointer; }
.su-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.6);
  font: 800 18px "Baloo 2", var(--display);
  pointer-events: none;
}
.su-stage.is-ready .su-loading { display: none; }

.su-preview {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: grid;
  gap: 2px;
  justify-items: center;
  padding: 10px 26px 12px;
  color: #fff;
  background: rgba(20, 16, 44, 0.86);
  border: 1px solid rgba(184, 128, 255, 0.6);
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  animation: su-rise 360ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
.su-preview[hidden] { display: none; }
.su-preview-tag { color: #d6b8ff; font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.su-preview strong { font: 800 22px/1.1 "Baloo 2", var(--display); }
.su-preview-cta { color: var(--su-accent); font: 800 15px "Baloo 2", var(--display); animation: su-breathe 1.4s ease-in-out infinite; }

.su-coach, .su-toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 24px);
  margin: 0;
  padding: 9px 16px;
  color: #fff;
  background: rgba(14, 18, 32, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  pointer-events: none;
}
.su-coach { top: 10px; border-color: rgba(255, 194, 75, 0.55); }
.su-toast { bottom: 14px; }
.su-coach[hidden], .su-toast[hidden] { display: none; }
.su-toast.is-in { animation: su-rise 260ms cubic-bezier(0.2, 0.8, 0.3, 1); }

@keyframes su-rise { from { opacity: 0; translate: 0 12px; } to { opacity: 1; translate: 0 0; } }
@keyframes su-breathe { 50% { opacity: 0.6; } }

/* ---------- Dialogs ---------- */
.su-dialog h2 { font-family: "Baloo 2", var(--display); }
.su-stars { display: flex; justify-content: center; gap: 6px; margin: -6px 0 12px; font-size: 44px; line-height: 1; }
.su-stars span { color: rgba(21, 18, 14, 0.14); }
.su-stars span.on {
  color: #f2b52e;
  text-shadow: 0 3px 0 #b37518;
  animation: su-star 420ms cubic-bezier(0.2, 0.8, 0.3, 1.4) both;
  animation-delay: calc(var(--i) * 170ms + 120ms);
}
@keyframes su-star { from { transform: scale(1.9); opacity: 0; } 70% { transform: scale(0.9); opacity: 1; } to { transform: scale(1); } }
.su-link {
  display: block;
  margin: 12px auto 0;
  padding: 6px 10px;
  color: var(--muted);
  background: none;
  border: 0;
  font: 700 14.5px var(--display);
  cursor: pointer;
}
.su-link:hover, .su-link:focus-visible { color: var(--ink); text-decoration: underline; }

.su-levels { width: min(560px, 100%); }
.su-lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; margin-bottom: 4px; }
.su-lv {
  display: grid;
  gap: 1px;
  justify-items: center;
  padding: 8px 2px 6px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.su-lv b { font: 800 17px/1 "Baloo 2", var(--display); }
.su-lv small { min-height: 14px; color: #d99a1a; font-size: 11px; line-height: 1.2; letter-spacing: -0.05em; }
.su-lv.is-picture { background: #f5efff; border-color: rgba(134, 90, 220, 0.35); }
.su-lv.is-current { outline: 3px solid var(--su-accent); outline-offset: 1px; }
.su-lv.is-locked { opacity: 0.45; cursor: default; }
.su-lv:not(.is-locked):hover { border-color: var(--gold-deep); }

/* ---------- Layout ---------- */
@media (min-width: 1180px) {
  .game-wrap > .su-stage { grid-column: 1; }
}
@media (max-width: 760px) {
  .su-stage {
    max-height: clamp(340px, calc(100vh - 60px - 52px - 16px), 900px);
    max-height: clamp(340px, calc(100svh - 60px - 52px - 16px), 900px);
    border-radius: 16px;
  }
  .su-coach { font-size: 13px; }
  /* One row on a phone: the heading stays for screen readers and search, off screen. */
  .su-page .game-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .su-page .game-bar { flex-wrap: nowrap; gap: 6px; }
  .su-page .deal-pill { padding: 6px 10px; font-size: 12.5px; white-space: nowrap; }
  .su-page .su-hud { gap: 6px; padding: 6px 10px; white-space: nowrap; }
  .su-page .su-hud-stars { font-size: 13px; }
  .su-page .game-bar-actions { gap: 5px; }
  .su-page .bar-btn { min-width: 34px; padding: 6px 7px; }
  .su-narrow { display: inline; }
}
@media (max-width: 360px) {
  .su-page .su-hud-stars { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .su-preview, .su-toast.is-in, .su-stars span.on, .su-preview-cta { animation: none; }
}
