:root {
  --bg: #0b0820;
  --bg2: #150f33;
  --panel: rgba(28, 20, 62, .72);
  --gold: #e6c36a;
  --gold-soft: #f3dea0;
  --violet: #8b5cf6;
  --violet-deep: #4c2a9a;
  --text: #ece8ff;
  --muted: #a49cc8;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 80% -10%, #2a1a63 0%, transparent 60%),
              radial-gradient(900px 600px at -10% 110%, #3a1450 0%, transparent 55%), var(--bg);
  overflow: hidden;
}
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

.app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100dvh; max-width: 820px; margin: 0 auto;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
}

/* Üst bar */
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 4px 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 42px; height: 42px; display: grid; place-items: center; font-size: 24px; color: var(--gold);
  border: 1px solid var(--gold); border-radius: 50%;
  box-shadow: 0 0 18px rgba(230, 195, 106, .35), inset 0 0 12px rgba(139, 92, 246, .35);
}
h1 { font: 700 1.25rem 'Cinzel', serif; letter-spacing: .08em; margin: 0; color: var(--gold-soft); }
.brand p { margin: 0; font-size: .72rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.actions { display: flex; gap: 6px; }

button { font: inherit; cursor: pointer; }
.ghost {
  background: rgba(139, 92, 246, .12); color: var(--text); border: 1px solid rgba(139, 92, 246, .45);
  padding: 8px 12px; border-radius: 999px; font-size: .82rem; transition: .2s;
}
.ghost:hover { background: rgba(139, 92, 246, .28); }
.gold {
  background: linear-gradient(135deg, var(--gold), #b8892d); color: #1a1030; border: 0;
  padding: 10px 18px; border-radius: 999px; font-weight: 600;
}

/* Sohbet */
.chat {
  flex: 1; overflow-y: auto; padding: 10px 2px 14px; display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.msg {
  max-width: 86%; padding: 12px 15px; border-radius: var(--radius); line-height: 1.55; font-size: .96rem;
  white-space: pre-wrap; word-wrap: break-word; animation: rise .35s ease both;
}
.msg.bot {
  align-self: flex-start; background: var(--panel); border: 1px solid rgba(230, 195, 106, .28);
  border-top-left-radius: 4px; backdrop-filter: blur(8px);
}
.msg.user {
  align-self: flex-end; background: linear-gradient(135deg, var(--violet-deep), var(--violet));
  border-top-right-radius: 4px; box-shadow: 0 4px 18px rgba(139, 92, 246, .3);
}
.msg.err { border-color: #e0707a; color: #ffc9ce; }
.msg strong { color: var(--gold-soft); }
.msg ul { margin: 6px 0; padding-left: 20px; white-space: normal; }
.msg p { margin: 0 0 8px; white-space: pre-wrap; } .msg p:last-child { margin: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.typing span {
  display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%;
  background: var(--gold); animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* Alt alan */
.composer { padding-bottom: 8px; }
.starters { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.starters::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; background: rgba(230, 195, 106, .08); color: var(--gold-soft);
  border: 1px solid rgba(230, 195, 106, .45); padding: 8px 14px; border-radius: 999px; font-size: .82rem; transition: .2s;
}
.chip:hover { background: rgba(230, 195, 106, .2); transform: translateY(-1px); }

#form {
  display: flex; align-items: flex-end; gap: 8px; background: var(--panel);
  border: 1px solid rgba(139, 92, 246, .5); border-radius: 26px; padding: 6px 6px 6px 16px;
  backdrop-filter: blur(8px);
}
#form:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230, 195, 106, .15); }
textarea {
  flex: 1; resize: none; background: transparent; border: 0; outline: 0; color: var(--text);
  font: inherit; font-size: 1rem; max-height: 120px; padding: 9px 0; line-height: 1.4;
}
textarea::placeholder { color: var(--muted); }
#send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; font-size: 1.1rem; color: #1a1030;
  background: linear-gradient(135deg, var(--gold), #b8892d); transition: .2s;
}
#send:disabled { opacity: .45; cursor: not-allowed; }
.note { margin: 8px 0 0; text-align: center; font-size: .68rem; color: var(--muted); }

/* Doğum bilgisi penceresi */
dialog {
  border: 1px solid var(--gold); border-radius: 22px; background: var(--bg2); color: var(--text);
  width: min(92vw, 420px); padding: 22px; box-shadow: 0 0 60px rgba(139, 92, 246, .45);
}
dialog::backdrop { background: rgba(5, 3, 18, .75); backdrop-filter: blur(4px); }
dialog h2 { font: 700 1.2rem 'Cinzel', serif; color: var(--gold-soft); margin: 0 0 4px; }
.hint { margin: 0 0 14px; font-size: .82rem; color: var(--muted); }
dialog label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 12px; }
dialog small { opacity: .7; }
dialog input {
  display: block; width: 100%; margin-top: 5px; padding: 11px 12px; font: inherit; font-size: 1rem;
  color: var(--text); background: rgba(255, 255, 255, .06); border: 1px solid rgba(139, 92, 246, .5);
  border-radius: 12px; color-scheme: dark;
}
dialog input:focus { outline: 0; border-color: var(--gold); }
.row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

@media (max-width: 520px) {
  .ghost#btnProfile { padding: 8px 10px; font-size: .76rem; }
  .brand p { display: none; }
  .msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; scroll-behavior: auto !important; } }
