/* ── New from template… and the welcome card (src/templates.js, src/tour.js) ── */
.tpl-overlay {
  position: fixed; inset: 0; z-index: 2600; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(8, 10, 14, 0.62);
}
.tpl-overlay[hidden] { display: none; }
.tpl-panel {
  width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: #1c1c1c; border: 1px solid #353535; border-radius: 10px; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 12px; color: #e0e0e0;
}
.tpl-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tpl-panel h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.tpl-lede { margin: 0; color: #a8a8a8; font-size: 0.86rem; line-height: 1.5; }
.tpl-x { width: 30px; height: 30px; border: none; border-radius: 6px; background: transparent; color: #aaa; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.tpl-x:hover { background: #2c2c2c; color: #fff; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding-top: 4px; }
.tpl-card {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch; text-align: left; cursor: pointer;
  padding: 10px; border: 1px solid #333; border-radius: 8px; background: #222; color: inherit; font: inherit;
}
.tpl-card:hover, .tpl-card:focus-visible { border-color: #4a7fcb; background: #252b35; outline: none; }
/* the picture: the template's first frame, pixelated, with what kind it is in a chip */
.tpl-pic {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 4px;
  background: repeating-conic-gradient(#2c2c2c 0 25%, #262626 0 50%) 0 0 / 12px 12px;
}
.tpl-pic canvas { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.tpl-kind {
  position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; font-style: normal;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.04em; color: #fff; background: #0f1218cc; border: 1px solid #ffffff26;
  backdrop-filter: blur(4px);
}
.tpl-card[data-tpl="walker"] .tpl-kind { color: #ffd88a; }
.tpl-card[data-tpl="island"] .tpl-kind { color: #8fe3a0; }
.tpl-card[data-tpl="tiles"] .tpl-kind { color: #f0a77a; }
.tpl-card b { font-size: 0.9rem; font-weight: 600; }
.tpl-card span { font-size: 0.76rem; color: #9a9a9a; line-height: 1.4; }

.welcome-panel { width: min(460px, 100%); gap: 14px; }
.welcome-actions { display: flex; flex-direction: column; gap: 8px; }
.welcome-actions .btn { height: 36px; justify-content: center; font-size: 0.86rem; }
.welcome-note { margin: 0; font-size: 0.74rem; color: #8a8a8a; line-height: 1.45; }

/* the tour: a ring round the control, a note beside it */
#tour-ring {
  position: fixed; z-index: 2550; pointer-events: none; border: 2px solid #ffc45a; border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(255, 196, 90, 0.18), 0 0 18px rgba(255, 196, 90, 0.35);
  transition: left 0.28s cubic-bezier(.2,.7,.2,1), top 0.28s cubic-bezier(.2,.7,.2,1), width 0.28s cubic-bezier(.2,.7,.2,1), height 0.28s cubic-bezier(.2,.7,.2,1);
}
#tour-ring[hidden], #tour-note[hidden] { display: none; }
#tour-note {
  position: fixed; z-index: 2560; width: 280px; padding: 14px 16px 12px; border-radius: 10px;
  background: #1f2633; border: 1px solid #4a7fcb; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  display: flex; flex-direction: column; gap: 6px; color: #e6e9f0;
  transition: left 0.32s cubic-bezier(.2,.7,.2,1), top 0.32s cubic-bezier(.2,.7,.2,1); /* glides to the next step's control */
}
#tour-note.swap > * { animation: tour-swap 0.3s ease both; } /* the next step's words fade in */
@keyframes tour-swap { from { opacity: 0; transform: translateY(3px); } }
#tour-note b { font-size: 0.95rem; }
#tour-note p { margin: 0; font-size: 0.82rem; line-height: 1.5; color: #c4cad6; }
.tour-step { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: #ffc45a; }
.tour-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.tour-skip { border: none; background: none; color: #9aa3b5; font: inherit; font-size: 0.78rem; cursor: pointer; padding: 4px 0; }
.tour-skip:hover { color: #fff; text-decoration: underline; }
/* Next: off until the step's done; done — lit, the step marked ✓ */
#tour-next:disabled { opacity: 0.4; cursor: not-allowed; filter: saturate(0.4); }
#tour-note.done .tour-step::after { content: ' · done ✓'; color: #7cc46a; }
@media (prefers-reduced-motion: reduce) { #tour-ring, #tour-note { transition: none; } #tour-note.swap > * { animation: none; } }
