:root {
  --bg: #0b0f14;
  --panel: #121821;
  --panel-2: #18202b;
  --line: #222c39;
  --text: #e6edf3;
  --muted: #8b98a8;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --user: #1d4ed8;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button { font: inherit; color: inherit; }

.app { display: flex; flex-direction: column; height: 100dvh; max-width: 820px; margin: 0 auto; }

.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; border-bottom: 1px solid var(--line);
  background: rgba(11,15,20,.92); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .3px; }
.orb { width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #bae6fd, var(--accent) 45%, #0369a1);
  box-shadow: 0 0 12px rgba(56,189,248,.6); transition: transform .3s; }
.orb.busy { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.35); box-shadow: 0 0 22px rgba(56,189,248,.9); } }
.icon-btn { background: none; border: 0; padding: 8px; border-radius: 10px; color: var(--muted); cursor: pointer; }
.icon-btn:active { background: var(--panel); }

.chat { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain; }
.empty { margin: auto; text-align: center; color: var(--muted); }
.empty-orb { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e0f2fe, var(--accent) 40%, #075985 75%);
  box-shadow: 0 0 40px rgba(56,189,248,.45); }

.msg { max-width: 86%; padding: 10px 14px; border-radius: var(--radius); word-wrap: break-word;
  overflow-wrap: anywhere; animation: rise .18s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { align-self: flex-end; background: var(--user); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line);
  border-bottom-left-radius: 6px; }
.msg.error { align-self: flex-start; background: #2a1215; border: 1px solid #5b1d22; color: #fecaca; }
.msg p { margin: 0 0 .5em; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: .2em 0 .5em; padding-left: 1.3em; }
.msg code { background: var(--panel-2); padding: 1px 5px; border-radius: 6px; font-size: .9em; }
.msg pre { background: var(--panel-2); padding: 10px; border-radius: 10px; overflow-x: auto; }
.msg pre code { background: none; padding: 0; }
.msg a { color: var(--accent); }
.msg h3, .msg h4 { margin: .3em 0; font-size: 1em; }

.tool-chip { align-self: flex-start; font-size: 13px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }

.typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); border-bottom-left-radius: 6px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); 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: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.confirm { align-self: stretch; background: var(--panel-2); border: 1px solid #854d0e; border-radius: 14px; padding: 12px; }
.confirm .title { font-size: 13px; color: #fbbf24; margin-bottom: 4px; font-weight: 600; }
.confirm .summary { margin-bottom: 10px; white-space: pre-wrap; }
.confirm .row { display: flex; gap: 8px; }
.confirm button { flex: 1; padding: 10px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 600; }
.confirm .yes { background: var(--ok); color: #052e1c; }
.confirm .no { background: var(--line); }
.confirm .result { font-size: 14px; color: var(--muted); }

.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px);
  border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea { flex: 1; resize: none; max-height: 160px; padding: 12px 14px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-size: 16px; /* iOS yakınlaştırmasın */ outline: none; }
.composer textarea:focus { border-color: var(--accent-2); }
.send { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent-2); color: #031b29; display: grid; place-items: center; }
.send:disabled { opacity: .45; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 340px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0 0 8px; font-weight: 600; }
.login-card input { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 16px; outline: none; }
.login-card input:focus { border-color: var(--accent-2); }
.login-card button { padding: 14px; border-radius: 14px; border: 0; background: var(--accent-2); color: #031b29;
  font-weight: 600; cursor: pointer; }
.login-error { color: var(--danger); margin: 0; }
