/* Paperfold. Shares /games/games.css; this is the board, its controls and the level map. */
.status .slim, .map-head .slim { padding: 6px 12px; font-size: .85rem; }

.play {
  max-width: 480px; margin: 0 auto; padding: 8px 16px 24px;
  display: flex; flex-direction: column; align-items: center;
}
#board {
  display: block; width: min(100%, calc((100dvh - 265px) * 340 / 390)); min-width: 280px;
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
}
#board.dragging { cursor: grabbing; }
#board.pop { animation: pop .45s ease-out; }
@keyframes pop { 40% { transform: scale(1.04); } }

.status { display: flex; align-items: center; gap: .5em; margin: 4px 0 8px; color: var(--muted); font-size: .95rem; }
.status #mapBtn { margin-left: .4em; }
.status #levelName { font-weight: 700; color: var(--ink-2); }

/* Undo on its own line, with Start over and Hint below it. */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(100%, 300px); margin-top: 8px; }
.tools .btn { padding: 9px 16px; }
#undoBtn { grid-column: 1 / -1; }

.win { text-align: center; margin-top: 8px; }
.win-title { margin: 0; font-size: 1.25rem; font-weight: 900; color: var(--ink); }
.win-sub { margin: 2px 0 12px; color: var(--muted); font-size: .95rem; }
.win-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.win-actions .btn { padding: 9px 16px; }

/* The How to play button, as on Stonecross, under the board where it is easy to find. */
.how-to {
  font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .45em; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark); border: 1px solid rgba(217, 72, 15, .25);
  transition: background .15s, color .15s, border-color .15s;
}
.how-to:hover { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.how-ico {
  display: grid; place-items: center; flex: none; width: 1.15em; height: 1.15em; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .78em; font-weight: 900;
}
.how-to:hover .how-ico { background: var(--accent-ink); color: var(--accent); }
.how-to-play { margin-top: 14px; font-size: .95rem; padding: 8px 16px; }

.how {
  width: min(92vw, 440px); max-height: calc(100dvh - 24px); border: 0; border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-l4); color: var(--ink-2);
}
.how::backdrop { background: rgba(0, 0, 0, .45); }
.how-head { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.how h2 { font-size: 1.35rem; margin-top: 4px; }
.how-text { margin: 4px 0 10px; min-height: 4.65em; font-size: .95rem; }
/* The picture gives way on a short phone, so the buttons stay on screen. */
#howStage { display: block; width: min(100%, 44dvh); margin: 0 auto; }
.how-note { margin: 4px 0 0; min-height: 2.8em; text-align: center; font-weight: 700; font-size: .9rem; line-height: 1.4; color: var(--ink); }
.how-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 4px; }
.how-nav .btn { padding: 8px 14px; }
#howBack { justify-self: start; }
#howNext { justify-self: end; white-space: nowrap; }
.how-dots { display: flex; gap: 2px; }
.how-dots button { width: 16px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.how-dots button::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.how-dots button.now::before { background: var(--accent); }

.map {
  width: min(92vw, 460px); max-height: 88dvh; border: 0; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-l4); color: var(--ink-2);
}
.map::backdrop { background: rgba(0, 0, 0, .45); }
.map-head { display: flex; align-items: center; justify-content: space-between; }
.map-actions { display: flex; gap: 6px; }
.map-note { margin: 6px 0 14px; color: var(--muted); font-size: .9rem; }
.map-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.map-cell {
  position: relative; aspect-ratio: 1; padding: 4px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--card); font: inherit; font-weight: 700; color: var(--ink-2);
  display: grid; place-items: center; overflow: hidden;
}
.map-cell:hover:not(:disabled) { background: var(--bg); }
.map-cell:disabled { color: var(--faint); background: var(--bg); cursor: default; border-style: dashed; }
.map-cell.current { border: 2px solid var(--accent); }
.map-cell svg { width: 100%; height: 100%; display: block; }
.map-cell .perfect {
  position: absolute; right: 3px; top: 3px; width: 9px; height: 9px; border-radius: 50%;
  background: #EF9F27; box-shadow: 0 0 0 1.5px #fff;
}

@media (max-width: 560px) {
  .play { padding: 4px 12px 20px; }
}
