/* Jigsaw Puzzle — Game Anything
 * tokens: --ss-* */

#jpPlayShell.game-worlds-play-shell {
  min-height: 0;
  box-sizing: border-box;
  background:
    radial-gradient(ellipse 110% 80% at 18% 12%, rgba(251, 191, 36, 0.1) 0%, transparent 52%),
    radial-gradient(ellipse 110% 80% at 86% 88%, rgba(56, 189, 248, 0.1) 0%, transparent 52%),
    linear-gradient(165deg, #05070c 0%, #0c1118 42%, #080b10 100%);
}

#jpPlayShell.game-worlds-play-shell:not([data-ss-sized]) {
  height: 0;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

.ss-outer-shell {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

:root {
  --ss-panel: rgba(15, 23, 42, 0.78);
  --ss-border: rgba(56, 189, 248, 0.22);
  --ss-text: #f1f5f9;
  --ss-muted: #94a3b8;
  --ss-gold: #fbbf24;
  --ss-sky: #38bdf8;
  --ss-radius: 18px;
  --ss-font: "Segoe UI", system-ui, sans-serif;
}

.ga-casual-scope.ss-app {
  --ss-panel: var(--ga-surface);
  --ss-border: var(--ga-border);
  --ss-text: var(--ga-text);
  --ss-muted: var(--ga-muted);
  --ga-accent-game: #fbbf24;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body.ss-standalone {
  height: 100%;
  width: 100%;
  background: #000;
}

body.ss-standalone {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  font-family: var(--ss-font);
  color: var(--ss-text);
  background: #000;
  -webkit-tap-highlight-color: transparent;
}

.ss-app {
  position: relative;
  min-height: 100%;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 5vw, 30px)
    max(30px, env(safe-area-inset-bottom));
  font-family: var(--ss-font);
  color: var(--ss-text);
}

#jpPlayShell .ss-app.ss-gw {
  align-items: stretch;
  padding: clamp(0.55rem, 2vw, 0.85rem) clamp(0.65rem, 2.5vw, 1rem);
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ss-screen {
  width: min(960px, 100%);
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  justify-content: center;
  align-items: center;
}

.ss-screen.ss-screen-active {
  display: flex;
  flex-direction: column;
}

.ss-screen-play.ss-screen-active {
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
}

#jpPlayShell .ss-screen-play.ss-screen-active {
  flex: 1 1 auto;
  min-height: 0;
  max-width: none;
}

#jpPlayShell .ss-screen-play.ss-screen-active .ss-play {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  width: 100%;
}

body.ss-standalone .ss-app {
  padding-bottom: 8px;
  overflow: hidden;
}

body.ss-standalone .ss-screen-play.ss-screen-active .ss-play {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

#ss-app.ss-mode-overlay {
  position: relative;
}

#ss-app.ss-mode-overlay #ss-screen-play.ss-screen-active {
  display: flex;
}

#ss-app.ss-mode-overlay #ss-screen-play .ss-play-head {
  visibility: hidden;
  pointer-events: none;
}

#ss-app.ss-mode-overlay #ss-screen-play .ss-board-wrap {
  pointer-events: none;
}

.ss-screen-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  width: 100% !important;
  max-width: none !important;
  flex: none !important;
  margin: 0;
  padding: clamp(12px, 3vw, 24px);
  box-sizing: border-box;
  background: rgba(2, 6, 23, 0.46);
  backdrop-filter: blur(11px) saturate(1.06);
  -webkit-backdrop-filter: blur(11px) saturate(1.06);
}

.ss-screen-overlay.ss-screen-active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#ss-screen-menu.ss-screen,
#ss-screen-difficulty.ss-screen,
#ss-screen-how.ss-screen {
  width: 100%;
  max-width: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#ss-screen-menu .ss-panel,
#ss-screen-difficulty .ss-panel,
#ss-screen-how .ss-panel {
  width: min(var(--ga-puzzle-menu-max), 100%);
  max-width: min(var(--ga-puzzle-menu-max), 100%);
  margin-inline: auto;
}

.ss-screen.ss-screen-active .ss-panel {
  animation: ss-panel-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ss-panel-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-screen.ss-screen-active .ss-panel {
    animation: none;
  }
}

.ss-panel {
  width: min(520px, 100%);
  padding: clamp(22px, 4.5vw, 34px) clamp(20px, 4vw, 30px);
  border-radius: var(--ss-radius);
  background: var(--ss-panel);
  border: 1px solid var(--ss-border);
  box-shadow: 0 24px 56px rgba(2, 6, 23, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.ss-panel h1,
.ss-panel h2 {
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ss-panel h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  background: linear-gradient(102deg, #fbbf24 0%, #f8fafc 45%, #38bdf8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ss-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #fbbf24;
}

.ss-lead {
  margin: 0 0 20px;
  line-height: 1.55;
  color: var(--ss-muted);
  font-size: 0.98rem;
}

.ss-muted {
  color: var(--ss-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.ss-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ss-btn {
  border: 1px solid var(--ss-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ss-text);
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
}

.ss-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.ss-btn:active {
  transform: scale(0.98);
}

.ss-btn-primary {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(135deg, #b45309, #fbbf24 48%, #38bdf8);
  color: #0f172a;
  box-shadow: 0 10px 32px rgba(251, 191, 36, 0.28);
}

.ss-btn-ghost {
  background: transparent;
  margin-top: 8px;
}

.ss-diff-grid {
  display: grid;
  gap: 10px;
  margin: 16px 0 8px;
}

.ss-diff-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--ss-border);
  background: rgba(15, 23, 42, 0.65);
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.ss-diff-card:hover {
  border-color: rgba(251, 191, 36, 0.45);
}

.ss-diff-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.ss-diff-meta {
  color: var(--ss-muted);
  font-size: 0.88rem;
}

.ss-list {
  margin: 0 0 18px;
  padding-left: 1.15rem;
  color: var(--ss-muted);
  line-height: 1.55;
}

.ss-list li {
  margin-bottom: 8px;
}

.ss-list strong {
  color: var(--ss-text);
}

.ss-play {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  width: 100%;
}

.ss-play-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
}

.ss-hud-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ss-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.7);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ss-muted);
}

.ss-pill-accent {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

.ss-diff-wrap {
  display: inline-flex;
  align-items: center;
}

.ss-diff-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 30px;
  padding: 4px 28px;
  text-align: center;
  text-align-last: center;
  -webkit-text-align-last: center;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background:
    rgba(15, 23, 42, 0.78)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%94a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  color: var(--ss-muted, #94a3b8);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.ss-diff-select:hover:not(:disabled) {
  border-color: rgba(148, 163, 184, 0.45);
  color: var(--ss-text, #e2e8f0);
}

.ss-diff-select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ss-diff-select:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.55);
  outline-offset: 2px;
}

.ss-diff-select option {
  background: #0f172a;
  color: #e2e8f0;
  text-align: center;
}

.ss-hud-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ss-tool {
  border: 1px solid var(--ss-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ss-text);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.ss-tool-ghost {
  background: transparent;
}

.ss-icon-btn {
  border: 1px solid var(--ss-border);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  min-width: 34px;
  min-height: 34px;
  cursor: pointer;
  font-size: 0.95rem;
}

.ss-board-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ss-hint-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.ss-hint-close:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(251, 191, 36, 0.55);
  color: #fde68a;
}

.ss-hint-close[hidden] {
  display: none !important;
}

.ss-board {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.ss-board:active {
  cursor: grabbing;
}

.ss-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
}

#jpPlayShell .ss-overlay.ga-game-overlay,
.ss-app .ss-overlay.ga-game-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  border-radius: inherit;
}

.ss-overlay[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  .ss-play-head {
    flex-direction: column;
    align-items: stretch;
  }
}

.game-worlds-body #jpPlayShell #ss-screen-menu.ss-screen-active,
.game-worlds-body #jpPlayShell #ss-screen-difficulty.ss-screen-active,
.game-worlds-body #jpPlayShell #ss-screen-how.ss-screen-active,
.game-worlds-body .game-worlds-play-shell #ss-screen-menu.ss-screen-active,
.game-worlds-body .game-worlds-play-shell #ss-screen-difficulty.ss-screen-active,
.game-worlds-body .game-worlds-play-shell #ss-screen-how.ss-screen-active {
  width: 100%;
  align-items: center;
  justify-content: center;
}
