:root {
  --gece: #03061a;
  --derin: #06104a;
  --havuz: #1733d8;
  --cizgi: #3d5cff;
  --gozyasi: #8fdcff;
  --kopuk: #eaf7ff;
  --kagit: #efe4cf;
  --kagit-koyu: #e2d3b6;
  --murekkep: #19203f;
  --damga: #c61c27;
  --kor: #ff7a1a;
  --balon-sen: #3a8cf6;
  --balon-o: #1d1552;
  --serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nabiz: 0;
  --ust: env(safe-area-inset-top, 0px);
  --alt: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--gece);
  color: var(--kopuk);
  font-family: var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; font: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#arka { z-index: 0; }
#on { z-index: 30; pointer-events: none; }
#ust { z-index: 34; }

.katman {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--ust) + 20px) 22px calc(var(--alt) + 20px);
  pointer-events: none;
}
.katman > * { pointer-events: auto; }
[hidden] { display: none !important; }

/* ---------- yükleniyor ---------- */
#yukleniyor { z-index: 50; font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: #8aa0ff; opacity: .7; }

/* ---------- KAPI: mühürlü dosya ---------- */
#kapi { z-index: 20; }
.dosya {
  position: relative;
  width: min(100%, 360px);
  padding: 26px 22px 58px;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(255,255,255,.35), transparent 60%),
    repeating-linear-gradient(0deg, rgba(120,90,40,.035) 0 2px, transparent 2px 5px),
    linear-gradient(170deg, var(--kagit), var(--kagit-koyu));
  color: var(--murekkep);
  border-radius: 6px 6px 10px 10px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.8), 0 0 0 1px rgba(0,0,0,.08) inset;
  transform: rotate(-1.2deg);
  animation: dosya-gel 1.1s cubic-bezier(.2,.9,.2,1) both;
}
.dosya::before { /* sekme */
  content: ''; position: absolute; left: 18px; top: -14px; width: 120px; height: 18px;
  background: var(--kagit); border-radius: 6px 6px 0 0;
  box-shadow: 0 -1px 0 rgba(0,0,0,.05) inset;
}
@keyframes dosya-gel { from { transform: translateY(40px) rotate(4deg) scale(.96); opacity: 0; } }
.dosya .ust { display: flex; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; opacity: .75; }
.dosya .ust span { white-space: nowrap; }
.damga {
  position: absolute; right: 14px; top: 58px;
  font-family: var(--mono); font-weight: 600; font-size: 22px; letter-spacing: .18em;
  color: var(--damga); border: 3px solid var(--damga); padding: 2px 10px; border-radius: 4px;
  transform: rotate(-11deg); opacity: .85; mix-blend-mode: multiply;
  animation: damga-vur .5s .9s cubic-bezier(.3,1.6,.5,1) both;
}
@keyframes damga-vur { from { transform: rotate(-11deg) scale(2.4); opacity: 0; } }
.dosya h1 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(27px, 8.4vw, 34px); line-height: 1.04; margin: 44px 0 10px; letter-spacing: -.01em; text-wrap: balance; }
.dosya .ses { font-family: var(--mono); font-size: 12px; line-height: 1.5; opacity: .8; }
.dosya .soru { margin-top: 22px; font-family: var(--mono); font-size: 13px; line-height: 1.5; font-weight: 600; }
.dosya form { margin-top: 12px; display: flex; gap: 8px; align-items: flex-end; }
.dosya input {
  flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 2px solid var(--murekkep);
  font-family: var(--mono); font-size: 18px; padding: 6px 2px; color: var(--murekkep); outline: none; border-radius: 0;
}
.dosya input::placeholder { color: rgba(25,32,63,.35); }
.dosya .dugme {
  background: var(--murekkep); color: var(--kagit); font-family: var(--mono); font-weight: 600; font-size: 12px;
  letter-spacing: .12em; padding: 11px 12px; border-radius: 4px; white-space: nowrap;
}
.dosya .dugme:active { transform: translateY(1px); }
.dosya .tepki { min-height: 22px; margin-top: 12px; font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.15; color: #1d3fb8; }
.dosya .ipucu { margin-top: 6px; font-family: var(--mono); font-size: 12px; line-height: 1.45; color: #6a4b12; }
.dosya .ipucu b { color: var(--damga); }
.dosya.salla { animation: salla .45s; }
@keyframes salla { 20%,60% { transform: translateX(-9px) rotate(-1.2deg); } 40%,80% { transform: translateX(9px) rotate(-1.2deg); } }
.dosya .acik-bilgi { margin-top: 20px; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.dosya .acik-bilgi .sayac { font-size: 26px; font-weight: 600; letter-spacing: .04em; display: block; margin: 4px 0 14px; }
.dosya .buyuk-dugme { width: 100%; padding: 15px; font-size: 14px; }

/* gözyaşı mührü */
.muhur {
  position: absolute; left: 50%; bottom: -34px; width: 78px; height: 92px; margin-left: -39px;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.45));
  transition: transform .2s;
}
.muhur .catlak { opacity: 0; transition: opacity .15s; }
.muhur.catla .catlak { opacity: 1; }
.muhur.catla { animation: titre .12s infinite; }
@keyframes titre { 50% { transform: translate(1px,-1px) rotate(1deg); } }

.dosya.parcala { animation: none; }
.yarim { position: fixed; z-index: 21; pointer-events: none; will-change: transform; }

/* ---------- HUD: gözyaşı metresi ---------- */
#hud {
  position: fixed; z-index: 40; top: calc(var(--ust) + 12px); right: 12px;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-align: right;
  color: #bcd0ff; pointer-events: none;
  transition: opacity .6s, transform .6s;
}
#hud .etiket { line-height: 1.35; }
#hud .etiket b { display: block; color: var(--kopuk); font-weight: 600; font-size: 11px; }
#hud svg { width: 22px; height: 54px; overflow: visible; }
#hud.titrek { animation: titre .1s 6; }
#hud.gizli { opacity: 0; transform: translateY(-10px); }

/* ---------- sahne metinleri ---------- */
#sahne { z-index: 10; }
.satir {
  position: absolute; left: 22px; right: 22px; text-align: center;
  opacity: 0; will-change: opacity, transform, filter;
}
.satir.daktilo { font-family: var(--mono); font-size: clamp(17px, 5vw, 21px); line-height: 1.45; font-weight: 600; letter-spacing: -.01em; text-shadow: 0 0 18px rgba(120,170,255,.45); }
.satir.daktilo::after { content: '▍'; margin-left: 2px; animation: imlec .9s steps(1) infinite; color: var(--gozyasi); }
.satir.daktilo.bitti::after { opacity: 0; }
@keyframes imlec { 50% { opacity: 0; } }
.satir.serif { font-family: var(--serif); font-style: italic; font-size: clamp(34px, 10.5vw, 48px); line-height: 1.04; letter-spacing: -.01em; text-shadow: 0 0 30px rgba(140,200,255,.55), 0 2px 0 rgba(0,0,0,.25); }
.satir.baslik { font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: .32em; color: var(--gozyasi); }
.satir.karanlik { font-family: var(--serif); font-style: italic; font-size: clamp(28px, 8.4vw, 38px); line-height: 1.12; color: #f4f1ff; }
.satir.gir { animation: gir .9s cubic-bezier(.2,.8,.2,1) forwards; }
.satir.cik { animation: cik .45s ease-in forwards; }
@keyframes gir { from { opacity: 0; transform: translateY(18px) scale(.98); filter: blur(10px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes cik { from { opacity: 1; } to { opacity: 0; transform: translateY(-14px); filter: blur(8px); } }
.satir .kelime { display: inline-block; opacity: 0; animation: kelime .7s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes kelime { from { opacity: 0; transform: translateY(.35em); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }

/* lovebomb yağmuru */
.bomba {
  position: absolute; left: 50%; max-width: 92vw; text-align: center; white-space: normal;
  font-family: var(--serif); font-style: italic; line-height: 1.02; color: #fff;
  text-shadow: 0 0 24px rgba(160,210,255,.7);
  transform: translate(-50%, 0); opacity: 0; will-change: transform, opacity;
  animation: bomba-gir .5s cubic-bezier(.2,1.5,.4,1) forwards;
}
.bomba.sans { font-family: var(--sans); font-style: normal; font-weight: 800; letter-spacing: -.02em; }
.bomba.son { font-size: clamp(40px, 13vw, 60px) !important; color: #fff; text-shadow: 0 0 40px #9fd8ff, 0 0 80px #3d6bff; }
@keyframes bomba-gir { from { opacity: 0; transform: translate(-50%, 12px) scale(.6) rotate(var(--r, 0deg)); } to { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(var(--r, 0deg)); } }
.bomba.eski { transition: opacity 1.2s; opacity: .2 !important; animation: none; transform: translate(-50%, 0) rotate(var(--r, 0deg)); }

/* glitch */
.glitch { font-family: var(--mono); font-weight: 600; font-size: clamp(18px, 5.6vw, 24px); line-height: 1.35; color: #fff; text-transform: uppercase; letter-spacing: .02em;
  text-shadow: 2px 0 #ff2a55, -2px 0 #28e7ff; }
.glitch.alt { font-size: 13px; text-transform: none; color: #ff8fa6; letter-spacing: .06em; }
body.titre #sahne { animation: sars .09s infinite; }
@keyframes sars { 0% { transform: translate(0,0); } 25% { transform: translate(-6px,2px) skewX(4deg); } 50% { transform: translate(5px,-3px); } 75% { transform: translate(-3px,4px) skewX(-6deg); } }
#flas { position: fixed; inset: 0; z-index: 35; background: #fff; opacity: 0; pointer-events: none; }
body.titre #flas { mix-blend-mode: difference; }

/* geri sayım */
.sayim { font-family: var(--mono); font-weight: 600; font-size: 38vw; line-height: 1; color: #fff; text-shadow: 0 0 40px var(--kor); }
.imha-yazi { font-family: var(--mono); font-weight: 600; font-size: clamp(18px, 5.4vw, 23px); line-height: 1.4; text-transform: uppercase; letter-spacing: .04em; color: #ffd9c2; }

/* ---------- SORGU: DM görünümü ---------- */
#sorgu { z-index: 15; justify-content: flex-start; padding-top: calc(var(--ust) + 90px); }
.sorgu-kart { width: min(100%, 420px); display: flex; flex-direction: column; gap: 14px; }
.sorgu-ust { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; color: #a9bcff; }
.sure { height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.sure i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gozyasi), #fff); transform-origin: left; }
.sure.acil i { background: #ff4d6d; animation: yanip .35s infinite alternate; }
@keyframes yanip { to { opacity: .35; } }
.sorgu-soru { font-family: var(--sans); font-weight: 800; font-size: clamp(22px, 6.6vw, 28px); line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; animation: gir .7s cubic-bezier(.2,.8,.2,1) both; }
.sohbet { display: flex; flex-direction: column; gap: 8px; min-height: 92px; }
.balon { max-width: 82%; padding: 10px 15px; border-radius: 22px; font-size: 16px; line-height: 1.3; animation: balon .35s cubic-bezier(.2,1.4,.4,1) both; }
.balon.sen { align-self: flex-end; background: var(--balon-sen); color: #fff; }
.balon.o { align-self: flex-start; background: var(--balon-o); color: #f1eeff; display: flex; gap: 8px; align-items: flex-end; border-bottom-left-radius: 6px; }
.balon.o .avatar { flex: none; width: 26px; height: 26px; margin: -2px 0 -4px -8px; border-radius: 50%; background: #2b2466; display: grid; place-items: center; font-size: 15px; }
.balon .yaziyor { display: inline-flex; gap: 4px; padding: 4px 0; }
.balon .yaziyor i { width: 7px; height: 7px; border-radius: 50%; background: #b9b2ff; animation: nokta 1s infinite; }
.balon .yaziyor i:nth-child(2) { animation-delay: .15s; } .balon .yaziyor i:nth-child(3) { animation-delay: .3s; }
@keyframes nokta { 0%,60%,100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes balon { from { opacity: 0; transform: translateY(10px) scale(.9); } }
.secenekler { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 9px; min-height: 180px; }
.secenek {
  position: relative; max-width: 88%; padding: 12px 17px; border-radius: 22px; font-size: 16px; line-height: 1.25; font-weight: 600;
  background: rgba(58,140,246,.16); color: #dfeaff; border: 1.5px solid rgba(120,175,255,.55);
  text-align: right; transition: transform .25s cubic-bezier(.2,1.4,.4,1), background .2s, opacity .3s;
  animation: balon .4s cubic-bezier(.2,1.4,.4,1) both;
}
.secenek:active { transform: scale(.96); }
.secenek.secildi { background: var(--balon-sen); color: #fff; border-color: transparent; }
.secenek.soluk { opacity: .18; pointer-events: none; }
.secenek.kacak { position: absolute; transition: left .22s cubic-bezier(.2,1.2,.4,1), top .22s cubic-bezier(.2,1.2,.4,1); }
.secenek.karis { color: transparent; text-shadow: 0 0 9px #fff; }
.kaydirac { width: 100%; padding: 10px 2px 0; }
.kaydirac .ray { position: relative; height: 44px; border-radius: 22px; background: rgba(58,140,246,.16); border: 1.5px solid rgba(120,175,255,.55); touch-action: none; }
.kaydirac .dolgu { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 22px; background: linear-gradient(90deg, #2c6fe0, var(--balon-sen)); }
.kaydirac .tutamac { position: absolute; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.4); display: grid; place-items: center; font-size: 18px; }
.kaydirac .uclar { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: #a9bcff; }
.kaydirac .deger { text-align: center; margin-top: 6px; font-family: var(--mono); font-weight: 600; font-size: 20px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 45; left: 12px; right: 12px; top: calc(var(--ust) + 10px);
  margin: 0 auto; max-width: 400px; display: flex; gap: 10px; align-items: center;
  padding: 11px 14px; border-radius: 18px; background: rgba(30,30,40,.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  color: #fff; font-size: 14px; line-height: 1.3; box-shadow: 0 12px 30px rgba(0,0,0,.45);
  transform: translateY(-140%); transition: transform .5s cubic-bezier(.2,1.2,.4,1);
}
#toast.acik { transform: none; }
#toast .ikon { flex: none; width: 34px; height: 34px; border-radius: 9px; background: #1733d8; display: grid; place-items: center; font-size: 18px; }
#toast b { display: block; font-size: 12px; opacity: .7; font-weight: 600; }

/* ---------- duraklatıldı / başlat ---------- */
#perde { z-index: 60; background: rgba(3,6,26,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: auto; gap: 14px; text-align: center; }
#perde .oynat { width: 92px; height: 92px; border-radius: 50%; background: #fff; color: var(--gece); display: grid; place-items: center; font-size: 34px; padding-left: 6px; box-shadow: 0 0 0 10px rgba(255,255,255,.12), 0 0 60px rgba(120,180,255,.6); animation: nabiz 1.6s infinite; }
@keyframes nabiz { 50% { box-shadow: 0 0 0 18px rgba(255,255,255,.06), 0 0 80px rgba(120,180,255,.8); } }
#perde p { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: #c9d6ff; }

/* ---------- SON ---------- */
#son { z-index: 25; text-align: center; gap: 18px; }
#son h2 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(34px, 10vw, 46px); line-height: 1.05; }
#son .etiket { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: #ffbe98; }
#son .sayac { font-family: var(--mono); font-weight: 600; font-size: clamp(38px, 12vw, 54px); letter-spacing: .02em; color: #fff; text-shadow: 0 0 30px rgba(255,122,26,.6); margin-top: -8px; }
#son .soru { font-family: var(--mono); font-size: 13px; color: #cfd9ff; margin-top: 6px; }
.tepkiler { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; width: min(100%, 360px); }
.tepkiler button { padding: 12px 8px; border-radius: 16px; background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.14); font-size: 14px; font-weight: 600; line-height: 1.2; transition: transform .2s, background .2s; }
.tepkiler button .e { display: block; font-size: 26px; margin-bottom: 3px; }
.tepkiler button.secili { background: var(--balon-sen); border-color: transparent; transform: scale(1.04); }
.not-alani { display: flex; gap: 8px; width: min(100%, 360px); }
.not-alani input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 22px; border: 1.5px solid rgba(255,255,255,.18); background: rgba(0,0,0,.25); color: #fff; font-size: 16px; outline: none; }
.not-alani button { padding: 0 16px; border-radius: 22px; background: var(--balon-sen); font-weight: 700; font-size: 14px; }
.not-alani button:disabled { opacity: .4; }
#son .bilgi { min-height: 18px; font-size: 13px; color: #9fe0b8; }
#son .tekrar { margin-top: 4px; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; color: #b7c6ff; padding: 10px 14px; border: 1px solid rgba(183,198,255,.35); border-radius: 30px; }

/* ---------- KÜL ---------- */
#kul { z-index: 25; text-align: center; gap: 14px; }
#kul h2 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(36px, 11vw, 50px); line-height: 1.05; color: #d8d2cc; }
#kul p { font-family: var(--mono); font-size: 13px; line-height: 1.6; color: #9b928a; max-width: 320px; }

/* ---------- test çubuğu ---------- */
#test-cubugu {
  position: fixed; z-index: 70; left: 8px; right: 8px; bottom: calc(var(--alt) + 8px);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border-radius: 12px;
  background: rgba(0,0,0,.72); font-family: var(--mono); font-size: 11px; color: #9ff;
}
#test-cubugu input[type=range] { flex: 1 1 100%; }
#test-cubugu button { padding: 4px 7px; border: 1px solid #466; border-radius: 6px; font-size: 11px; color: #cff; }

@media (prefers-reduced-motion: reduce) {
  .satir.gir, .bomba { animation-duration: .01s; }
}
