/* Wibi Puzzles: jigsaw player styles. Uses the site.css variables and the .btn / .chip classes. */
.jg { position: relative; margin: 0 auto; max-width: 1180px; }
.jg [hidden] { display: none !important; }
.jg-loading { padding: 48px 12px; text-align: center; font-weight: 800; }

.jg-pick { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.jg-h { margin-bottom: 4px; }
.jg-levels { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 12px; }
.jg-levels .chip { min-height: 48px; font-size: 1rem; padding: 10px 16px; }
.jg-levels .chip small { font-size: .8rem; }
.jg-levels .chip[aria-pressed="true"] small { color: #fff; opacity: .9; }
.jg-note { font-size: .95rem; margin: 0; }
.jg-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.jg-actions .btn { min-height: 46px; }

.jg-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.jg-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.jg-stat { background: var(--surface); border: 2px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: .95rem; }
.jg-stat b { font-family: var(--font-head); color: var(--purple); font-size: 1.05rem; }
.jg-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.jg-tools .chip { min-height: 44px; padding: 8px 14px; font-size: .92rem; }

.jg-stage { position: relative; width: 100%; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.jg-stage canvas { display: block; width: 100%; height: auto; touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.jg-stage canvas:active { cursor: grabbing; }

.jg-preview { position: absolute; inset: 0; z-index: 3; background: rgba(15, 17, 36, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 14px; }
.jg-preview img { display: block; max-width: 100%; max-height: 78%; width: auto; height: auto; border-radius: 14px; box-shadow: var(--shadow-lg); }

.jg-win { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; width: min(88%, 360px); background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px; text-align: center; }
.jg-win h3 { color: var(--purple); margin-bottom: 6px; }
.jg-win-time { font-size: 1.1rem; margin-bottom: 4px; }
.jg-win-best { font-size: .95rem; min-height: 1.2em; }
.jg-win .jg-actions { justify-content: center; }
.jg-win .btn { min-height: 46px; }

.jg-hint { font-size: .92rem; margin: 10px 0 0; }

/* full screen: the stage fits the height that is left under the toolbar */
.jg:fullscreen, .jg:-webkit-full-screen { background: var(--bg); padding: 12px; max-width: none; display: flex; flex-direction: column; justify-content: center; overflow: auto; }
.jg:fullscreen .jg-stage, .jg:-webkit-full-screen .jg-stage { width: min(100%, calc((100vh - 150px) * 1200 / 1260)); margin: 0 auto; }
.jg:fullscreen .jg-hint, .jg:-webkit-full-screen .jg-hint { display: none; }

@media (max-width: 480px) {
  .jg-pick { padding: 14px; }
  .jg-levels .chip { flex: 1 1 calc(50% - 10px); justify-content: center; }
  .jg-stat { font-size: .88rem; }
  .jg-tools .chip { flex: 1 1 calc(50% - 8px); justify-content: center; text-align: center; }
  .jg-tools { width: 100%; }
  .jg-stats { width: 100%; }
  .jg-win { width: 92%; padding: 14px; }
}

@media (min-width: 701px) {
  .jg-stage { max-width: calc((100vh - 240px) * 1200 / 1260); margin: 0 auto; }
}

