/* MiniMat prototip — tokenlar stil rehberi §4 */
:root {
  --sky: #5EC8E5;
  --sky-deep: #2C8FB8;
  --ink: #1F2A44;
  --panel: #FFF8EC;
  --go: #FF8A3D;
  --go-deep: #E06A1E;
  --star: #FFC83D;
  --ok: #3DBB6B;
  --oops: #E8505B;
  --hint: #8E6CE0;
  --sq-light: #F4E9D2;
  --sq-dark: #7FB8A4;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(31, 42, 68, .18);
  --font-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, #8FDCEF 0, transparent 55%),
    radial-gradient(ellipse at 100% 100%, #3FAFD3 0, transparent 50%),
    var(--sky);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
svg { display: block; }

/* ---------- üst bar ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; max-width: 1040px; margin: 0 auto; padding: 12px 16px 16px; }
.topbar { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 52px; height: 52px; border-radius: 50%; border: 4px solid var(--ink);
  background: var(--panel); box-shadow: var(--shadow); display: grid; place-items: center; flex: none;
}
.icon-btn svg { width: 26px; height: 26px; }
.lesson-title {
  font-family: var(--font-head); font-weight: 800; font-size: clamp(24px, 4.5vw, 34px); margin: 0;
  color: #fff; letter-spacing: .3px;
  text-shadow: -3px -3px 0 var(--ink), 3px -3px 0 var(--ink), -3px 3px 0 var(--ink), 3px 3px 0 var(--ink), 0 5px 0 var(--ink);
  flex: 1; min-width: 0;
}
.progress { list-style: none; display: flex; gap: 8px; margin: 0; padding: 8px 12px; background: rgba(31,42,68,.18); border-radius: 999px; }
.progress li { width: 22px; height: 22px; border-radius: 50%; background: var(--panel); border: 3px solid var(--ink); display: grid; place-items: center; }
.progress li.current { background: var(--go); transform: scale(1.15); }
.progress li.done { background: transparent; border: 0; }
.progress li.done svg { width: 26px; height: 26px; }

/* ---------- sahne ---------- */
.stage { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: center; padding-top: 12px; }
.board-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.goal {
  font-family: var(--font-head); font-size: 22px; font-weight: 700;
  background: var(--panel); border: 4px solid var(--ink); border-radius: 999px; padding: 4px 20px 2px;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; min-height: 48px;
}
.goal .goal-icon { width: 32px; height: 32px; }
.goal .count { color: var(--sky-deep); }

.board-frame {
  padding: 12px; border-radius: 28px; background: #8A5A3B; border: 5px solid var(--ink);
  box-shadow: 0 10px 0 rgba(31,42,68,.25), inset 0 0 0 4px #A97350;
  width: min(100%, 520px);
}
.board {
  position: relative; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr);
  aspect-ratio: 1; border-radius: 16px; border: 3px solid var(--ink); touch-action: none;
}
.cell {
  position: relative; border: 0; padding: 0; margin: 0; background: var(--sq-light);
  display: grid; place-items: center; outline: none;
}
.cell.dark { background: var(--sq-dark); }
.cell:nth-child(1) { border-top-left-radius: 13px; }
.cell:nth-child(5) { border-top-right-radius: 13px; }
.cell:nth-child(21) { border-bottom-left-radius: 13px; }
.cell:nth-child(25) { border-bottom-right-radius: 13px; }
.cell:focus-visible { box-shadow: inset 0 0 0 5px var(--hint); z-index: 2; }
.coord { position: absolute; font-size: 12px; font-weight: 800; opacity: .55; pointer-events: none; }
.coord.rank { top: 4px; left: 6px; }
.coord.file { bottom: 3px; right: 7px; }
.cell .item { width: 72%; height: 72%; pointer-events: none; }
.cell .item.cookie { width: 94%; height: 94%; animation: cookie-wiggle 2.4s ease-in-out infinite; }
@keyframes cookie-wiggle { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg) scale(1.05); } 92% { transform: rotate(6deg); } }
.cell .item.bush { width: 86%; height: 86%; }

/* seçili kare, geçerli hamle noktaları */
.cell.from { background: color-mix(in srgb, var(--star) 55%, var(--sq-light)); }
.cell.legal::after {
  content: ''; position: absolute; width: 28%; height: 28%; border-radius: 50%;
  background: rgba(31, 42, 68, .35); box-shadow: 0 0 0 3px rgba(255,255,255,.7);
  pointer-events: none;
}
.cell.legal.has-cookie::after { width: 86%; height: 86%; background: transparent; box-shadow: inset 0 0 0 5px rgba(31,42,68,.35); }
.cell.oops { animation: oops .45s ease-out; }
@keyframes oops { 0%, 60% { background: color-mix(in srgb, var(--oops) 55%, var(--sq-light)); } 100% { } }
.cell.hint-sq::before {
  content: ''; position: absolute; inset: 8%; border-radius: 18px; border: 5px dashed var(--hint);
  animation: pulse .7s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes pulse { from { transform: scale(.88); opacity: .55; } to { transform: scale(1); opacity: 1; } }
.cell.sight { background: color-mix(in srgb, var(--ok) 40%, var(--sq-light)); }
.cell.sight.dark { background: color-mix(in srgb, var(--ok) 45%, var(--sq-dark)); }

/* yeme efekti */
.pop { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 4; }
.pop .item { grid-area: 1 / 1; width: 94%; height: 94%; animation: none; transition: width .12s ease-out, height .12s ease-out, transform .12s ease-out; }
/* Burç'un ağzı karenin ~%60 yüksekliğinde: kurabiye küçülüp oraya gider */
.pop.at-mouth .item { width: 40%; height: 40%; transform: translateY(26%); }
.pop .bitten { opacity: 0; }
.pop.bite1 .cookie:not(.bitten) { opacity: 0; }
.pop.bite1 .bitten { opacity: 1; animation: bite-shake .16s ease-out; }
.pop.bite2 .bitten { animation: into-mouth .2s ease-in forwards; }
@keyframes bite-shake { 0% { transform: translateY(26%) scale(1.15) rotate(-8deg); } 100% { transform: translateY(26%) scale(.95) rotate(0); } }
@keyframes into-mouth { from { transform: translateY(26%) scale(.95); } to { transform: translateY(34%) scale(0); opacity: 0; } }
.crumbs { position: absolute; left: 50%; top: 58%; width: 0; height: 0; pointer-events: none; z-index: 5; }
.crumbs i {
  position: absolute; width: 9px; height: 7px; margin: -4px; border-radius: 40% 60% 50% 45%;
  background: #D98B3A; border: 1.5px solid var(--ink);
  animation: crumb .6s cubic-bezier(.2,.7,.4,1) forwards;
}
.crumbs i:nth-child(3n) { background: #5A3220; }
@keyframes crumb {
  0% { transform: translate(0, 0) scale(var(--s)) rotate(0); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.4), calc(var(--dy) * 1.4 + 26px)) scale(var(--s)) rotate(var(--r)); opacity: 0; }
}
.yum {
  position: absolute; left: 50%; top: -38%; transform: translateX(-50%); z-index: 6; pointer-events: none;
  font-family: var(--font-head); font-weight: 800; font-size: clamp(16px, 3.2vw, 24px); white-space: nowrap; color: #fff;
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink);
  animation: yum .9s ease-out forwards;
}
@keyframes yum { 0% { transform: translate(-50%, 20%) scale(.6); opacity: 0; } 25% { transform: translate(-50%, 0) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -45%) scale(1); opacity: 0; } }

/* taş katmanı */
.piece {
  position: absolute; left: 0; top: 0; width: 20%; height: 20%; z-index: 3; pointer-events: none;
  transition: transform .32s cubic-bezier(.3, .7, .3, 1);
  display: grid; place-items: center;
}
.piece .burc { width: 104%; height: 129%; flex: none; transform-origin: 50% 94%; margin-top: -32%; overflow: visible; }
.piece { place-items: start center; }
.piece.selected .burc { animation: lift .3s ease-out forwards; }
@keyframes lift { to { transform: translateY(-8%) scale(1.08); } }
.piece.hop .burc { animation: hop .32s ease-out; }
@keyframes hop { 0% { transform: translateY(0); } 45% { transform: translateY(-22%) scale(1.06); } 100% { transform: translateY(0); } }
.piece.shake .burc { animation: shake .3s ease-in-out; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-9%); } 75% { transform: translateX(9%); } }
.piece.nudge .burc { animation: nudge .45s ease-out; }
@keyframes nudge { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.14); } }
.piece.cheer .burc { animation: cheer .6s ease-out 2; }
@keyframes cheer { 0%, 100% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-18%) rotate(-6deg); } 60% { transform: translateY(-6%) rotate(5deg); } }

/* ---------- rehber paneli ---------- */
.guide { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bubble {
  position: relative; background: var(--panel); border: 4px solid var(--ink); border-radius: var(--radius);
  padding: 14px 18px; font-size: 21px; line-height: 1.3; min-height: 92px; width: 100%;
  box-shadow: var(--shadow); display: flex; align-items: center;
}
.bubble::after {
  content: ''; position: absolute; bottom: -18px; left: 50%; width: 26px; height: 26px; background: var(--panel);
  border-right: 4px solid var(--ink); border-bottom: 4px solid var(--ink); transform: translateX(-50%) rotate(45deg);
}
.bubble.fresh { animation: bubble-in .28s ease-out; }
@keyframes bubble-in { from { transform: scale(.9); opacity: .4; } to { transform: scale(1); opacity: 1; } }

.minik-holder, .start-minik, .result-minik { width: 220px; aspect-ratio: 220 / 240; }
.minik-holder svg, .start-minik svg, .result-minik svg { width: 100%; height: 100%; overflow: visible; }

/* Minik ifadeleri: varsayılan her şey gizli, data-mood açar */
.mk-eyes, .mk-brows, .mk-trunk, .mk-mouth, .mk-sparkles { display: none; }
[data-mood="idle"] .mk-eyes-open, [data-mood="idle"] .mk-trunk-idle, [data-mood="idle"] .mk-mouth-smile,
[data-mood="think"] .mk-eyes-open, [data-mood="think"] .mk-brows-think, [data-mood="think"] .mk-trunk-think,
[data-mood="happy"] .mk-eyes-happy, [data-mood="happy"] .mk-trunk-up, [data-mood="happy"] .mk-mouth-smile,
[data-mood="veryhappy"] .mk-eyes-happy, [data-mood="veryhappy"] .mk-trunk-up, [data-mood="veryhappy"] .mk-mouth-smile, [data-mood="veryhappy"] .mk-sparkles,
[data-mood="sad"] .mk-eyes-open, [data-mood="sad"] .mk-brows-sad, [data-mood="sad"] .mk-trunk-down, [data-mood="sad"] .mk-mouth-sad,
[data-mood="surprised"] .mk-eyes-big, [data-mood="surprised"] .mk-trunk-idle, [data-mood="surprised"] .mk-mouth-o,
[data-mood="point"] .mk-eyes-open, [data-mood="point"] .mk-trunk-point, [data-mood="point"] .mk-mouth-smile { display: inline; }

.mk-body-wrap { transform-origin: 110px 230px; }
[data-mood="idle"] .mk-body-wrap { animation: breathe 3.2s ease-in-out infinite; }
[data-mood="idle"] .mk-eyes-open { animation: blink 4.6s infinite; transform-origin: 110px 88px; }
[data-mood="idle"] .mk-ear-l { animation: flap-l 5s ease-in-out infinite; transform-origin: 80px 92px; }
[data-mood="idle"] .mk-ear-r { animation: flap-r 5s ease-in-out infinite; transform-origin: 140px 92px; }
[data-mood="veryhappy"] .mk-body-wrap { animation: jump .55s ease-out 3; }
[data-mood="happy"] .mk-body-wrap { animation: bob .5s ease-out 1; }
[data-mood="sad"] .mk-ear { transform: rotate(0); }
[data-mood="sad"] .mk-ear-l { transform: rotate(-12deg); transform-origin: 80px 92px; }
[data-mood="sad"] .mk-ear-r { transform: rotate(12deg); transform-origin: 140px 92px; }
[data-mood="surprised"] .mk-ear-l { transform: rotate(10deg) scale(1.05); transform-origin: 80px 92px; }
[data-mood="surprised"] .mk-ear-r { transform: rotate(-10deg) scale(1.05); transform-origin: 140px 92px; }
.mk-sparkles path { animation: twinkle .6s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.015); } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes flap-l { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-2deg); } }
@keyframes flap-r { 0%, 80%, 100% { transform: rotate(0); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(2deg); } }
@keyframes jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14%) scale(1.03, .97); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes twinkle { from { transform: scale(.7) rotate(0); } to { transform: scale(1.1) rotate(20deg); } }

/* ---------- düğmeler ---------- */
.controls { display: flex; gap: 10px; width: 100%; }
.btn {
  border: 4px solid var(--ink); border-radius: 18px; padding: 10px 16px; font-family: var(--font-head);
  font-weight: 800; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow); min-height: 56px; transition: transform .08s;
}
.btn svg { width: 24px; height: 24px; }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(31,42,68,.18); }
.btn:focus-visible, .icon-btn:focus-visible, .toggle:focus-visible { outline: 4px solid var(--hint); outline-offset: 3px; }
.controls .btn { flex: 1; }
.btn-hint { background: #E6DEFA; }
.btn-hint.glow { background: var(--hint); color: #fff; animation: glow .8s ease-in-out infinite alternate; }
@keyframes glow { from { box-shadow: var(--shadow), 0 0 0 0 rgba(142,108,224,.6); } to { box-shadow: var(--shadow), 0 0 0 10px rgba(142,108,224,0); } }
.btn-ghost { background: var(--panel); }
.btn-go { background: var(--go); color: var(--ink); }
.btn-next { width: 100%; font-size: 24px; animation: bob .9s ease-in-out infinite; }
.btn-big { font-size: 28px; padding: 12px 40px; min-height: 68px; }

/* ---------- ses çubuğu ---------- */
.sound-bar { display: flex; justify-content: center; gap: 10px; padding-top: 16px; flex-wrap: wrap; }
.toggle {
  border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px 6px 12px; background: var(--panel);
  font-size: 16px; min-height: 44px; display: inline-flex; align-items: center; gap: 8px;
}
.toggle::before { content: ''; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); background: var(--ok); }
.toggle[aria-pressed="false"] { opacity: .65; }
.toggle[aria-pressed="false"]::before { background: #fff; }

/* ---------- katmanlar ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px;
  background: rgba(31, 42, 68, .55); backdrop-filter: blur(3px);
}
.overlay[hidden] { display: none; }
.card {
  background: var(--panel); border: 5px solid var(--ink); border-radius: 32px; box-shadow: 0 10px 0 rgba(31,42,68,.3);
  padding: 24px 28px 28px; text-align: center; max-width: 440px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 10px; animation: bubble-in .3s ease-out;
}
.card h2 { font-family: var(--font-head); font-weight: 800; font-size: 34px; margin: 0; line-height: 1.1; }
.card p { font-size: 20px; margin: 0 0 8px; }
.start-minik { width: 190px; }
.result-minik { width: 150px; }
.result-stars { display: flex; gap: 6px; align-items: flex-end; }
.result-stars svg { width: 70px; height: 70px; }
.result-stars svg:nth-child(2) { width: 88px; height: 88px; }
.result-stars .s-in { animation: star-in .45s cubic-bezier(.3,1.6,.5,1) backwards; }
@keyframes star-in { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }

/* ---------- dar ekran ---------- */
@media (max-width: 820px) {
  .stage { grid-template-columns: 1fr; gap: 12px; }
  .guide { display: grid; grid-template-columns: 120px 1fr; grid-template-areas: "m b" "c c" "n n"; align-items: center; width: 100%; max-width: 520px; margin: 0 auto; }
  .minik-holder { grid-area: m; width: 120px; }
  .bubble { grid-area: b; font-size: 18px; min-height: 76px; }
  .bubble::after { left: -16px; top: 50%; bottom: auto; transform: translateY(-50%) rotate(135deg); }
  .controls { grid-area: c; }
  .btn-next { grid-area: n; }
  .progress li { width: 18px; height: 18px; }
  .progress { gap: 5px; padding: 6px 8px; }
}
@media (max-width: 420px) {
  .lesson-title { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 4px 2px 6px; }
  .goal { font-size: 18px; min-height: 42px; }
  .coord { font-size: 10px; }
  .app, .map-screen { padding: 10px 12px 12px; }
  .icon-btn { width: 44px; height: 44px; }
  .progress li { width: 15px; height: 15px; border-width: 2.5px; }
  .progress li.done svg { width: 20px; height: 20px; }
  .guide { grid-template-columns: 96px 1fr; }
  .minik-holder { width: 96px; }
  .bubble { font-size: 17px; padding: 10px 14px; min-height: 64px; }
  .btn { padding-top: 8px; padding-bottom: 8px; }
  .sound-bar { gap: 6px; padding-top: 10px; flex-wrap: nowrap; }
  .toggle { font-size: 14px; padding: 6px 10px; gap: 6px; }
  .toggle::before { width: 14px; height: 14px; }
  .map-total { font-size: 20px; padding: 2px 12px 2px 6px; }
  .map-total svg { width: 26px; height: 26px; }
  .card h2 { font-size: 28px; }
  .badge-art { width: 160px; }
}
/* Yatay telefon: ekran kısa, tahta ekranın yüksekliğine sığar. */
@media (max-height: 520px) and (orientation: landscape) {
  .app { padding: 8px 12px; }
  .topbar .icon-btn { width: 42px; height: 42px; }
  .lesson-title { font-size: 22px; }
  /* Tahta solda tüm yüksekliği kullanır; görev etiketi ve rehber sağda. */
  .stage { grid-template-columns: auto minmax(220px, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "board goal" "board guide"; gap: 8px 16px; padding-top: 6px; align-items: start; }
  .board-area { display: contents; }
  .goal { grid-area: goal; justify-self: start; font-size: 18px; min-height: 40px; }
  .board-frame { grid-area: board; width: calc(100vh - 76px); padding: 8px; border-radius: 20px; }
  .guide { grid-area: guide; align-self: start; }
  .sound-bar { position: fixed; right: 12px; bottom: 8px; padding: 0; gap: 6px; }
  .toggle { font-size: 13px; padding: 4px 10px; min-height: 36px; }
  .toggle::before { width: 12px; height: 12px; }
  .guide { display: grid; grid-template-columns: 90px 1fr; grid-template-areas: "m b" "c c" "n n"; }
  .minik-holder { width: 90px; grid-area: m; }
  .bubble { grid-area: b; font-size: 16px; min-height: 0; }
  .bubble::after { left: -16px; top: 50%; bottom: auto; transform: translateY(-50%) rotate(135deg); }
  .controls { grid-area: c; } .btn-next { grid-area: n; }
}

/* ---------- hareket azaltma ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .piece { transition: none; }
}

/* ---------- Burç yüz durumları (data-face) ---------- */
.bc-eyes, .bc-brows, .bc-mouth { display: none; }
[data-face="idle"] .bc-eyes-open, [data-face="idle"] .bc-brows-normal, [data-face="idle"] .bc-mouth-smile,
[data-face="open"] .bc-eyes-open, [data-face="open"] .bc-brows-normal, [data-face="open"] .bc-mouth-open,
[data-face="chew"] .bc-eyes-happy, [data-face="chew"] .bc-brows-normal, [data-face="chew"] .bc-mouth-chew,
[data-face="happy"] .bc-eyes-happy, [data-face="happy"] .bc-brows-normal, [data-face="happy"] .bc-mouth-open,
[data-face="sad"] .bc-eyes-open, [data-face="sad"] .bc-brows-sad, [data-face="sad"] .bc-mouth-sad { display: inline; }
.bc-body { transform-origin: 50px 116px; }
[data-face="idle"] .bc-body { animation: bc-breathe 2.8s ease-in-out infinite; }
[data-face="idle"] .bc-eyes-open { animation: blink 5.2s infinite; transform-origin: 50px 68px; }
[data-face="open"] .bc-body { transform: scale(1.04, 1.02); }
[data-face="chew"] .bc-cheek { animation: cheek-puff .17s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
[data-face="chew"] .bc-body { animation: chew .17s ease-in-out infinite alternate; }
.piece.munch .burc { animation: munch .22s ease-out; }
.selected .bc-pupil { transform: translateY(-1.5px); }
@keyframes bc-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, .99); } }
@keyframes chew { from { transform: scale(1, 1); } to { transform: scale(1.03, .975); } }
@keyframes cheek-puff { from { transform: scale(1); } to { transform: scale(1.45, 1.3); } }
@keyframes munch { 0% { transform: scale(1, 1); } 40% { transform: scale(1.1, .9); } 100% { transform: scale(1, 1); } }

/* ---------- yürüme: adım zıplaması, varış, toz ---------- */
.piece.step .burc { animation: step-hop .15s ease-out; }
@keyframes step-hop { 0% { transform: translateY(0) scale(1, 1); } 45% { transform: translateY(-16%) scale(.96, 1.05); } 100% { transform: translateY(0) scale(1.04, .96); } }
.piece.land .burc { animation: land .22s ease-out; }
@keyframes land { 0% { transform: scale(1.12, .86); } 60% { transform: scale(.97, 1.04); } 100% { transform: scale(1, 1); } }
.dust { position: absolute; left: 0; right: 0; bottom: 8%; height: 30%; pointer-events: none; z-index: 2; }
.dust i {
  position: absolute; bottom: 0; width: 22%; aspect-ratio: 1; border-radius: 50%;
  background: rgba(255, 255, 255, .9); border: 2px solid rgba(31, 42, 68, .25);
  animation: puff .45s ease-out forwards;
}
.dust i:nth-child(1) { left: 20%; }
.dust i:nth-child(2) { left: 40%; width: 28%; animation-delay: .03s; }
.dust i:nth-child(3) { left: 62%; animation-delay: .06s; }
@keyframes puff { 0% { transform: scale(.3) translateY(0); opacity: .9; } 100% { transform: scale(1.3) translateY(-30%); opacity: 0; } }

/* ---------- gösterici el ---------- */
.coach-hand {
  position: absolute; left: 0; top: 0; width: 20%; height: 20%; z-index: 6; pointer-events: none;
  transform-origin: 40% 8%; filter: drop-shadow(0 4px 0 rgba(31,42,68,.25));
}
.coach-hand .hand-svg { width: 100%; height: 100%; display: block; }
.coach-ghost { z-index: 4; transition: none; }
.cell.coach-target::after {
  content: ''; position: absolute; inset: 10%; border-radius: 50%; border: 5px solid var(--go);
  animation: coach-ring .7s ease-out forwards; pointer-events: none;
}
@keyframes coach-ring { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cell.coach-target::after { animation: none; opacity: 1; }
}

/* ---------- dünya haritası: Kale Vadisi ---------- */
.map-screen { min-height: 100%; max-width: 1040px; margin: 0 auto; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.map-top { display: flex; align-items: center; gap: 12px; }
.map-total {
  display: flex; align-items: center; gap: 6px; background: var(--panel); border: 4px solid var(--ink);
  border-radius: 999px; padding: 4px 16px 4px 8px; box-shadow: var(--shadow);
  font-family: var(--font-head); font-size: 24px; font-weight: 800;
}
.map-total svg { width: 32px; height: 32px; }
.map-body { display: grid; grid-template-columns: minmax(0, 560px) minmax(220px, 300px); gap: 24px; justify-content: center; align-items: center; flex: 1; }
.map-scene {
  position: relative; width: 100%; aspect-ratio: 4 / 5; border: 5px solid var(--ink); border-radius: 28px;
  overflow: hidden; box-shadow: 0 10px 0 rgba(31,42,68,.25); background: #D8F5FB;
  container-type: inline-size; /* düğüm yazıları haritanın genişliğine göre ölçeklenir */
}
.map-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-trail { animation: trail 1.6s linear infinite; }
@keyframes trail { to { stroke-dashoffset: -32; } }
.map-guide { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.map-guide .minik-holder { width: 200px; }

.map-node {
  position: absolute; width: 24%; transform: translate(-50%, -50%); border: 0; padding: 0; background: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px; z-index: 2;
}
.node-medal {
  position: relative; width: 74%; aspect-ratio: 1; border-radius: 50%; background: var(--panel);
  border: 5px solid var(--ink); box-shadow: 0 6px 0 var(--ink); display: grid; place-items: center;
  transition: transform .15s ease-out;
}
.map-node:active .node-medal { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.map-node:focus-visible { outline: none; }
.map-node:focus-visible .node-medal { outline: 5px solid var(--hint); outline-offset: 4px; }
.node-icon { width: 70%; height: 70%; display: grid; place-items: center; }
.node-icon svg { width: 100%; height: 100%; overflow: visible; }
.node-icon.icon-rook svg { width: 76%; height: 94%; margin-top: -10%; }
.node-icon.icon-pawn svg { width: 104%; height: 104%; margin-top: 4%; }
.node-icon .mk-eyes-open, .node-icon .mk-trunk-idle, .node-icon .mk-mouth-smile { display: inline; }
.node-icon .bc-eyes-open, .node-icon .bc-brows-normal, .node-icon .bc-mouth-smile { display: inline; }
.node-num {
  position: absolute; top: -2%; left: 6%; width: 30%; aspect-ratio: 1; border-radius: 50%;
  background: var(--sky-deep); color: #fff; border: 4px solid var(--ink);
  font-family: var(--font-head); font-weight: 800; font-size: clamp(10px, 3.6cqw, 20px); display: grid; place-items: center;
}
.node-stars { display: flex; gap: 2px; margin-top: 4px; width: 70%; }
.node-stars svg { flex: 1; width: 100%; height: auto; }
.node-title {
  background: var(--panel); border: 3px solid var(--ink); border-radius: 999px; padding: 1px 10px;
  font-family: var(--font-head); font-weight: 800; font-size: clamp(9px, 3cqw, 16px); white-space: nowrap;
  box-shadow: 0 3px 0 rgba(31,42,68,.2);
}
.map-node.is-done .node-medal { background: #FFE9A8; }
.map-node.is-current .node-medal { background: #FFD3B3; animation: node-pulse 1.4s ease-in-out infinite; }
@keyframes node-pulse { 0%, 100% { box-shadow: 0 6px 0 var(--ink), 0 0 0 0 rgba(255,138,61,.6); } 50% { box-shadow: 0 6px 0 var(--ink), 0 0 0 14px rgba(255,138,61,0); } }
.map-node.is-locked .node-icon, .map-node.is-soon .node-icon { filter: grayscale(1); opacity: .45; }
.map-node.is-locked .node-medal, .map-node.is-soon .node-medal { background: #E7E2D8; }
.map-node.is-locked .node-stars, .map-node.is-soon .node-stars { visibility: hidden; }
.node-lock { position: absolute; width: 42%; right: -6%; bottom: -4%; }
.map-node.nope .node-medal { animation: shake .3s ease-in-out; }
.map-node.unlocking .node-lock { animation: unlock .7s ease-in forwards; }
.map-node.unlocking .node-medal { animation: node-pop .6s .5s ease-out both; }
@keyframes unlock { 40% { transform: translateY(-20%) rotate(-12deg); } 100% { transform: translateY(60%) rotate(20deg); opacity: 0; } }
@keyframes node-pop { 0% { transform: scale(.85); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.map-pin {
  position: absolute; width: 13%; aspect-ratio: 1; z-index: 3; pointer-events: none;
  transform: translate(5%, -63%); transform-origin: 40% 8%; opacity: 0;
  animation: map-tap 4.2s ease-in-out infinite;
}
.map-pin .hand-svg { width: 100%; height: 100%; display: block; }
/* El ara ara sağ alttan belirerek gelir, düğüme tam görünür hâlde bir kez dokunur ve silinerek kaybolur. */
@keyframes map-tap {
  0%, 30% { transform: translate(40%, -10%) scale(1); opacity: 0; }
  48% { transform: translate(12%, -46%) scale(1); opacity: 1; }
  58% { transform: translate(5%, -63%) scale(.88); opacity: 1; }
  66% { transform: translate(12%, -46%) scale(1); opacity: 1; }
  82%, 100% { transform: translate(30%, -20%) scale(1); opacity: 0; }
}
.map-node.is-current .node-medal::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 5px solid var(--go);
  opacity: 0; animation: map-ripple 4.2s ease-out infinite; pointer-events: none;
}
@keyframes map-ripple {
  0%, 57% { transform: scale(.85); opacity: 0; }
  59% { transform: scale(.88); opacity: .7; }
  75%, 100% { transform: scale(1.3); opacity: 0; }
}

.result-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }

@media (max-width: 820px) {
  .map-body { grid-template-columns: 1fr; gap: 12px; }
  .map-scene { max-width: 520px; margin: 0 auto; }
  .map-guide { order: -1; display: grid; grid-template-columns: 96px 1fr; align-items: center; width: 100%; max-width: 520px; margin: 0 auto; }
  .map-guide .minik-holder { width: 96px; grid-row: 1; grid-column: 1; }
  .map-guide .bubble { grid-row: 1; grid-column: 2; min-height: 0; font-size: 18px; }
  .map-guide .bubble::after { bottom: auto; top: 50%; left: -16px; transform: translateY(-50%) rotate(135deg); }
}
@media (prefers-reduced-motion: reduce) {
  .map-pin { opacity: .45; }
  .map-trail, .map-pin, .map-node.is-current .node-medal, .map-node.is-current .node-medal::after, .map-node.unlocking .node-lock, .map-node.unlocking .node-medal { animation: none; }
  .map-node.unlocking .node-lock { opacity: 0; }
}

/* ---------- piyon dersi ---------- */
.board.is-pawn .pop.at-mouth .item { transform: translateY(-55%); }
.cell.goal-row { background-image: linear-gradient(rgba(255,200,61,.28), rgba(255,200,61,.28)); }
.pw-crown { display: none; }
.piece.promoted .pw-crown { display: inline; animation: crown-in .6s cubic-bezier(.3,1.6,.5,1) both; transform-origin: 50px 10px; transform-box: view-box; }
@keyframes crown-in { from { transform: translateY(-30px) scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.goal .goal-icon svg { width: 100%; height: 100%; }

/* ---------- vadi rozeti ---------- */
.badge-card { text-align: center; }
.badge-art { width: 200px; margin: 0 auto; }
.badge-art svg { width: 100%; height: auto; overflow: visible; }
.badge-art .bc-eyes-happy, .badge-art .bc-mouth-smile, .badge-art .bc-brows-normal { display: inline; }
.badge-screen-pop, #badge-screen:not([hidden]) .badge-art { animation: badge-pop .8s cubic-bezier(.3,1.5,.5,1) both; }
@keyframes badge-pop { from { transform: scale(.2) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
.map-node.is-done .icon-trophy svg { filter: none; }
@media (prefers-reduced-motion: reduce) {
  .piece.promoted .pw-crown, #badge-screen:not([hidden]) .badge-art { animation: none; }
}

/* Yatay telefon (harita ve kartlar): harita solda ekran yüksekliğinde, Minik sağda.
   Harita kuralları dosyada daha önce geldiği için bu blok sonda durmalı. */
@media (max-height: 520px) and (orientation: landscape) {
  .map-screen { padding: 8px 12px; gap: 6px; }
  .map-body { grid-template-columns: calc((100vh - 80px) * .8) minmax(200px, 300px); }
  .map-guide { order: 0; display: flex; }
  .map-guide .bubble { font-size: 16px; min-height: 0; }
  .map-guide .bubble::after { left: 50%; top: auto; bottom: -18px; transform: translateX(-50%) rotate(45deg); }
  .map-guide .minik-holder { width: 110px; }
  .overlay .card { max-height: calc(100vh - 24px); overflow: auto; padding-top: 12px; padding-bottom: 12px; }
  .result-minik, .start-minik { width: 90px; }
  .badge-art { width: 110px; }
  .map-guide .minik-holder { grid-row: auto; grid-column: auto; }
  .map-guide .bubble { grid-row: auto; grid-column: auto; }
}
