/*
 * Tutorial Modal — Daily Grid Games
 * Full-screen glass overlay with step-through cards and SVG/HTML demo visuals.
 */

/* ─── Overlay ────────────────────────────────────────────────────────────────── */
.dg-tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px 20px;
  opacity: 0;
  transition: opacity 0.22s ease;
}

.dg-tutorial-overlay.dg-visible {
  opacity: 1;
}

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.dg-tutorial-card {
  position: relative;
  background: rgba(10, 15, 34, 0.94);
  border: 0.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 28px 72px rgba(0, 0, 0, 0.65);
  width: 100%;
  max-width: 340px;
  overflow: hidden;
  transform: scale(0.94) translateY(10px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dg-tutorial-overlay.dg-visible .dg-tutorial-card {
  transform: scale(1) translateY(0);
}

/* ─── Skip button ────────────────────────────────────────────────────────────── */
.dg-tutorial-skip {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: rgba(200, 210, 230, 0.4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
  z-index: 2;
}

.dg-tutorial-skip:hover {
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.07);
}

/* ─── Step wrapper ───────────────────────────────────────────────────────────── */
.dg-tutorial-step {
  display: flex;
  flex-direction: column;
}

/* ─── Demo area ──────────────────────────────────────────────────────────────── */
.dg-tutorial-demo {
  width: 100%;
  min-height: 180px;
  background: rgba(255, 255, 255, 0.022);
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  overflow: hidden;
}

.dg-tutorial-demo svg {
  max-width: 100%;
  height: auto;
}

/* ─── Text ───────────────────────────────────────────────────────────────────── */
.dg-tutorial-text {
  padding: 18px 22px 4px;
  text-align: center;
}

.dg-tutorial-title {
  font-size: 16px;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0 0 7px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
}

.dg-tutorial-desc {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(200, 210, 230, 0.62);
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
}

/* ─── Progress dots ──────────────────────────────────────────────────────────── */
.dg-tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 14px 0 2px;
}

.dg-tutorial-dot {
  height: 6px;
  width: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: background 0.2s ease, width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dg-tutorial-dot.dg-active {
  background: rgba(255, 255, 255, 0.82);
  width: 18px;
}

/* ─── Nav row ────────────────────────────────────────────────────────────────── */
.dg-tutorial-nav {
  display: flex;
  gap: 8px;
  padding: 10px 18px 18px;
}

.dg-tutorial-btn {
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, transform 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
}

.dg-tutorial-btn:active {
  opacity: 0.7;
  transform: scale(0.97);
}

.dg-tutorial-btn-prev {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(200, 210, 230, 0.6);
  flex: 0 0 auto;
  padding: 11px 16px;
}

.dg-tutorial-btn-prev[disabled] {
  opacity: 0 !important;
  pointer-events: none;
}

.dg-tutorial-btn-next {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.dg-tutorial-btn-next.dg-last {
  background: rgba(99, 160, 255, 0.22);
  color: #93c5fd;
  border-color: rgba(99, 160, 255, 0.36);
}

/* ─── Step slide animation ───────────────────────────────────────────────────── */
.dg-slide-fwd {
  animation: dg-slide-fwd 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dg-slide-back {
  animation: dg-slide-back 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dg-slide-fwd {
  from { transform: translateX(28px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes dg-slide-back {
  from { transform: translateX(-28px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ─── Demo SVG animation helpers (used inside demo strings) ─────────────────── */
@keyframes dg-demo-pulse {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 1;    }
}

@keyframes dg-demo-blink {
  0%, 45%, 100% { opacity: 1;   }
  55%, 90%      { opacity: 0.2; }
}

@keyframes dg-demo-draw {
  from { stroke-dashoffset: 120; }
  to   { stroke-dashoffset: 0;   }
}

@keyframes dg-demo-spin-cw {
  0%,  30%  { transform: rotate(0deg);  }
  70%, 100% { transform: rotate(90deg); }
}

@keyframes dg-demo-tap {
  0%, 100% { r: 6;  opacity: 0.8; }
  50%       { r: 14; opacity: 0;   }
}

.dg-demo-pulse   { animation: dg-demo-pulse 2s ease-in-out infinite; }
.dg-demo-blink   { animation: dg-demo-blink 2s ease-in-out infinite; }
.dg-demo-spin-cw { animation: dg-demo-spin-cw 2.2s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.dg-demo-tap     { animation: dg-demo-tap 2s ease-out infinite; }
.dg-demo-draw    { stroke-dasharray: 120; animation: dg-demo-draw 2s ease-in-out infinite; }

/* ─── Help button (injected by shell) ────────────────────────────────────────── */
.dg-tutorial-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 0.5px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(200, 210, 230, 0.5);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 14px;
  transition: background 0.15s, color 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* When placed inside the How to Play details panel */
.dg-tutorial-help-btn--inline {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-top: 14px;
  border-radius: 8px;
}

.dg-tutorial-help-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.8);
}

/* ─── Reduced motion ─────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dg-tutorial-overlay,
  .dg-tutorial-card,
  .dg-tutorial-dot { transition: none; }

  .dg-slide-fwd,
  .dg-slide-back { animation: none; }

  .dg-demo-pulse,
  .dg-demo-blink,
  .dg-demo-spin-cw,
  .dg-demo-tap,
  .dg-demo-draw { animation: none; opacity: 1; }
}
