/* Kelimak: kurulmakta olan bir merdiven.
   Üst zincir gün doğumu renklerinde, alt zincir deniz renklerinde büyür; buluşunca merdiven limon yeşiline döner. */
:root {
  --night: #130e2c;
  --night-2: #1d1645;
  --night-3: #2a2160;
  --ink: #fff5e4;
  --muted: #b9b1de;
  --faint: rgba(255, 245, 228, 0.16);

  --sun-1: #ff7139;
  --sun-2: #ffbf3c;
  --sun-mark: #ffd86b;
  --sea-1: #33c4ff;
  --sea-2: #7a66ff;
  --sea-mark: #a6e8ff;
  --lime: #c6ff3a;
  --lime-2: #8ef05a;
  --hot: #ff4d70;
  --warn: #ffb84d;

  --tile: #fff5e4;
  --tile-ink: #1b1437;

  --rail: 12px;
  --beam-h: 60px;
  --rung-gap: 12px;
  --kb-h: 218px;
  --spring: cubic-bezier(0.2, 1.3, 0.4, 1);
  --out: cubic-bezier(0.16, 1, 0.3, 1);

  --display: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;

  --confetti-1: #ff7139;
  --confetti-2: #ffbf3c;
  --confetti-3: #33c4ff;
  --confetti-4: #c6ff3a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--night-3) transparent;
  scroll-padding-bottom: calc(var(--kb-h) + 12px + env(safe-area-inset-bottom));
}
body.solved, body.empty { scroll-padding-bottom: 0; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 400 16px/1.5 var(--display);
  font-optical-sizing: auto;
  background:
    radial-gradient(120% 46% at 50% -6%, rgba(255, 158, 64, 0.55), rgba(255, 113, 57, 0.18) 45%, transparent 72%),
    radial-gradient(110% 40% at 50% 70%, rgba(51, 160, 255, 0.24), rgba(122, 102, 255, 0.14) 48%, transparent 74%),
    var(--night);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--lime); color: var(--tile-ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--lime); outline-offset: 3px; border-radius: 10px; }
.ic { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.page {
  width: min(100%, 470px);
  margin: 0 auto;
  padding: 0 16px calc(var(--kb-h) + 20px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.solved .page { padding-bottom: 40px; }
body.solved .ladder, body.solved .rungs { flex: none; } /* bitince raylar son basamakta biter */

/* ---- Üst çubuk ---------------------------------------------------------- */
/* Ad solda büyük, tarih altında küçük; yardım düğmesi sağda ikisinin ortasında. */
.head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 8px; /* logonun alt çizgisi ile tarih arası */
  padding: 12px 0 6px;
}
/* Ad: img/kelimak.svg. KEL + merdiven İ + MAK; harfler çizgiye çevrilmiş, yazı tipi yüklenmesini beklemez.
   font-size harflerin boyu: logo 1.067em yüksek, çünkü merdiven harflerin üstüne taşar (noktası güneş).
   Basamaklar ancak bu boyda seçiliyor; 26px'te merdiven ince bir "i" gibi okunuyordu. */
.brand {
  grid-column: 1;
  margin: 0;
  font-size: 36px;
}
.brand .logo {
  display: block;
  width: auto;
  height: 1.067em;
}
.date { grid-column: 1; grid-row: 2; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.help-btn {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
  background: rgba(255, 255, 255, 0.05);
  font-size: 22px;
  transition: background 0.2s, border-color 0.2s;
}
.help-btn:hover, .help-btn[aria-expanded="true"] { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 245, 228, 0.4); }

.help {
  margin: 6px 0 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(29, 22, 69, 0.78);
  border: 1px solid var(--faint);
  font-size: 15px;
  line-height: 1.45;
  color: #e9e3ff;
}
.help p { margin: 0 0 8px; }
.help strong { color: var(--ink); }
.help .ex { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; }
.help .ex span {
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--tile);
  color: var(--tile-ink);
  font: 800 16px/1.2 var(--display);
  letter-spacing: 0.06em;
}
.help .ex b { color: #d2470e; }
.help .ex + p { margin-top: 12px; }
.help p:last-child { margin-bottom: 0; }

/* ---- Merdiven ------------------------------------------------------------- */
.ladder { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; outline: none; }
.rungs {
  flex: 1 0 auto;
  list-style: none;
  margin: 6px 0 0;
  padding: 22px 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--rung-gap);
}
/* Raylar: üstten gün, alttan deniz */
.rungs::before,
.rungs::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--rail);
  border-radius: 99px;
  background: linear-gradient(180deg, var(--sun-2), var(--sun-1) 30%, var(--sea-2) 70%, var(--sea-1));
  box-shadow: inset -4px 0 6px -3px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(5, 2, 20, 0.45);
}
.rungs::before { left: 0; }
.rungs::after { right: 0; }
/* Buluşmada raylardan bir ışık geçer */
.ladder.done .rungs::before,
.ladder.done .rungs::after {
  background:
    linear-gradient(180deg, transparent 0 42%, rgba(255, 255, 255, 0.92) 50%, transparent 58%) 0 0 / 100% 300% no-repeat,
    var(--win-rail);
  animation: rail-sweep 0.9s var(--out) both;
}
@keyframes rail-sweep {
  from { background-position: 0 100%, 0 0; }
  to { background-position: 0 0, 0 0; }
}
/* Yön çizgisi (ilk yardım): sol rayın dışında ince bir çizgi; renkleri JS basamak ortalarına durak olarak koyar
   (yeşil yaklaşıyor, sarı aynı uzaklık, kırmızı uzaklaşıyor, soluk henüz kurulmamış boşluk). */
.termo {
  position: absolute;
  left: -12px;
  width: 6px;
  border-radius: 99px;
  pointer-events: none;
  box-shadow: 0 0 10px rgba(142, 240, 90, 0.18);
  transition: opacity 0.3s;
}
.termo[hidden] { display: none; }
@starting-style { .termo { opacity: 0; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.rung {
  position: relative;
  height: var(--beam-h);
  padding: 0 calc(var(--rail) - 3px);
  display: flex;
  align-items: stretch;
}
.rung.end { --beam-h: 68px; }
.beam {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  container-type: inline-size;
  transition: background 0.35s var(--out), border-color 0.25s, transform 0.3s var(--spring), box-shadow 0.3s;
}
.rung.ust .beam { background: linear-gradient(100deg, #e9592a, #f59a33 55%, #f7b443); box-shadow: inset 0 -9px 12px -7px rgba(120, 30, 0, 0.45), 0 8px 18px rgba(8, 3, 30, 0.4); }
.rung.alt .beam { background: linear-gradient(100deg, #6c58f2, #4a8ff7 50%, #2fb6ef); box-shadow: inset 0 -9px 12px -7px rgba(10, 10, 80, 0.5), 0 8px 18px rgba(8, 3, 30, 0.4); }
.rung.step.ust .beam { background: linear-gradient(100deg, #b94a2b, #c9792f 60%, #cf8f39); }
.rung.step.alt .beam { background: linear-gradient(100deg, #5546c4, #3c74c9 55%, #2e93c4); }

/* Cıvatalar: kirişin raya oturduğu yer */
.bolt {
  position: absolute;
  z-index: 2;
  top: calc(var(--beam-h) / 2);
  width: 9px;
  height: 9px;
  margin-top: -4.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0 22%, var(--ink) 38%, #d8ccb6 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.bolt.l { left: 1.5px; }
.bolt.r { right: 1.5px; }

/* Harf taşları */
.word {
  --t: min(46px, calc((100cqi - 26px - (var(--n) - 1) * 5px) / var(--n)));
  display: flex;
  gap: 5px;
}
.rung.end .word { --t: min(50px, calc((100cqi - 26px - (var(--n) - 1) * 5px) / var(--n))); }
.ch {
  width: var(--t);
  height: var(--t);
  display: grid;
  place-items: center;
  border-radius: calc(var(--t) * 0.2);
  background: var(--tile);
  color: var(--tile-ink);
  font: 800 calc(var(--t) * 0.56) / 1 var(--display);
  font-variation-settings: "opsz" 96;
  box-shadow: inset 0 -6px 8px -6px rgba(27, 20, 55, 0.3), 0 2px 5px rgba(10, 4, 30, 0.3);
}
.rung.ust .ch.chg { background: var(--sun-mark); }
.rung.alt .ch.chg { background: var(--sea-mark); }
/* Harf çıkarılan yer: iki taş arasında (ya da kenarda) taşlardan biraz uzun ince bir çizgi, zincirin işaret renginde */
.ch { position: relative; }
.ch.cut::before,
.ch.cut-end::after {
  content: "";
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  border-radius: 2px;
  background: var(--cut, var(--ink));
}
.ch.cut::before { left: -4px; }
.ch.cut-end::after { right: -4px; }
.rung.ust { --cut: var(--sun-mark); }
.rung.alt { --cut: var(--sea-mark); }
.rung.gap.st-bitir { --cut: var(--lime); }

/* Eklenen basamaklarda solda anlam "?", iç uçta sağda kaldır düğmesi: taşlar ikisine de yer bırakır */
.rung:not(.gap) .beam { padding: 0 34px; }
.rung.end .bolt { width: 11px; height: 11px; margin-top: -5.5px; }
.drop {
  position: absolute;
  z-index: 3;
  right: calc(var(--rail) + 4px);
  top: 50%;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(19, 14, 44, 0.55);
  color: var(--ink);
  font-size: 17px;
  opacity: 0.75;
  transition: opacity 0.2s, background 0.2s, transform 0.2s;
}
.drop:hover, .drop:focus-visible { opacity: 1; background: rgba(19, 14, 44, 0.85); transform: scale(1.08); }

/* Anlam düğmesi: küçük görünür, dokunma alanı 32px */
.mean-btn {
  position: absolute;
  z-index: 3;
  left: calc(var(--rail) + 3px);
  top: 50%;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(19, 14, 44, 0.4) 0 10.5px, transparent 11px);
  color: rgba(255, 245, 228, 0.82);
  font-size: 14px;
  transition: color 0.2s, background 0.2s;
}
.mean-btn .ic { stroke-width: 2.6; }
.mean-btn:hover, .mean-btn[aria-expanded="true"] { color: #fff; background: radial-gradient(circle, rgba(19, 14, 44, 0.75) 0 10.5px, transparent 11px); }

/* Sil'e boş satırda basınca son basamak işaretlenir; bir daha basınca silinir */
.rung.armed .beam { outline: 2.5px dashed var(--hot); outline-offset: 3px; filter: saturate(0.5) brightness(0.8); }
.rung.armed .drop { opacity: 1; background: var(--hot); }
.gap.arm .tag { color: #ff8aa0; border-color: rgba(255, 77, 112, 0.5); }

/* Çıkmaz yol: yardımın kaldırılmasını önerdiği basamaklar */
.rung.dead .beam { filter: saturate(0.3) brightness(0.72); }
.rung.dead .beam::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(-45deg, rgba(19, 14, 44, 0.34) 0 6px, transparent 6px 13px);
}
.rung.dead .word { position: relative; }
.dead-tag {
  position: absolute;
  z-index: 4;
  top: -9px;
  left: calc(var(--rail) + 16px);
  padding: 0 8px;
  border-radius: 99px;
  background: var(--warn);
  color: var(--tile-ink);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 18px;
  letter-spacing: 0.02em;
  pointer-events: none;
}
.rung.dead.pulse .beam { animation: shake 0.42s var(--out); }

/* ---- Boşluk: hayalet kirişler -------------------------------------------- */
.rung.gap { cursor: text; outline: none; }
.rung.gap.ust { margin-top: auto; }
.rung.gap.alt { margin-bottom: auto; }
.rung.gap .beam {
  border: 2px dashed rgba(255, 245, 228, 0.2);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: none;
}
.rung.gap .bolt { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 245, 228, 0.35); }
.rung.gap:hover .beam { border-color: rgba(255, 245, 228, 0.36); }
/* Etkin boşluk, altında asılı etiket için yer açar */
.rung.gap.active { height: calc(var(--beam-h) + 34px); padding-bottom: 34px; }
.rung.gap.active .beam { border-color: rgba(255, 245, 228, 0.55); background: rgba(255, 255, 255, 0.06); }
.rung.gap:focus-visible .beam { outline: 2.5px solid var(--lime); outline-offset: 3px; }
.rung.gap .ch { background: rgba(255, 245, 228, 0.92); }

.rung.gap.active.st-ust .beam { border-style: solid; border-color: var(--sun-2); background: rgba(255, 140, 60, 0.2); }
.rung.gap.active.st-alt .beam { border-style: solid; border-color: var(--sea-1); background: rgba(60, 160, 255, 0.2); }
.rung.gap.active.st-bitir .beam { border-style: solid; border-color: var(--lime); background: rgba(198, 255, 58, 0.18); }
.rung.gap.st-ust .ch.chg { background: var(--sun-mark); }
.rung.gap.st-alt .ch.chg { background: var(--sea-mark); }
.rung.gap.st-bitir .ch.chg { background: var(--lime); }
.rung.gap.active.st-red .beam, .rung.gap.active.st-var .beam, .rung.gap.active.st-kopuk .beam { border-color: rgba(255, 184, 77, 0.6); }
.rung.gap.active.st-hata .beam { border-style: solid; border-color: var(--hot); background: rgba(255, 77, 112, 0.16); }

.caret {
  width: 3px;
  height: 30px;
  border-radius: 2px;
  background: var(--lime);
  animation: blink 1.05s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Geri bildirim etiketi: etkin kirişin altında asılı */
.tag {
  position: absolute;
  z-index: 4;
  top: calc(var(--beam-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 40px);
  padding: 3px 11px 3px 9px;
  border-radius: 99px;
  background: var(--night-2);
  border: 1px solid var(--faint);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.tag span { overflow: hidden; text-overflow: ellipsis; }
.tag .ic { font-size: 15px; }
.st-ust .tag { color: var(--sun-2); border-color: rgba(255, 191, 60, 0.45); }
.st-alt .tag { color: var(--sea-1); border-color: rgba(51, 196, 255, 0.45); }
.st-bitir .tag { color: var(--lime); border-color: rgba(198, 255, 58, 0.5); }
.st-red .tag, .st-var .tag, .st-kopuk .tag { color: var(--warn); border-color: rgba(255, 184, 77, 0.45); }
.st-hata .tag { color: #fff; background: #d6224b; border-color: #d6224b; }

/* Bağlanan uç kiriş yükselir */
.rung.lit .beam {
  transform: translateY(-3px);
  filter: brightness(1.1) saturate(1.1);
  outline: 2.5px solid var(--lime);
  outline-offset: 2px;
  box-shadow: 0 14px 24px rgba(8, 3, 30, 0.55);
}

/* ---- Hareket ---------------------------------------------------------------- */
.rung.fresh.ust .beam { animation: in-left 0.42s var(--spring) both; }
.rung.fresh.alt .beam { animation: in-right 0.42s var(--spring) both; }
.rung.fresh .bolt { animation: bolt-pop 0.3s var(--spring) 0.3s both; }
@keyframes in-left { from { transform: translateX(-26%) scaleX(0.7); opacity: 0; } }
@keyframes in-right { from { transform: translateX(26%) scaleX(0.7); opacity: 0; } }
@keyframes bolt-pop { from { transform: scale(0); } 60% { transform: scale(1.5); } }

.gap.shake .beam { animation: shake 0.42s var(--out); }
@keyframes shake {
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

/* ---- Bitiş rengi --------------------------------------------------------------
   Bitince basamaklar bir renge döner; uçlar aynı ailenin koyu, dolgun tonunda sabit kalır (zıplamaz).
   Üç takım var; <html data-tema> ile seçilir (geliştirici görünümünde denenir, ileride A/B denemesi için).
   Varsayılan Yaprak. */
/* Yaprak: neon değil, yumuşak yaprak yeşili; koyu orman uçlar */
:root, [data-tema="yaprak"] {
  --win-step: linear-gradient(100deg, #5a9c48, #6fb156 55%, #82bf66);
  --win-step-line: transparent;
  --win-step-shade: rgba(20, 55, 10, 0.45);
  --win-end: linear-gradient(100deg, #1b4f34, #22603e 55%, #2a6d47);
  --win-end-line: rgba(196, 236, 160, 0.5);
  --win-end-shade: rgba(5, 25, 10, 0.7);
  --win-rail: linear-gradient(180deg, #9fd27c, #5a9c48);
  --win-chg: #1b3d27;
  --win-chg-ink: #dff7c4;
}
/* Limon: parlak limon basamaklar, koyu yeşil uçlar */
[data-tema="limon"] {
  --win-step: linear-gradient(100deg, #93e83f, #c6ff3a 55%, #e1ff7a);
  --win-step-shade: rgba(40, 90, 0, 0.4);
  --win-end: linear-gradient(100deg, #17763f, #229150 55%, #2fa35b);
  --win-end-line: rgba(198, 255, 58, 0.6);
  --win-end-shade: rgba(0, 35, 12, 0.7);
  --win-rail: linear-gradient(180deg, var(--lime), var(--lime-2));
  --win-chg: var(--tile-ink);
  --win-chg-ink: var(--lime);
}
/* Zümrüt: maviye çalan serin yeşil, koyu deniz yeşili uçlar */
[data-tema="zumrut"] {
  --win-step: linear-gradient(100deg, #1c9a7e, #25ae8c 55%, #38bf99);
  --win-step-shade: rgba(0, 45, 35, 0.45);
  --win-end: linear-gradient(100deg, #0b4744, #105a54 55%, #156a60);
  --win-end-line: rgba(130, 235, 200, 0.55);
  --win-end-shade: rgba(0, 20, 18, 0.7);
  --win-rail: linear-gradient(180deg, #5bd6b0, #1c9a7e);
  --win-chg: #0b3a36;
  --win-chg-ink: #b8fbe4;
}
.ladder.done .rung { --cut: var(--win-chg); }
.ladder.done .rung .beam {
  background: var(--win-step);
  box-shadow: inset 0 0 0 1.5px var(--win-step-line), inset 0 -9px 12px -7px var(--win-step-shade), 0 8px 18px rgba(8, 3, 30, 0.4);
}
.ladder.done .rung.end .beam {
  background: var(--win-end);
  box-shadow: inset 0 0 0 2.5px var(--win-end-line), inset 0 -11px 14px -8px var(--win-end-shade), 0 10px 22px rgba(8, 3, 30, 0.5);
}
.ladder.done .ch.chg { background: var(--win-chg); color: var(--win-chg-ink); }
.rung.joined .beam { animation: join 0.6s var(--spring) var(--d, 0ms) both; }
.rung.end.joined .beam { animation: none; }
@keyframes join {
  0% { transform: none; }
  45% { transform: translateY(-5px) scale(1.03); filter: brightness(1.25); }
  100% { transform: none; }
}

/* ---- Alt satır --------------------------------------------------------------- */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 14px;
}
body.solved .foot { display: none; }
.foot .link:disabled { opacity: 0.45; cursor: default; text-decoration: none; }
.foot .link:disabled:hover { color: var(--muted); }
.link {
  border: 0;
  background: none;
  padding: 6px 2px;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(185, 177, 222, 0.45);
}
.link:hover { color: var(--ink); }
/* ---- Geliştirici çubuğu ------------------------------------------------------
   Yalnızca geliştirici görünümünde. Amber kesik kenar oyunun parçası olmadığını söyler; düğmeler parmakla rahat
   basılacak boyda (40px). Taslak bulmacada "İncele ve onayla" amber dolgulu: bekleyen iş o. */
.dev {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 16px;
  border: 1.5px dashed rgba(255, 184, 77, 0.45);
  background: rgba(19, 14, 44, 0.55);
  font-size: 14px;
}
.dev[hidden] { display: none; }
.dev-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dev-state {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.dev-state.taslak { color: var(--warn); background: rgba(255, 184, 77, 0.14); }
.dev-state.onayli { color: var(--lime-2); background: rgba(142, 240, 90, 0.14); }
.dev-meta, .dev-label { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.dev-acts { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
.dev-theme { display: grid; gap: 6px; }
.dev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1.5px solid var(--faint);
  border-radius: 12px;
  background: rgba(255, 245, 228, 0.05);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s var(--spring);
}
.dev-btn:hover { border-color: rgba(255, 245, 228, 0.34); background-color: rgba(255, 245, 228, 0.09); }
.dev-btn:active { transform: scale(0.96); }
.dev-btn.go { border-color: transparent; background: var(--warn); color: var(--tile-ink); font-weight: 800; }
.dev-btn.go:hover { background: #ffc56b; }
.dev-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  border: 1.5px solid var(--faint);
  border-radius: 13px;
}
.dev-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s, color 0.2s;
}
.dev-seg button:hover { color: var(--ink); }
.dev-seg [aria-pressed="true"] { background: rgba(255, 245, 228, 0.12); color: var(--ink); font-weight: 700; }
.dev-seg .sw { width: 14px; height: 14px; border-radius: 50%; background: var(--win-step); box-shadow: inset 0 0 0 1px rgba(255, 245, 228, 0.25); }

/* ---- Sonuç ------------------------------------------------------------------- */
.result {
  margin: 26px 0 0;
  padding: 0 2px;
  scroll-margin-top: 12px;
}
.result[hidden] { display: none; }
.verdict .big { margin: 0; font: 800 38px/1.05 var(--display); letter-spacing: -0.015em; }
.verdict .sub { margin: 8px 0 0; color: var(--muted); font-size: 16px; font-variant-numeric: tabular-nums; }
.verdict .sub strong { color: var(--ink); font-weight: 700; }
.result .label { margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
/* Pes edilince cevap: küçük bir merdiven */
.mini {
  list-style: none;
  margin: 18px 0 0;
  padding: 8px 0;
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
}
.mini::before,
.mini::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--sun-2), var(--sun-1) 35%, var(--sea-2) 65%, var(--sea-1));
}
.mini::before { left: 0; }
.mini::after { right: 0; }
.mini li {
  display: flex;
  justify-content: center;
  margin: 0 2px;
  padding: 3px 12px;
  border-radius: 9px;
  background: var(--night-3);
}
.mini .word { --t: 24px; gap: 2px; }
.mini .ch { font-size: 15px; border-radius: 5px; box-shadow: none; }
.mini .ch.chg { background: var(--lime); }
.mini { --cut: var(--lime); }
.mini .ch.cut::before { left: -2px; width: 2px; }
.mini .ch.cut-end::after { right: -2px; width: 2px; }
/* Oyuncunun kendi basamakları (yardımın verdikleri de) cevapta zincir renginde */
.mini li.mine.ust { background: linear-gradient(100deg, #b94a2b, #c9792f 60%, #cf8f39); }
.mini li.mine.alt { background: linear-gradient(100deg, #5546c4, #3c74c9 55%, #2e93c4); }

/* Puan: dokununca hesabı açılır */
.verdict .pts {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 700;
  text-decoration: underline dotted rgba(255, 245, 228, 0.55);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
.verdict .pts:hover, .verdict .pts[aria-expanded="true"] { text-decoration-color: var(--ink); }
.calc {
  margin: 14px 0 0;
  padding: 12px 14px;
  max-width: 340px;
  border-radius: 14px;
  background: rgba(29, 22, 69, 0.78);
  border: 1px solid var(--faint);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.calc[hidden] { display: none; }
.calc dl { margin: 0; }
.calc dl div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.calc dt { color: var(--muted); }
.calc dd { margin: 0; font-weight: 600; }
.calc .sum { margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--faint); }
.calc .sum dt { color: var(--ink); }
.calc-f { margin: 10px 0 0; font-weight: 600; }
.calc-f strong { color: var(--lime); }
.calc-note { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.4; }

.name { margin-top: 22px; }
.name label { display: block; margin-bottom: 7px; color: var(--ink); font-weight: 700; font-size: 15px; }
.name .row { display: flex; gap: 8px; }
.name input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 245, 228, 0.25);
  background: rgba(10, 6, 30, 0.45);
  font-size: 17px;
  font-weight: 600;
}
.name input::placeholder { color: rgba(185, 177, 222, 0.75); }
.name input:focus { border-color: var(--lime); outline: none; }
.btn {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: var(--lime);
  color: var(--tile-ink);
  font-weight: 800;
  font-size: 16px;
  box-shadow: inset 0 -7px 10px -7px rgba(40, 90, 0, 0.5);
  transition: transform 0.15s var(--spring), filter 0.2s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.6; cursor: default; }

/* İkincil düğme: lime çerçeve ve yazı, dolgu yok (birincil "Kaydet"in yanında onunla yarışmasın). */
.btn.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: rgba(198, 255, 58, 0.06);
  color: var(--lime);
  box-shadow: inset 0 0 0 1.5px rgba(198, 255, 58, 0.5);
  text-decoration: none;
  line-height: 48px;
}
.btn.ghost:hover { background: rgba(198, 255, 58, 0.12); filter: none; }
.btn .ic { font-size: 20px; }

.board { margin-top: 22px; }
.board:empty { display: none; }

/* ---- Lalettayin ---------------------------------------------------------------
   Günün sonucunun altında rastgele bulmacalara geçiş; lalettayin.html'de başlığın altında zorluk ve "Rastgele". */
.lal-more { margin-top: 30px; padding-top: 22px; border-top: 1px solid rgba(255, 245, 228, 0.09); }
.lal-more .btn { width: 100%; }
.lal-more p { margin: 8px 0 0; color: var(--muted); font-size: 14px; text-align: center; }
.result .again { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin-top: 24px; }

.lal { display: flex; gap: 8px; margin: 8px 0 6px; }
.lal-sel {
  flex: none;
  appearance: none;
  height: 44px;
  padding: 0 38px 0 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 245, 228, 0.25);
  background: rgba(10, 6, 30, 0.45) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff5e4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6.5 9.5 5.5 5.5 5.5-5.5'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s;
}
.lal-sel:hover { border-color: rgba(255, 245, 228, 0.45); }
.lal-sel option { background: var(--night-2); color: var(--ink); }
.lal-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--faint);
  border-radius: 14px;
  background: rgba(255, 245, 228, 0.06);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s var(--spring);
}
.lal-btn .ic { font-size: 19px; }
.lal-btn span { overflow: hidden; text-overflow: ellipsis; }
.lal-btn:hover { border-color: rgba(255, 245, 228, 0.36); background-color: rgba(255, 245, 228, 0.1); }
.lal-btn:active { transform: scale(0.97); }
.lal-btn[aria-busy="true"] { color: var(--muted); cursor: progress; }
.lal-btn.sure { border-color: rgba(255, 184, 77, 0.6); color: var(--warn); }
.scores { list-style: none; margin: 0; padding: 0; font-variant-numeric: tabular-nums; }
.scores li {
  display: grid;
  grid-template-columns: 26px 1fr auto 40px 52px;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid rgba(255, 245, 228, 0.09);
  font-size: 15px;
}
.scores li.me { color: var(--lime); font-weight: 700; }
.scores .rank { color: var(--muted); }
.scores .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.scores .st, .scores .tm { color: var(--muted); font-size: 13.5px; }
.scores .pt { text-align: right; font-weight: 800; }
.scores .tm { text-align: right; }


.rungs:empty { display: none; }
.empty-day { text-align: center; padding: 12vh 10px 0; }
.empty-day .ghost { width: 76px; height: 118px; margin: 0 auto 22px; display: block; }
.empty-day .big { font: 800 28px/1.15 var(--display); margin: 0 0 8px; color: var(--ink); text-wrap: balance; }
.empty-day p { color: var(--muted); }
.empty-day a { color: var(--lime); }
body.empty .keys, body.empty .foot { display: none; }

/* ---- Bulunamadı (404.html) --------------------------------------------------- */
/* Boş günün düzeni; merdivenin ortadaki basamağı sol cıvatasından sarkıyor, sağda boş cıvata deliği kalıyor.
   Sayfa açılınca basamak yerindedir, sonra düşüp sallanarak durur. */
body.lost .page { padding-bottom: 40px; }
.brand a { display: inline-block; border-radius: 6px; }
.lost-day p { max-width: 31ch; margin: 0 auto; text-wrap: pretty; }
.lost-day .fall {
  transform-box: view-box;
  transform-origin: 14px 48px;
  transform: rotate(38deg);
  animation: rung-fall 1.5s var(--out) 0.35s backwards;
}
@keyframes rung-fall {
  0% { transform: rotate(0deg); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  32% { transform: rotate(54deg); }
  56% { transform: rotate(31deg); }
  76% { transform: rotate(41deg); }
  100% { transform: rotate(38deg); }
}
.empty-day a.btn {
  display: inline-flex;
  align-items: center;
  margin-top: 28px;
  color: var(--tile-ink);
  text-decoration: none;
}

/* ---- Klavye ------------------------------------------------------------------ */
.keys {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  background: rgba(16, 11, 38, 0.94);
  border-top: 1px solid rgba(255, 245, 228, 0.1);
  transition: transform 0.4s var(--out);
}
body.solved .keys { transform: translateY(110%); }
.krow { display: flex; justify-content: center; gap: 5px; max-width: 520px; margin: 0 auto 7px; }
.krow:last-child { margin-bottom: 0; }
.key {
  flex: 1 1 0;
  max-width: 44px;
  height: 54px;
  border: 0;
  border-radius: 9px;
  background: #342a72;
  color: var(--ink);
  font: 700 19px/1 var(--display);
  box-shadow: inset 0 -7px 10px -7px rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  transition: background 0.12s, transform 0.12s var(--spring);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.key:hover { background: #40358a; }
.key:active { transform: translateY(1px) scale(0.95); background: #4b3f9e; }
.key.wide { flex: 1.6 1 0; max-width: 72px; font-size: 15px; }
.key.enter { background: var(--lime); color: var(--tile-ink); font-weight: 800; letter-spacing: 0.02em; box-shadow: inset 0 -7px 10px -7px rgba(40, 90, 0, 0.55); }
.key.enter:disabled { background: rgba(198, 255, 58, 0.16); color: rgba(198, 255, 58, 0.6); box-shadow: inset 0 0 0 1.5px rgba(198, 255, 58, 0.28); cursor: default; }
.key.back { font-size: 24px; }
.keys.off { pointer-events: none; }

/* Anlam penceresi (popover: dışına dokununca ya da Esc ile kapanır) */
.mean {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 14px 16px 12px;
  border: 1px solid rgba(255, 245, 228, 0.18);
  border-radius: 16px;
  background: var(--night-2);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.65);
}
.mean:popover-open { animation: mean-in 0.18s var(--out); }
@keyframes mean-in { from { opacity: 0; transform: translateY(4px); } }
.mean::backdrop { background: transparent; }
.mean p { margin: 0; }
.mean-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 9px; margin-bottom: 6px !important; }
.mean-word { font-weight: 800; font-size: 15px; letter-spacing: 0.06em; }
.mean-pos { color: var(--muted); font-size: 13.5px; }
.mean-notes { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px !important; }
.mean-note {
  padding: 0 8px;
  border: 1px solid rgba(255, 184, 77, 0.45);
  border-radius: 99px;
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 20px;
}
.mean-list { margin: 0; padding-left: 1.25em; }
.mean-list li + li { margin-top: 4px; }
.mean-list li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.mean-wait, .mean-none { color: var(--muted); }
.mean-links { margin-top: 10px !important; color: var(--muted); font-size: 13px; }
.mean-links a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: rgba(255, 245, 228, 0.35); }
.mean-links a:hover { text-decoration-color: currentColor; }

.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 20; }

/* ---- Geniş ekran --------------------------------------------------------------- */
@media (min-width: 720px) {
  :root { --beam-h: 64px; }
  .rung.end { --beam-h: 74px; }
  .head { padding-top: 26px; }
  .brand { font-size: 44px; }
}
@media (max-height: 700px) {
  :root { --beam-h: 52px; --rung-gap: 9px; --kb-h: 196px; }
  .rung.end { --beam-h: 58px; }
  .key { height: 48px; }
  .brand { font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .caret { opacity: 1; }
}
