/* Single player: puzzle map, puzzle intro, game, result, and Dual's level grid (js/screens/single.js) */

/* ---------- Stars ---------- */
.sg-stars { display: inline-flex; gap: 4px; align-items: flex-end; }
.sg-star { display: block; }
.sg-star svg { display: block; width: 100%; height: 100%; fill: #EFE2C4; stroke: #D8C291; stroke-width: 1.2; }
.sg-star.on svg { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.1; }
.sg-stars.sm .sg-star { width: 30px; height: 30px; }
.sg-stars.md .sg-star { width: 44px; height: 44px; }
.sg-stars.lg { gap: 18px; }
.sg-stars.lg .sg-star { width: 150px; height: 150px; }
.sg-stars.lg .sg-star:nth-child(2) { width: 176px; height: 176px; transform: translateY(-22px); }
.sg-stars.lg .sg-star.on { animation: sg-star-in .55s cubic-bezier(.3,1.6,.5,1) both; }
.sg-stars.lg .sg-star.on svg { filter: drop-shadow(3px 5px 0 rgba(0,0,0,.25)); }
@keyframes sg-star-in {
  from { transform: scale(0) rotate(-40deg); opacity: 0; }
  to { opacity: 1; }
}
.sg-stars.lg .sg-star:nth-child(2).on { animation-name: sg-star-in-mid; }
@keyframes sg-star-in-mid {
  from { transform: translateY(-22px) scale(0) rotate(-40deg); opacity: 0; }
  to { transform: translateY(-22px); opacity: 1; }
}

/* ---------- Mini board (intro chip + placeholders) ---------- */
.sg-mini {
  display: grid; gap: 3px; padding: 6px; border-radius: 6px;
  background: #BDBDBD;
}
.sg-mini span { background: #ECECEC; border-radius: 3px; }
.sg-mini span.y { background: var(--yellow); }
.sg-mini span.m { background: var(--maroon); }
.sg-mini span.g { background: var(--green); }

/* ---------- Friendly notice (empty / missing states) ---------- */
.sg-notice {
  position: absolute; left: 0; right: 0; top: 210px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.sg-notice-art { transform: rotate(-6deg); margin-bottom: 30px; opacity: .9; }
.sg-notice h2 { margin: 0; font-size: 46px; font-weight: 900; color: var(--maroon); }
.sg-notice p { margin: 16px 0 0; font-size: 30px; max-width: 760px; }
.sg-notice .pill { margin-top: 44px; }
.sg-notice .pill:active { transform: translate(3px, 4px); }

/* ---------- Puzzle map ---------- */
.sg-map .sg-title {
  position: absolute; left: 0; right: 0; top: 46px; z-index: 2; margin: 0; text-align: center; pointer-events: none;
  font-size: 54px; font-weight: 900; color: var(--maroon);
}
.sg-map .sg-tabs { top: 116px; z-index: 2; }
.sg-map-top {
  position: absolute; left: 0; right: 0; top: 0; height: 132px; z-index: 1; pointer-events: none;
  background: linear-gradient(var(--cream) 78%, rgba(251, 241, 222, 0));
}
.sg-map.with-tabs .sg-map-top { height: 190px; }
.sg-total {
  position: absolute; right: 44px; top: 44px; z-index: 2;
  display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 22px 0 14px; border-radius: 26px;
  background: var(--white); font-size: 26px; font-weight: 900; color: var(--ink);
  box-shadow: 2px 3px 0 rgba(0,0,0,.2);
}
.sg-total:empty { display: none; }
.sg-total svg { width: 32px; height: 32px; fill: var(--yellow); stroke: var(--ink); stroke-width: 1.1; }

.sg-scroll {
  position: absolute; inset: 0; padding-top: 110px;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.sg-scroll::-webkit-scrollbar { display: none; }
.sg-map.with-tabs .sg-scroll { padding-top: 170px; }
.sg-path { position: relative; width: 1194px; min-height: 100%; padding: 24px 40px 40px; }
.sg-path > .sg-notice { top: 120px; }

/* Levels sit three to a row. Every level box is the same size; the cube picture is sized
   in single.js (BOX_W x BOX_H) to fit inside .sg-box with room for the glow and bounce. */
.sg-world { display: flex; flex-wrap: wrap; justify-content: center; gap: 36px 30px; }
.sg-land {
  --cube: 88px;
  width: 348px; height: 430px; padding: 14px 14px 18px; border-radius: 30px;
  background: #FFF9EE;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  box-shadow: inset 0 0 0 2px #EADBB8;
}
.sg-land-name {
  height: 30px; padding: 0 16px; border-radius: 15px; background: #F3E7CB;
  font-size: 16px; font-weight: 900; line-height: 30px; letter-spacing: 1.5px; text-transform: uppercase; color: #9b8a66;
}
.sg-land > .sg-box:first-child { margin-top: 30px; }
.sg-box { width: 320px; height: 292px; display: grid; place-items: center; }
.sg-land.done { background: #EFF5EA; box-shadow: inset 0 0 0 2px #BCD3AF; }
.sg-land.locked { background: #F6EEDD; }
.sg-shape { display: grid; gap: 8px; }
.sg-gap { width: var(--cube); height: var(--cube); }
.sg-shape-empty {
  width: 260px; padding: 30px 10px; border-radius: 22px; border: 3px dashed #D9C79C;
  font-size: 24px; font-weight: 700; color: #9b8a66; text-align: center;
}

.sg-land-label { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sg-land-title { font-size: 32px; font-weight: 900; color: var(--navy); line-height: 1; }
.sg-land.done .sg-land-title { color: var(--green); }
.sg-land.locked .sg-land-title { color: #B3A483; }
.sg-land-meta { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 700; color: #6d6455; }
.sg-land.locked .sg-land-meta { color: #A8996F; }
.sg-land-stars { display: flex; align-items: center; gap: 3px; margin-left: 10px; }
.sg-land-icon svg { display: block; width: 22px; height: 22px; fill: currentColor; stroke: currentColor; }
.sg-land.done .sg-land-icon:first-child { color: var(--green); }
.sg-land-icon.star svg { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.2; }

/* One puzzle = one cube */
.sg-cube {
  position: relative; width: var(--cube); height: var(--cube); border-radius: calc(var(--cube) * .14);
  background: var(--yellow); border: 2px solid var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: inset 0 0 10px rgba(255,255,255,.55), inset 0 -6px 0 rgba(0,0,0,.12), 0 5px 0 var(--ink);
  transition: transform .08s ease, box-shadow .08s ease;
}
.sg-cube:active { transform: translateY(4px); box-shadow: inset 0 0 10px rgba(255,255,255,.45), 0 1px 0 var(--ink); }
.sg-cube.done { background: var(--green); }
.sg-cube.locked { background: #EDE4D0; border-color: #CDBF9F; box-shadow: inset 0 0 10px rgba(255,255,255,.7), 0 5px 0 #CDBF9F; }
.sg-cube.locked:active { box-shadow: 0 1px 0 #CDBF9F; }
.sg-cube-num {
  font-size: calc(var(--cube) * .44); font-weight: 900; line-height: 1; color: #fff;
  text-shadow: 0 0 1px #000, 1px 2px 0 rgba(0,0,0,.45);
}
.sg-cube.locked .sg-cube-num { color: #CDBF9F; text-shadow: none; }
.sg-stars.cube { gap: 1px; }
.sg-stars.cube .sg-star { width: calc(var(--cube) * .22); height: calc(var(--cube) * .22); }
.sg-cube-play {
  padding: 1px 7px; border-radius: 8px; background: #fff;
  font-size: calc(var(--cube) * .15); font-weight: 900; letter-spacing: 1px; color: var(--maroon);
}
.sg-cube.current { z-index: 1; animation: sg-cube-bob 1.4s ease-in-out infinite; }
.sg-cube.current::before {
  content: ""; position: absolute; inset: -12px; border-radius: 20px;
  border: 6px solid rgba(233, 171, 46, .5); animation: sg-ring 1.6s ease-out infinite;
}
@keyframes sg-ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
@keyframes sg-cube-bob { 50% { transform: translateY(-5px); } }
.sg-cube.fresh { animation: sg-cube-pop .7s cubic-bezier(.3,1.6,.5,1) .3s both, sg-cube-bob 1.4s ease-in-out 1s infinite; }
@keyframes sg-cube-pop { from { transform: scale(.3) rotate(-20deg); } }

.sg-path-end {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 40px;
  font-size: 24px; font-weight: 700; color: #9b8a66;
}
.sg-flag svg { display: block; width: 44px; height: 44px; fill: var(--maroon); stroke: #6b5a39; }

/* ---------- Dual Player level grid ---------- */
.sg-levels .sg-title {
  position: absolute; left: 0; right: 0; top: 52px; margin: 0; text-align: center;
  font-size: 54px; font-weight: 900; color: var(--maroon);
}
.sg-levels .sg-sub {
  position: absolute; left: 0; right: 0; top: 120px; margin: 0; text-align: center;
  font-size: 28px; font-weight: 700; color: var(--navy); letter-spacing: 1px;
}
.sg-levels .sg-sub:empty { display: none; }
.sg-tabs {
  position: absolute; left: 0; right: 0; top: 128px;
  display: flex; justify-content: center; gap: 16px;
}
.sg-levels.with-sub .sg-tabs { top: 166px; }
.sg-tab {
  height: 56px; padding: 0 32px; border-radius: 28px;
  background: #EDE2CA; color: #6b5a39; font-size: 26px; font-weight: 700;
  box-shadow: inset 0 0 6px rgba(255,255,255,.7), 2px 3px 0 rgba(0,0,0,.25);
}
.sg-tab.on { background: var(--navy); color: #fff; }
.sg-tab:active { transform: translate(2px, 2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }

.sg-grid {
  position: absolute; left: 50%; top: 186px; width: 928px; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; gap: 24px 22px; justify-content: center;
}
.sg-grid > * { width: 168px; flex: none; }
.sg-levels.with-sub .sg-grid { top: 196px; }
.sg-levels.with-tabs .sg-grid { top: 220px; }
.sg-levels.with-sub.with-tabs .sg-grid { top: 252px; }
.sg-grid.empty { display: block; top: 0; }

.sg-tile {
  position: relative; width: 168px; height: 152px; border-radius: 28px;
  background: var(--yellow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  box-shadow: inset 0 0 10px rgba(255,255,255,.55), inset 0 -4px 8px rgba(0,0,0,.12), 4px 5px 0 rgba(0,0,0,.5);
  transition: transform .08s ease, box-shadow .08s ease;
  animation: sg-rise .35s ease backwards;
}
.sg-tile:active { transform: translate(3px, 4px); box-shadow: inset 0 0 10px rgba(255,255,255,.4), 1px 1px 0 rgba(0,0,0,.5); }
.sg-tile.done { background: var(--green); }
.sg-num {
  font-size: 64px; font-weight: 900; line-height: 1; color: #fff;
  text-shadow: 0 0 1px #000, 1px 2px 0 rgba(0,0,0,.45);
}
.sg-tile-title {
  max-width: 150px; font-size: 18px; font-weight: 700; color: #fff; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.sg-tile .sg-stars { margin-top: 4px; }
.sg-tile.locked { background: #E6DCC7; box-shadow: inset 0 0 10px rgba(255,255,255,.6), 3px 4px 0 rgba(0,0,0,.2); }
.sg-tile.locked .sg-num { color: #C3B595; text-shadow: none; }
.sg-tile.locked .sg-tile-title { color: #b3a483; text-shadow: none; }
.sg-lock svg { width: 34px; height: 34px; fill: #A8996F; stroke: #A8996F; margin-top: 2px; }
.sg-soon {
  position: absolute; top: -10px; right: -8px;
  background: var(--navy); color: #fff; font-size: 16px; font-weight: 700;
  padding: 5px 12px; border-radius: 14px; transform: rotate(6deg);
}
@keyframes sg-rise { from { transform: translateY(16px); opacity: 0; } }
.sg-tile:nth-child(5n+2) { animation-delay: .03s; }
.sg-tile:nth-child(5n+3) { animation-delay: .06s; }
.sg-tile:nth-child(5n+4) { animation-delay: .09s; }
.sg-tile:nth-child(5n) { animation-delay: .12s; }

.sg-page-prev, .sg-page-next { position: absolute; top: 400px; width: 84px; height: 84px; }
.sg-page-prev { left: 30px; }
.sg-page-next { right: 30px; }
.sg-page-prev:disabled, .sg-page-next:disabled { opacity: .35; cursor: default; }
.sg-page-dots { position: absolute; left: 0; right: 0; bottom: 34px; display: flex; justify-content: center; gap: 12px; }
.sg-page-dots span { width: 16px; height: 16px; border-radius: 50%; background: #E2D3B0; }
.sg-page-dots span.on { background: var(--navy); }

/* ---------- Puzzle intro ---------- */
.sg-intro-body { position: absolute; inset: 0; padding-top: 36px; display: flex; flex-direction: column; align-items: center; }
.sg-kicker { margin: 0 0 2px; font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: 2px; text-transform: uppercase; }
.sg-level-title {
  margin: 0; font-size: 64px; font-weight: 900; color: var(--yellow); line-height: 1.1;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  animation: pop .6s ease both;
}
.sg-lead { margin: 14px 0 0; max-width: 900px; font-size: 30px; line-height: 1.35; text-align: center; }
.sg-chips { display: flex; gap: 64px; margin-top: 40px; }
.sg-chip { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sg-chip-label { font-size: 22px; color: #6d6455; }
.sg-chip-box {
  width: 176px; height: 176px; border-radius: 30px; background: #F8EEDB;
  display: grid; place-items: center;
  box-shadow: inset 0 0 12px rgba(255,255,255,.9), 0 6px 14px rgba(120,90,30,.2), 0 1px 0 rgba(0,0,0,.08);
}
.sg-chip-value { font-size: 30px; font-weight: 700; color: var(--navy); }
.sg-chip-icon svg { display: block; width: 104px; height: 104px; }
.sg-chip-icon.clock svg { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.1; }
.sg-chip-icon.clock svg path { stroke: var(--ink); }
.sg-chip-icon.person svg { fill: var(--yellow); stroke: var(--yellow-dark); stroke-width: .8; }
.sg-best { display: flex; align-items: center; gap: 16px; margin-top: 26px; font-size: 24px; font-weight: 700; color: #6d6455; }
.sg-coming {
  position: absolute; left: 50%; top: 656px; transform: translateX(-50%); margin: 0;
  padding: 18px 44px; border-radius: 40px; background: #EDE2CA;
  font-size: 32px; font-weight: 700; color: #6b5a39; white-space: nowrap;
}

/* ---------- Game ---------- */
.sg-view { position: absolute; inset: 0; }
.sg-pause { position: absolute; left: 44px; top: 34px; width: 84px; height: 84px; z-index: 2; }
.sg-pause svg { width: 34px; height: 34px; }

.sg-timer {
  position: absolute; left: calc(50% - 115px); top: 34px; width: 230px; height: 80px; border-radius: 40px;
  background: var(--green); border: 3px solid var(--yellow);
  color: #fff; font-size: 48px; font-weight: 700; line-height: 74px; text-align: center; letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 10px rgba(255,255,255,.35), 4px 5px 0 rgba(0,0,0,.45);
  transition: background .3s;
}
.sg-timer.low { background: #C62D3A; animation: sg-beat 1s ease-in-out infinite; }
.sg-timer.over { background: var(--maroon); animation: none; }
@keyframes sg-beat { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.12); } 45% { transform: scale(1); } }

.sg-progress { position: absolute; right: 44px; top: 38px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.sg-progress-text { font-size: 24px; font-weight: 700; color: var(--navy); }
.sg-dots { display: flex; gap: 10px; }
.sg-dot { width: 24px; height: 24px; border-radius: 50%; background: #E6D8BA; border: 3px solid transparent; }
.sg-dot.now { background: #fff; border-color: var(--navy); animation: sg-beat 1.6s ease-in-out infinite; }
.sg-dot.good { background: var(--green); }
.sg-dot.soft { background: var(--yellow); }

.sg-heading {
  position: absolute; left: 0; right: 0; top: 40px; margin: 0; text-align: center;
  font-size: 56px; font-weight: 900; color: var(--maroon);
  animation: pop .6s ease both;
}

.sg-card {
  position: absolute; left: calc(50% - 320px); top: 140px; width: 640px; height: 520px;
  background: var(--white); border-radius: 32px; padding: 26px;
  box-shadow: 0 8px 0 rgba(0,0,0,.1), 0 16px 40px rgba(120,90,30,.2);
}
.sg-card.show { animation: sg-card-in .45s cubic-bezier(.3,1.4,.6,1) both; }
@keyframes sg-card-in { from { transform: scale(.85); opacity: 0; } }
.sg-card.veil .sg-pic { visibility: hidden; }
.sg-card.blur .sg-pic { filter: blur(18px); }
.sg-pic { width: 100%; height: 100%; display: grid; place-items: center; transition: filter .2s; }
.sg-pic img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; -webkit-user-drag: none; }
.sg-pic-missing { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.sg-pic-missing .sg-mini { transform: rotate(-6deg); opacity: .7; }
.sg-pic-missing p { margin: 0; max-width: 420px; font-size: 28px; color: #6d6455; }

.sg-banner {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  padding: 18px 56px; border-radius: 26px; background: var(--maroon);
  font-size: 68px; font-weight: 900; color: #fff; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0,0,0,.35); box-shadow: 6px 8px 0 rgba(0,0,0,.35);
  transform: translate(-50%, -50%) rotate(-4deg);
  animation: sg-banner-in .5s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes sg-banner-in { from { transform: translate(-50%, -50%) rotate(-4deg) scale(.2); opacity: 0; } }

.sg-badge {
  position: absolute; left: 50%; bottom: -28px; z-index: 1;
  padding: 14px 46px; border-radius: 40px; white-space: nowrap;
  font-size: 42px; font-weight: 900; color: #fff;
  text-shadow: 0 0 1px #000, 1px 2px 0 rgba(0,0,0,.35);
  box-shadow: inset 0 0 10px rgba(255,255,255,.45), 5px 6px 0 rgba(0,0,0,.4);
  transform: translateX(-50%) rotate(-3deg);
  animation: sg-badge-in .5s cubic-bezier(.3,1.6,.5,1) both;
}
.sg-badge.good { background: var(--green); }
.sg-badge.soft { background: var(--yellow); }
@keyframes sg-badge-in { from { transform: translateX(-50%) rotate(-3deg) scale(.2); opacity: 0; } }

.sg-actions { position: absolute; left: 0; right: 0; top: 704px; display: flex; justify-content: center; gap: 40px; }
.sg-actions .pill { width: 400px; }
.sg-actions .sg-done { width: 482px; }

/* ---------- Result ---------- */
.sg-result { position: absolute; inset: 0; padding-top: 50px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.sg-result-level { margin: 0; font-size: 26px; font-weight: 700; color: var(--navy); letter-spacing: 1px; }
.sg-result-title {
  margin: 4px 0 34px; font-size: 68px; font-weight: 900; color: var(--maroon); line-height: 1.1;
  animation: pop .6s ease both;
}
.sg-result.passed .sg-result-title { color: var(--yellow); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.sg-score { margin: 18px 0 0; font-size: 40px; font-weight: 700; }
.sg-result-sub { margin: 10px 0 0; font-size: 26px; color: #6d6455; max-width: 820px; }
.sg-unlocked {
  display: flex; align-items: center; gap: 14px; margin-top: 22px;
  padding: 12px 34px; border-radius: 36px; background: var(--green);
  font-size: 32px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4);
  box-shadow: 4px 5px 0 rgba(0,0,0,.4);
  animation: sg-badge-pop .6s cubic-bezier(.3,1.6,.5,1) 1.6s both;
}
.sg-unlocked svg { width: 34px; height: 34px; fill: #fff; stroke: #fff; }
@keyframes sg-badge-pop { from { transform: scale(.2); opacity: 0; } }
.sg-result-actions { top: 690px; gap: 30px; }
.sg-result-actions .pill { width: 310px; height: 92px; font-size: 40px; }

/* Wider buttons in the pause modal while the game is up */
.sg-game.active ~ .modal .modal-actions .pill { width: 250px; font-size: 30px; }
