/* Puzzle Geser: tampilan. Aturan: window.GESER (geser.js). */
.gs { --gs-1: #0f766e; --gs-2: #0d9488; --gs-3: #14b8a6; --gs-ink: #134e4a; --gs-p1: #ea580c; --gs-ok: #16a34a; }
.gs .t-goal { display: none; }
.gs-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: clamp(6px, 1vw, 14px); overflow: hidden; position: relative; background: linear-gradient(135deg, #ccfbf1, #f0fdfa 55%, #e0f2fe); }
.gs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* bilah: tujuan, contoh, ulang */
.gs-bar { flex: none; display: flex; align-items: center; gap: 8px; justify-content: center; }
.gs-goal { flex: 1; min-width: 0; font: 800 clamp(14px, 1.6vw, 24px)/1.25 var(--font); color: var(--gs-ink); text-align: left; }
.gs-bar .gs-goal { text-align: center; }
.gs-btn { min-height: 48px; min-width: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border-radius: 999px; border: 3px solid var(--gs-2); background: #fff; color: var(--gs-1); font: 800 clamp(14px, 1.3vw, 19px) var(--font); cursor: pointer; flex: none; -webkit-tap-highlight-color: transparent; }
.gs-btn svg { width: 22px; height: 22px; flex: none; }
.gs-btn:hover { background: #f0fdfa; }
.gs-btn:focus-visible, .gs-thumb:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.gs-btn:disabled { opacity: .45; cursor: default; }
.gs-btn.pen { border-color: #d97706; color: #92400e; }
.gs-thumb { flex: none; width: 52px; height: 52px; padding: 3px; border-radius: 14px; border: 3px solid var(--gs-2); background: #fff; cursor: pointer; }
.gs-thumb[hidden], .gs-btn[hidden] { display: none; }
.gs-thumb img { width: 100%; height: 100%; display: block; }

/* papan */
.gs-boards { flex: 1; min-height: 0; display: flex; gap: clamp(8px, 2vw, 28px); justify-content: center; align-items: stretch; }
.gp { --pc: var(--gs-2); flex: 1 1 0; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; justify-items: center; gap: 6px; }
.gp.p1 { --pc: var(--gs-p1); }
.gp-h { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 28px; font-family: var(--font); }
.gp-h .nm { font-size: clamp(16px, 2vw, 28px); font-weight: 800; color: var(--pc); }
.gp-h .nm:empty { display: none; }
.gp-h .mv, .gp-h .tm { font-weight: 700; font-size: clamp(14px, 1.7vw, 24px); background: #fff; border: 3px solid var(--pc); border-radius: 999px; padding: 1px 14px; color: #0f172a; font-variant-numeric: tabular-nums; }
.gp-h b { font-weight: 800; }
.gp.lock .gp-h .tm { background: #fef3c7; }
.gp-area { width: 100%; min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.gp-board { position: relative; box-sizing: border-box; border: 5px solid var(--pc); border-radius: 18px; background: #0b3f3b; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; box-shadow: 0 10px 26px rgba(15, 118, 110, .3); }
.gp-board::after { content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: 12px; }
.gp.done .gp-board { border-color: var(--gs-ok); }
.gp.lock .gp-board { opacity: .7; }
.gs-t, .gs-blank { position: absolute; left: 0; top: 0; width: calc(100% / var(--n)); height: calc(100% / var(--n)); box-sizing: border-box; padding: 3px; }
.gs-t { transition: translate .14s ease; cursor: pointer; z-index: 1; }
.gs-t.lift { transition: none; z-index: 6; cursor: grabbing; }
.gs-t.lift .in { box-shadow: 0 8px 18px rgba(0, 0, 0, .4); }
.gs-blank { z-index: 0; transition: translate .14s ease; pointer-events: none; }
.gs-blank .in { width: 100%; height: 100%; border-radius: 10px; border: 3px dashed rgba(204, 251, 241, .4); background: rgba(255, 255, 255, .06); box-sizing: border-box; background-repeat: no-repeat; }
.gs-blank.fin .in { border: 0; background-color: #f0fdfa; box-shadow: none; }
.in { width: 100%; height: 100%; border-radius: 10px; box-sizing: border-box; }
.in.gm { background-color: #f0fdfa; background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12); }
.in.tx { background: linear-gradient(160deg, #14b8a6, #0f766e); color: #fff; font-family: var(--font); font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.12; font-variant-numeric: tabular-nums; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18); overflow: hidden; }
.in.tx .ln { display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.fr { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.05; }
.fr i { font-style: normal; display: block; padding: 0 .12em; }
.fr i:first-child { border-bottom: .09em solid currentColor; }
.fr-w { margin-right: .2em; }
.gs-t.ok .in.gm { box-shadow: inset 0 0 0 4px var(--gs-ok); }
.gs-t.ok .in.tx { background: linear-gradient(160deg, #22c55e, #15803d); box-shadow: inset 0 0 0 3px #bbf7d0; }
.gs-t.hint { z-index: 4; }
.gs-t.hint .in { animation: gs-hint .55s ease-in-out 3; outline: 4px solid #f59e0b; outline-offset: -4px; }
.gs-t.flash .in { animation: gs-flash .3s; }
.gs-t.no .in { animation: gs-no .3s; }
.gp.done .gs-t .in { box-shadow: inset 0 0 0 2px var(--gs-ok); }
.gp.done .gs-t .in.tx { background: linear-gradient(160deg, #22c55e, #15803d); }
.gp.done .gs-t, .gp.done .gs-blank { padding: 0; }
.gp.done .gs-t .in, .gp.done .gs-blank .in { border-radius: 0; }
.gp.done .gs-blank:not(.fin) .in { border-color: transparent; background: transparent; }

.gp-tools { display: flex; gap: 8px; justify-content: center; }
.gp-tools.off { visibility: hidden; }
.gp-tools .gs-btn { flex: 0 1 auto; }

/* contoh gambar */
.gs-ex { position: absolute; inset: 0; z-index: 20; background: rgba(6, 78, 59, .55); display: grid; place-items: center; padding: 10px; cursor: pointer; }
.gs-ex[hidden], .gs-toast[hidden] { display: none; }
.gs-excard { background: #fff; border: 5px solid var(--gs-2); border-radius: 22px; padding: 12px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; }
.gs-eximg { width: min(60vh, 64vw, 440px); aspect-ratio: 1; }
.gs-eximg img { width: 100%; height: 100%; display: block; }
.gs-exnote { font: 800 16px var(--font); color: #92400e; min-height: 1.2em; }
.gs-exnote:empty { display: none; }
.gs-toast { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 21; background: #92400e; color: #fff; font: 800 16px var(--font); padding: 6px 16px; border-radius: 999px; pointer-events: none; }

/* popup */
.gs-how { text-align: left; margin-top: 10px; color: var(--muted); font-size: 15px; }
.gs-how summary { cursor: pointer; font-weight: 800; color: var(--ink); min-height: 32px; display: flex; align-items: center; }
.gs-how ol { margin: 6px 0 0; padding-left: 22px; line-height: 1.5; }
.op-desc { text-align: left; font-size: clamp(14px, 1.5vw, 17px); }
.gs-res .gs-stars { font-size: clamp(36px, 8vw, 56px); color: #f59e0b; line-height: 1; letter-spacing: 4px; margin-bottom: 6px; }
.gs-res .gs-stars[hidden] { display: none; }
.gs-resimg { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 8px; font-weight: 800; color: var(--ink); font-size: clamp(16px, 2vw, 22px); text-align: left; }
.gs-resimg[hidden] { display: none; }
.gs-resimg img { width: 72px; height: 72px; flex: none; }
.gs-res .winner.b { color: var(--gs-p1); }

@keyframes gs-hint { 50% { transform: scale(1.1); } }
@keyframes gs-flash { 50% { transform: scale(1.08); } }
@keyframes gs-no { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* HP portrait */
@media (max-width: 700px) and (orientation: portrait) {
  .gs-boards { flex-direction: column; gap: 6px; }
  .gp-h { flex-wrap: nowrap; gap: 6px; }
  .gp-h .nm { font-size: 15px; }
  .gp-h .mv, .gp-h .tm { font-size: 13px; padding: 0 9px; border-width: 2px; white-space: nowrap; }
  .gp-tools .gs-btn { min-height: 44px; }
}
@media (max-width: 520px) {
  .gs-btn span { display: none; }
  .gs-btn { padding: 0; width: 48px; }
  .gp-tools .gs-btn { width: auto; min-width: 56px; padding: 0 14px; }
  .gs-wrap { padding: 6px; gap: 4px; }
}

/* HP landscape (layar pendek): bilah di kiri, tombol papan di samping papan */
@media (max-height: 560px) {
  .topbar .title { display: block; flex: 1; min-width: 0; font-size: 14px; }
  .gs .t-nm { display: none; }
  .gs .t-goal { display: inline; }
  .gs-wrap { flex-direction: row; gap: 4px; padding: 3px 4px; }
  .gs-bar { flex-direction: column; justify-content: flex-start; width: 48px; gap: 4px; }
  .gs-goal { display: none; }
  .gs-btn span { display: none; }
  .gs-btn { padding: 0; width: 44px; min-height: 44px; min-width: 44px; border-width: 2px; }
  .gs-thumb { width: 44px; height: 44px; padding: 2px; border-width: 2px; border-radius: 10px; }
  .gs-boards { gap: 6px; }
  .gp { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); gap: 2px 4px; }
  .gp-h { grid-column: 1 / -1; min-height: 22px; gap: 6px; }
  .gp-h .nm { font-size: 14px; }
  .gp-h .mv, .gp-h .tm { font-size: 13px; padding: 0 9px; border-width: 2px; }
  .gp-area { grid-row: 2; grid-column: 1; }
  .gp-tools { grid-row: 2; grid-column: 2; flex-direction: column; justify-content: center; gap: 6px; }
  .gp-tools .gs-btn { width: 44px; min-width: 44px; padding: 0; }
  .gp-board { border-width: 4px; border-radius: 14px; }
  .gs-t, .gs-blank { padding: 2px; }
  .in { border-radius: 8px; }
  .gs-eximg { width: min(70vh, 60vw, 440px); }
  .gs-res .trophy { display: none; }
  .gs-res .gs-stars { font-size: 34px; }
  .gs-resimg img { width: 48px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .gs-t, .gs-blank { transition: none; }
  .gs-t.hint .in, .gs-t.flash .in, .gs-t.no .in { animation: none; }
}
