/* === TEMA DEĞİŞKENLERİ (tools/theme_css.py üretir) === */
:root {
  --t0-110-170: 0, 110, 170;
  --t0-16-24: 0, 16, 24;
  --t0-20-12: 0, 20, 12;
  --t0-20-40: 0, 20, 40;
  --t0-212-255: 0, 212, 255;
  --t109-151-173: 109, 151, 173;
  --t2-6-15: 2, 6, 15;
  --t2-8-18: 2, 8, 18;
  --t216-244-255: 216, 244, 255;
  --t230-251-255: 230, 251, 255;
  --t4-17-31: 4, 17, 31;
  --t6-20-38: 6, 20, 38;
  --t61-255-176: 61, 255, 176;
}
/* Siyah-beyaz tema: <html data-theme="mono"> */
:root[data-theme="mono"] {
  --t0-110-170: 91, 91, 91;
  --t0-16-24: 8, 8, 8;
  --t0-20-12: 9, 9, 9;
  --t0-20-40: 10, 10, 10;
  --t0-212-255: 235, 235, 235;
  --t109-151-173: 144, 144, 144;
  --t2-6-15: 4, 4, 4;
  --t2-8-18: 4, 4, 4;
  --t216-244-255: 239, 239, 239;
  --t230-251-255: 247, 247, 247;
  --t4-17-31: 9, 9, 9;
  --t6-20-38: 11, 11, 11;
  --t61-255-176: 230, 230, 230;
}
/* === TEMA SONU === *//* Asistan telefon arayüzü — tema: siyah-beyaz ya da mavi; iPhone çentik/ada güvenli alanlarına uyumlu */
:root {
  --c: rgb(var(--t0-212-255)); --c-dim: rgba(var(--t0-212-255),.55); --c-faint: rgba(var(--t0-212-255),.12); --line: rgba(var(--t0-212-255),.25);
  --bg: rgb(var(--t2-6-15)); --panel: rgba(var(--t6-20-38),.78); --text: rgb(var(--t216-244-255)); --muted: rgb(var(--t109-151-173));
  --warn: #ff9f1c; --err: #ff4545; --ok: rgb(var(--t61-255-176));
  --glow: 0 0 8px rgba(var(--t0-212-255),.65), 0 0 22px rgba(var(--t0-212-255),.22);
  --head: 'Orbitron', 'Rajdhani', -apple-system, sans-serif; --body: 'Rajdhani', -apple-system, 'Segoe UI', sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px;
  overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { background: radial-gradient(ellipse at 50% 22%, rgba(var(--t0-110-170),.28), transparent 60%), var(--bg); }
button { font-family: var(--head); cursor: pointer; border: none; }
input { font-family: var(--body); font-size: 17px; }  /* 16px+ : iOS odaklanınca yakınlaştırmasın */
.view { height: 100dvh; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
.muted { color: var(--muted); }

/* ---------- eşleştirme ---------- */
#pairView { justify-content: center; align-items: center; padding: calc(24px + var(--st)) 24px calc(24px + var(--sb)); }
.pair-box { width: 100%; max-width: 380px; text-align: center; }
.pair-orb { width: 110px; height: 110px; margin: 0 auto 14px; border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--t230-251-255)) 0 14%, var(--c) 22%, rgba(var(--t0-212-255),.15) 48%, transparent 62%);
  box-shadow: var(--glow); border: 2px solid var(--line); animation: pulse 2.4s ease-in-out infinite; }
.pair-box h1 { font-family: var(--head); letter-spacing: 8px; color: var(--c); text-shadow: var(--glow); font-size: 24px; margin: 0 0 10px; }
.pair-box p { font-size: 15px; line-height: 1.4; }
.pair-box input { display: block; width: 100%; margin: 10px 0; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(var(--t0-20-40),.8); color: var(--text); text-align: center; outline: none; }
#pairCode { font-family: var(--head); font-size: 28px; letter-spacing: 10px; }
.pair-box input:focus { border-color: var(--c); box-shadow: var(--glow); }
.primary { width: 100%; padding: 15px; border-radius: 12px; background: var(--c); color: rgb(var(--t0-16-24)); font-weight: 900;
  letter-spacing: 4px; font-size: 15px; box-shadow: var(--glow); margin-top: 6px; }
.err-text { color: var(--err); min-height: 20px; }

/* ---------- üst ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(8px + var(--st)) 16px 8px; }
.brand { font-family: var(--head); font-weight: 900; letter-spacing: 5px; color: var(--c); text-shadow: var(--glow); font-size: 16px;
  display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: pulse 1.2s infinite; }
.stop { background: rgba(255,50,50,.15); color: #ff7a7a; border: 1px solid var(--err); border-radius: 10px; padding: 8px 14px;
  font-weight: 900; letter-spacing: 3px; font-size: 12px; box-shadow: 0 0 10px rgba(255,60,60,.3); }
.stop:active { background: rgba(255,50,50,.45); color: #fff; }
.install-hint { margin: 0 12px 6px; padding: 10px 36px 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  font-size: 14px; position: relative; }
.install-hint button { position: absolute; right: 8px; top: 8px; background: none; color: var(--muted); font-size: 14px; }
.share-ico { color: var(--c); }

/* ---------- reaktör ---------- */
.stage { flex: 0 0 auto; height: 34dvh; min-height: 200px; display: flex; flex-direction: column; align-items: center; position: relative; }
#reactor { width: 100%; flex: 1; min-height: 0; }
.state { font-family: var(--head); letter-spacing: 6px; font-size: 12px; color: var(--c); text-shadow: var(--glow); }
.subtitle { min-height: 22px; max-width: 92%; text-align: center; font-size: 16px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- hızlı komutlar ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; flex-shrink: 0; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex-shrink: 0; background: var(--c-faint); color: var(--c); border: 1px solid var(--line); border-radius: 20px;
  padding: 8px 14px; font-family: var(--body); font-weight: 600; font-size: 14px; }
.chips button:active { background: rgba(var(--t0-212-255),.3); }

/* ---------- sekmeler ---------- */
.tabs { display: flex; margin: 0 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.tab { flex: 1; background: none; color: var(--muted); padding: 10px 0; font-size: 11px; letter-spacing: 2px; border-bottom: 2px solid transparent; }
.tab.active { color: var(--c); border-bottom-color: var(--c); text-shadow: var(--glow); }
.badge { background: var(--warn); color: #000; border-radius: 10px; padding: 1px 6px; font-size: 10px; margin-left: 4px; }
.panes { flex: 1; min-height: 0; position: relative; }
.pane { position: absolute; inset: 0; overflow-y: auto; padding: 10px 12px; display: none; -webkit-overflow-scrolling: touch; }
.pane.active { display: block; }
.empty { color: var(--muted); text-align: center; padding: 20px; }

/* ---------- sohbet ---------- */
.msg { max-width: 86%; margin: 6px 0; padding: 9px 12px; border-radius: 16px; line-height: 1.35; font-size: 16px; word-wrap: break-word; user-select: text; }
.msg.user { margin-left: auto; background: rgba(var(--t0-212-255),.16); border: 1px solid var(--line); border-bottom-right-radius: 4px; }
.msg.atlas { background: var(--panel); border: 1px solid rgba(var(--t0-212-255),.15); border-bottom-left-radius: 4px; }
.msg.err { border-color: var(--err); color: #ffb3b3; }
.msg.tool { max-width: 100%; background: none; border: none; padding: 2px 4px; color: var(--muted); font-size: 13px; }
.msg pre { white-space: pre-wrap; background: rgba(0,0,0,.4); padding: 6px; border-radius: 8px; font-size: 13px; }
.msg code { background: rgba(0,0,0,.35); padding: 0 4px; border-radius: 4px; }

/* ---------- görevler ---------- */
.card { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel); }
.card .title { font-weight: 700; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; margin-top: 3px; word-break: break-word; }
.card .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card .actions button { flex: 1; min-width: 90px; padding: 10px; border-radius: 10px; font-size: 11px; letter-spacing: 2px; font-weight: 700; }
.b-ok { background: rgba(var(--t61-255-176),.14); color: var(--ok); border: 1px solid var(--ok) !important; }
.b-no { background: rgba(255,69,69,.12); color: var(--err); border: 1px solid var(--err) !important; }
.b-mid { background: var(--c-faint); color: var(--c); border: 1px solid var(--line) !important; }
.st { font-family: var(--head); font-size: 9px; letter-spacing: 1px; padding: 2px 7px; border-radius: 10px; border: 1px solid; margin-left: 6px; }
.st-bekliyor { color: var(--muted); } .st-çalışıyor { color: var(--c); } .st-onay { color: var(--warn); } .st-durdu { color: var(--warn); } .st-bitti { color: var(--ok); } .st-hata { color: var(--err); }

/* ---------- sistem ---------- */
.sys-grid { display: grid; gap: 12px; margin: 6px 0 14px; }
.meter { display: grid; grid-template-columns: 44px 1fr 44px 44px; align-items: center; gap: 8px; }
.meter em { font-style: normal; text-align: right; font-family: var(--head); font-size: 12px; color: var(--text); }
.meter em.na { color: var(--muted); } .meter em.warn { color: var(--warn); } .meter em.err { color: var(--err); }
.meter label { font-family: var(--head); font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.meter b { text-align: right; font-family: var(--head); font-size: 13px; }
.bar { height: 10px; border-radius: 6px; background: rgba(var(--t0-212-255),.1); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--c); box-shadow: var(--glow); transition: width .6s ease; }
.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed rgba(var(--t0-212-255),.14); font-size: 15px; }
.kv span { color: var(--muted); } .kv b.ok { color: var(--ok); } .kv b.err { color: var(--err); } .kv b.warn { color: var(--warn); }
.ghost { width: 100%; margin-top: 18px; padding: 12px; border-radius: 12px; background: none; color: var(--err); border: 1px solid rgba(255,69,69,.4);
  font-family: var(--body); font-size: 15px; }

/* ---------- yazma / mikrofon ---------- */
.composer { display: flex; gap: 8px; align-items: center; padding: 10px 12px calc(10px + var(--sb)); border-top: 1px solid var(--line);
  background: rgba(var(--t2-8-18),.92); flex-shrink: 0; }
#text { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 22px; border: 1px solid var(--line); background: rgba(var(--t0-20-40),.85); color: var(--text); outline: none; }
#text:focus { border-color: var(--c); }
.send { width: 44px; height: 44px; border-radius: 50%; background: var(--c-faint); color: var(--c); border: 1px solid var(--line); font-size: 18px; }
.mic { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--t0-212-255),.35), rgba(var(--t0-212-255),.08));
  border: 2px solid var(--c); box-shadow: var(--glow); position: relative; display: grid; place-items: center; flex-shrink: 0; }
.mic-ico { width: 16px; height: 24px; border-radius: 8px; border: 3px solid var(--c); position: relative; }
.mic-ico::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 2px; height: 6px; background: var(--c); transform: translateX(-50%); }
.mic.rec { background: radial-gradient(circle, rgba(255,69,69,.55), rgba(255,69,69,.12)); border-color: var(--err);
  box-shadow: 0 0 calc(10px + var(--lvl, 0) * 30px) rgba(255,69,69,.8); }
.mic.rec .mic-ico { border-color: #fff; } .mic.rec .mic-ico::after { background: #fff; }
.mic.busy { opacity: .6; }
.rec-time { position: absolute; bottom: -2px; font-family: var(--head); font-size: 9px; color: #fff; }

/* ---------- onay sayfası ---------- */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; z-index: 30; animation: fade .2s; }
.sheet[hidden] { display: none; }
.sheet-box { width: 100%; background: rgb(var(--t4-17-31)); border-top: 2px solid var(--warn); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--sb));
  box-shadow: 0 -10px 40px rgba(255,159,28,.25); animation: up .25s ease; }
.sheet-title { font-family: var(--head); color: var(--warn); letter-spacing: 3px; font-size: 13px; margin-bottom: 10px; }
.sheet-summary { font-size: 18px; font-weight: 600; line-height: 1.35; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: rgba(0,0,0,.45); border-radius: 8px; padding: 8px;
  margin-top: 10px; white-space: pre-wrap; word-break: break-all; max-height: 120px; overflow: auto; }
.code:empty { display: none; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions button { flex: 1; padding: 16px; border-radius: 14px; font-weight: 900; letter-spacing: 3px; font-size: 14px; }
.yes { background: var(--ok); color: rgb(var(--t0-20-12)); } .no { background: rgba(255,69,69,.15); color: var(--err); border: 1px solid var(--err) !important; }
.count { text-align: center; color: var(--warn); font-family: var(--head); font-size: 12px; margin-top: 10px; }

/* ---------- bildirim ---------- */
#toasts { position: fixed; top: calc(56px + var(--st)); left: 12px; right: 12px; z-index: 40; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.toast { background: rgba(var(--t4-17-31),.97); border: 1px solid var(--c); border-radius: 12px; padding: 10px 12px; font-size: 15px; box-shadow: var(--glow); animation: fade .2s; }
.toast.warn { border-color: var(--warn); color: #ffd08a; } .toast.error { border-color: var(--err); color: #ffb3b3; }

.boot-msg { position: fixed; inset: 0; display: grid; place-items: center; color: var(--c); font-family: var(--head);
  letter-spacing: 4px; font-size: 14px; z-index: 1; pointer-events: none; }
.boot-error { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--sb)); z-index: 50; background: #2a0606;
  border: 1px solid var(--err); color: #ffc4c4; border-radius: 10px; padding: 10px; font-size: 13px; word-break: break-word; }
.boot-error[hidden] { display: none; }

@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .5 } }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes up { from { transform: translateY(40px) } to { transform: none } }

/* ================= ATLAS siyah-beyaz tema: ince ayarlar ================= */
:root[data-theme="mono"] {
  --bg: #000; --panel: rgba(255,255,255,.04); --text: #f2f2f2; --muted: #8c8c8c;
  --line: rgba(255,255,255,.14); --c-faint: rgba(255,255,255,.07);
  --glow: 0 0 8px rgba(255,255,255,.4), 0 0 24px rgba(255,255,255,.1);
}
:root[data-theme="mono"] body {
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255,255,255,.07), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px), #000;
}
:root[data-theme="mono"] .brand, :root[data-theme="mono"] .pair-box h1, :root[data-theme="mono"] .state { color: #fff; }
:root[data-theme="mono"] .primary { background: #fff; color: #000; box-shadow: 0 0 22px rgba(255,255,255,.25); }
:root[data-theme="mono"] .pair-orb { background: radial-gradient(circle, #fff 0 12%, rgba(255,255,255,.55) 22%, rgba(255,255,255,.08) 48%, transparent 62%); }
:root[data-theme="mono"] .msg.user { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.16); }
:root[data-theme="mono"] .msg.atlas { background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.08); backdrop-filter: blur(8px); }
:root[data-theme="mono"] .mic { background: radial-gradient(circle, rgba(255,255,255,.22), rgba(255,255,255,.04)); border-color: #fff; }
:root[data-theme="mono"] .mic-ico { border-color: #fff; } :root[data-theme="mono"] .mic-ico::after { background: #fff; }
:root[data-theme="mono"] .tab.active { color: #fff; border-bottom-color: #fff; }
:root[data-theme="mono"] .chips button { color: #eaeaea; }
:root[data-theme="mono"] .composer { background: rgba(0,0,0,.92); }
:root[data-theme="mono"] .dot { background: #fff; box-shadow: 0 0 8px #fff; }
:root[data-theme="mono"] .dot.off { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
:root[data-theme="mono"] .bar i { background: #fff; }
:root[data-theme="mono"] .card { background: rgba(255,255,255,.035); }
:root[data-theme="mono"] .yes { background: #fff; color: #000; }

.msg.media { padding: 6px; }
.msg.media .shot { display: block; width: 100%; border-radius: 12px; }
.msg.media .shot.zoom { position: fixed; inset: 0; z-index: 99; width: 100vw; height: 100vh; object-fit: contain;
  background: #000; border-radius: 0; }
.msg.media small { display: block; margin-top: 4px; opacity: .7; font-size: 13px; }

/* Üretilen görsel/video: AÇ / KAYDET düğmesi + tam ekran görüntüleyici (Kaydet / Paylaş) */
.msg.media .media-open { display: block; margin-top: 6px; padding: 8px 12px; border-radius: 10px; font-size: 11px;
  letter-spacing: 2px; font-weight: 700; background: var(--c-faint); color: var(--c); border: 1px solid var(--line); }
.viewer { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.94); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: calc(12px + var(--st)) 12px calc(16px + var(--sb)); }
.viewer[hidden] { display: none; }
.viewer-media { flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 0; }
.viewer-media img, .viewer-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.viewer-cap { color: #ccc; font-size: 13px; margin: 10px 0; text-align: center; }
.viewer-bar { display: flex; gap: 10px; width: 100%; }
.viewer-bar button { flex: 1; padding: 15px; border-radius: 14px; font-weight: 900; letter-spacing: 2px; font-size: 13px;
  background: var(--c-faint); color: var(--c); border: 1px solid var(--line); }
.viewer-bar button:disabled { opacity: .5; }
button.sure { background: var(--err) !important; color: #fff !important; }
