/* "How to play" tutorials with Shadi (web/assets/js/tutorial.js): arcade-play and the KG corner. */
.tu-dialog { position: relative; width: min(560px, calc(100% - 20px)); max-height: calc(100dvh - 20px); overflow: auto; border: 0; border-radius: 28px; padding: 16px 18px 18px; background: var(--card); }
.tu-dialog::backdrop { background: rgba(10, 19, 48, .5); }
.tu-top { display: flex; align-items: center; gap: 8px; }
.tu-top h2 { flex: 1; margin: 0; font-size: clamp(17px, 3.6vw, 21px); line-height: 1.3; }
.tu-icon-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 21px; cursor: pointer; }
.tu-skip { flex: none; min-height: 46px; border: 0; border-radius: 999px; padding: 0 16px; background: var(--tint-yellow); color: var(--ink); font: 800 16px var(--font-display); cursor: pointer; box-shadow: 0 3px 0 #f0b72f; }
.tu-skip:active, .tu-icon-btn:active { transform: translateY(2px); }

/* Shadi and the speech bubble */
.tu-guide { display: flex; align-items: center; gap: 10px; margin: 12px 0 10px; }
.tu-shadi { width: 64px; height: 76px; flex: none; animation: tu-float 2.4s ease-in-out infinite; }
.tu-shadi.happy { animation: kg-jump .6s ease 2; }
@keyframes tu-float { 50% { translate: 0 -5px; } }
.tu-bubble { position: relative; flex: 1; margin: 0; background: var(--card); border: 2px solid var(--edge-purple); border-radius: 20px; padding: 10px 14px; font: 700 clamp(17px, 3.8vw, 20px)/1.45 var(--font-display); color: var(--ink); animation: tu-in .3s ease; }
@keyframes tu-in { from { transform: scale(.85); } }
.tu-bubble::before { content: ''; position: absolute; top: 50%; inset-inline-start: -11px; translate: 0 -50%; border: 10px solid transparent; border-inline-end-color: var(--edge-purple); border-inline-start: 0; }
.tu-say.nudge { border-color: var(--primary); animation: tu-nudge 1s ease-in-out infinite; }
@keyframes tu-nudge { 50% { transform: scale(1.15); box-shadow: 0 0 0 6px var(--primary-soft); } }

/* The little demo scene with the hand */
.tu-scene { position: relative; overflow: hidden; background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 14px 10px; min-height: 190px; display: flex; align-items: center; justify-content: center; }
.tu-board { width: 100%; }
.tu-hand { position: absolute; left: 50%; top: 110%; z-index: 3; font-size: 46px; line-height: 1; pointer-events: none; opacity: 0; translate: -32% -6%;
  filter: drop-shadow(0 4px 4px rgba(10, 19, 48, .3)); transition: left .6s cubic-bezier(.4, 0, .2, 1), top .6s cubic-bezier(.4, 0, .2, 1), opacity .3s, scale .15s; }
.tu-hand.on { opacity: 1; }
.tu-hand.press { scale: .82; }
.tu-hand.drag { transition-duration: 1s, 1s, .3s, .15s; }
.tu-hand.bob { animation: tu-bob 1s ease-in-out infinite; }
.tu-hand.wiggle { animation: wiggle .5s ease 2; }
@keyframes tu-bob { 50% { transform: translateY(10px); } }
.tu-hit { animation: kg-pop .3s ease; }
.tu-try .tu-board * { pointer-events: none; }
.tu-try .tu-board .tu-target, .tu-try .tu-board .tu-target * { pointer-events: auto; cursor: pointer; }
.tu-try .tu-board { pointer-events: auto; }
.tu-target { position: relative; z-index: 2; outline: 4px solid var(--yellow) !important; outline-offset: 3px; animation: tu-glow 1.1s ease-in-out infinite; }
.tu-target:focus-visible { outline-color: var(--primary) !important; }
@keyframes tu-glow { 50% { box-shadow: 0 0 0 10px rgba(255, 201, 60, .45); } }
.tu-done { outline: 4px solid var(--green) !important; outline-offset: 3px; }

/* Rules card (older players) */
.tu-rules { list-style: none; margin: 0; padding: 12px; display: grid; gap: 8px; background: var(--card); border: 2px solid var(--line); border-radius: 22px; }
.tu-rules li { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 16px; line-height: 1.45; background: var(--card); border-radius: 14px; padding: 8px 12px; }
.tu-rules li > span:first-child { flex: none; font-size: 26px; min-width: 34px; text-align: center; }

/* Dots and navigation */
.tu-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tu-dots { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 12px 0; }
.tu-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); font-style: normal; font-size: 0; transition: transform .2s; }
.tu-dots i.past { background: #b9b0fb; }
.tu-dots i.on { background: var(--primary); transform: scale(1.35); }
.tu-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tu-nav .btn { min-height: 54px; min-width: 120px; font-size: 19px; }
.tu-nav .tu-back:disabled { visibility: hidden; }
.tu-go { animation: tu-nudge 1.2s ease-in-out infinite; }
.tu-wait { font: 800 18px var(--font-display); color: var(--link); }

.tu-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.tu-confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 3px; animation: kg-fall 2.2s ease-in forwards; }

/* Young players: bigger everything */
.tu-young .tu-bubble { font-size: clamp(20px, 4.6vw, 24px); }
.tu-young .tu-shadi { width: 76px; height: 90px; }
.tu-young .tu-scene { min-height: 220px; }

/* ---- Scene pieces (game look-alikes, sized for the dialog) ---- */
.tu-scene .aq-q { font-size: clamp(17px, 3.6vw, 20px); margin: 4px 0 8px; }
.tu-scene .aq-choices { gap: 8px; margin-top: 6px; }
.tu-scene .aq-choices button { min-height: 50px; padding: 8px; font-size: clamp(17px, 3.6vw, 21px); }
.tu-scene .sm-q { font-size: clamp(32px, 7vw, 44px); margin: 0 0 8px; }
.tu-scene .wt-pic { font-size: 54px; }
.tu-scene .wt-slots { margin: 4px 0 10px; }
.tu-scene .mm-grid { width: min(100%, 300px); }
.tu-scene .ck-face { width: 130px; }
.tu-scene .sh-board .sh-shape, .tu-scene .sh-hole { width: 90px; height: 90px; }
.tu-scene .sh-shape { width: 58px; height: 58px; }
.tu-scene .bs-scale { max-width: 320px; gap: 24px; padding-bottom: 38px; }
.tu-scene .el-tile { width: 100px; height: 108px; }
.tu-scene .el-sym { font-size: 40px; }
.tu-scene .bl-sky { min-height: 0; padding: 8px; }
.tu-scene .cn-tray { min-height: 66px; }
.tu-scene .mr-typed { min-height: 40px; font-size: 26px; margin-bottom: 6px; }
.tu-scene .tu-col .sm-q { margin: 0; }
.tu-scene .rh-pads { width: min(100%, 210px); gap: 10px; }
.tu-scene .rh-pad { border-radius: 20px; }
.tu-scene .sd-grid { width: min(100%, 176px); }
.tu-scene .sd-cell { font-size: 22px; }
.tu-scene .pz { width: 120px; }
.tu-scene .gr-svg { width: 150px; }
.tu-scene .ws-grid { width: min(100%, 220px); }
.tu-scene .ws-cell.on { background: var(--primary); color: #fff; }
.tu-scene .an-svg { width: 150px; }
.tu-scene .kg-options { margin-top: 8px; gap: 10px; }
.tu-scene .kg-option { border-radius: 20px; }
.tu-scene .kg-letter, .tu-scene .kg-number { font-size: 54px; }
.tu-scene .kg-animal { font-size: 54px; }
.tu-row { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.tu-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tu-big { font: 800 30px var(--font-display); }
.tu-ear { font-size: 40px; }
.tu-pipes { display: grid; grid-template-columns: repeat(3, 64px); gap: 4px; background: var(--tint-purple); padding: 5px; border-radius: 14px; }
.tu-pipe { width: 64px; height: 64px; border: 0; border-radius: 10px; background: var(--card); padding: 0; display: grid; place-items: center; font-size: 30px; }
.tu-pipe svg { width: 100%; height: 100%; transition: transform .3s ease; }
.tu-pipe svg path { stroke: #b8b4d6; stroke-width: 18; stroke-linecap: round; fill: none; }
.tu-pipe.lit svg path { stroke: var(--sky); }
.tu-pipe.r1 svg { transform: rotate(90deg); }
.tu-track { position: relative; height: 56px; width: min(100%, 300px); background: #3b3f55; border-radius: 14px; }
.tu-track span { position: absolute; top: 10px; left: 8px; font-size: 30px; transform: scaleX(-1); transition: left .6s ease; }
.tu-track span.go { left: 46%; }
.tu-track b { position: absolute; right: 8px; top: 12px; font-size: 26px; }
.tu-map { width: 170px; height: auto; }
.tu-map path { fill: #e6f4ea; stroke: #2f8f5b; stroke-width: 3; stroke-linejoin: round; }
.tu-map circle { fill: #fff; stroke: var(--primary); stroke-width: 3; }
.tu-map circle.lit { fill: var(--yellow); stroke: var(--ink); }
.tu-map circle.on { fill: var(--green); stroke: #fff; }
.tu-trace { font: 800 120px/1 var(--font-display); color: #e9e6fb; position: relative; width: 150px; height: 150px; display: grid; place-items: center; background: var(--card); border: 3px dashed var(--edge-purple); border-radius: 22px; }
.tu-trace i { position: absolute; width: 14px; height: 14px; }
.tu-trace.on { color: var(--link); }

@media (max-width: 480px) {
  .tu-dialog { padding: 12px 12px 14px; border-radius: 22px; }
  .tu-top h2 { font-size: 16px; }
  .tu-skip { padding: 0 12px; font-size: 15px; }
  .tu-icon-btn { width: 42px; height: 42px; }
  .tu-shadi { width: 50px; height: 60px; }
  .tu-young .tu-shadi { width: 58px; height: 70px; }
  .tu-scene { padding: 10px 6px; min-height: 170px; }
  .tu-nav .btn { min-width: 0; flex: 1; }
  .tu-pipes { grid-template-columns: repeat(3, 56px); }
  .tu-pipe { width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .tu-shadi, .tu-shadi.happy, .tu-bubble, .tu-hit, .tu-go, .tu-say.nudge, .tu-target, .tu-hand.bob, .tu-hand.wiggle { animation: none; }
  .tu-hand, .tu-pipe svg, .tu-track span, .tu-kbd { transition: none; }
}

/* Scene pieces made only for the tutorials */
.tu-pipe.tu-empty { background: var(--card); }
.tu-pipe.tu-end.lit { background: #ffe9a8; animation: kg-pop .35s ease; color: var(--on-bright); }
.tu-stones { display: flex; justify-content: center; gap: 4px; margin: 26px 0 6px; }
.tu-stones span { position: relative; width: 36px; height: 30px; border-radius: 50%; background: var(--tint-green); border: 2px solid #9fe0c4; display: grid; place-items: center; }
.tu-stones b { font-size: 14px; }
.tu-frog { position: absolute; bottom: 70%; left: 50%; translate: -50% 0; font-size: 30px; font-style: normal; animation: kg-pop .3s ease; }
.tu-scene .pz-slice.tu-target { fill: #ffe9a8; stroke: #f0b72f; stroke-width: 3; }
.tu-scene circle.tu-target { fill: var(--yellow); stroke: var(--ink); animation: rg-pulse 1s ease-in-out infinite; }
.tu-scene svg .tu-target { outline: none !important; }
/* Play vs the bot boards */
.tu-ttt { display: grid; grid-template-columns: repeat(3, 60px); gap: 5px; justify-content: center; }
.tu-ttt button, .tu-sl button, .tu-sl span, .tu-ck button, .tu-rv button { border: 0; padding: 0; border-radius: 12px; background: var(--card); box-shadow: 0 3px 0 var(--line); font: 800 28px/1 var(--font-display); color: var(--ink); display: grid; place-items: center; }
.tu-ttt button { height: 60px; }
.tu-ttt .win, .tu-c4 .win, .tu-mz .win { background: var(--tint-green); box-shadow: 0 0 0 3px var(--green); }
.tu-c4 { display: grid; grid-template-columns: repeat(5, 40px); gap: 4px; justify-content: center; background: #3d7bf5; padding: 6px; border-radius: 14px; width: max-content; margin: 0 auto; }
.tu-c4 span { height: 40px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-size: 30px; line-height: 1; }
.tu-c4-drop { border: 0; background: none; padding: 0; height: 30px; font-size: 20px; }
.tu-box { position: relative; width: 120px; height: 120px; margin: 10px; border-radius: 6px; transition: background .3s; }
.tu-box.mine { background: var(--tint-purple); }
.tu-box > i { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); translate: -50% -50%; }
.tu-box > i:nth-of-type(1) { left: 0; top: 0; } .tu-box > i:nth-of-type(2) { left: 100%; top: 0; }
.tu-box > i:nth-of-type(3) { left: 0; top: 100%; } .tu-box > i:nth-of-type(4) { left: 100%; top: 100%; }
.tu-side { position: absolute; border: 0; padding: 0; background: repeating-linear-gradient(90deg, #c9c4ef 0 6px, transparent 6px 12px); border-radius: 4px; }
.tu-side.on { background: var(--primary); }
.tu-s-top { top: -4px; left: 0; right: 0; height: 8px; } .tu-s-bottom { bottom: -4px; left: 0; right: 0; height: 8px; }
.tu-s-left { left: -4px; top: 0; bottom: 0; width: 8px; } .tu-s-right { right: -4px; top: 0; bottom: 0; width: 8px; }
.tu-s-left:not(.on), .tu-s-right:not(.on) { background: repeating-linear-gradient(0deg, #c9c4ef 0 6px, transparent 6px 12px); }
.tu-rv { display: flex; gap: 4px; justify-content: center; background: #2f8f5b; padding: 6px; border-radius: 12px; width: max-content; margin: 0 auto; }
.tu-rv button { width: 46px; height: 46px; background: #3fa66d; box-shadow: none; font-size: 32px; }
.tu-rv button i { width: 10px; height: 10px; border-radius: 50%; background: rgba(0, 0, 0, .25); }
.tu-mc { display: flex; gap: 6px; justify-content: center; align-items: stretch; background: #c98b3a; padding: 8px; border-radius: 30px; width: max-content; margin: 0 auto; }
.tu-mc button, .tu-mc-store { border: 0; border-radius: 50%; width: 62px; height: 62px; background: #8a5a1f; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; padding: 0; }
.tu-mc b { font: 800 18px var(--font-display); }
.tu-mc-store { border-radius: 26px; width: 58px; height: auto; min-height: 62px; background: #6e4513; }
.tu-ck { display: grid; grid-template-columns: repeat(4, 46px); width: max-content; margin: 0 auto; border: 3px solid var(--ink); border-radius: 8px; overflow: hidden; }
.tu-ck button { width: 46px; height: 46px; border-radius: 0; box-shadow: none; background: var(--tint-yellow); font-size: 30px; }
.tu-ck button.dk { background: #8a5a1f; }
.tu-ck button.sel { background: #ffe9a8; color: var(--on-bright); }
.tu-vs { display: flex; justify-content: center; gap: 24px; font: 800 20px var(--font-display); margin-bottom: 4px; }
.tu-sn { display: grid; grid-template-columns: repeat(5, 48px); gap: 3px; width: max-content; margin: 0 auto; }
.tu-sn span { position: relative; height: 44px; border-radius: 8px; background: var(--tint-yellow); display: grid; place-items: center; font-size: 22px; }
.tu-sn span:nth-child(odd) { background: var(--tint-green); }
.tu-sn small { position: absolute; top: 1px; inset-inline-start: 4px; font-size: 10px; font-weight: 800; color: var(--muted); }
.tu-me { position: absolute; font-style: normal; font-size: 26px; animation: kg-pop .3s ease; }
.tu-dice { margin-top: 10px; }
.tu-dice button { border: 2px solid var(--line); border-radius: 12px; background: var(--card); font: 800 20px var(--font-display); padding: 6px 12px; }
.tu-dice button.right { border-color: var(--green); background: var(--tint-green); }
.tu-mg { display: grid; grid-template-columns: repeat(3, 52px); gap: 5px; width: max-content; margin: 0 auto; background: #cdc1b4; padding: 5px; border-radius: 10px; color: var(--on-bright); }
.tu-mg span { height: 52px; border-radius: 8px; background: var(--tint-orange); display: grid; place-items: center; font: 800 22px var(--font-display); color: #776e65; }
.tu-mg .v4 { background: #ede0c8; } .tu-mg .v8 { background: #f2b179; color: #fff; }
.tu-arrows { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.tu-arrows button { width: 48px; height: 44px; border: 2px solid var(--line); border-radius: 12px; background: var(--card); font-size: 22px; padding: 0; }
.tu-sl { display: grid; grid-template-columns: repeat(3, 52px); gap: 5px; width: max-content; margin: 0 auto; }
.tu-sl button { height: 52px; background: var(--primary); color: #fff; box-shadow: 0 3px 0 var(--primary-dark); font-size: 24px; }
.tu-sl .gap { height: 52px; background: var(--tint-purple); box-shadow: none; }
.tu-sl.done button { background: var(--green); box-shadow: 0 3px 0 #178a5e; }
.tu-mz { display: grid; grid-template-columns: repeat(4, 44px); gap: 2px; width: max-content; margin: 0 auto; }
.tu-mz span { position: relative; height: 44px; border-radius: 6px; background: var(--card); display: grid; place-items: center; font-size: 24px; }
.tu-mz span.wall { background: #5b45f8; }
.tu-gicon { font-size: 72px; line-height: 1; }
.tu-gplay { min-width: 120px; font-size: 26px; }

/* The device's own keyboard, drawn small: slides up when the hand taps the typing box. */
.tu-kbd { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-height: 0; overflow: hidden; margin: 0 -10px -14px; padding: 0 8px;
  background: #d5d8de; border-radius: 14px 14px 0 0; transition: max-height .35s ease, padding .35s ease, margin .35s ease; color: var(--on-bright); }
.tu-kbd::before { content: '⌨️'; flex-basis: 100%; text-align: center; font-size: 14px; line-height: 1; opacity: .7; }
.tu-kbd span { min-width: 30px; height: 34px; padding: 0 4px; border-radius: 7px; background: var(--card); box-shadow: 0 1px 0 #8f949e; display: grid; place-items: center; font: 700 17px var(--font-display); color: var(--ink); }
.tu-kbd-num span { min-width: 44px; }
.tu-kb-up .tu-kbd { max-height: 140px; padding: 6px 8px 10px; margin-top: 10px; }
.tu-kbd span.tu-hit { background: #c9c4ef; }
.tu-scene .mr-typed { width: 160px; margin: 0 auto; }
.tu-ph { font: 700 15px var(--font-body, inherit); color: #9a94c4; }
.tu-scene .sp-word { min-height: 48px; font-size: 26px; margin-bottom: 4px; }
.tu-scene .hm-type { min-height: 44px; font-size: 16px; }
.tu-scene .hm-tried { min-height: 0; margin: 4px 0 0; }

@media (max-width: 480px) {
  .tu-stones span { width: 30px; height: 26px; }
}
