/* Tahtalı Yol's map (js/ladder-map.js): painted pictures stacked, wooden boxes along the path. */
#screen-ladder { position: relative; }
#screen-ladder .ladder-head { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.1; }
#screen-ladder .ladder-head .sub-title { text-align: left; }
.ladder-sub { font-size: 13px; font-weight: 800; opacity: 0.7; }

#ladder-scroll {
  flex: 1; min-height: 0; width: min(100%, 560px); margin: 0 auto;
  overflow-y: auto; overflow-x: hidden; touch-action: pan-y; overscroll-behavior: contain;
  background: #7fa957; border-radius: 18px 18px 0 0;
}
#ladder-map { position: relative; width: 100%; overflow: hidden; }
.ladder-pic { position: absolute; left: 0; width: 100%; display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
/* The way ahead fades out: the map ends a little above the step to play. */
.ladder-fog { position: absolute; left: 0; right: 0; top: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, var(--bg1) 0, var(--bg1) 12%, transparent 100%); }

.ladder-node {
  position: absolute; z-index: 2; transform: translate(-50%, -50%); padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  font-family: var(--font-display); -webkit-tap-highlight-color: transparent;
}
.ladder-node:active { transform: translate(-50%, -50%) scale(0.94); }
/* A done step is a little 3×3 wooden letter board (Nov 2026, Ibur): a frame with a nail in each corner and two grooves
   each way between the cells. Colours come from variables, so the gold region only swaps them. */
.ladder-node.done {
  --wd: #b37c45; --wl: #c99460; --wg: #6b3f1c; --wf: #5a3519;
  width: 50px; height: 50px; border-radius: 9px; border: 2px solid var(--wf); color: #fff7ea; box-sizing: border-box;
  background:
    radial-gradient(circle at 4px 4px, var(--wf) 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 4px) 4px, var(--wf) 1.5px, transparent 2px),
    radial-gradient(circle at 4px calc(100% - 4px), var(--wf) 1.5px, transparent 2px),
    radial-gradient(circle at calc(100% - 4px) calc(100% - 4px), var(--wf) 1.5px, transparent 2px),
    /* grooves: a dark line with a light edge under/right of it */
    linear-gradient(90deg, transparent calc(33.3% - 1px), var(--wg) calc(33.3% - 1px) calc(33.3% + 1px), rgba(255,240,215,0.35) calc(33.3% + 1px) calc(33.3% + 2px), transparent calc(33.3% + 2px),
      transparent calc(66.6% - 1px), var(--wg) calc(66.6% - 1px) calc(66.6% + 1px), rgba(255,240,215,0.35) calc(66.6% + 1px) calc(66.6% + 2px), transparent calc(66.6% + 2px)),
    linear-gradient(180deg, transparent calc(33.3% - 1px), var(--wg) calc(33.3% - 1px) calc(33.3% + 1px), rgba(255,240,215,0.35) calc(33.3% + 1px) calc(33.3% + 2px), transparent calc(33.3% + 2px),
      transparent calc(66.6% - 1px), var(--wg) calc(66.6% - 1px) calc(66.6% + 1px), rgba(255,240,215,0.35) calc(66.6% + 1px) calc(66.6% + 2px), transparent calc(66.6% + 2px)),
    /* light from the top, then the wood grain */
    linear-gradient(180deg, rgba(255,255,255,0.2), transparent 50%, rgba(0,0,0,0.12)),
    repeating-linear-gradient(8deg, var(--wd) 0 3px, var(--wl) 3px 5px, var(--wd) 5px 9px);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.12), 0 4px 0 var(--wf), 0 6px 10px rgba(0,0,0,0.3);
}
.ladder-node.done b { font-size: 21px; font-weight: 800; text-shadow: 0 2px 0 var(--wf), 0 0 4px rgba(0,0,0,0.45); }
.ladder-node.done i {
  position: absolute; right: -9px; top: -9px; width: 22px; height: 22px; border-radius: 50%;
  background: #2b7470; border: 2px solid #fff; display: flex; align-items: center; justify-content: center;
}
.ladder-node.done i svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.ladder-node.current {
  width: 66px; height: 66px; border-radius: 14px; border: 3px solid #fff7ea; color: #fff;
  /* the same 3×3 board as the done steps, in coral */
  background: linear-gradient(90deg, transparent calc(33.3% - 1px), rgba(120,40,15,0.55) calc(33.3% - 1px) calc(33.3% + 1px), rgba(255,230,210,0.4) calc(33.3% + 1px) calc(33.3% + 2px), transparent calc(33.3% + 2px), transparent calc(66.6% - 1px), rgba(120,40,15,0.55) calc(66.6% - 1px) calc(66.6% + 1px), rgba(255,230,210,0.4) calc(66.6% + 1px) calc(66.6% + 2px), transparent calc(66.6% + 2px)),
    linear-gradient(180deg, transparent calc(33.3% - 1px), rgba(120,40,15,0.55) calc(33.3% - 1px) calc(33.3% + 1px), rgba(255,230,210,0.4) calc(33.3% + 1px) calc(33.3% + 2px), transparent calc(33.3% + 2px), transparent calc(66.6% - 1px), rgba(120,40,15,0.55) calc(66.6% - 1px) calc(66.6% + 1px), rgba(255,230,210,0.4) calc(66.6% + 1px) calc(66.6% + 2px), transparent calc(66.6% + 2px)),
    linear-gradient(180deg, rgba(255,255,255,0.18), transparent 50%, rgba(0,0,0,0.1)), #ec7a52;
  animation: ladder-pulse 1.6s ease-out infinite;
}
.ladder-node.current b { font-size: 27px; font-weight: 800; text-shadow: 0 2px 0 #9b4524, 0 0 5px rgba(120,40,15,0.5); }
.ladder-node.current small { text-shadow: 0 0 4px rgba(120,40,15,0.6); font-family: var(--font-ui); font-size: 11px; font-weight: 900; letter-spacing: 1px; margin-top: 2px; }
@keyframes ladder-pulse {
  0% { box-shadow: 0 0 0 0 rgba(236,122,82,0.7), 0 4px 0 #6b3f1f; }
  100% { box-shadow: 0 0 0 18px rgba(236,122,82,0), 0 4px 0 #6b3f1f; }
}

#ladder-play {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 3;
  width: min(calc(100% - 32px), 420px); box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.ladder-step-note:empty { display: none; }
.ladder-node.done.open i { background: #ec7a52; }
.ladder-node.done.open i svg path.fill { fill: #fff; stroke: none; }
.fp-done-stay { width: 100%; margin-top: 4px; }
.fp-done-stay-note { margin: 4px 0 0; text-align: center; font: 700 13px var(--font-ui); color: var(--fg); opacity: 0.75; }
.fp-done-stay-note[hidden] { display: none; }
.fp-done-finish {
  margin-top: 4px; padding: 6px 10px; border: 0; background: none; color: var(--fg); opacity: 0.7;
  font: 800 13px var(--font-ui); text-decoration: underline; cursor: pointer;
}
.fp-done-finish[hidden], .fp-done-stay[hidden], #ladder-step-play[hidden] { display: none; }

/* Stars (Nov 2026): under every done box, in the step window and the done window; a chest per region. */
.ladder-stars { position: absolute; left: 50%; top: -31px; transform: translateX(-50%); display: flex; gap: 1px;
  padding: 2px 6px 3px; border-radius: 999px; background: rgba(40,24,10,0.72); box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  font: 900 17px/1 var(--font-ui); white-space: nowrap; }
.ladder-stars span { color: rgba(255,255,255,0.28); }
.fp-done-stars span { color: rgba(255,255,255,0.55); -webkit-text-stroke: 1px #5a3519; }
.ladder-stars span.on, .fp-done-stars span.on { color: #ffc93c; }
.fp-done-stars { display: block; font: 900 30px/1 var(--font-ui); letter-spacing: 2px; margin-bottom: 4px; }
.fp-done-stars span { -webkit-text-stroke: 1.5px #b07a12; color: transparent; }
.fp-done-stars span.on { -webkit-text-stroke: 1.5px #b07a12; }
.ladder-step-stars { margin: 4px 0 8px; text-align: center; font: 800 13px var(--font-ui); }
.ladder-node.done.gold { --wd: #e1a92e; --wl: #f2c75a; --wg: #9a6a08; --wf: #8a5a00; color: #fff; }
.ladder-node.done.gold b { text-shadow: 0 2px 0 #8a5a00; }

/* Region borders: a wavy dashed line where two pictures meet. */
.ladder-border { position: absolute; left: 0; width: 100%; height: 24px; z-index: 1; pointer-events: none; overflow: visible;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }
.ladder-border path { fill: none; stroke: #fff7ea; stroke-width: 3; stroke-dasharray: 10 8; stroke-linecap: round;
  vector-effect: non-scaling-stroke; }

.ladder-chest {
  position: absolute; z-index: 2; transform: translate(-50%, -50%); padding: 0; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px; -webkit-tap-highlight-color: transparent;
}
.ladder-chest img { width: 58px; height: auto; display: block; filter: drop-shadow(0 3px 3px rgba(0,0,0,0.4)); pointer-events: none; }
.ladder-chest small { font: 900 11px/1 var(--font-ui); color: #fff; background: rgba(40,24,10,0.72); padding: 3px 6px; border-radius: 999px; white-space: nowrap; }
.ladder-chest.open small { background: #2b7470; }
.ladder-chest.gold small { background: #b07a12; }

/* Boards to continue (Nov 2026, design A): a coral pill above "Oyna"; a tap slides a drawer of coral cards up in its
   place, and "Oyna" steps aside until it closes. */
.ladder-open-btn { position: absolute; right: max(16px, calc(50% - 210px)); bottom: 80px; z-index: 3; display: flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px 0 11px; border: 0; border-radius: 20px; background: var(--c-orange, #EC7A52); color: #fff;
  font: 900 14px var(--font-ui); box-shadow: 0 4px 12px rgba(0,0,0,0.3); cursor: pointer; transition: opacity .2s, transform .2s; }
.ladder-open-btn svg { width: 22px; height: 22px; }
.ladder-open-btn b { font-family: 'Baloo 2', sans-serif; font-size: 16px; background: rgba(255,255,255,0.22); border-radius: 10px; padding: 0 7px; }
.ladder-open-btn[hidden] { display: none; }
.ladder-open-btn.away, #ladder-play.away { opacity: 0; pointer-events: none; transform: translate(-50%, 20px); }
.ladder-open-btn.away { transform: translateY(20px); }
#ladder-play { transition: opacity .2s, transform .2s; }
.ladder-open { position: absolute; left: 50%; bottom: 0; z-index: 4; transform: translateX(-50%); box-sizing: border-box;
  width: min(100%, 560px); padding: 14px 14px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0;
  background: var(--surface, #FBF6EA); box-shadow: 0 -8px 24px rgba(0,0,0,0.3); animation: lo-up .25s ease-out; }
.ladder-open[hidden] { display: none; }
@keyframes lo-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.lo-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 900; margin: 0 2px 10px; }
.lo-right { display: flex; align-items: center; gap: 10px; }
.lo-right b { font-family: 'Baloo 2', sans-serif; font-size: 17px; color: var(--c-orange); }
.lo-close { width: 30px; height: 30px; border: 0; border-radius: 50%; background: rgba(var(--fg-rgb),0.08); color: var(--fg); font-size: 14px; cursor: pointer; }
.lo-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lo-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; padding: 10px; border: 0; border-radius: 14px;
  background: var(--c-orange, #EC7A52); color: #fff; font: inherit; text-align: left; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,0.18); }
.lo-slot b { font-family: 'Baloo 2', sans-serif; font-size: 17px; line-height: 1.1; }
.lo-slot .lo-stars { font-size: 14px; letter-spacing: 1px; color: rgba(255,255,255,0.4); }
.lo-slot .lo-stars .on { color: #FFE08A; }
.lo-slot .lo-note { font-size: 11px; font-weight: 700; opacity: 0.9; }
.lo-slot .lo-go { margin-top: 2px; font-size: 13px; font-weight: 900; }
.lo-slot.empty { align-items: center; justify-content: center; cursor: default; background: transparent; color: var(--fg); opacity: 0.5;
  font-size: 13px; font-weight: 700; box-shadow: none; outline: 2px dashed rgba(var(--fg-rgb),0.3); outline-offset: -2px; }
.lo-tip { margin: 10px 0 0; text-align: center; font-size: 12px; font-weight: 700; opacity: 0.6; }

/* AdMob banner (js/ads.js) on a Tahtalı Yol board: the top bar stays at the very top (in the camera cutout band, like a
   level), the banner floats right under it (its margin is the bar's bottom), and this gap under the bar keeps its room,
   so the targets start under the banner (Nov 2026, Ibur; it used to sit above the top bar). */
body.ad-top #app.fp-mode #topbar { margin-bottom: var(--ad-top); }
/* Landscape: the banner sits at the very top across the screen (the plugin centres it over the whole width), so the whole
   game screen starts under it and the board gets a little smaller (js/ads.js, adsBannerMarginNow). */
@media (orientation: landscape) and (max-height: 600px) {
  body.ad-top #app.fp-mode #topbar { margin-bottom: 0; }
  body.ad-top #screen-game.active { padding-top: var(--ad-top); box-sizing: border-box; }
}
.ad-hint-left { margin: 0 0 6px; font: 700 13px var(--font-ui); opacity: 0.7; }

/* While an interstitial shows (js/ads.js): a plain cover in the page's colour over everything, so the cutout band
   the ad leaves free shows no half-cut title. */
body.ad-cover::after { content: ""; position: fixed; inset: 0; z-index: 10000; background: var(--bg1); }

/* The chest window (explainChest). */
.ladder-chest-box #ladder-chest-pic { display: block; width: 96px; height: auto; margin: 0 auto 4px; filter: drop-shadow(0 4px 4px rgba(0,0,0,0.25)); }
.lch-bar { position: relative; align-self: stretch; width: 100%; box-sizing: border-box; height: 22px; margin: 6px 0 10px; border-radius: 11px; background: var(--surface-2, #eee6d6); overflow: hidden; }
.lch-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #ffc93c; border-radius: 11px; }
.lch-bar::after { content: ''; position: absolute; top: 3px; bottom: 3px; left: var(--open-at); width: 2px; background: rgba(0,0,0,0.35); }
.lch-bar span { position: relative; display: block; text-align: center; font: 900 13px/22px var(--font-ui); color: var(--fg); }
.lch-rules { align-self: stretch; list-style: none; margin: 0 0 6px; padding: 0; text-align: left; font: 700 14px/1.35 var(--font-ui); }
.lch-rules li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; }
.lch-rules li > b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2, #eee6d6); color: #b07a12; font-size: 13px; }
.lch-rules li.done > b { background: var(--c-green, #3a9a5b); color: #fff; }
.ladder-chest-box .menu-btn { width: 100%; margin-top: 6px; }
