/* Jigsaw Puzzles: the table, the frame, the pieces and the tray are one canvas filling the stage; the HUD, the box lid,
   the view buttons, the tool bar, the tray filters, the coach line, the result card and the panels are HTML over it */
.jg { display: flex; flex-direction: column; color: #e4ecff; --jg-hud: 54px; --jg-bar: 64px; --jg-low: 64px; --jg-accent: #55d6ff; --jg-warm: #ffd166; --jg-coral: #ff9a6b;
  --jg-line: #1c2b4a; --jg-glass: rgba(8,13,30,0.84); }
.jg-stage { position: relative; width: 100%; height: min(86vh, 800px); min-height: 480px; background: #0b1328; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; outline: none; }
@media (max-width: 600px) { .jg-stage { height: auto; aspect-ratio: 3 / 4.4; max-height: 88vh; min-height: 0; } }
#jg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: grab; }
#jg-canvas.grabbing { cursor: grabbing; }
#jg-canvas.over { cursor: pointer; }
#jg-canvas:focus-visible { box-shadow: inset 0 0 0 2px rgba(85,214,255,.5); }

/* the progress line along the top */
.jg-prog { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 4; background: rgba(255,255,255,.05); pointer-events: none; }
.jg-prog i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #55d6ff, #ffd166); box-shadow: 0 0 10px rgba(255,209,102,.6); transition: width .35s ease; }

/* HUD */
.jg-hud { position: absolute; left: 0; right: 0; top: 3px; height: var(--jg-hud); display: flex; align-items: center; gap: 14px; padding: 0 8px 0 10px; z-index: 3; pointer-events: none; }
.jg-hud > * { pointer-events: auto; }
.jg-pz { flex: 0 1 auto; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; min-width: 96px; max-width: 46vw; height: 44px; padding: 2px 26px 2px 10px; border-radius: 12px;
  border: 1px solid var(--jg-line); background: var(--jg-glass); color: #fff; cursor: pointer; font: inherit; line-height: 1.05; touch-action: manipulation; text-align: left; transition: border-color .15s; }
.jg-pz-lv { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--jg-warm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.jg-pz-n { font-size: 17px; font-weight: 900; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.jg-lv-s { display: none; }
.jg-pz-dd { position: absolute; right: 6px; top: 50%; width: 16px; height: 16px; margin-top: -8px; fill: none; stroke: #8aa3c4; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .jg-pz:hover { border-color: var(--jg-accent); } }
.jg-pz:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-stat { display: flex; flex-direction: column; line-height: 1.05; flex: none; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.jg-k { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: #a9bddb; }
.jg-stat b { font-size: 21px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; white-space: nowrap; }
.jg-pct b { display: inline-block; transition: transform .16s cubic-bezier(.3,1.6,.5,1), color .16s; transform-origin: center; }
.jg-pct b.pop { transform: scale(1.14); color: var(--jg-warm); }
.jg-time b { font-size: 17px; margin-top: 3px; color: #e4ecff; }
.jg-notimer .jg-time { display: none; }
.jg-sp { flex: 1 1 auto; }
.jg-tool { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 1px solid var(--jg-line); background: var(--jg-glass);
  color: #cfdcf5; cursor: pointer; touch-action: manipulation; padding: 0; transition: border-color .15s, color .15s; }
.jg-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jg-tool .spk { fill: currentColor; stroke: none; }
@media (hover: hover) { .jg-tool:hover { border-color: var(--jg-accent); color: #fff; } }
.jg-tool::after { content: ""; position: absolute; inset: -2px; border-radius: 13px; }
.jg-tool:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
#jg-sound .off { display: none; } #jg-sound[aria-pressed="true"] { color: #6c7fa0; } #jg-sound[aria-pressed="true"] .on { display: none; } #jg-sound[aria-pressed="true"] .off { display: inline; }
.jg-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--jg-coral); box-shadow: 0 0 8px var(--jg-coral); }
.jg-dot[hidden] { display: none; }

/* the box lid: the picture to work from, top left */
.jg-lid[hidden] { display: none; }
.jg-lid { position: absolute; left: 10px; top: calc(var(--jg-hud) + 10px); z-index: 3; width: min(38%, 240px); padding: 6px; border-radius: 14px; background: var(--jg-glass); border: 1px solid var(--jg-line);
  box-shadow: 0 12px 30px rgba(0,0,0,.45); animation: jg-in .2s ease-out; }
.jg-lid.big { width: min(calc(100% - 70px), 560px); }
.jg-lid-pic { display: block; width: 100%; padding: 0; border: 0; border-radius: 9px; overflow: hidden; background: #050914; cursor: zoom-in; line-height: 0; }
.jg-lid.big .jg-lid-pic { cursor: zoom-out; }
.jg-lid-pic img { width: 100%; height: auto; display: block; }
.jg-lid-pic:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-lid-row { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.jg-lid-row b { flex: 1 1 auto; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #a9bddb; padding-left: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-lid-btn { position: relative; flex: none; height: 26px; min-width: 26px; padding: 0 8px; border-radius: 8px; border: 1px solid #263a63; background: #0c1630; color: #cfdcf5; font: 700 11.5px system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.jg-lid-btn[aria-pressed="true"] { background: rgba(255,209,102,.16); border-color: rgba(255,209,102,.6); color: var(--jg-warm); }
.jg-lid-btn::after { content: ""; position: absolute; inset: -5px -3px; }
.jg-lid-x { font-size: 16px; line-height: 1; padding: 0; }
@media (hover: hover) { .jg-lid-btn:hover { border-color: var(--jg-accent); } }

/* the view buttons: undo and zoom, on the right */
.jg-zoom { position: absolute; right: 8px; top: calc(var(--jg-hud) + 10px); z-index: 3; display: flex; flex-direction: column; gap: 6px; }
.jg-zb { position: relative; width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 1px solid var(--jg-line); background: var(--jg-glass); color: #cfdcf5; cursor: pointer; touch-action: manipulation; transition: border-color .15s, color .15s, opacity .15s; }
.jg-zb svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.jg-zb::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; }
.jg-zb:disabled { opacity: .35; cursor: default; }
@media (hover: hover) { .jg-zb:hover:not(:disabled) { border-color: var(--jg-accent); color: #fff; } }
.jg-zb:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }

/* the coach line: a word of help, or a hint, above the tools */
.jg-coach[hidden] { display: none; }
.jg-coach { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--jg-low) + 8px); z-index: 4; width: min(calc(100% - 20px), 520px); padding: 8px 34px 8px 12px; border-radius: 12px;
  background: rgba(8,13,30,0.92); border: 1px solid rgba(85,214,255,0.45); box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 13.5px; line-height: 1.38; color: #e4ecff; animation: jg-rise .22s ease-out; }
@keyframes jg-rise { from { opacity: 0; transform: translate(-50%, 6px); } }
@keyframes jg-drop { from { opacity: 0; transform: translate(-50%, -6px); } }
.jg-coach { pointer-events: none; }
.jg-coach-close { pointer-events: auto; }
.jg-coach b { color: var(--jg-accent); font-weight: 800; margin-right: 6px; }
.jg-coach.hint { border-color: rgba(255,209,102,0.6); }
.jg-coach.hint b { color: var(--jg-warm); }
.jg-coach-close { position: absolute; top: 2px; right: 2px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: #8aa3c4; font-size: 19px; line-height: 1; cursor: pointer; }
@media (hover: hover) { .jg-coach-close:hover { color: #fff; background: rgba(255,255,255,.08); } }

/* the tray's filters, over the top of the tray (the tray itself is drawn on the canvas) */
.jg-trayhead[hidden] { display: none; }
.jg-trayhead { position: absolute; left: 0; right: 0; bottom: calc(var(--jg-bar) + var(--jg-trayh)); height: 40px; z-index: 3; display: flex; align-items: center; gap: 5px; padding: 0 8px;
  overflow-x: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-x; }
.jg-trayhead::-webkit-scrollbar { display: none; }
.jg-chip { flex: none; height: 30px; display: inline-flex; align-items: center; gap: 5px; padding: 0 10px; border-radius: 999px; border: 1px solid #263a63; background: rgba(8,13,30,0.9); color: #cfdcf5;
  font: 700 12.5px system-ui, sans-serif; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.jg-chip small { font-size: 11px; color: #8aa3c4; font-weight: 700; font-variant-numeric: tabular-nums; }
.jg-chip[aria-pressed="true"] { background: rgba(255,209,102,.16); border-color: rgba(255,209,102,.7); color: #fff; }
.jg-chip[aria-pressed="true"] small { color: var(--jg-warm); }
.jg-chip.col { width: 30px; padding: 0; justify-content: center; }
.jg-chip.col i { width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.jg-chip.col[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--c); border-color: transparent; }
.jg-chip:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-chip-sep { flex: none; width: 1px; height: 20px; background: #263a63; margin: 0 2px; }
@media (hover: hover) { .jg-chip:hover { border-color: var(--jg-accent); } }

/* the tool bar */
.jg-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; height: calc(var(--jg-bar) - 12px); z-index: 3; display: flex; gap: 6px; padding: 0 6px; width: min(calc(100% - 12px), 540px); }
.jg-btn { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 14px; border: 1px solid var(--jg-line);
  background: rgba(8,13,30,0.88); color: #d7e2f8; font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; cursor: pointer; touch-action: manipulation; padding: 0 2px;
  transition: border-color .15s, color .15s, opacity .15s, background .15s, transform .08s; }
.jg-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jg-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (hover: hover) { .jg-btn:hover:not(:disabled) { border-color: var(--jg-accent); color: #fff; } }
.jg-btn:active:not(:disabled) { transform: translateY(1px); }
.jg-btn:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-btn:disabled { opacity: 0.36; cursor: default; }
.jg-btn[aria-pressed="true"] { background: rgba(85,214,255,0.14); border-color: rgba(85,214,255,0.6); color: #fff; }
.jg-hint { color: #ffe3a3; }
@media (hover: hover) { .jg-hint:hover:not(:disabled) { border-color: var(--jg-warm); } }
.jg-badge { position: absolute; top: 4px; right: calc(50% - 26px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--jg-warm); color: #1a1200; font: 800 10.5px/18px system-ui, sans-serif; font-style: normal; font-variant-numeric: tabular-nums; }
.jg-badge[hidden] { display: none; }

/* the result card: over the bottom of the finished picture */
.jg-card[hidden] { display: none; }
.jg-carded .jg-bar { visibility: hidden; }
.jg-card { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 5; width: min(calc(100% - 16px), 460px); padding: 14px 14px 12px; border-radius: 18px;
  background: rgba(8,13,30,0.94); border: 1px solid rgba(255,209,102,0.35); box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 40px rgba(255,209,102,.12); animation: jg-up .35s cubic-bezier(.2,.9,.25,1.1);
  max-height: calc(100% - var(--jg-hud) - 20px); overflow: auto; overscroll-behavior: contain; }
@keyframes jg-up { from { opacity: 0; transform: translate(-50%, 24px); } }
/* a short, wide stage (a phone on its side): the card sits beside the finished picture */
.jg-side .jg-card { left: auto; right: 58px; transform: none; width: min(46%, 340px); animation-name: jg-up-side; }
@keyframes jg-up-side { from { opacity: 0; transform: translateY(24px); } }
.jg-card h2 { margin: 0; font-size: 22px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.15; text-shadow: 0 0 22px rgba(255,209,102,.45); }
.jg-card p { margin: 3px 0 0; font-size: 13px; color: #a9bddb; line-height: 1.4; }
.jg-card .jg-stats { margin-top: 10px; }
.jg-card .jg-actions { margin-top: 12px; }

/* panels */
.jg-overlay[hidden] { display: none; }
.jg-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 6; overflow: auto; overscroll-behavior: contain;
  background: radial-gradient(ellipse at center, rgba(4,6,15,0.55), rgba(3,5,12,0.88)); animation: jg-fade .18s ease-out; touch-action: pan-y; }
.jg-panel { position: relative; width: min(100%, 440px); margin: auto; padding: 20px 18px 18px; border: 1px solid var(--jg-line); border-radius: 18px; text-align: left; outline: none;
  background: rgba(9,14,32,0.97); box-shadow: 0 20px 60px rgba(0,0,0,0.55); animation: jg-in .26s cubic-bezier(.2,.9,.25,1.1); }
.jg-panel.wide { width: min(100%, 640px); }
@keyframes jg-in { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes jg-fade { from { opacity: 0; } }
.jg-panel h2 { margin: 0 40px 12px 0; font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 0.01em; text-transform: none; line-height: 1.25; }
.jg-panel h3 { margin: 16px 0 8px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: #8aa3c4; }
.jg-panel p, .jg-panel li { font-size: 13.5px; line-height: 1.5; color: #c1cfe8; }
.jg-panel p { margin: 0 0 8px; }
.jg-panel ul { margin: 0 0 8px; padding-left: 18px; }
.jg-panel kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: 5px; border: 1px solid #2c3f6a; background: #0b1328; color: #fff; font: 700 12px/1.6 system-ui, sans-serif; text-align: center; }
.jg-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: #d7e2f8; cursor: pointer; padding: 0; z-index: 2; }
.jg-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
@media (hover: hover) { .jg-x:hover { background: rgba(255,255,255,.14); color: #fff; } }
.jg-x:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-fine { font-size: 12px !important; color: #6c7fa0 !important; margin: 10px 0 0 !important; }

.jg-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.jg-row { display: flex; gap: 8px; } .jg-row > * { flex: 1 1 0; min-width: 0; }
.jg-b { font: inherit; font-weight: 700; font-size: 14.5px; padding: 10px 14px; min-height: 46px; border-radius: 12px; cursor: pointer; touch-action: manipulation; text-decoration: none;
  border: 1px solid var(--jg-line); background: #0d1631; color: #e4ecff; transition: background .15s, border-color .15s, transform .1s, filter .15s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
@media (hover: hover) { .jg-b:hover:not(:disabled) { border-color: var(--jg-accent); } }
.jg-b:active { transform: translateY(1px); }
.jg-b:disabled { opacity: .45; cursor: default; }
.jg-b:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.jg-b svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.jg-b span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-b-primary { background: linear-gradient(135deg, #ffd166, #ffb35c); color: #1d1100; border-color: transparent; font-size: 16px; font-weight: 800; box-shadow: 0 6px 24px rgba(255,190,90,0.3); }
@media (hover: hover) { .jg-b-primary:hover:not(:disabled) { border-color: transparent; filter: brightness(1.06); } }
.jg-b-sm { min-height: 38px; padding: 6px 10px; font-size: 13px; }

.jg-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 4px; }
.jg-stats.three { grid-template-columns: repeat(3, 1fr); }
.jg-stats div { padding: 8px 4px; border-radius: 10px; background: #070d20; border: 1px solid #16244a; text-align: center; min-width: 0; }
.jg-stats span { display: block; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #6c7fa0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-stats b { display: block; margin-top: 2px; font-size: 17px; color: #e4ecff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.jg-stats .gold b { color: var(--jg-warm); } .jg-stats .ok b { color: #7dffcf; } .jg-stats .cy b { color: var(--jg-accent); }
.jg-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; vertical-align: middle; margin-left: 6px;
  color: #1a1200; background: linear-gradient(90deg, #ffd166, #fff1b8, #ffd166); background-size: 200% 100%; animation: jg-shine 1.6s linear infinite; box-shadow: 0 0 18px rgba(255,209,102,0.5); }
@keyframes jg-shine { to { background-position: -200% 0; } }

/* the library */
.jg-hubs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.jg-hubc { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 84px; padding: 10px 10px 9px; border-radius: 14px; border: 1px solid var(--jg-line);
  background: radial-gradient(120% 120% at 100% 0%, color-mix(in srgb, var(--hc) 20%, transparent), transparent 60%), #070d20; color: #e4ecff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; overflow: hidden; transition: border-color .15s; }
.jg-hubc svg { width: 24px; height: 24px; fill: none; stroke: var(--hc); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 2px; }
.jg-hubc b { font-size: 14px; color: #fff; }
.jg-hubc small { font-size: 11.5px; color: #8aa3c4; line-height: 1.3; }
.jg-hubc em { position: absolute; top: 9px; right: 10px; font-style: normal; font-size: 11px; font-weight: 800; color: var(--hc); font-variant-numeric: tabular-nums; }
.jg-hubc.daily { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 12px; min-height: 0; padding: 8px; }
.jg-hubc.daily img { width: 96px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: #050914; }
.jg-hubc.daily div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (hover: hover) { .jg-hubc:hover { border-color: var(--hc); } }
.jg-hubc:focus-visible { outline: 2px solid var(--hc); outline-offset: 2px; }
.jg-cont { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -2px; overscroll-behavior: contain; scrollbar-width: thin; }
.jg-ci { flex: none; width: 128px; padding: 0; border-radius: 12px; border: 1px solid #16244a; background: #070d20; color: #e4ecff; font: inherit; text-align: left; cursor: pointer; overflow: hidden; touch-action: manipulation; }
.jg-ci img { display: block; width: 100%; height: 72px; object-fit: cover; background: #050914; }
.jg-ci span { display: block; padding: 5px 7px 6px; font-size: 11.5px; line-height: 1.25; }
.jg-ci span b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-ci span small { color: #8aa3c4; }
.jg-ci .jg-mini { display: block; height: 3px; background: #16244a; } .jg-ci .jg-mini i { display: block; height: 100%; background: linear-gradient(90deg, #55d6ff, #ffd166); }
.jg-ci:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
@media (hover: hover) { .jg-ci:hover { border-color: var(--jg-accent); } }
.jg-cats { display: flex; gap: 5px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scrollbar-width: none; overscroll-behavior: contain; }
.jg-cats::-webkit-scrollbar { display: none; }
.jg-pics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.jg-pic { position: relative; padding: 0; border-radius: 12px; border: 1px solid #16244a; background: #070d20; color: #e4ecff; font: inherit; text-align: left; cursor: pointer; overflow: hidden; touch-action: manipulation; transition: border-color .15s, transform .1s; }
.jg-pic img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #050914; }
.jg-pic span { display: block; padding: 6px 8px 7px; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-pic em { position: absolute; top: 6px; right: 6px; font-style: normal; font-size: 10.5px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgba(5,9,20,.82); color: var(--jg-warm); font-variant-numeric: tabular-nums; }
.jg-pic em.ok { color: #7dffcf; }
@media (hover: hover) { .jg-pic:hover { border-color: var(--jg-accent); } }
.jg-pic:active { transform: translateY(1px); }
.jg-pic:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }

/* setting up a puzzle */
.jg-prev { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: clamp(100px, 28vh, 250px); object-fit: cover; border-radius: 12px; background: #050914; margin-bottom: 4px; }
.jg-prev.tall { aspect-ratio: auto; max-height: 34vh; object-fit: contain; }
.jg-sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.jg-size { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 56px; padding: 4px 2px; border-radius: 12px; border: 1px solid #1d2c52; background: #070d20; color: #e4ecff; font: inherit; cursor: pointer; touch-action: manipulation; }
.jg-size b { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; }
.jg-size small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; color: #6c7fa0; }
.jg-size i { font-style: normal; font-size: 10px; color: #7dffcf; font-variant-numeric: tabular-nums; }
.jg-size[aria-pressed="true"] { border-color: var(--jg-warm); background: rgba(255,209,102,.1); box-shadow: inset 0 0 0 1px var(--jg-warm); }
.jg-size[aria-pressed="true"] small { color: var(--jg-warm); }
.jg-size:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-sethead { display: flex; align-items: center; gap: 8px; margin: 0 40px 12px 0; }
.jg-sethead h2 { margin: 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-back { width: 34px; height: 34px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.07); color: #d7e2f8; cursor: pointer; }
.jg-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .jg-back:hover { background: rgba(255,255,255,.14); color: #fff; } }
.jg-back:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-opts { margin-top: 6px; }
.jg-opt { padding: 8px 0; }
.jg-opt:last-child { border-bottom: 0; }
.jg-b-again { flex: 0 1 auto !important; }
.jg-seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: #070d20; border: 1px solid var(--jg-line); }
.jg-seg button { flex: 1 1 0; min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: #8aa3c4; font: 700 13px system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.jg-seg button[aria-pressed="true"] { background: #16244a; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,.5); }
.jg-seg button:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 1px; }

/* settings and tabs */
.jg-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #16244a; cursor: pointer; }
.jg-set span { display: flex; flex-direction: column; gap: 2px; } .jg-set b { font-size: 14px; color: #fff; } .jg-set small { font-size: 12px; color: #8aa3c4; }
.jg-set input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.jg-sw { position: relative; width: 46px; height: 27px; flex: none; border-radius: 14px; border: 1px solid #263a63; background: #0c1630; transition: background .15s, border-color .15s; }
.jg-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #6c7fa0; transition: transform .15s, background .15s; }
.jg-set input:checked + .jg-sw { background: rgba(85,214,255,.18); border-color: var(--jg-accent); }
.jg-set input:checked + .jg-sw::after { transform: translateX(19px); background: var(--jg-accent); box-shadow: 0 0 10px rgba(85,214,255,.7); }
.jg-set input:focus-visible + .jg-sw { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 13px; background: #070d20; border: 1px solid var(--jg-line); margin: 0 0 12px; }
.jg-tab { font: inherit; font-size: 13.5px; font-weight: 700; color: #8aa3c4; background: transparent; border: 0; border-radius: 9px; min-height: 38px; padding: 0 4px; white-space: nowrap; cursor: pointer; }
.jg-tab[aria-selected="true"] { background: #16244a; color: #fff; box-shadow: inset 0 0 0 1px rgba(85,214,255,0.45); }
.jg-tab:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 1px; }
.jg-tables { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.jg-tablesw { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border-radius: 12px; border: 1px solid #16244a; background: #070d20; color: #c1cfe8; font: 700 11px system-ui, sans-serif; cursor: pointer; }
.jg-tablesw i { width: 100%; height: 30px; border-radius: 8px; background-color: var(--c); background-size: cover; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.jg-tablesw[aria-pressed="true"] { border-color: var(--jg-warm); color: #fff; box-shadow: inset 0 0 0 1px var(--jg-warm); }
.jg-tablesw:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-howto { display: grid; grid-template-columns: 58px 1fr; gap: 10px 12px; align-items: center; margin: 4px 0 6px; }
.jg-howto svg { width: 58px; height: 50px; }
.jg-howto p { margin: 0; }
.jg-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.jg-table th, .jg-table td { padding: 6px 4px; text-align: right; border-bottom: 1px solid #16244a; font-variant-numeric: tabular-nums; }
.jg-table th:first-child, .jg-table td:first-child { text-align: left; }
.jg-table thead th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: #6c7fa0; }
.jg-table tbody th { color: #fff; font-weight: 700; }
.jg-table td { color: #d7e2f8; }
.jg-list { display: flex; flex-direction: column; gap: 6px; }
.jg-li { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 13px; border: 1px solid #16244a; background: #070d20; color: #e4ecff; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; transition: border-color .15s; }
.jg-li:disabled { opacity: .45; cursor: default; }
@media (hover: hover) { .jg-li:not(:disabled):hover { border-color: var(--jg-accent); } }
.jg-li:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
.jg-li-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: rgba(85,214,255,.12); color: var(--jg-accent); }
.jg-li-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jg-li-t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.jg-li-t b { font-size: 14.5px; color: #fff; } .jg-li-t small { font-size: 12px; color: #8aa3c4; }

/* the daily calendar */
.jg-cal-head { display: flex; align-items: center; gap: 8px; margin: 12px 0 6px; }
.jg-cal-head b { flex: 1 1 auto; text-align: center; color: #fff; font-size: 15px; }
.jg-step { width: 42px; height: 42px; flex: none; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid #263a63; background: #0d1631; color: #e4ecff; cursor: pointer; }
.jg-step svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.jg-step:disabled { opacity: .35; cursor: default; }
.jg-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.jg-cal-w { text-align: center; font-size: 10.5px; font-weight: 800; color: #6c7fa0; padding: 2px 0; }
.jg-cal-d { position: relative; aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; border: 1px solid #16244a; background: #070d20; color: #d7e2f8; font: 700 13px system-ui, sans-serif; cursor: pointer; padding: 0; }
.jg-cal-d.off { opacity: .28; cursor: default; }
.jg-cal-d.ok { background: rgba(125,255,207,0.12); border-color: rgba(125,255,207,0.55); color: #7dffcf; }
.jg-cal-d.part { border-color: rgba(255,209,102,0.55); }
.jg-cal-d.today { box-shadow: 0 0 0 2px var(--jg-coral), 0 0 14px rgba(255,154,107,.45); }
@media (hover: hover) { .jg-cal-d:not(.off):hover { border-color: var(--jg-accent); } }
.jg-cal-d:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 1px; }

/* the gallery */
.jg-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.jg-gi { position: relative; padding: 0; border-radius: 12px; border: 1px solid rgba(255,209,102,.3); background: #070d20; color: #e4ecff; font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.jg-gi img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #050914; }
.jg-gi span { display: block; padding: 6px 8px 7px; font-size: 12px; line-height: 1.3; }
.jg-gi span b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jg-gi span small { color: #8aa3c4; font-variant-numeric: tabular-nums; }
.jg-gi:focus-visible { outline: 2px solid var(--jg-accent); outline-offset: 2px; }
@media (hover: hover) { .jg-gi:hover { border-color: var(--jg-warm); } }
.jg-empty { padding: 26px 12px; text-align: center; color: #8aa3c4; font-size: 13.5px; border: 1px dashed #263a63; border-radius: 14px; }

.jg-toast[hidden] { display: none; }
.jg-toast { position: absolute; left: 50%; top: calc(var(--jg-hud) + 14px); transform: translateX(-50%); z-index: 7; padding: 8px 14px; border-radius: 999px; background: #e4ecff; color: #07101f; font-size: 13px; font-weight: 800; animation: jg-drop .2s ease-out; pointer-events: none; white-space: nowrap; max-width: calc(100% - 110px); box-shadow: 0 8px 24px rgba(0,0,0,.4); overflow: hidden; text-overflow: ellipsis; }
.jg-loading[hidden] { display: none; }
.jg-loading { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(5,8,18,0.62); color: #d7e2f8; font-size: 14px; }
.jg-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,209,102,.2); border-top-color: var(--jg-warm); animation: jg-rot .9s linear infinite; }
@keyframes jg-rot { to { transform: rotate(360deg); } }
.jg-lbar { display: block; width: 160px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.1); overflow: hidden; }
.jg-lbar i { display: block; height: 100%; width: 0; background: var(--jg-warm); transition: width .1s linear; }
.jg-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.jg-help { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 14px; }
.jg-help .hint-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .jg-help .hint-kb { display: none; } .jg-help .hint-touch { display: inline; } }
.stage .jg-help { padding: 10px 14px 12px; }

/* narrow phones */
@media (max-width: 560px) { .jg-hud { gap: 10px; } .jg-hubc { min-height: 76px; padding: 9px 8px 8px; } .jg-hubc b { font-size: 13px; } .jg-hubc small { font-size: 11px; } .jg-prev { aspect-ratio: auto; height: 120px; } .jg-prev.tall { height: 150px; max-height: none; } .jg-size { min-height: 50px; } .jg-p-setup h3 { margin-top: 10px; } }
@media (max-width: 460px) {
  .jg-hud { gap: 6px; padding-left: 8px; padding-right: 6px; }
  .jg-lv-l { display: none; } .jg-lv-s { display: inline; }
  .jg-sethead h2 { font-size: 18px; }
  .jg-card .jg-b-sm { padding: 6px; gap: 5px; }
  .jg-pz { padding-right: 22px; padding-left: 8px; max-width: 42vw; }
  .jg-pz-n { font-size: 15px; }
  .jg-stat b { font-size: 18px; }
  .jg-time b { font-size: 14px; }
  .jg-tool { width: 36px; height: 36px; border-radius: 11px; }
  .jg-zb { width: 34px; height: 34px; }
  .jg-btn { font-size: 10.5px; border-radius: 12px; }
  .jg-panel { padding: 18px 14px 14px; }
  .jg-stats b { font-size: 15px; }
  .jg-pics, .jg-gal { grid-template-columns: repeat(2, 1fr); }
  .jg-tables { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 420px) { .jg-lid-row b { display: none; } .jg-lid-row { justify-content: flex-end; } .jg-prev { height: 100px; } .jg-prev.tall { height: 120px; } .jg-opt small { display: none; } .jg-opt { padding: 7px 0; } .jg-size { min-height: 46px; } .jg-p-setup .jg-actions { margin-top: 10px; } }
@media (max-width: 400px) { .jg-pz-n { font-size: 14px; } .jg-tab { font-size: 12.5px; } }
@media (max-width: 380px) { #jg-sound { display: none; } .jg-sizes { gap: 4px; } .jg-size b { font-size: 15px; } .jg-hubc { padding: 9px 7px 8px; } .jg-hubc b { font-size: 12.5px; } }

/* full screen: the table takes every pixel */
.stage.is-immersive .stage-body > .jg { min-height: 0; flex: 1 1 auto; }
.stage.is-immersive .jg-stage { flex: 1 1 auto; height: auto; aspect-ratio: auto; max-height: none; min-height: 0; }
.stage.is-immersive .jg-help { display: none; }
@media (prefers-reduced-motion: reduce) { .jg-panel, .jg-toast, .jg-coach, .jg-overlay, .jg-card, .jg-lid { animation: none; } .jg-tag { animation: none; } .jg-pct b, .jg-prog i { transition: none; } }
.jg-calm .jg-panel, .jg-calm .jg-toast, .jg-calm .jg-coach, .jg-calm .jg-overlay, .jg-calm .jg-card, .jg-calm .jg-lid { animation: none; } .jg-calm .jg-tag { animation: none; }
