/* The tutorial on a phone (client-tutorial-touch.js): a lesson card on the
   left under your portrait, and cues that point at what to touch. */

html.touch-play #tutorial-overlay {
  left: calc(8px + var(--sal)) !important;
  right: auto !important;
  top: calc(96px + var(--sat)) !important;
  bottom: auto !important;
  width: min(300px, 40vw) !important;
  transform: none !important;
  z-index: 18;
  pointer-events: none !important;
}
/* What to do first, then why: goals sit under the title on a phone. */
html.touch-play #tutorial-card {
  display: flex;
  flex-direction: column;
  max-height: calc(var(--app-h, 100dvh) * 0.4);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 10px 8px;
  pointer-events: auto;
  box-sizing: border-box;
}
html.touch-play #tutorial-step,
html.touch-play #tutorial-drag { display: none !important; }
html.touch-play #tutorial-title { order: 0; }
html.touch-play #tutorial-goals { order: 1; }
html.touch-play #tutorial-keys { order: 2; }
html.touch-play #tutorial-hint { order: 3; }
html.touch-play #tutorial-body { order: 4; opacity: 0.88; }
html.touch-play .tutorial-actions { order: 5; }
html.touch-play #tutorial-card h2 {
  font-size: 15px;
  margin: 2px 0 4px;
  letter-spacing: 0.05em;
  cursor: pointer;
}
html.touch-play #tutorial-card h2::after {
  content: "▾";
  float: right;
  font-size: 12px;
  opacity: 0.7;
}
html.touch-play #tutorial-card.tut-folded h2::after { content: "▸"; }
html.touch-play #tutorial-body {
  font-size: 12.5px;
  line-height: 1.35;
  margin: 0 0 4px;
}
html.touch-play #tutorial-hint {
  font-size: 12px;
  margin: 0 0 4px;
}
html.touch-play #tutorial-keys { margin: 2px 0 4px; gap: 4px; }
html.touch-play #tutorial-keys .tut-key { font-size: 11px; padding: 2px 7px; }
html.touch-play #tutorial-goals { margin: 2px 0 4px; padding-left: 0; }
html.touch-play #tutorial-goals li { font-size: 12px; line-height: 1.35; }
html.touch-play #tutorial-card.tut-folded #tutorial-body,
html.touch-play #tutorial-card.tut-folded #tutorial-hint,
html.touch-play #tutorial-card.tut-folded #tutorial-keys { display: none !important; }
html.touch-play .tutorial-actions { margin: 4px 0 0; gap: 6px; display: flex; flex-wrap: wrap; }
html.touch-play .tutorial-actions button {
  width: auto;
  min-width: 0;
  min-height: 30px;
  margin: 0;
  padding: 4px 10px;
  font-size: 11px;
  flex: 1 1 auto;
}

/* Spell buttons a lesson wants. */
html.touch-play .touch-spell.tut-glow {
  box-shadow: 0 0 0 2px #fff1c0, 0 0 14px 4px rgba(255, 214, 110, 0.85);
  animation: tutGlow 1s ease-in-out infinite alternate;
}
@keyframes tutGlow {
  from { box-shadow: 0 0 0 2px #fff1c0, 0 0 8px 2px rgba(255, 214, 110, 0.55); }
  to { box-shadow: 0 0 0 3px #fffbe0, 0 0 20px 7px rgba(255, 224, 130, 0.95); }
}

/* Cues: where to put your thumb. */
#tut-cues { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
html:not(.touch-play) #tut-cues { display: none; }
.tut-cue {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px dashed rgba(255, 228, 150, 0.9);
  box-shadow: 0 0 18px rgba(255, 210, 110, 0.45), inset 0 0 18px rgba(255, 210, 110, 0.25);
  animation: tutCue 1.1s ease-in-out infinite;
}
.tut-cue-label {
  position: absolute;
  left: 50%;
  top: -22px;
  transform: translateX(-50%);
  font: 700 12px var(--ui-label, Georgia), Georgia, serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffe9b4;
  text-shadow: 1px 1px 0 #000, 0 0 6px #000;
  white-space: nowrap;
}
@keyframes tutCue {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(0.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); }
}
.tut-cue-stick .tut-cue-label { top: auto; bottom: -22px; }
.tut-cue-stick i {
  position: absolute;
  width: 0;
  height: 0;
  border: 8px solid transparent;
}
.tut-cue-stick i.up { left: calc(50% - 8px); top: 4px; border-bottom-color: #ffe29a; border-top: 0; }
.tut-cue-stick i.down { left: calc(50% - 8px); bottom: 4px; border-top-color: #ffe29a; border-bottom: 0; }
.tut-cue-stick i.left { top: calc(50% - 8px); left: 4px; border-right-color: #ffe29a; border-left: 0; }
.tut-cue-stick i.right { top: calc(50% - 8px); right: 4px; border-left-color: #ffe29a; border-right: 0; }
.tut-cue-swipe { border-style: solid; border-color: rgba(255, 228, 150, 0.35); }
.tut-cue-swipe .finger {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff6d8, #e8c070 60%, rgba(160, 110, 30, 0.6));
  box-shadow: 0 0 12px rgba(255, 220, 130, 0.9);
  animation: tutSwipe 1.4s ease-in-out infinite;
}
@keyframes tutSwipe {
  0% { transform: translateX(-42px); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateX(42px); opacity: 0; }
}
.tut-cue-tap { border-style: solid; border-width: 3px; }
@media (prefers-reduced-motion: reduce) {
  .tut-cue, .tut-cue-swipe .finger, html.touch-play .touch-spell.tut-glow { animation: none; }
}
