/* A finite, silent rehearsal. The real board remains the only place to play. */
.tutorial-teaching .dialog-character-heading {
  justify-content: center;
  gap: 12px;
}
.tutorial-teaching .dialog-character-heading h2 {
  font-family: var(--heading);
  line-height: 1.08;
}
.tutorial-teaching .dialog-speech {
  margin-block: 8px 12px;
}
.tutorial-demo {
  --demo-duration: 3.6s;
  --demo-touch: 12.5%;
  --demo-end: 87.5%;
  pointer-events: none;
  user-select: none;
  padding: 16px 14px 12px;
  margin: 8px 0 18px;
  border: 1px solid #e5ca91;
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 0, #fffef3, #fff3d4 66%, #f5e4be);
  box-shadow: inset 0 2px 0 #fff, 0 4px 0 #d9be85, 0 8px 16px #94743714;
}
.tutorial-demo-letters {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--demo-count), minmax(0, 1fr));
  gap: 6px;
  max-width: 280px;
  margin: auto;
  padding-bottom: 50px;
}
.tutorial-demo-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  height: 56px;
  border: 2px solid #fff9e8;
  border-radius: 15px;
  background: linear-gradient(140deg, #fffdf5, #fff0cd);
  color: #1b4c57;
  font: 600 32px/1 var(--heading);
  box-shadow: inset 0 1px 0 white, 0 4px 0 #d1b783, 0 6px 8px #8f6c2820;
}
.tutorial-demo--intro {
  --demo-touch: 20%;
  --demo-end: 20%;
}
.tutorial-demo--intro .tutorial-demo-letters {
  grid-template-columns: 1fr 35px 1fr;
  max-width: 240px;
}
.tutorial-demo-arrow {
  align-self: start;
  margin-top: 10px;
  color: #b28a3e;
  font: 600 32px/1 var(--heading);
  text-align: center;
}
.tutorial-demo--intro .tutorial-demo-tile:nth-child(3) {
  color: white;
  background: linear-gradient(140deg, #27c5b7, #148ba6 65%, #2c78b1);
  border-color: #a6efdf;
  box-shadow: inset 0 1px 0 #d6fff3, 0 4px 0 #176c7b, 0 7px 12px #386e6630;
}
.tutorial-demo--correction {
  --demo-touch: 50%;
  --demo-end: 50%;
}
.tutorial-demo--correction .tutorial-demo-letters {
  max-width: 72px;
}
.tutorial-demo--correction .tutorial-demo-tile {
  color: #aa5453;
  background: #fbe3d5;
  border-color: #e3a591;
}
.tutorial-demo-hand {
  position: absolute;
  top: 35px;
  left: var(--demo-end);
  width: 42px;
  height: 56px;
  margin-left: -13px;
  transform: translateY(-12px) rotate(-8deg);
  filter: drop-shadow(1px 4px 2px #7a5a3333);
}
.tutorial-demo-hand svg {
  display: block;
  width: 100%;
  height: 100%;
}
.tutorial-demo-contact {
  position: absolute;
  top: 17px;
  left: var(--demo-touch);
  width: 35px;
  height: 35px;
  margin-left: -18px;
  border: 3px solid #f5bd47;
  border-radius: 50%;
  box-shadow: 0 0 0 5px #fff4ba88;
  opacity: 0;
}
.tutorial-demo-steps {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  font-size: 13px;
  font-weight: 900;
  color: #66776c;
}
.tutorial-demo-steps > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tutorial-demo-steps i {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f2dfb0;
  color: #85662e;
  font-style: normal;
}
.tutorial-demo--intro .tutorial-demo-steps,
.tutorial-demo--correction .tutorial-demo-steps {
  max-width: 220px;
  margin: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .tutorial-demo-hand {
    animation: tutorial-demo-gesture var(--demo-duration) ease-in-out 2 both;
  }
  .tutorial-demo-contact {
    animation: tutorial-demo-contact var(--demo-duration) ease-in-out 2 both;
  }
  .tutorial-demo--drag .tutorial-demo-tile {
    animation: tutorial-demo-reveal var(--demo-duration) ease-out 2 forwards;
    animation-delay: calc(var(--demo-order) * 350ms);
  }
  .tutorial-demo--intro .tutorial-demo-tile:nth-child(3) {
    animation: tutorial-demo-accent var(--demo-duration) ease-out 2 both;
  }
  .tutorial-demo--correction .tutorial-demo-tile {
    animation: tutorial-demo-correct var(--demo-duration) ease-out 2 forwards;
  }
  .tutorial-demo-touch {
    animation: tutorial-demo-touch-label var(--demo-duration) ease-out 2 both;
  }
  .tutorial-demo-drag {
    animation: tutorial-demo-drag-label var(--demo-duration) ease-out 2 both;
  }
  .tutorial-demo-release {
    animation: tutorial-demo-release-label var(--demo-duration) ease-out 2 both;
  }
}
@keyframes tutorial-demo-gesture {
  0%, 9% { left: var(--demo-touch); transform: translateY(-14px) rotate(-8deg); opacity: 0; }
  16% { left: var(--demo-touch); transform: translateY(-7px) rotate(-8deg); opacity: 1; }
  24% { left: var(--demo-touch); transform: translateY(5px) rotate(-6deg) scale(.9); opacity: 1; }
  68%, 76% { left: var(--demo-end); transform: translateY(5px) rotate(-4deg) scale(.9); opacity: 1; }
  89%, 100% { left: var(--demo-end); transform: translateY(-14px) rotate(-8deg); opacity: 0; }
}
@keyframes tutorial-demo-contact {
  0%, 16%, 86%, 100% { opacity: 0; transform: scale(.65); }
  24% { opacity: 1; transform: scale(1); left: var(--demo-touch); }
  68%, 76% { opacity: 1; transform: scale(.85); left: var(--demo-end); }
}
@keyframes tutorial-demo-reveal {
  0%, 24% { background: #fff3d8; color: #1b4c57; border-color: #fff9e8; transform: translateY(0); }
  34%, 100% { background: #188fa3; color: white; border-color: #a5efdf; transform: translateY(1px); }
}
@keyframes tutorial-demo-accent {
  0%, 23% { opacity: .45; transform: scale(.95); }
  36% { opacity: 1; transform: scale(1.09) rotate(3deg); }
  46%, 100% { opacity: 1; transform: none; }
}
@keyframes tutorial-demo-correct {
  0%, 24% { color: #aa5453; background: #fbe3d5; border-color: #e3a591; }
  36%, 100% { color: transparent; background: #fff5df; border-color: #fff9e8; }
}
@keyframes tutorial-demo-touch-label {
  0%, 32% { color: #147d8d; }
  40%, 100% { color: #66776c; }
}
@keyframes tutorial-demo-drag-label {
  0%, 28%, 78%, 100% { color: #66776c; }
  38%, 70% { color: #147d8d; }
}
@keyframes tutorial-demo-release-label {
  0%, 68% { color: #66776c; }
  78%, 100% { color: #147d8d; }
}
@media (prefers-reduced-motion: reduce) {
  .tutorial-demo-hand { opacity: .8; }
  .tutorial-demo--drag .tutorial-demo-tile {
    color: white;
    background: #188fa3;
    border-color: #a5efdf;
  }
}
@media (max-width: 350px) {
  .tutorial-demo { padding-inline: 10px; }
  .tutorial-demo-steps { font-size: 12px; }
  .tutorial-demo-tile { height: 50px; font-size: 29px; }
}

/* Literal hand pixels from tutorial-a-desktop. Its original fingertip remains
   registered to the real contact ring; this artwork never dispatches input. */
.tutorial-demo-hand {
  width: 52px;
  height: 53px;
  margin-left: -4px;
  background: url("../assets/expedition/study-game-tutorial-hand.png") center / contain no-repeat;
}
.tutorial-demo-hand svg,
.ftue-hand > svg { visibility: hidden; }
.ftue-hand::after {
  content: "";
  position: absolute;
  left: 17px;
  top: 5px;
  width: 52px;
  height: 53px;
  background: url("../assets/expedition/study-game-tutorial-hand.png") center / contain no-repeat;
  pointer-events: none;
}

/* Exact tutorial-b pixels. The coach lives in the layout below the live grid;
   there is no scrim, modal, disabled board, or practice copy of the controls. */
.study-challenge .ftue-hand::after,
.study-challenge .tutorial-demo-hand {
  background-image: url("../assets/expedition/batch-tutorial-hand.png");
}
.study-challenge .ftue-hand::after {
  left: 13px;
  top: 5px;
  width: 52px;
  height: 64px;
  transform-origin: 7px 3px;
}
.study-challenge .ftue-path rect {
  fill: #11c9cf;
  fill-opacity: .2;
  stroke: #fff4a4;
  stroke-width: 3;
}
.study-challenge .ftue-path polyline { stroke: #fff1a6; stroke-width: 6; }
.study-challenge .ftue-path .ftue-trace { stroke: #ffc13b; stroke-width: 5; }
.study-challenge .ftue-contact {
  border-color: #fffce5;
  background: #01c3cf44;
  box-shadow: 0 0 0 5px #1ee5df88, 0 0 15px #fff8ac;
}
.study-challenge .ftue-gesture-label {
  top: -5px;
  z-index: 8;
  padding: 5px 11px;
  border: 1px solid #e3b94c;
  background: linear-gradient(130deg, #fff4c5, #ffdf7b, #ffc84c);
  font: 600 12px/1.2 var(--heading);
  color: #674713;
  box-shadow: inset 0 1px #fffef3, 0 3px 5px #6b471e33;
}
.study-challenge .ftue-scratch[data-gesture="press"] .ftue-hand::after,
.study-challenge .ftue-scratch[data-gesture="drag"] .ftue-hand::after {
  transform: scale(.9);
}
.study-challenge .ftue-scratch[data-gesture="release"] .ftue-hand::after {
  transform: translateY(-7px) rotate(-6deg);
}
.study-challenge .ftue-scratch[data-gesture="release"] .ftue-gesture-label {
  background: linear-gradient(130deg, #d7fff4, #8fece2, #74dceb);
  border-color: #39a6a7;
  color: #115965;
}
.study-touch-coach {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 3px 8px;
  align-items: center;
  margin: 5px 7px 2px;
  padding: 7px 10px 8px;
  border: 2px solid #d3b064;
  border-radius: 15px;
  background: linear-gradient(145deg, #fffbea, #fff0c4);
  box-shadow: inset 0 1px #fff, 0 3px #c0a06655;
  color: #28595b;
  pointer-events: none;
}
.study-coach-portrait { position: relative; display: block; width: 42px; height: 46px; overflow: hidden; border-radius: 12px; }
.study-coach-portrait > img { position: absolute; display: block; width: 240%; max-width: none; height: auto; left: -75%; top: -40%; }
/* rem with px floors: the coach replaced a 1rem teaching dialog, so it must
   grow with enlarged system text like the rest of the first-run copy, and
   never drop below the 16px instruction minimum (AGENTS.md). */
.study-touch-coach strong { display: block; font: 600 max(17px, 1.0625rem)/1.1 var(--heading); }
.study-touch-coach p { margin: 3px 0 0; font: 800 max(16px, 1rem)/1.3 var(--body); }
.study-touch-coach ol { grid-column: 2; display: flex; gap: 8px; list-style: none; margin: 2px 0 0; padding: 0; font: 600 max(12px, .75rem)/1.2 var(--heading); }
.study-touch-coach li { display: flex; align-items: center; gap: 5px; color: #2d7780; }
.study-touch-coach li + li::before { content: "→"; color: #b58a2c; }
.study-touch-coach li[hidden] { display: none; }
.study-challenge.learning-game .tool-hint { display: none; }
@media (max-height: 650px) {
  .study-touch-coach { margin-block: 2px; padding: 5px 8px; grid-template-columns: 30px minmax(0, 1fr); gap: 2px 6px; }
  .study-coach-portrait { width: 30px; height: 34px; }
  .study-touch-coach strong { font-size: max(15px, .9375rem); }
  .study-touch-coach p { font-size: max(16px, 1rem); }
  .study-touch-coach ol { font-size: max(11px, .6875rem); margin: 0; }
}
@media (min-width: 500px) and (max-height: 550px) {
  .study-touch-coach { grid-area: 3 / 2; margin: 0; }
  .study-coach-portrait { display: none; }
  .study-touch-coach { grid-template-columns: 1fr; }
  .study-touch-coach ol { grid-column: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .study-touch-coach.is-entering { animation: study-coach-arrive 260ms ease-out both; }
  @keyframes study-coach-arrive { from { opacity: .3; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}
