:root {
  --zemin: #f4f1ea;
  --yuzey: #fffdf8;
  --murekkep: #1d1b16;
  --ikincil: #5a554a;
  --cizgi: #d8d2c3;
  --vurgu: #1f5a48;
  --vurgu-koyu: #174537;
  --vurgu-ustu: #fdfbf5;
  --balon: #dfe9dc;
  --balon-yazi: #16261f;
  --kod-zemin: #ebe6da;
  --hata: #a3321f;
  --hata-zemin: #f6e3dc;
  --golge: 0 1px 2px rgb(40 34 20 / 0.06), 0 6px 20px rgb(40 34 20 / 0.07);
  --yazi: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tek: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --gecis: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --zemin: #16181b;
    --yuzey: #1f2226;
    --murekkep: #eceae4;
    --ikincil: #a9a69c;
    --cizgi: #33373c;
    --vurgu: #86c9ae;
    --vurgu-koyu: #a2d8c1;
    --vurgu-ustu: #0e1a15;
    --balon: #24362e;
    --balon-yazi: #e6efe9;
    --kod-zemin: #272b30;
    --hata: #f0a08e;
    --hata-zemin: #3a231e;
    --golge: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--zemin);
  color: var(--murekkep);
  font: 400 1.125rem/1.55 var(--yazi);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  caret-color: var(--vurgu);
  accent-color: var(--vurgu);
}
::selection { background: var(--vurgu); color: var(--vurgu-ustu); }
[hidden] { display: none !important; }
.gizli { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--vurgu); outline-offset: 2px; }
button, input, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--vurgu); text-underline-offset: 0.18em; }

/* ---------- ortak denetimler ---------- */
.dugme {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.25rem; padding: 0 1.5rem;
  border: 0; border-radius: 0.875rem;
  background: var(--vurgu); color: var(--vurgu-ustu);
  font-weight: 650; cursor: pointer;
  transition: background var(--gecis), transform var(--gecis), opacity var(--gecis);
}
.dugme:hover { background: var(--vurgu-koyu); }
.dugme:active { transform: scale(0.98); }
.dugme:disabled { opacity: 0.55; cursor: default; }
.bag {
  border: 0; background: none; padding: 0.625rem 0.25rem; margin: -0.625rem 0;
  color: var(--vurgu); font-size: 1rem; font-weight: 600;
  text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px;
  cursor: pointer; white-space: nowrap;
}
.bag:hover { text-decoration-thickness: 2px; }
.bag:disabled { opacity: 0.5; cursor: default; }
.hata { color: var(--hata); margin: 0; font-size: 1rem; }

/* ---------- giriş ---------- */
.giris {
  min-height: 100dvh;
  max-width: 27rem; margin: 0 auto;
  padding: max(14vh, calc(env(safe-area-inset-top) + 3rem)) max(1.5rem, env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 2rem) max(1.5rem, env(safe-area-inset-left));
}
.giris-ikon { display: block; border-radius: 0.875rem; margin-bottom: 1.75rem; }
.giris h1 { margin: 0 0 0.625rem; font-size: 1.875rem; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.giris-aciklama { margin: 0 0 2rem; color: var(--ikincil); }
.giris form { display: grid; gap: 0.625rem; }
.giris label { font-size: 1rem; font-weight: 600; }
.giris input {
  width: 100%; min-height: 3.5rem; padding: 0 1rem;
  border: 1.5px solid var(--cizgi); border-radius: 0.875rem;
  background: var(--yuzey);
  font: 600 1.375rem/1 var(--tek); letter-spacing: 0.16em; text-transform: uppercase;
  transition: border-color var(--gecis);
}
.giris input::placeholder { color: var(--ikincil); opacity: 0.55; font-weight: 400; letter-spacing: 0.08em; }
.giris input:focus { outline: none; border-color: var(--vurgu); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vurgu) 22%, transparent); }
.giris .dugme { margin-top: 0.625rem; width: 100%; }
.giris-not { margin: 1.5rem 0 0; color: var(--ikincil); font-size: 1rem; }

/* ---------- sohbet ---------- */
.sohbet {
  position: fixed; inset: 0 0 auto 0;
  height: var(--boy, 100dvh);
  display: flex; flex-direction: column;
}
.ust {
  flex: none; display: flex; align-items: center; gap: 0.75rem;
  padding: calc(env(safe-area-inset-top) + 0.75rem) max(1.125rem, env(safe-area-inset-right)) 0.75rem max(1.125rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--cizgi);
  background: var(--zemin);
}
.ust-ad { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.01em; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rozet { font-size: 0.8125rem; font-weight: 600; padding: 0.125rem 0.5rem; border: 1px solid var(--cizgi); border-radius: 99px; color: var(--ikincil); white-space: nowrap; }

.akis { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; outline: none; scrollbar-width: thin; scrollbar-color: var(--cizgi) transparent; }
.mesajlar {
  max-width: 42rem; margin: 0 auto;
  padding: 1.5rem max(1.125rem, env(safe-area-inset-right)) 1.25rem max(1.125rem, env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 1.375rem;
}
.mesaj { overflow-wrap: anywhere; }
.mesaj > :first-child { margin-top: 0; }
.mesaj > :last-child { margin-bottom: 0; }
.mesaj p { margin: 0 0 0.75em; }
.mesaj ul, .mesaj ol { margin: 0 0 0.75em; padding-left: 1.4em; }
.mesaj li { margin: 0.3em 0; padding-left: 0.15em; }
.mesaj li::marker { color: var(--vurgu); font-weight: 600; }
.mesaj strong { font-weight: 700; }
.mesaj code { font: 0.92em var(--tek); background: var(--kod-zemin); padding: 0.1em 0.35em; border-radius: 0.35em; }
.mesaj pre {
  margin: 0 0 0.75em; padding: 0.875rem 1rem; white-space: pre-wrap;
  font: 1rem/1.5 var(--tek); background: var(--kod-zemin); border-radius: 0.75rem;
  user-select: all; -webkit-user-select: all;
}
.mesaj.kullanici {
  align-self: flex-end; max-width: 86%;
  background: var(--balon); color: var(--balon-yazi);
  padding: 0.75rem 1rem; border-radius: 1.25rem 1.25rem 0.375rem 1.25rem;
  white-space: pre-wrap;
}
.mesaj.asistan { align-self: stretch; max-width: 100%; }
.mesaj.sistem {
  align-self: stretch; padding: 0.875rem 1rem; border-radius: 0.875rem;
  background: var(--hata-zemin); color: var(--hata); font-size: 1.0625rem;
}
.iletildi {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem;
  padding: 0.375rem 0.75rem 0.375rem 0.625rem;
  border: 1px solid color-mix(in srgb, var(--vurgu) 40%, transparent); border-radius: 99px;
  color: var(--vurgu); font-size: 0.9375rem; font-weight: 600;
}
.iletildi svg { flex: none; }

.kopyala {
  display: inline-flex; align-items: center; min-height: 2.75rem; margin: -0.25em 0 0.75em; padding: 0.375rem 0.875rem;
  border: 1.5px solid var(--cizgi); border-radius: 99px; background: var(--yuzey); color: var(--vurgu);
  font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  transition: border-color var(--gecis), transform var(--gecis);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kopyala:hover { border-color: var(--vurgu); }
.kopyala:active { transform: scale(0.97); }

.oneriler { max-width: 42rem; margin: 0 auto 0.5rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.375rem; }
.oneriler[hidden] { display: none; }
.oneri {
  min-height: 2.75rem; padding: 0.5rem 1rem; text-align: left;
  border: 1.5px solid var(--cizgi); border-radius: 1.25rem; background: var(--yuzey); color: inherit;
  font: inherit; font-size: 1rem; cursor: pointer;
  transition: border-color var(--gecis), transform var(--gecis);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.oneri:hover { border-color: var(--vurgu); }
.oneri:active { transform: scale(0.98); }

.yaziyor { display: inline-flex; gap: 0.375rem; padding: 0.5rem 0; }
.yaziyor i { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--ikincil); animation: nabiz 1.2s infinite ease-in-out; }
.yaziyor i:nth-child(2) { animation-delay: 0.15s; }
.yaziyor i:nth-child(3) { animation-delay: 0.3s; }
@keyframes nabiz { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.bos { margin: auto 0; padding: 12vh 0 0; }
.bos h2 { margin: 0 0 0.5rem; font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; }
.bos p { margin: 0 0 1.5rem; color: var(--ikincil); max-width: 30ch; }

.yaz {
  flex: none;
  padding: 0.625rem max(0.875rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.875rem, env(safe-area-inset-left));
  background: var(--zemin);
}
.yaz-kutu {
  max-width: 42rem; margin: 0 auto;
  display: flex; align-items: flex-end; gap: 0.5rem;
  padding: 0.375rem 0.375rem 0.375rem 1.125rem;
  background: var(--yuzey); border: 1.5px solid var(--cizgi); border-radius: 1.625rem;
  box-shadow: var(--golge);
  transition: border-color var(--gecis);
}
.yaz-kutu:focus-within { border-color: var(--vurgu); }
.yaz textarea {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none;
  padding: 0.5625rem 0; max-height: 9.5rem; line-height: 1.45;
  font-size: 1.125rem; /* 16px altı iOS'ta sayfayı yakınlaştırır */
}
.yaz textarea::placeholder { color: var(--ikincil); opacity: 0.85; }
.gonder {
  flex: none; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--vurgu); color: var(--vurgu-ustu);
  transition: background var(--gecis), transform var(--gecis), opacity var(--gecis);
}
.gonder:hover { background: var(--vurgu-koyu); }
.gonder:active { transform: scale(0.94); }
.gonder:disabled { background: var(--cizgi); color: var(--ikincil); cursor: default; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .yaziyor i { opacity: 0.6; }
}
