/* ===== Fonts ===== */
@font-face { font-family: "Reem Kufi"; src: url(assets/fonts/ReemKufi-Var.ttf) format("truetype"); font-weight: 400 700; font-display: block; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url(assets/fonts/IBMPlexSansArabic-Medium.ttf) format("truetype"); font-weight: 500; font-display: block; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url(assets/fonts/IBMPlexSansArabic-SemiBold.ttf) format("truetype"); font-weight: 600; font-display: block; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url(assets/fonts/IBMPlexSansArabic-Bold.ttf) format("truetype"); font-weight: 700; font-display: block; }

/* ===== Tokens ===== */
:root {
  --bg: #0f0d0a;
  --surface: rgba(19, 16, 12, .92);
  --surface-solid: #16130f;
  --line: rgba(236, 224, 200, .13);
  --line-strong: rgba(236, 224, 200, .3);
  --text: #ece3d0;
  --text-dim: #ada18a;
  --accent: #c49a52;
  --accent-ink: #1b140b;
  --danger: #c9533b;
  --ok: #86a35c;
  --r: 10px;
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --pad: 1;
  --J: calc(clamp(80px, 24vh, 104px) * var(--pad));
  --S: calc(clamp(58px, 17vh, 72px) * var(--pad));
  color-scheme: dark; /* one deliberate dark look: the jungle at dusk */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif; font-weight: 500;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
img, svg { -webkit-user-drag: none; pointer-events: none; }
.hidden { display: none !important; }
#safeProbe { position: fixed; visibility: hidden; padding: var(--st) var(--sr) var(--sb) var(--sl); }

#cv { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; background: #000; }
#grade { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 55%, transparent 58%, rgba(0, 0, 0, .38) 100%); }

/* ===== Type ===== */
.t-title { font-family: "Reem Kufi", serif; font-weight: 700; margin: 0; color: var(--text); line-height: 1.15; letter-spacing: 0;
  font-size: clamp(24px, 7vh, 32px); text-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.t-title.big { font-size: clamp(42px, 14vh, 64px); }
.eyebrow { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; color: var(--accent); letter-spacing: .02em; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: clamp(170px, 26vw, 230px); height: clamp(42px, 12vh, 48px); padding: 0 22px;
  border-radius: var(--r); background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: clamp(15px, 4.4vh, 17px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 18px rgba(0, 0, 0, .35);
  transition: transform .08s ease, filter .12s ease;
}
.btn:active { transform: translateY(1px); filter: brightness(.9); }
.btn.ghost { background: rgba(22, 19, 15, .9); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong), 0 6px 18px rgba(0, 0, 0, .3); }
.btn.small { min-width: 0; height: 36px; padding: 0 16px; font-size: 14px; }
.btn.danger { color: #e7a08f; }
.icon-btn { width: 40px; height: 40px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; pointer-events: auto; }
.icon-btn svg { width: 20px; height: 20px; fill: var(--text); }
.icon-btn:active { transform: scale(.94); }

/* ===== Surfaces ===== */
.card { background: var(--surface); border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line), 0 18px 44px rgba(0, 0, 0, .5); padding: 18px 22px; }
.screen { position: fixed; inset: 0; display: none; z-index: 20; }
.screen.show { display: block; animation: fadeIn .3s ease both; }
.screen.dim { background: rgba(8, 7, 5, .66); }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.cover { position: absolute; inset: 0; background: center / cover no-repeat; }
.cover.kb { inset: -3%; animation: kb 30s ease-in-out infinite alternate; }
@keyframes kb { from { transform: scale(1) } to { transform: scale(1.06) translate(-1%, -.6%) } }
.veil { position: absolute; inset: 0; background: rgba(10, 8, 6, .55); }
.shade-r { position: absolute; inset: 0; background: linear-gradient(to left, rgba(12, 10, 7, .9) 0%, rgba(12, 10, 7, .72) 34%, rgba(12, 10, 7, 0) 66%); }
.shade-l { position: absolute; inset: 0; background: linear-gradient(to right, rgba(12, 10, 7, .9) 0%, rgba(12, 10, 7, .72) 34%, rgba(12, 10, 7, 0) 66%); }

/* Loading */
#loading { background: var(--bg); }
.load-box { position: absolute; left: 50%; bottom: calc(10vh + var(--sb)); transform: translateX(-50%); width: min(520px, 68vw); text-align: center; }
.bar { height: 4px; margin: 16px auto 12px; border-radius: 2px; background: rgba(236, 224, 200, .14); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#loadTip { margin: 0; font-size: 14px; color: var(--text-dim); }

/* Title */
.title-wrap { position: absolute; right: calc(5vw + var(--sr)); top: 50%; transform: translateY(-50%); text-align: right; max-width: 46vw; }
.tagline { margin: 6px 0 20px; font-size: clamp(14px, 4vh, 17px); color: var(--text-dim); font-weight: 600; }
.menu { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.tap-hint { position: absolute; left: calc(4vw + var(--sl)); bottom: calc(5vh + var(--sb)); font-size: 13px; color: var(--text-dim); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35 } }

/* Story */
#story { background: #000; }
.story-stage { position: absolute; inset: 0; overflow: hidden; }
.story-stage img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; opacity: 0; will-change: transform, opacity; }
.story-card { position: absolute; left: calc(4vw + var(--sl)); right: calc(4vw + var(--sr)); bottom: calc(14px + var(--sb));
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 78px;
  background: var(--surface); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line), 0 12px 30px rgba(0, 0, 0, .45); }
#storyPortrait { width: clamp(52px, 17vh, 68px); height: clamp(52px, 17vh, 68px); object-fit: cover; object-position: 50% 14%; border-radius: 10px;
  box-shadow: inset 0 0 0 1px var(--line-strong); background: #1c1813; flex: none; }
#storyPortrait.none { display: none; }
.story-text { flex: 1; min-width: 0; }
.story-text b { display: block; font-size: 13.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.story-text b:empty { display: none; }
.story-text p { margin: 0; font-size: clamp(15px, 4.6vh, 19px); line-height: 1.6; font-weight: 600; color: var(--text); min-height: 1.6em; }
.story-next { position: absolute; left: 16px; bottom: 12px; width: 8px; height: 8px; border-left: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  transform: rotate(-45deg); animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(3px) rotate(-45deg) } }
.skip { position: absolute; top: calc(12px + var(--st)); left: calc(14px + var(--sl)); }

/* Map */
#map { background: var(--bg); }
.map-frame { position: absolute; top: 50%; transform: translateY(-50%); left: calc(14px + var(--sl)); width: min(calc(100vh - 28px), 58vw); aspect-ratio: 1; border-radius: 12px; overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line), 0 14px 34px rgba(0, 0, 0, .5); }
#mapInner { position: absolute; inset: 0; }
#mapImg { width: 100%; height: 100%; object-fit: cover; display: block; filter: brightness(.86) saturate(.9); }
#mapNodes { position: absolute; inset: 0; }
.node { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; pointer-events: auto; display: grid; place-items: center;
  background: rgba(18, 14, 10, .9); box-shadow: inset 0 0 0 2px rgba(236, 224, 200, .8), 0 3px 8px rgba(0, 0, 0, .5);
  font-weight: 700; font-size: 13px; color: var(--text); direction: ltr; }
.node::before { content: ""; position: absolute; inset: -9px; } /* larger tap target */
.node.done { background: var(--accent); color: var(--accent-ink); box-shadow: 0 3px 8px rgba(0, 0, 0, .5); }
.node.locked { background: rgba(18, 14, 10, .78); box-shadow: inset 0 0 0 1px var(--line); }
.node.locked svg { width: 13px; height: 13px; fill: var(--text-dim); color: var(--text-dim); }
.node.sel { box-shadow: 0 0 0 3px rgba(12, 10, 7, .85), 0 0 0 5px var(--text), 0 3px 8px rgba(0, 0, 0, .5); }
.node .ns { position: absolute; top: 31px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; }
.node .ns svg { width: 9px; height: 9px; fill: rgba(236, 224, 200, .25); }
.node .ns svg.on { fill: var(--accent); }
.map-side { position: absolute; top: 0; bottom: 0; right: calc(14px + var(--sr)); left: calc(min(calc(100vh - 28px), 58vw) + 28px + var(--sl)); display: grid; place-items: center; }
.map-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.map-card .desc { margin: 0 0 2px; font-size: clamp(13px, 3.8vh, 15px); color: var(--text-dim); line-height: 1.6; }
.map-card .btn { width: 100%; }

/* Stars */
.stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 8px; direction: ltr; }
.stars svg { width: clamp(30px, 10vh, 42px); height: clamp(30px, 10vh, 42px); fill: rgba(236, 224, 200, .16); stroke: rgba(236, 224, 200, .3); stroke-width: .6; }
.stars svg.on { fill: var(--accent); stroke: none; animation: starIn .4s cubic-bezier(.2, 1.5, .4, 1) both; }
.stars.sm svg { width: 22px; height: 22px; }
@keyframes starIn { from { transform: scale(.4); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* Modals */
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(360px, 78vw); max-height: calc(100vh - 20px); overflow: auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 9px; text-align: center; }
.modal .t-title { margin-bottom: 4px; }
.modal .btn { width: 100%; min-width: 0; }
.modal .btn.small { align-self: center; width: auto; }
.rows { display: flex; flex-direction: column; margin: 2px 0; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; }
.switch { position: relative; width: 46px; height: 28px; border-radius: 14px; background: rgba(236, 224, 200, .16); transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: #d9cfbb; transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(-18px); background: #fff7e8; }
.seg { display: flex; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line-strong); overflow: hidden; }
.seg button { padding: 6px 11px; font-size: 13.5px; font-weight: 600; color: var(--text-dim); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* Results */
.result-card { position: absolute; right: calc(5vw + var(--sr)); top: 50%; transform: translateY(-50%); width: min(400px, 48vw); text-align: center; }
.result-card.left { right: auto; left: calc(5vw + var(--sl)); }
.result-card .t-title { font-size: clamp(28px, 9vh, 40px); }
.result-card .sub { margin: 6px 0 16px; color: var(--text-dim); font-weight: 600; }
.res-rows { margin: 0 0 14px; text-align: right; font-size: clamp(13px, 3.8vh, 15px); font-weight: 600; }
.res-rows div { display: flex; justify-content: space-between; padding: clamp(4px, 1.2vh, 7px) 2px; border-bottom: 1px solid var(--line); }
.res-rows div span:last-child { color: var(--text); direction: ltr; }
.res-rows div span:first-child { color: var(--text-dim); }
.row-btns { display: flex; justify-content: center; gap: 8px; }
.row-btns .btn { min-width: 0; flex: 1; padding: 0 10px; }
.row-btns .btn:first-child { flex: 1.4; }

/* Rotate */
#rotate { z-index: 90; background: var(--bg); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 30px; }
#rotate.show { display: flex; }
#rotate p { margin: 18px 0 0; font-family: "Reem Kufi"; font-weight: 700; font-size: 26px; }
#rotate small { color: var(--text-dim); font-size: 14px; max-width: 30ch; line-height: 1.6; }
#a2hs { margin-top: 14px; font-size: 12.5px !important; opacity: .8; }
.rot-phone { width: 58px; height: 98px; border: 2.5px solid var(--text); border-radius: 12px; position: relative; animation: rot 2.4s ease-in-out infinite; }
.rot-phone i { position: absolute; left: 50%; bottom: 6px; width: 16px; height: 3px; margin-left: -8px; border-radius: 2px; background: var(--text); }
@keyframes rot { 0%, 25% { transform: rotate(0) } 55%, 85% { transform: rotate(-90deg) } 100% { transform: rotate(0) } }

/* ===== HUD ===== */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
.hud-bar { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.hud-right { position: absolute; top: calc(8px + var(--st)); right: calc(10px + var(--sr)); }
.hud-right .sep { width: 1px; height: 18px; background: var(--line-strong); }
#hearts { display: flex; gap: 3px; direction: ltr; }
#hearts svg { width: 19px; height: 19px; fill: #c9533b; stroke: rgba(0, 0, 0, .35); stroke-width: 1; }
#hearts svg.off { fill: none; stroke: rgba(236, 224, 200, .4); stroke-width: 1.6; }
#hearts svg.lost { animation: lost .5s ease both; }
@keyframes lost { 40% { transform: scale(1.3) } 100% { transform: scale(1) } }
.stat { display: flex; align-items: center; gap: 5px; }
.stat b { font-weight: 700; font-size: 15px; direction: ltr; min-width: 1.4em; text-align: center; }
.ic { width: 17px; height: 17px; }
.ic.gem { fill: #b5473a; }
.ic.coco { fill: #8a6640; }
.stat.bump { animation: lost .35s ease; }
.hud-left { position: absolute; top: calc(8px + var(--st)); left: calc(10px + var(--sl)); display: flex; align-items: center; gap: 8px; flex-direction: row-reverse; pointer-events: auto; }
.hud-score { font-weight: 700; font-size: 15px; min-width: 64px; justify-content: center; direction: ltr; }
.hud-center { position: absolute; top: calc(8px + var(--st)); left: 50%; transform: translateX(-50%); }
#status { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 700; font-size: 14px; opacity: 0; transform: translateY(-4px); transition: opacity .25s, transform .25s; white-space: nowrap; }
#status.show { opacity: 1; transform: none; }
#status i { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
#status.chase i { background: var(--danger); animation: pulse .8s infinite; }
#status.chase { color: #f0c4b8; }
#status.hidden-ok i { background: var(--ok); }
#status.sus i { background: var(--accent); }

#toast { position: fixed; top: 27%; left: 50%; transform: translate(-50%, 6px); z-index: 12; pointer-events: none; opacity: 0; text-align: center; transition: opacity .35s, transform .35s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast small { display: block; font-size: 13px; font-weight: 600; color: var(--accent); text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
#toast small:empty { display: none; }
#toast strong { display: block; font-family: "Reem Kufi"; font-weight: 700; font-size: clamp(26px, 9vh, 40px); color: var(--text); text-shadow: 0 2px 12px rgba(0, 0, 0, .55); }
#toast strong:empty { display: none; }
#toast.minor strong { font-family: "IBM Plex Sans Arabic"; font-size: 17px; font-weight: 700; padding: 6px 14px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); text-shadow: none; }

#hint { position: fixed; left: 50%; top: calc(52px + var(--st)); transform: translate(-50%, -4px); z-index: 11; pointer-events: none; opacity: 0; transition: opacity .3s, transform .3s; max-width: 72vw; }
#hint.show { opacity: 1; transform: translate(-50%, 0); }
#hint span { display: block; padding: 8px 14px; border-radius: var(--r); background: var(--surface-solid); box-shadow: inset 0 0 0 1px var(--line-strong), 0 8px 20px rgba(0, 0, 0, .4);
  font-weight: 600; font-size: clamp(13px, 3.8vh, 15px); color: var(--text); line-height: 1.5; text-align: center; }

#mash { position: fixed; left: 50%; top: 30%; transform: translateX(-50%); z-index: 12; pointer-events: none; display: none; text-align: center; padding: 10px 16px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
#mash.show { display: block; }
.mash-text { font-weight: 700; font-size: 17px; color: var(--text); }
.mash-bar { width: 200px; height: 6px; margin: 8px auto 0; background: rgba(236, 224, 200, .14); border-radius: 3px; overflow: hidden; }
.mash-bar i { display: block; height: 100%; width: 0; background: var(--accent); }

/* ===== Touch controls ===== */
#touch { position: fixed; inset: 0; z-index: 9; pointer-events: none; direction: ltr; }
#stickZone { position: absolute; left: 0; top: 22%; bottom: 0; width: 46%; pointer-events: auto; }
#stick { position: absolute; left: calc(var(--sl) + 24px + 62px * var(--pad)); bottom: calc(var(--sb) + 18px + 62px * var(--pad)); width: 0; height: 0; }
#stickBase { position: absolute; width: calc(124px * var(--pad)); height: calc(124px * var(--pad)); left: calc(-62px * var(--pad)); top: calc(-62px * var(--pad)); border-radius: 50%;
  background: rgba(12, 10, 8, .3); box-shadow: inset 0 0 0 2px rgba(236, 224, 200, .3); transition: opacity .2s; opacity: .75; }
#stickKnob { position: absolute; width: calc(54px * var(--pad)); height: calc(54px * var(--pad)); left: calc(-27px * var(--pad)); top: calc(-27px * var(--pad)); border-radius: 50%;
  background: rgba(236, 228, 210, .62); box-shadow: 0 3px 10px rgba(0, 0, 0, .3); transition: background .15s; }
#stick.active #stickKnob { background: rgba(236, 228, 210, .9); }
#stick.active #stickBase { opacity: 1; }
#btnZone { position: absolute; right: 0; bottom: 0; width: 50%; height: 100%; pointer-events: none; }
.pad { position: absolute; pointer-events: auto; border-radius: 50%; display: grid; place-items: center; color: var(--text);
  background: rgba(12, 10, 8, .42); box-shadow: inset 0 0 0 2px rgba(236, 224, 200, .36), 0 4px 12px rgba(0, 0, 0, .25); transition: background .08s, transform .08s; }
.pad::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; } /* generous touch target */
.pad svg { width: 46%; height: 46%; fill: currentColor; }
.pad.down { background: rgba(196, 154, 82, .92); color: var(--accent-ink); transform: scale(.95); box-shadow: none; }
.pad-jump { width: var(--J); height: var(--J); right: calc(var(--sr) + 20px); bottom: calc(var(--sb) + 16px); }
.pad-crouch { width: var(--S); height: var(--S); right: calc(var(--sr) + 34px + var(--J)); bottom: calc(var(--sb) + 12px); }
.pad-throw { width: var(--S); height: var(--S); right: calc(var(--sr) + 20px + var(--J) * .72); bottom: calc(var(--sb) + 16px + var(--J) * .96); }
.pad-throw svg { width: 50%; height: 50%; }
.pad-throw b { position: absolute; right: -4px; top: -4px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--surface-solid); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong); font-weight: 700; font-size: 12.5px; line-height: 22px; text-align: center; }
.pad.empty { opacity: .45; }
.pad-act { position: absolute; right: calc(var(--sr) + 14px); bottom: calc(var(--sb) + 24px + var(--J) + var(--S) * .95); height: 44px; padding: 0 16px 0 14px;
  display: flex; align-items: center; gap: 7px; border-radius: 22px; pointer-events: auto; direction: rtl;
  background: var(--surface-solid); box-shadow: inset 0 0 0 1.5px var(--accent), 0 6px 16px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; visibility: hidden; }
.pad-act::before { content: ""; position: absolute; inset: -10px; }
.pad-act.on { opacity: 1; transform: none; visibility: visible; }
.pad-act svg { width: 18px; height: 18px; fill: var(--ok); }
.pad-act span { font-weight: 700; font-size: 15px; color: var(--text); }
.pad-act.down { background: var(--accent); }
.pad-act.down span { color: var(--accent-ink); }

/* First-run guide */
#coach { position: fixed; inset: 0; z-index: 15; background: rgba(8, 7, 5, .6); }
.coach-tag { position: absolute; padding: 7px 12px; border-radius: 10px; background: var(--surface-solid); box-shadow: inset 0 0 0 1px var(--line-strong), 0 8px 20px rgba(0, 0, 0, .45);
  font-weight: 700; font-size: 14.5px; color: var(--text); white-space: nowrap; text-align: center; transform: translate(-50%, -100%); }
.coach-tag small { display: block; font-weight: 500; font-size: 12px; color: var(--text-dim); margin-top: 1px; }
.coach-tag::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: var(--surface-solid); }
.coach-tag.side { transform: translate(-100%, -50%); }
.coach-tag.side::after { left: auto; right: -6px; bottom: auto; top: 50%; margin: -6px 0 0; border: 6px solid transparent; border-right: 0; border-left-color: var(--surface-solid); }
#coachOk { position: absolute; left: 50%; top: calc(16px + var(--st)); transform: translateX(-50%); }

/* keyboard focus and reduced motion */
button:focus-visible, .node:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .cover.kb, .tap-hint, .story-next, .rot-phone, #status.chase i, .stars svg.on { animation: none !important; }
  .story-img { transition: opacity .3s ease !important; }
}

/* lessons: the prompt stays until you do it; the control gets a calm ring */
#hint.lesson span { background: var(--surface-solid); box-shadow: inset 0 0 0 1.5px var(--accent), 0 10px 24px rgba(0, 0, 0, .5); font-size: clamp(14px, 4.2vh, 16px); }
.pad.teach, .pad-act.teach, #stickBase.teach { animation: teachRing 1.1s ease-in-out infinite; }
@keyframes teachRing { 0%, 100% { box-shadow: inset 0 0 0 2px rgba(236, 224, 200, .4), 0 0 0 0 rgba(196, 154, 82, .0); } 50% { box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 9px rgba(196, 154, 82, .35); } }
#stickBase.teach { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .pad.teach, .pad-act.teach, #stickBase.teach { animation: none; box-shadow: inset 0 0 0 3px var(--accent); } }
.row-btns .btn:first-child { flex: 1.6; }
