:root {
  color-scheme: dark;
  --zemin: #14110f;
  --yuzey: #1e1a17;
  --yuzey-2: #2a2420;
  --metin: #f7f3ee;
  --metin-soluk: #b6aaa0;
  --vurgu: #d98a3f;
  --mirlama: #6fbf73;
  --bosluk: 0.6rem;
  --radius: 0.75rem;
  --gecis: 140ms cubic-bezier(.4, 0, .2, 1);
  --sicrama: cubic-bezier(.34, 1.56, .64, 1);
  --tahta: min(96vw, 56vh, 480px);
  --aralik: calc(var(--tahta) * 0.022);
  --hucre: calc((var(--tahta) - var(--aralik) * 5) / 4);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--zemin);
  color: var(--metin);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  align-items: stretch;
  touch-action: none;
  overscroll-behavior: none;
  /* Jest her yerden okunur: uzun basista metin secimi, resim surukleme ve
     iOS baloncugu kaydirmayi bolmesin. */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  padding:
    calc(env(safe-area-inset-top, 0px) + 0.5rem)
    env(safe-area-inset-right, 0px)
    calc(env(safe-area-inset-bottom, 0px) + 0.5rem)
    env(safe-area-inset-left, 0px);
}

/* Kabuk ekranin tamamini alir: ustbar en ustte, araclar/kademe yolu en altta,
   tahta ikisinin arasinda ortalanir (margin:auto). Tahta genislikle sinirli
   oldugu icin uzun telefonda artan yukseklik ust/alta yigilmak yerine
   tahtanin cevresine simetrik dagilir; o bosluk da kaydirma alanidir. */
.uygulama {
  width: var(--tahta);
  display: flex;
  flex-direction: column;
  gap: var(--bosluk);
}
.tahta { margin: auto 0; }

.ustbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--bosluk); flex-wrap: wrap; }
.marka { display: flex; align-items: center; gap: 0.55rem; flex: 0 0 auto; }
.marka__yazi { display: flex; align-items: baseline; gap: 0.35rem; }
.marka h1 { margin: 0; font-size: clamp(1.5rem, 7vw, 2.2rem); letter-spacing: -0.02em; line-height: 1; }
.marka__alt { color: var(--vurgu); font-weight: 700; font-size: 0.85rem; }
/* Lusie'nin portresi: yuvarlak, vurgu renginde ince halka + yumusak golge.
   Baslikla ayni yukseklikte durur; ekrana gore olcekleniyor. */
.marka__foto {
  width: clamp(2.4rem, 11vw, 3.2rem);
  height: clamp(2.4rem, 11vw, 3.2rem);
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--vurgu);
  box-shadow: 0 0 0 3px rgba(217, 138, 63, 0.18), 0 4px 12px rgba(0, 0, 0, 0.45);
  flex: 0 0 auto;
}

.skorlar { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; flex: 1 1 auto; min-width: 0; }
.skor-kutu {
  background: var(--yuzey);
  border-radius: var(--radius);
  padding: 0.3rem 0.5rem;
  min-width: 3.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
}
.skor-kutu__baslik { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--metin-soluk); }
.skor-kutu__deger { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Unvan sayinin altinda kucuk bir satir. Kutu, en uzun unvan olan
   "Bitki Bekcisi" sigacak kadar genis; tek satirda kalsin diye tasan
   kisim ucnokta ile kesiliyor. */
.skor-kutu--genis { min-width: 5.6rem; }
/* Ulasilan kademenin karesi sayinin yaninda kucuk bir daire olarak durur:
   oyuncu "hangi Lusie'deyim" sorusunu sayiya bakmadan gorur. */
.skor-kutu__satir { display: flex; align-items: center; justify-content: center; gap: 0.3rem; }
.skor-kutu__foto {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
}
.skor-kutu__foto[hidden] { display: none; }
.skor-kutu__unvan {
  font-size: 0.62rem;
  line-height: 1.15;
  color: var(--vurgu);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mirlama { display: flex; align-items: center; gap: 0.5rem; }
.mirlama__cubuk {
  position: relative;
  flex: 1;
  height: 2.1rem;
  background: var(--yuzey);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.mirlama__dolu {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 55%), linear-gradient(90deg, #3f7a45, var(--mirlama));
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(111, 191, 115, 0.35);
  transition: width 220ms var(--gecis);
}
.mirlama__etiket {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--metin);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.mirlama__cubuk--dolu .mirlama__dolu { animation: nabiz 1.4s ease-in-out infinite; }

@keyframes nabiz { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }

/* Pati: hazir olunca yesil gradyan + disa yayilan nabiz halkasi; secim modunda kehribar. */
.mirlama .btn--pati { flex: 0 0 auto; align-self: stretch; min-height: 0; gap: 0.35rem; padding: 0.3rem 0.8rem; font-size: 0.8rem; border-radius: 999px; }
.btn--pati:not(:disabled) {
  --btn-yuzey: linear-gradient(180deg, #8ad98e 0%, #4f9d55 100%);
  --btn-kenar: rgba(200, 255, 205, 0.35);
  color: #0f2410;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: pati-nabiz 1.6s ease-out infinite;
}
.btn--pati.btn--pati-aktif:not(:disabled) {
  --btn-yuzey: linear-gradient(180deg, #f2a85a 0%, #cf7a2f 100%);
  --btn-kenar: rgba(255, 225, 190, 0.35);
  color: #1e1005;
  animation: none;
}
@keyframes pati-nabiz {
  0% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(111, 191, 115, 0.6); }
  100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 0 rgba(0, 0, 0, 0.3), 0 0 0 0.75rem rgba(111, 191, 115, 0); }
}

.tahta {
  position: relative;
  width: var(--tahta);
  height: var(--tahta);
  background: var(--yuzey);
  border-radius: var(--radius);
  padding: var(--aralik);
}
.tahta--secim { outline: 2px dashed var(--mirlama); outline-offset: 3px; }
.tahta--secim .kare { cursor: pointer; }
.tahta--secim .kare:hover { filter: brightness(1.2); }

.tahta__zemin {
  display: grid;
  grid-template-columns: repeat(4, var(--hucre));
  grid-template-rows: repeat(4, var(--hucre));
  gap: var(--aralik);
  height: 100%;
}
.tahta__zemin div { background: rgba(255, 255, 255, 0.04); border-radius: calc(var(--radius) * 0.7); }

.tahta__kareler { position: absolute; inset: var(--aralik); }

.kare {
  position: absolute;
  width: var(--hucre);
  height: var(--hucre);
  border-radius: calc(var(--radius) * 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  font-weight: 700;
  background: #3a322c;
  color: var(--metin);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: translate(
    calc(var(--kx) * (var(--hucre) + var(--aralik))),
    calc(var(--ky) * (var(--hucre) + var(--aralik)))
  );
  transition: transform var(--gecis);
}

img { -webkit-user-drag: none; }

.kare__foto {
  position: relative;
  z-index: 1;
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: block;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.kare__deger {
  position: absolute;
  right: 5%;
  bottom: 5%;
  font-size: calc(var(--hucre) * 0.17);
  font-variant-numeric: tabular-nums;
  background: rgba(20, 17, 15, 0.72);
  color: #f7f3ee;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}
.kare--hane4 .kare__deger { font-size: calc(var(--hucre) * 0.136); }
.kare--hane5 .kare__deger { font-size: calc(var(--hucre) * 0.108); }

/* Gecis efektleri. Yeni kare yumusak bir sicramayla belirir; birlesen kare
   morf + patlama: eski yuz buyuyerek yeni yuzun icinde erir, kare parlayip
   hafif sicrar, cevresine hale yayilir ve parcaciklar sacilir. Pati vurusu
   kareyi toz bulutuyla dusurur. Parcaciklar JS'te --dx/--dy/--boy ile
   hucre biriminde konumlanir (render.js burstParticles). */
.kare--yeni { animation: belir 240ms var(--sicrama) both; }
/* Birlesme: kare yerinden oynamaz; yeni yuz merkezden buyuyerek (zoom-in, sicramasiz) eski yuzun
   ustune gelir, eski yuz altinda kucularek soner, kare bir an parlar. */
.kare--birlesen { animation: parla 380ms ease-out both; z-index: 2; }
.kare--birlesen .kare__foto,
.kare--birlesen .kare__deger { animation: yaklas 340ms cubic-bezier(.2, .8, .2, 1) both; }
.kare--dusen {
  --menzil: calc(0.7 + var(--siddet, 0.5) * 0.9);
  animation: patla 640ms ease-out both;
  z-index: 3;
}
/* Karenin kendi yuzu yanip soner; dilimlerdeki kopyalar (kare__kirik icinde) kalir. */
.kare--dusen > .kare__foto,
.kare--dusen > .kare__deger { animation: yokol 90ms 50ms ease-in both; }
@keyframes yokol { to { opacity: 0; } }
/* Fuzyon: birlesen iki kare hedefe kayarken ayni anda parlar ve isik sacar. */
.kare--kaynasan { animation: kaynas 200ms ease-in both; z-index: 2; }
@keyframes kaynas {
  from { filter: brightness(1.1); box-shadow: 0 0 0 0 rgba(255, 214, 150, 0); }
  to {
    filter: brightness(calc(1.6 + var(--siddet, 0.5) * 0.9)) saturate(1.3);
    box-shadow: 0 0 calc(10px + var(--siddet, 0.5) * 26px) calc(2px + var(--siddet, 0.5) * 6px) rgba(255, 214, 150, 0.85);
    scale: 1.06;
  }
}

@keyframes belir { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }
@keyframes parla { from { filter: brightness(calc(1.2 + var(--siddet, 0.5) * 0.5)) saturate(1.2); } to { filter: none; } }
@keyframes yaklas { from { scale: 0.45; opacity: 0.5; } to { scale: 1; opacity: 1; } }
/* Komsular: sok dalgasi ulasinca (80 ms) disa itilir, sonumlenerek yerine doner. */
.kare--sarsilan { animation: sars 480ms 80ms cubic-bezier(.2, .7, .3, 1) both; }
@keyframes sars {
  0% { translate: 0 0; rotate: 0deg; }
  25% {
    translate: calc(var(--sx) * var(--sg) * var(--hucre) * 0.14) calc(var(--sy) * var(--sg) * var(--hucre) * 0.14);
    rotate: calc((var(--sx) + var(--sy)) * var(--sg) * 4deg);
  }
  55% {
    translate: calc(var(--sx) * var(--sg) * var(--hucre) * -0.05) calc(var(--sy) * var(--sg) * var(--hucre) * -0.05);
    rotate: calc((var(--sx) + var(--sy)) * var(--sg) * -2deg);
  }
  80% { translate: calc(var(--sx) * var(--sg) * var(--hucre) * 0.02) calc(var(--sy) * var(--sg) * var(--hucre) * 0.02); rotate: 0deg; }
  100% { translate: 0 0; rotate: 0deg; }
}
/* Dinamit: 0-12 % beyaza yanar ve sisir, 20 %'de zemin/golge yok olur (yalniz dilimler kalir). */
@keyframes patla {
  0% { filter: brightness(1.4); scale: 1; }
  10% { filter: brightness(3.2) saturate(0.2); scale: 1.14; box-shadow: 0 0 calc(var(--hucre) * 0.6) #fff3d6; }
  20%, 100% { background-color: transparent; background-image: none; box-shadow: none; filter: none; scale: 1.14; }
}
/* Kirik dilimler: karenin yuzunun kopyasi, kademe renginde, clip-path ile kek dilimi;
   orta acisi yonunde ucar, doner, sonda yercekimiyle asagi kayip soner. */
.kare__kirik {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  pointer-events: none;
  z-index: 2;
  box-shadow: none;
  animation: kirik 720ms 40ms cubic-bezier(.15, .6, .3, 1) both;
}
@keyframes kirik {
  0% { translate: 0 0; rotate: 0deg; opacity: 1; filter: brightness(2.2); }
  18% { filter: brightness(1.15); }
  65% {
    translate: calc(var(--dx) * var(--hucre) * var(--menzil, 1) * 0.85) calc(var(--dy) * var(--hucre) * var(--menzil, 1) * 0.85);
    opacity: 1;
  }
  100% {
    translate: calc(var(--dx) * var(--hucre) * var(--menzil, 1) * 1.2) calc(var(--dy) * var(--hucre) * var(--menzil, 1) * 1.2 + var(--hucre) * 0.6);
    rotate: var(--rot, 90deg);
    opacity: 0;
    scale: 0.55;
  }
}

/* Hale: karenin kenarindan disari yayilan yumusak halka (sok dalgasi). */
.kare--birlesen::before {
  content: '';
  position: absolute;
  inset: calc(-25% - var(--siddet, 0.5) * 40%);
  border-radius: 50%;
  background: radial-gradient(circle, transparent 38%, rgba(255, 214, 150, calc(0.3 + var(--siddet, 0.5) * 0.4)) 47%, transparent 62%);
  pointer-events: none;
  animation: hale 520ms ease-out both;
}
@keyframes hale {
  from { scale: 0.55; opacity: 1; }
  to { scale: 1.25; opacity: 0; }
}

.kare__eski {
  position: absolute;
  left: 13%;
  top: 13%;
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  animation: eri 300ms ease-in both;
  z-index: 0;
}
@keyframes eri { from { opacity: 1; scale: 1; } to { opacity: 0; scale: 0.8; } }

.kare__parca {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--hucre) * var(--boy));
  height: calc(var(--hucre) * var(--boy));
  margin: calc(var(--hucre) * var(--boy) / -2);
  border-radius: 50%;
  background: var(--rk);
  box-shadow: 0 0 6px var(--rk);
  pointer-events: none;
  animation: sac 560ms cubic-bezier(0.15, 0.7, 0.3, 1) both;
}
@keyframes sac {
  from { translate: 0 0; opacity: 1; scale: 1; }
  to {
    translate: calc(var(--dx) * var(--hucre) * (0.7 + var(--siddet, 0.5) * 0.7)) calc(var(--dy) * var(--hucre) * (0.7 + var(--siddet, 0.5) * 0.7));
    opacity: 0;
    scale: 0.25;
  }
}
.kare--dusen .kare__parca { animation-duration: 420ms; }

/* Kademe renkleri. Lusie'nin tekir paletinden acik kremden yanik
   turuncuya, sonra amber; 2048 ustu uc kademe kendi ozel dilini alir. */
.tile--2    { background: #e9dfd3; }
.tile--4    { background: #e3d3bd; }
.tile--8    { background: #e8a86a; }
.tile--16   { background: #e3924f; }
.tile--32   { background: #dd7a3c; }
.tile--64   { background: #d45f2c; }
.tile--128  { background: #c9a227; }
.tile--256  { background: #c79a1f; }
.tile--512  { background: #c29213; }
.tile--1024 { background: #b98a0c; }
.tile--2048 { background: #b38005; box-shadow: 0 0 18px rgba(217, 138, 63, 0.55); }
.tile--4096 {
  background: linear-gradient(145deg, #d4a017, #8a6508);
  box-shadow: 0 0 22px rgba(212, 160, 23, 0.6);
}
.tile--8192 {
  background: linear-gradient(145deg, #3b4f9e, #1b2350);
  box-shadow: 0 0 22px rgba(90, 120, 220, 0.6);
}
.tile--16384 {
  background: linear-gradient(145deg, #7b3fbf, #2b7fbf, #bf3f8a);
  box-shadow: 0 0 28px rgba(160, 90, 220, 0.7);
}

.zincir-rozet {
  position: absolute;
  top: 12%;
  left: 50%;
  translate: -50% 0;
  background: var(--mirlama);
  color: #10240f;
  font-weight: 800;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 5;
  pointer-events: none;
  animation: rozet 900ms var(--gecis) both;
}
.zincir-rozet[hidden] { display: none !important; }

@keyframes rozet {
  0% { opacity: 0; scale: 0.7; }
  20% { opacity: 1; scale: 1.05; }
  75% { opacity: 1; scale: 1; }
  100% { opacity: 0; translate: -50% -40%; }
}

.araclar { display: flex; gap: 0.4rem; }

/* Kademe yolu: 14 nokta tahta genisligine esit dagilir; nokta boyu tahtadan turer. */
.yol {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  padding: 0.45rem 0.35rem;
  background: var(--yuzey);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background-color var(--gecis), box-shadow var(--gecis);
}
.yol:hover { background: #241f1b; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08); }
.yol:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--zemin), 0 0 0 4px var(--vurgu); }
.yol__nokta {
  --nokta: calc((var(--tahta) - 0.7rem - 13 * 0.2rem) / 14);
  width: var(--nokta);
  height: var(--nokta);
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--yuzey-2);
  object-fit: cover;
  box-shadow: 0 0 0 1.5px transparent;
  transition: box-shadow var(--gecis), transform var(--gecis);
}
.yol__nokta--acik { background: none; }
.yol__nokta--son { box-shadow: 0 0 0 2px var(--vurgu), 0 0 10px rgba(232, 148, 58, 0.45); transform: scale(1.12); }
.yol__nokta--hedef { box-shadow: 0 0 0 1.5px var(--metin-soluk); }

/* Dugmeler: katmanli yuzey (gradyan + ust isik + yumusak golge), hover kaldirma, basinca cokme. */
.btn {
  --btn-yuzey: linear-gradient(180deg, #372e27 0%, #262019 100%);
  --btn-kenar: rgba(255, 255, 255, 0.07);
  --btn-golge: 0 1px 0 rgba(0, 0, 0, 0.35), 0 8px 18px -10px rgba(0, 0, 0, 0.75);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  flex: 1;
  min-height: 2.75rem;
  background: var(--btn-yuzey);
  color: var(--metin);
  border: 1px solid var(--btn-kenar);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.01em;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--btn-golge);
  transition: translate var(--gecis), scale var(--gecis), box-shadow var(--gecis),
    filter var(--gecis), opacity var(--gecis), background-color var(--gecis);
}
.btn:hover:not(:disabled) {
  translate: 0 -1px;
  filter: brightness(1.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 0 rgba(0, 0, 0, 0.35), 0 12px 22px -10px rgba(0, 0, 0, 0.8);
}
.btn:active:not(:disabled) {
  translate: 0 1px;
  scale: 0.98;
  filter: brightness(0.95);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.45);
}
.btn:disabled { opacity: 0.38; cursor: default; box-shadow: none; filter: saturate(0.6); }
/* Basis: ezil-uza (squash & stretch) + dokunulan noktadan yayilan dalga (.btn__dalga, JS ekler). */
.btn { overflow: hidden; isolation: isolate; }
.btn--bas { animation: btnBas 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.btn--bas .btn__ikon { animation: btnIkon 460ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes btnBas {
  0% { scale: 1; }
  18% { scale: 0.9 0.86; filter: brightness(1.35); }
  55% { scale: 1.07 1.1; filter: brightness(1.15); }
  100% { scale: 1; filter: brightness(1); }
}
@keyframes btnIkon {
  0% { rotate: 0deg; scale: 1; }
  30% { rotate: -14deg; scale: 1.25; }
  65% { rotate: 9deg; scale: 1.1; }
  100% { rotate: 0deg; scale: 1; }
}
.btn__dalga {
  position: absolute;
  left: var(--rx, 50%);
  top: var(--ry, 50%);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 244, 220, 0.95) 0%, rgba(255, 190, 110, 0.55) 40%, rgba(255, 150, 60, 0) 70%);
  animation: btnDalga 520ms ease-out both;
  z-index: -1;
}
@keyframes btnDalga {
  0% { scale: 0.2; opacity: 1; }
  100% { scale: 30; opacity: 0; }
}
.btn--bas::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255, 224, 170, 0.9), inset 0 0 22px rgba(255, 170, 80, 0.75);
  animation: btnHale 480ms ease-out both;
}
@keyframes btnHale {
  0% { opacity: 1; }
  100% { opacity: 0; }
}
.anahtar.btn--bas { animation: btnBas 380ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--zemin), 0 0 0 4px var(--vurgu); }
.btn__ikon {
  width: 1.15em;
  height: 1.15em;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn__ikon--dolu { fill: currentColor; stroke: none; }
.btn--birincil {
  --btn-yuzey: linear-gradient(180deg, #f2a85a 0%, #cf7a2f 100%);
  --btn-kenar: rgba(255, 225, 190, 0.35);
  --btn-golge: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 22px -10px rgba(217, 138, 63, 0.8);
  color: #1e1005;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn--ikon { flex: 0 0 auto; width: 2.75rem; padding: 0; }
.btn--ikon .btn__ikon { width: 1.35rem; height: 1.35rem; }
.btn--genis { width: 100%; flex: none; }
/* display:inline-flex, hidden ozniteligini ezer; "Uygulamayi Yukle" gibi kosullu dugmeler gercekten gizlensin. */
.btn[hidden] { display: none !important; }
/* Baglanti olarak kullanilan dugme (APK indir): alti cizili metin degil, dugme. */
a.btn { text-decoration: none; color: inherit; }
.btn--sade {
  --btn-yuzey: rgba(255, 255, 255, 0.03);
  --btn-kenar: rgba(255, 255, 255, 0.12);
  --btn-golge: none;
  box-shadow: none;
}
.btn--sade:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); box-shadow: none; }
.btn--kucuk { flex: 0 0 auto; min-height: 0; padding: 0.5rem 0.95rem; font-size: 0.85rem; border-radius: 999px; }

/* "Ana ekrana ekle" seridi: yalnizca tarayici kurulabilir dediginde gorunur
   (pwa.js), araclarin altinda, tahtanin ritmini bozmayan ince bir kart. */
.yukle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  background: var(--yuzey);
  border: 1px solid var(--yuzey-2);
  border-radius: var(--radius);
  animation: yukle-gir 260ms var(--gecis);
}
.yukle[hidden] { display: none; }
.yukle__foto { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.yukle__yazi { display: flex; flex-direction: column; gap: 0.1rem; flex: 1 1 auto; min-width: 0; font-size: 0.8rem; line-height: 1.25; }
.yukle__yazi strong { font-size: 0.85rem; }
.yukle__yazi span { color: var(--metin-soluk); }
.yukle__kapat {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--metin-soluk);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.yukle__kapat:hover { background: var(--yuzey-2); color: var(--metin); }
.yukle__kapat:focus-visible { outline: 2px solid var(--vurgu); outline-offset: 2px; }
@keyframes yukle-gir { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .yukle { animation: none; } }

.perde {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 7, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10;
}
.perde[hidden] { display: none !important; }

.panel {
  background: var(--yuzey);
  border-radius: calc(var(--radius) * 1.3);
  padding: 1.4rem;
  width: min(100%, 24rem);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  max-height: 100%;
  overflow-y: auto;
}
.panel--genis { width: min(100%, 32rem); }
.panel h2 { margin: 0 0 0.2rem; font-size: 1.4rem; }
.panel__alt { margin: 0; color: var(--metin-soluk); line-height: 1.5; font-size: 0.92rem; }

.ayar-satir { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.15rem 0; }
/* Anahtar: etiket + kayan dugmeli ray (knob radyal gradyan; konum gecisi sicramali). */
.anahtar {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  color: var(--metin);
  border: 0;
  padding: 0.2rem 0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--gecis);
}
.anahtar::after {
  content: '';
  width: 2.7rem;
  height: 1.55rem;
  border-radius: 999px;
  background-color: var(--vurgu);
  background-image: radial-gradient(circle, #fff 0 0.5rem, transparent 0.58rem);
  background-size: 1.2rem 1.2rem;
  background-repeat: no-repeat;
  background-position: calc(100% - 0.18rem) 50%;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: background-color var(--gecis), background-position 200ms var(--sicrama), box-shadow var(--gecis);
}
.anahtar[aria-pressed="false"] { color: var(--metin-soluk); }
.anahtar[aria-pressed="false"]::after { background-color: var(--yuzey-2); background-position: 0.18rem 50%; }
.anahtar:hover::after { filter: brightness(1.1); }
.anahtar:focus-visible { outline: none; }
.anahtar:focus-visible::after { box-shadow: 0 0 0 2px var(--zemin), 0 0 0 4px var(--vurgu); }

.album {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.5rem;
  margin: 0.2rem 0 0.4rem;
}
.album__kart {
  background: var(--yuzey-2);
  border-radius: var(--radius);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: center;
}
.album__kart--kilitli { opacity: 0.35; }
.album__foto {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: block;
  margin-bottom: 0.3rem;
}
.album__deger { font-size: 0.7rem; color: var(--metin-soluk); font-variant-numeric: tabular-nums; }
.album__ad { font-weight: 700; font-size: 0.85rem; }
.album__hikaye { font-size: 0.72rem; color: var(--metin-soluk); line-height: 1.35; }

/* Kutlama fotografi panelin icinde yukseklikle sinirli: 9:19 dikey kareler
   tam boy gosterilince "Devam Et" ekranin altina dusuyordu. Yuzler dort
   fotografta da ust-orta bolgede, kirpma oraya odaklanir. */
.kutlama__foto {
  width: 100%;
  max-height: min(42vh, 20rem);
  object-fit: cover;
  object-position: 50% 28%;
  border-radius: var(--radius);
  display: block;
}

.rozet { margin: 0; color: var(--vurgu); font-weight: 700; }
.ozet { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem; margin: 0.2rem 0 0.5rem; }
.ozet dt { color: var(--metin-soluk); }
.ozet dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* Uzun telefon (tahta genislikle sinirli, dikeyde pay artiyor): kontroller
   ferahlar ki bosluk tek bir yerde yigilmasin. */
@media (min-height: 780px) and (max-width: 520px) {
  :root { --bosluk: 0.85rem; }
  .skor-kutu { padding: 0.45rem 0.6rem; }
  .mirlama__cubuk { height: 2.25rem; }
  .btn { min-height: 3.15rem; padding: 0.85rem 1rem; font-size: 1rem; }
  .btn--pati { min-height: 0; padding: 0.3rem 0.9rem; font-size: 0.82rem; }
  .yol { padding: 0.55rem 0.4rem; }
  .yol__nokta { --nokta: calc((var(--tahta) - 0.8rem - 13 * 0.2rem) / 14); }
}

/* Ust cubuk telefonda TEK satir kalir: bes-alti haneli skorlar marka ile yan
   yana sigmali. Marka logo dizilimine gecer ("2048" adin altinda), sayilar dar
   ekranda kademeli kuculur. flex-wrap yalniz son care olarak duruyor. */
@media (max-width: 520px) {
  .marka__yazi { flex-direction: column; align-items: flex-start; gap: 0.1rem; }
  .marka__alt { line-height: 1; }
}
@media (max-width: 400px) {
  .skor-kutu { padding: 0.3rem 0.4rem; }
  .skor-kutu__deger { font-size: 0.95rem; }
}
@media (max-width: 340px) {
  .skor-kutu { padding: 0.3rem 0.35rem; min-width: 3rem; }
  .skor-kutu__deger { font-size: 0.88rem; }
  .skor-kutu--genis { min-width: 5rem; }
}

@media (max-height: 680px) {
  :root { --tahta: min(94vw, 48vh, 480px); }
  .yol { display: none; }
  .marka h1 { font-size: 1.3rem; }
  .mirlama__cubuk { height: 1.8rem; }
}

/* Ekran flasi: patlama merkezinden (--fx/--fy) yayilan isik; --siddet opakligi verir.
   Beyaz ilk parlama (::after) 180 ms, turuncu hale 560 ms. Perdelerin ustunde, tiklanmaz. */
/* Parcacik katmani (fx.js): tahtanin ustunde, perdenin (z 10) altinda. */
.fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 8;
}
.flas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%),
    #fff4dc 0%, rgba(255, 205, 130, 0.9) 16%, rgba(255, 150, 60, 0.4) 42%, transparent 70%);
}
.flas::after { content: ''; position: absolute; inset: 0; background: #fff8ec; opacity: 0; }
.flas--patla { animation: flas-patla 560ms ease-out both; }
.flas--patla::after { animation: flas-beyaz 180ms ease-out both; }
.flas--kaynas { animation: flas-kaynas 420ms ease-out both; }
@keyframes flas-patla {
  0% { opacity: 0; }
  6% { opacity: calc(0.55 + var(--siddet, 0.5) * 0.45); }
  30% { opacity: calc(0.2 + var(--siddet, 0.5) * 0.2); }
  100% { opacity: 0; }
}
@keyframes flas-beyaz { 0% { opacity: calc(0.35 + var(--siddet, 0.5) * 0.5); } 100% { opacity: 0; } }
@keyframes flas-kaynas { 0% { opacity: 0; } 12% { opacity: calc(var(--siddet, 0.5) * 0.5); } 100% { opacity: 0; } }
/* Ekran sarsintisi: kabuk --ssg genligiyle titrer (dinamit / buyuk birlesme). */
.uygulama.sarsinti { animation: sarsinti 520ms 40ms cubic-bezier(.2, .7, .3, 1) both; }
@keyframes sarsinti {
  0% { translate: 0 0; rotate: 0deg; }
  10% { translate: calc(var(--ssg, 1) * -7px) calc(var(--ssg, 1) * 5px); rotate: calc(var(--ssg, 1) * -0.6deg); }
  25% { translate: calc(var(--ssg, 1) * 7px) calc(var(--ssg, 1) * -6px); rotate: calc(var(--ssg, 1) * 0.5deg); }
  40% { translate: calc(var(--ssg, 1) * -5px) calc(var(--ssg, 1) * 3px); rotate: calc(var(--ssg, 1) * -0.3deg); }
  55% { translate: calc(var(--ssg, 1) * 3px) calc(var(--ssg, 1) * -2px); rotate: 0deg; }
  75% { translate: calc(var(--ssg, 1) * -1px) calc(var(--ssg, 1) * 1px); }
  100% { translate: 0 0; rotate: 0deg; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Kimlik kartı girdisi + tehlike düğmesi */
.girdi {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: var(--yuzey-2);
  color: var(--metin);
  font: inherit;
  font-size: 1rem;
  transition: border-color var(--gecis), box-shadow var(--gecis);
}
.girdi::placeholder { color: var(--metin-soluk); opacity: 0.8; }
.girdi:focus-visible { outline: none; border-color: var(--vurgu); box-shadow: 0 0 0 3px rgba(217, 138, 63, 0.28); }
.girdi[aria-invalid="true"] { border-color: #d9534f; }
.panel__hata { margin: -0.2rem 0 0; color: #f0a19e; font-size: 0.85rem; }
.panel__kucuk { font-size: 0.8rem; }
.panel__kucuk a { color: var(--vurgu); }
.btn--tehlike { background: #b3342e; color: #fff; border-color: #c94a44; }
.btn--tehlike:hover:not(:disabled) { background: #c93f38; }
