/* DailyMuse Jigsaw */
[x-cloak] { display: none !important; }

.jg-page { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.jg-play-page { max-width: none; padding: 0; height: 100%; overflow: hidden; }

/* Keep the board in view — site footer/FABs must not steal the play viewport. */
html:has(.jg-play-page),
body:has(.jg-play-page) {
  height: 100%;
  overflow: hidden;
}
body:has(.jg-play-page) > footer,
body:has(.jg-play-page) .feedback-float-btn,
body:has(.jg-play-page) .feedback-modal,
body:has(.jg-play-page) #dm-dark-toggle {
  display: none !important;
}
body:has(.jg-play-page) > main {
  height: calc(100vh - 60px);
  overflow: hidden;
}
@media (max-width: 800px) {
  body:has(.jg-play-page) > nav { display: none !important; }
  body:has(.jg-play-page) > main { height: 100vh; }
}

.jg-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 28px;
}
@media (max-width: 800px) {
  .jg-hero { grid-template-columns: 1fr; }
}

.jg-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #6B7A8D;
  background: #fff;
  border: 1px solid #DDE1E7;
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 12px;
}
.jg-kicker i { width: 8px; height: 8px; border-radius: 50%; background: #6B9E7E; display: inline-block; }

.jg-daily-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  min-height: 220px;
  background: #1E2D3D;
  color: #fff;
}
.jg-daily-card img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0.55;
}
.jg-daily-card .jg-daily-body {
  position: relative; z-index: 1; padding: 22px;
  background: linear-gradient(180deg, rgba(30,45,61,0.15), rgba(30,45,61,0.82));
  min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end;
}

.jg-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin: 8px 0 18px;
}
.jg-chip {
  border: 1px solid #DDE1E7; background: #fff; color: #1E2D3D;
  border-radius: 8px; padding: 8px 12px; font-size: 13px; cursor: pointer;
}
.jg-chip.is-on { background: #4A6FA5; color: #fff; border-color: #4A6FA5; }

.jg-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.jg-thumb {
  position: relative; border: 2px solid transparent; border-radius: 12px;
  overflow: hidden; cursor: pointer; background: #fff; text-align: left;
  padding: 0; aspect-ratio: 16/10;
}
.jg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jg-thumb.is-on { border-color: #4A6FA5; box-shadow: 0 0 0 3px rgba(74,111,165,0.25); }
.jg-thumb span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 8px 8px; font-size: 12px; color: #fff; font-weight: 600;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
}

.jg-settings {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  background: #fff; border: 1px solid #DDE1E7; border-radius: 12px; padding: 16px; margin: 18px 0;
}
@media (max-width: 640px) { .jg-settings { grid-template-columns: 1fr; } }

.jg-play {
  display: grid;
  grid-template-columns: 1fr 220px;
  grid-template-rows: auto 1fr;
  height: calc(100vh - 60px);
  background: #dfe5ee;
}
.jg-play-bar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; background: #fff; border-bottom: 1px solid #DDE1E7;
}
.jg-board-wrap { position: relative; min-height: 0; }
.jg-board { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.jg-board:active { cursor: grabbing; }

.jg-tray-wrap {
  background: #fff; border-left: 1px solid #DDE1E7;
  display: flex; flex-direction: column; min-height: 0;
}
.jg-tray-head {
  padding: 10px 12px; font-size: 12px; font-weight: 600; color: #6B7A8D;
  border-bottom: 1px solid #DDE1E7; display: flex; justify-content: space-between;
}
.jg-tray {
  flex: 1; overflow: auto; padding: 8px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; align-content: start;
}
.jg-tray-piece {
  border: 1px solid #DDE1E7; border-radius: 8px; background: #f7f8fa;
  padding: 2px; cursor: grab; touch-action: none;
}
.jg-tray-piece canvas { width: 100%; height: auto; display: block; pointer-events: none; }
.jg-tray-piece.is-hint { outline: 3px solid #f5a623; box-shadow: 0 0 12px rgba(245,166,35,0.6); }

.jg-stat {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  background: #F4F5F7; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 700;
}

@media (max-width: 800px) {
  .jg-play {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr 168px;
    height: 100vh;
  }
  .jg-tray-wrap { border-left: 0; border-top: 1px solid #DDE1E7; }
  .jg-tray { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .jg-tray-piece { min-height: 72px; padding: 4px; }
}

.jg-saves { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.jg-save {
  display: flex; gap: 10px; align-items: center; padding: 10px;
  background: #fff; border: 1px solid #DDE1E7; border-radius: 10px; text-decoration: none; color: inherit;
}
.jg-save img { width: 56px; height: 40px; object-fit: cover; border-radius: 6px; }
.jg-credit { font-size: 12px; color: #6B7A8D; margin-top: 8px; }
.jg-credit a { color: #4A6FA5; }

/* ── Lobby value ─────────────────────────────────────────── */
.jg-slogan-title {
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  font-weight: 800;
  color: #1E2D3D;
  line-height: 1.15;
  margin: 0 0 12px;
}
.jg-slogan {
  font-size: 1.05rem;
  color: #5A6878;
  max-width: 36rem;
  line-height: 1.55;
  margin: 0 0 20px;
}
.jg-cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.jg-upload-cta { position: relative; }

.jg-demos { margin: 8px 0 32px; }
.jg-demos-head { margin-bottom: 12px; }
.jg-demos-head h2 { font-size: 1.125rem; font-weight: 700; margin: 0 0 4px; }
.jg-demos-head p { font-size: 0.9rem; color: #6B7A8D; margin: 0; }
.jg-demo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.jg-demo {
  position: relative;
  border: 0;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  text-align: left;
  background: #1E2D3D;
}
.jg-demo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jg-demo-badge {
  position: absolute; top: 10px; left: 10px;
  background: #4A6FA5; color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
}
.jg-demo-meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 12px 12px;
  background: linear-gradient(transparent, rgba(15,23,32,0.78));
  color: #fff; display: flex; flex-direction: column; gap: 2px;
}
.jg-demo-meta strong { font-size: 14px; }
.jg-demo-meta small { font-size: 12px; opacity: 0.85; }
.jg-demo:hover { box-shadow: 0 0 0 3px rgba(74,111,165,0.35); }
@media (max-width: 700px) {
  .jg-demo-grid { grid-template-columns: 1fr; }
  .jg-demo { aspect-ratio: 16/9; }
}

/* ── Play bars ───────────────────────────────────────────── */
.jg-play-bar--mob { display: none; }
.jg-mob-title {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.jg-icon-btn { min-width: 40px; }
.jg-tools-label {
  font-size: 11px; font-weight: 700; color: #6B7A8D; text-transform: uppercase;
  letter-spacing: 0.06em; margin: 0 2px 0 6px; white-space: nowrap;
  user-select: none;
}
.jg-board-wrap { overflow: hidden; }
.jg-zoom-hint {
  position: absolute; left: 8px; bottom: 8px; margin: 0;
  font-size: 11px; color: #6B7A8D; background: rgba(255,255,255,0.82);
  padding: 4px 8px; border-radius: 999px; pointer-events: none;
}
@media (max-width: 800px) {
  .jg-play-bar--desk { display: none; }
  .jg-play-bar--mob {
    display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
    padding: 8px 10px; background: #fff; border-bottom: 1px solid #DDE1E7;
  }
  .jg-play-bar--mob .jg-stat { padding: 6px 8px; font-size: 12px; }
}

/* ── Tools sheet ─────────────────────────────────────────── */
.jg-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,32,0.35); z-index: 60;
}
.jg-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 8px 16px 24px; transform: translateY(110%);
  transition: transform 0.22s ease; box-shadow: 0 -8px 32px rgba(15,23,32,0.18);
  pointer-events: none;
}
.jg-sheet.is-open { transform: translateY(0); pointer-events: auto; }
.jg-sheet.is-open { transform: translateY(0); }
.jg-sheet-handle {
  width: 40px; height: 4px; border-radius: 999px; background: #DDE1E7;
  margin: 6px auto 12px; cursor: pointer;
}
.jg-sheet-title { font-size: 13px; font-weight: 700; color: #6B7A8D; margin: 0 0 12px; }
.jg-sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jg-sheet-btn {
  border: 1px solid #DDE1E7; background: #F7F8FA; color: #1E2D3D;
  border-radius: 10px; padding: 12px 10px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.jg-sheet-btn--primary { background: #4A6FA5; color: #fff; border-color: #4A6FA5; }

/* ── Toasts & complete ───────────────────────────────────── */
.jg-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 70; background: #1E2D3D; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(15,23,32,0.2); max-width: 90vw;
}
.jg-toast--error { position: static; transform: none; background: #FEF2F2; color: #B42318; }

.jg-complete {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15,23,32,0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.jg-complete-card {
  background: #fff; border-radius: 18px; padding: 28px 24px 22px;
  width: min(420px, 100%); text-align: center;
  box-shadow: 0 20px 50px rgba(15,23,32,0.25);
}
.jg-complete-kicker {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: #6B9E7E; font-weight: 700; margin: 0 0 8px;
}
.jg-complete-title { font-size: 1.15rem; font-weight: 700; margin: 0 0 12px; }
.jg-complete-time {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 2.4rem; font-weight: 800; color: #4A6FA5; margin: 0; line-height: 1;
}
.jg-complete-sub { font-size: 13px; color: #6B7A8D; margin: 6px 0 16px; }
.jg-complete-stats {
  display: flex; justify-content: center; gap: 16px;
  font-size: 13px; color: #5A6878; margin-bottom: 18px;
}
.jg-complete-actions { display: flex; flex-direction: column; gap: 8px; }
.jg-complete-actions .btn { width: 100%; }