/* ============================================================
   ANAGRAM — oyun sayfası stilleri
   ============================================================ */
.an-page { padding: 16px 16px 40px; display: flex; justify-content: center; }
#an {
  --n: 5;
  --ts: min(64px, calc((min(94vw, 540px) - 20px - (var(--n) - 1) * 8px) / var(--n)));
  width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center;
}
.an-head { width: 100%; display: grid; grid-template-columns: 76px 1fr 76px; align-items: center; gap: 8px; }
.an-head > .icon-btn { justify-self: start; }
.an-titles { text-align: center; }
.an-titles h1 { font-size: 28px; margin: 0; }
.an-titles p { margin: 4px 0 0; color: var(--ink-dim); font-size: 14px; }
.an-starsbox {
  justify-self: end;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 10px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  font-family: "Fredoka", sans-serif; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.an-starsbox:hover { border-color: var(--violet); transform: translateY(-2px); }
.an-starsbox span { font-size: 15px; }
.an-starsbox b { color: #ffcc33; }
.an-starsbox small { font-size: 11px; color: var(--ink-dim); }

/* Bölüm ilerlemesi */
.an-progress { width: 100%; max-width: 420px; margin-top: 14px; }
.an-progress-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; font-family: "Fredoka", sans-serif; }
.an-progress-top b { font-size: 18px; color: var(--ink); }
.an-progress-top span { font-size: 13.5px; color: var(--violet-bright); }
#an-dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
#an-dots i {
  height: 18px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 11px; color: #3a2400;
  background: var(--bg-soft-2); border: 1px solid var(--line);
  transition: background 0.3s;
}
#an-dots i.done { background: linear-gradient(180deg, #ffd666, #f2a933); border-color: transparent; }
#an-dots i.cur { box-shadow: 0 0 0 2px var(--violet); animation: an-cur 1.6s ease-in-out infinite; }
#an-dots i.lock { opacity: 0.45; }
@keyframes an-cur { 50% { box-shadow: 0 0 0 2px var(--violet), 0 0 12px rgba(139, 92, 246, 0.8); } }

/* Kurt ve konuşma balonu */
.an-stage { display: flex; align-items: center; gap: 10px; margin: 14px 0 8px; min-height: 96px; }
#an-wolf { flex: none; width: 92px; height: 92px; }
#an-wolf img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35)); }
#an-wolf.bump { animation: an-bump 0.5s cubic-bezier(.34,1.56,.64,1); }
#an-wolf[data-mood="happy"].bump { animation: an-jump 0.7s cubic-bezier(.34,1.56,.64,1); }
#an-wolf[data-mood="sad"].bump { animation: an-no 0.5s ease; }
@keyframes an-bump { 40% { transform: scale(1.08) rotate(-3deg); } }
@keyframes an-jump { 35% { transform: translateY(-16px) rotate(-6deg); } 65% { transform: translateY(0) scale(1.05, 0.95); } }
@keyframes an-no { 25%, 75% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
#an-say {
  position: relative;
  max-width: 300px;
  padding: 10px 16px; border-radius: 16px;
  background: #fff; color: #2a1a5e;
  font-family: "Fredoka", sans-serif; font-weight: 500; font-size: 16px; line-height: 1.3;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
#an-say::before {
  content: ""; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  border: 8px solid transparent; border-left: 0; border-right-color: #fff;
}
#an-say.pop { animation: an-say 0.35s cubic-bezier(.34,1.56,.64,1); }
@keyframes an-say { from { transform: scale(0.8); opacity: 0.4; } }

/* Cevap kutuları */
#an-slots { display: flex; gap: 8px; justify-content: center; margin: 8px 0 18px; }
.an-slot {
  width: var(--ts); aspect-ratio: 1; padding: 0;
  border-radius: 14px;
  border: 2px dashed rgba(166, 123, 251, 0.5);
  background: rgba(139, 92, 246, 0.08);
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: calc(var(--ts) * 0.52); color: #fff;
  cursor: default;
}
.an-slot.full {
  border: 0; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 6px 14px rgba(0, 0, 0, 0.3);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.an-slot.in { animation: an-in 0.28s cubic-bezier(.34,1.56,.64,1); }
@keyframes an-in { from { transform: translateY(26px) scale(0.7); opacity: 0.3; } }
.an-slot.lock { cursor: default; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 0 0 3px #ffcc33, 0 0 16px rgba(255, 204, 51, 0.6); }
.an-slot.glow { animation: an-in 0.28s cubic-bezier(.34,1.56,.64,1), an-glow 1s ease 0.3s; }
@keyframes an-glow { 50% { transform: scale(1.12); } }
#an-slots.shake { animation: an-shake 0.45s ease; }
#an-slots.shake .an-slot.full:not(.lock) { background: linear-gradient(180deg, #ff8fa3, #e64d6b); }
@keyframes an-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
#an-slots.win .an-slot { animation: an-win 0.6s cubic-bezier(.34,1.56,.64,1) both; }
#an-slots.win .an-slot:nth-child(1) { animation-delay: 0s; }
#an-slots.win .an-slot:nth-child(2) { animation-delay: 0.06s; }
#an-slots.win .an-slot:nth-child(3) { animation-delay: 0.12s; }
#an-slots.win .an-slot:nth-child(4) { animation-delay: 0.18s; }
#an-slots.win .an-slot:nth-child(5) { animation-delay: 0.24s; }
#an-slots.win .an-slot:nth-child(6) { animation-delay: 0.3s; }
#an-slots.win .an-slot:nth-child(7) { animation-delay: 0.36s; }
#an-slots.win .an-slot:nth-child(8) { animation-delay: 0.42s; }
@keyframes an-win { 40% { transform: translateY(-14px) scale(1.1); background: linear-gradient(180deg, #7ee0b0, #3fae7c); } 100% { background: linear-gradient(180deg, #7ee0b0, #3fae7c); } }

/* Karışık harfler */
#an-pool { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: var(--ts); }
.an-tile {
  width: var(--ts); aspect-ratio: 1; padding: 0;
  border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.22), 0 8px 16px rgba(0, 0, 0, 0.3);
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: calc(var(--ts) * 0.52); color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.15s, opacity 0.2s;
}
.an-tile:hover:not(:disabled) { transform: translateY(-4px) rotate(-2deg); }
.an-tile:active:not(:disabled) { transform: scale(0.92); }
.an-tile.used { opacity: 0.12; transform: scale(0.85); cursor: default; box-shadow: none; }
.an-tile.deal { animation: an-deal 0.4s cubic-bezier(.34,1.56,.64,1) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes an-deal { from { transform: translateY(-20px) rotate(-14deg) scale(0.6); opacity: 0; } }

/* Araçlar */
.an-tools { display: flex; gap: 8px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.an-tool {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--ink);
  font-family: "Fredoka", sans-serif; font-size: 15px; cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.an-tool:hover:not(:disabled) { border-color: var(--violet); transform: translateY(-2px); }
.an-tool:disabled { opacity: 0.4; cursor: default; }
#an-hint { border-style: dashed; border-color: var(--violet); color: var(--violet-bright); }

/* Bölüm sonu değil, her seviye sonu: alttan çıkan panel */
#an-result {
  display: none; flex-direction: column; align-items: center; gap: 8px;
  margin-top: 14px;
}
#an-result.show { display: flex; animation: an-res 0.45s cubic-bezier(.34,1.56,.64,1); }
@keyframes an-res { from { transform: translateY(16px); opacity: 0; } }
#an.loading #an-result, #an.loading .an-tools, #an.loading #an-slots, #an.loading #an-pool { display: none; }
.an-res-stars { display: flex; gap: 6px; }
.an-res-stars i { font-style: normal; font-size: 34px; line-height: 1; color: rgba(255, 255, 255, 0.15); }
.an-res-stars i.on { color: #ffcc33; text-shadow: 0 0 14px rgba(255, 204, 51, 0.6); animation: an-star 0.45s cubic-bezier(.34,1.8,.64,1) both; animation-delay: calc(0.2s + var(--i) * 0.18s); }
@keyframes an-star { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
.an-res-alt { margin: 0; color: var(--ink-dim); font-size: 14px; }
.an-next { font-size: 17px; padding: 12px 34px; animation: an-pulse 1.6s ease-in-out 1s infinite; }
@keyframes an-pulse { 50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0.2); } }
/* Çözülünce araçlar gizlensin, yerine panel gelsin */
#an:has(#an-result.show) .an-tools { display: none; }

/* Yükleniyor */
.an-loading { display: none; flex-direction: column; align-items: center; gap: 10px; margin: 24px 0; color: var(--ink-dim); font-family: "Fredoka", sans-serif; }
#an.loading .an-loading { display: flex; }
.an-ld { display: flex; gap: 6px; }
.an-ld i { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 600; color: #fff; background: var(--violet); animation: an-ld 1.2s ease-in-out infinite; }
.an-ld i:nth-child(2) { background: #f29e33; animation-delay: 0.15s; }
.an-ld i:nth-child(3) { background: #4abf8c; animation-delay: 0.3s; }
@keyframes an-ld { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-12px) rotate(-10deg); } }

#an-toast {
  position: fixed; top: 96px; left: 50%; transform: translate(-50%, -10px); z-index: 4600;
  background: var(--ink); color: var(--bg);
  font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 15px;
  padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#an-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Pencereler */
.an-modal { position: fixed; inset: 0; z-index: 4500; background: rgba(6, 4, 14, 0.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; animation: an-fade 0.25s ease-out; }
@keyframes an-fade { from { opacity: 0; } }
.an-card {
  position: relative; width: min(420px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.25), transparent 70%), var(--bg-soft);
  border: 1px solid var(--line); border-radius: 22px; padding: 24px 22px 20px; text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: an-card-in 0.35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes an-card-in { from { transform: scale(0.85); opacity: 0; } }
.an-card.end { animation: an-end-in 0.6s cubic-bezier(.22, 1.2, .36, 1) both; }
@keyframes an-end-in { 0% { transform: scale(1.9); opacity: 0; filter: blur(6px); } 60% { opacity: 1; filter: blur(0); } 100% { transform: scale(1); opacity: 1; } }
.an-x { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink-dim); cursor: pointer; z-index: 2; }
.an-card h3 { font-size: 24px; margin: 6px 0 8px; }
.an-card p { color: var(--ink-dim); font-size: 14.5px; margin: 0 0 12px; }

.an-demo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0 2px; }
.an-demo-row { display: flex; gap: 5px; }
.an-demo-row i { width: 36px; height: 36px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 18px; color: #fff; background: var(--c); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.an-demo-row:not(.mix) i { animation: an-demo 3s ease-in-out infinite; animation-delay: calc(var(--i) * 0.35s); }
.an-demo-row.mix i { animation: an-demo-mix 3s ease-in-out infinite; }
@keyframes an-demo { 0%, 8% { opacity: 0; transform: translateY(26px) scale(0.7); } 18%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes an-demo-mix { 0%, 10% { opacity: 1; } 55%, 88% { opacity: 0.2; } 100% { opacity: 1; } }
.an-how { list-style: none; padding: 0; margin: 12px 0 16px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.an-how li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-dim); font-size: 14.5px; }
.an-how li span { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--violet); color: #fff; font-family: "Fredoka", sans-serif; font-size: 14px; }
.an-go { font-size: 17px; padding: 13px 32px; }

/* Bölüm sonu */
.an-ch-icon { font-size: 30px; line-height: 1; }
.an-ch-wolf { display: block; margin: 0 auto; width: 110px; height: 110px; object-fit: contain; animation: an-jump 1.2s ease-in-out 0.4s infinite; }
.an-ch-stars { display: flex; align-items: baseline; justify-content: center; gap: 6px; font-family: "Fredoka", sans-serif; }
.an-ch-stars b { font-size: 48px; line-height: 1; color: #ffcc33; }
.an-ch-stars span { font-size: 18px; color: var(--ink-dim); }
.an-chnext { width: 100%; justify-content: center; margin-bottom: 10px; }
/* Paylaş / Diğer mini oyunlar: eşit, çerçeveli iki düğme */
.an-end-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.an-sub {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 8px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: rgba(139, 92, 246, 0.08);
  color: var(--ink); font-family: "Fredoka", sans-serif; font-size: 14.5px; line-height: 1.15;
  text-decoration: none; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.an-sub svg { flex: none; width: 18px; height: 18px; color: var(--violet-bright); }
.an-sub:hover { border-color: var(--violet); background: rgba(139, 92, 246, 0.2); transform: translateY(-2px); }
.an-sub:active { transform: scale(0.97); }

/* Seviye listesi */
.an-card.levels { width: min(480px, 100%); display: flex; flex-direction: column; overflow: hidden; padding-bottom: 14px; }
.an-lv-total { color: #ffcc33 !important; font-family: "Fredoka", sans-serif; margin-bottom: 10px !important; }
/* Liste kendi içinde kayar (bölümler aşağı doğru iner) */
.an-lv-list {
  display: flex; flex-direction: column; gap: 16px; text-align: left;
  max-height: min(62vh, 560px); overflow-y: auto; overscroll-behavior: contain;
  margin: 0 -10px; padding: 2px 10px 8px;
  scrollbar-width: thin; scrollbar-color: var(--violet) transparent;
  /* Akıcı kaydırma: liste kendi katmanında, bölümler ayrı ayrı çizilir */
  will-change: transform; transform: translateZ(0);
  -webkit-overflow-scrolling: touch;
}
.an-lv-list::-webkit-scrollbar { width: 8px; }
.an-lv-list::-webkit-scrollbar-track { background: rgba(139, 92, 246, 0.08); border-radius: 99px; }
.an-lv-list::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #a67bfb, #7c3aed); border-radius: 99px; }
.an-lv-list::-webkit-scrollbar-thumb:hover { background: #a67bfb; }
.an-lv-ch { contain: layout paint; }
.an-lv-ch h4 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-family: "Fredoka", sans-serif; font-size: 15.5px; color: var(--ink); }
.an-lv-ch h4 small { font-size: 12px; color: var(--ink-faint); font-weight: 500; }
.an-lv-ch h4 em { margin-left: auto; font-style: normal; font-size: 13px; color: var(--ink-dim); }
.an-lv-ch h4 em.full { color: #ffcc33; }
.an-lv-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.an-lv {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px 7px; border-radius: 13px;
  border: 1.5px solid var(--line); background: var(--bg-soft-2); color: var(--ink);
  font-family: "Fredoka", sans-serif; cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.an-lv b { font-size: 18px; line-height: 1; }
.an-lv:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--violet); }
/* Yıldızlar: dolu = parlak altın, boş = sönük */
.an-lv-st { display: flex; gap: 1px; }
.an-lv-st i { font-style: normal; font-size: 14px; line-height: 1; color: rgba(255, 255, 255, 0.16); }
.an-lv-st i.on { color: #ffcc33; }
/* 3 yıldız: altın çerçeve; 1-2 yıldız: normal; 0: soluk */
.an-lv.s3 { border-color: rgba(255, 204, 51, 0.75); background: linear-gradient(180deg, rgba(255, 204, 51, 0.18), rgba(255, 204, 51, 0.05)); }
.an-lv.s3 b { color: #ffe08a; }
.an-lv.s1, .an-lv.s2 { border-color: rgba(166, 123, 251, 0.45); }
.an-lv.cur { border-color: var(--violet); background: rgba(139, 92, 246, 0.3); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25); }
.an-lv.lock { opacity: 0.38; cursor: default; padding: 12px 2px; }
.an-lv.lock b { font-size: 15px; }

.an-share-preview { text-align: left; white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; color: var(--ink); margin: 6px 0 14px; }
.an-share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.an-share-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-family: "Fredoka", sans-serif; font-size: 13px; text-decoration: none; cursor: pointer; }
.an-share-btn .ic { font-size: 20px; height: 24px; display: inline-flex; align-items: center; }
.an-share-btn svg { width: 22px; height: 22px; }
.an-share-btn:hover { border-color: var(--violet); }

/* Seçilme olmasın */
.page:has(#an) main, #an, #an *, .an-modal, .an-modal * { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
.an-share-preview { -webkit-user-select: text; user-select: text; }

@media (max-width: 640px) {
  .an-page { padding-top: 10px; }
  .an-head { grid-template-columns: 64px 1fr 64px; }
  .an-titles h1 { font-size: 22px; }
  .an-titles p { display: none; }
  #an { --ts: min(58px, calc((100vw - 32px - (var(--n) - 1) * 6px) / var(--n))); }
  #an-slots, #an-pool { gap: 6px; }
  #an-wolf { width: 74px; height: 74px; }
  .an-stage { min-height: 76px; margin-top: 10px; }
  #an-say { font-size: 15px; }
  .an-tool { padding: 8px 13px; font-size: 14px; }
  body:has(#an) .egg-moon { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .an-tile.deal, .an-slot.in, #an-slots.win .an-slot, .an-next, #an-dots i.cur, .an-ch-wolf { animation: none; }
}

/* Pencerelerin kaydırma çubuğu da site renginde */
.an-card { scrollbar-width: thin; scrollbar-color: var(--violet) transparent; }
.an-card::-webkit-scrollbar { width: 8px; }
.an-card::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #a67bfb, #7c3aed); border-radius: 99px; }
/* Seviye listesi açıkken arka plan bulanıklığı kapalı: kaydırma takılmasın */
.an-modal:has(.levels) { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(6, 4, 14, 0.84); }
