/* Acil durum web görünümü (ACIL-DURUM-AGI.md §20.5) — tek stil dosyası; CSP `style-src 'self'`.
   Renkler YALNIZ jeton: açık ve koyu tema aynı adlarla. Nabız < 3 Hz (WCAG 2.3.1), "hareketi azalt"ta
   sabit; dokunma alanı en az 44 px; renk tek başına bilgi taşımaz (çiplerde metin var). */

:root {
  --zemin: #f6f4f9;
  --yuzey: #ffffff;
  --yuzey-2: #efebf4;
  --yazi: #1d1428;
  --yazi-soluk: #5d5468;
  --kenar: #d9d2e3;
  --vurgu: #5b2ca0;
  --vurgu-yazi: #ffffff;
  --tehlike: #b3261e;
  --tehlike-yazi: #ffffff;
  --acil-zemin: #fde7e5;
  --acil-yazi: #7a1610;
  --uyari-zemin: #fff3d6;
  --uyari-yazi: #6b4b00;
  --etkin-zemin: #e3f4e8;
  --etkin-yazi: #1d5a2e;
  --bitti-zemin: #ececf0;
  --bitti-yazi: #47474f;
  --odak: #2f6fdd;
  --golge: 0 8px 28px rgba(20, 10, 40, .18);
  --iskelet: #e7e2ee;
  --iskelet-parlak: #f4f1f8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --zemin: #141019;
    --yuzey: #1d1824;
    --yuzey-2: #261f30;
    --yazi: #f1ecf7;
    --yazi-soluk: #b5aac2;
    --kenar: #3a3145;
    --vurgu: #b48cf2;
    --vurgu-yazi: #160c24;
    --tehlike: #f2b8b5;
    --tehlike-yazi: #410e0b;
    --acil-zemin: #4a1512;
    --acil-yazi: #ffdad6;
    --uyari-zemin: #3d2f05;
    --uyari-yazi: #ffe08a;
    --etkin-zemin: #143a20;
    --etkin-yazi: #b6efc3;
    --bitti-zemin: #2a2a30;
    --bitti-yazi: #d0d0d8;
    --odak: #8ab4ff;
    --golge: 0 8px 28px rgba(0, 0, 0, .5);
    --iskelet: #2a2333;
    --iskelet-parlak: #352c40;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--zemin);
  color: var(--yazi);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body.sos-pencere-acik { overflow: hidden; }
h1 { font-size: 1.35rem; margin: .4rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: var(--vurgu); }
:focus-visible { outline: 3px solid var(--odak); outline-offset: 2px; }

#sos { max-width: 760px; margin: 0 auto; padding: 0 16px 32px; }

/* ---------- Düğmeler ---------- */
.sos-dugme {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--kenar);
  background: var(--yuzey); color: var(--yazi); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.sos-dugme:disabled { opacity: .55; cursor: not-allowed; }
.sos-birincil { background: var(--vurgu); border-color: var(--vurgu); color: var(--vurgu-yazi); }
.sos-ikincil { background: var(--yuzey); color: var(--yazi); }
.sos-tehlike { background: var(--tehlike); border-color: var(--tehlike); color: var(--tehlike-yazi); }
.sos-soluk { opacity: .55; }
.sos-kucuk { min-height: 44px; padding: .35rem .7rem; font-size: .9rem; }
.sos-buyuk { min-height: 52px; font-size: 1.05rem; }
.sos-dugme-sirasi { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }

/* ---------- Kabuk ---------- */
/* Başlık YAPIŞKAN: canlı işaret kaydırınca da görünür (ANA KURAL "etkin durum her ekranda"). */
.sos-ust {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .8rem 0; border-bottom: 1px solid var(--kenar);
  position: sticky; top: 0; z-index: 20; background: var(--zemin);
}
.sos-yardim-dugme { min-width: 44px; }
.sos-gizli { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sos-serit-uyari { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .4rem .8rem; margin: .5rem 0; border-radius: 10px; background: var(--uyari-zemin); color: var(--uyari-yazi);
  font-size: .92rem; }
.sos-giris-ust { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.sos-ust-sol { display: flex; flex-direction: column; }
.sos-ust-sol span { color: var(--yazi-soluk); font-size: .9rem; }
.sos-ust-sag { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.sos-ben { color: var(--yazi-soluk); font-size: .9rem; }
.sos-canli {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; min-width: 44px;
  padding: .4rem .8rem; border-radius: 22px; border: 2px solid var(--tehlike);
  background: var(--acil-zemin); color: var(--acil-yazi); font: inherit; font-weight: 700; cursor: pointer;
}
.sos-bolumler { display: flex; gap: .4rem; margin: .8rem 0; border-bottom: 1px solid var(--kenar); }
.sos-bolumler button {
  min-height: 44px; padding: .5rem .9rem; border: 0; border-bottom: 3px solid transparent;
  background: none; color: var(--yazi-soluk); font: inherit; font-weight: 600; cursor: pointer;
}
.sos-bolumler button[aria-current="page"] { color: var(--yazi); border-bottom-color: var(--vurgu); }
.sos-icerik { outline: none; }
.sos-not { color: var(--yazi-soluk); font-size: .92rem; }
.sos-uyari {
  background: var(--uyari-zemin); color: var(--uyari-yazi); border-radius: 8px; padding: .5rem .7rem;
  margin: .4rem 0; font-size: .92rem;
}
.sos-rozet {
  display: inline-flex; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; align-items: center;
  justify-content: center; border-radius: .7rem; background: var(--tehlike); color: var(--tehlike-yazi);
  font-size: .8rem; font-weight: 700;
}

/* ---------- Web çekirdeği ---------- */
.sos-cekirdek {
  margin: 1.4rem 0 0; padding: .8rem 1rem; border-radius: 12px; background: var(--yuzey-2);
  color: var(--yazi); font-size: .92rem;
}
.sos-cekirdek ul { margin: 0; padding-left: 1.1rem; }

/* ---------- Şablon ---------- */
/* Kısa gecikmeyle belirir: anında gelen veride titreme olmaz (ANA KURAL "şablon"). */
.sos-iskelet { padding: .6rem 0; opacity: 0; animation: sos-belir 0s linear .15s forwards; }
@keyframes sos-belir { to { opacity: 1; } }
.sos-serit { height: 3px; border-radius: 2px; background: var(--vurgu); opacity: .55; margin-bottom: .8rem;
  animation: sos-serit 1.6s ease-in-out infinite; transform-origin: left; }
.sos-iskelet-baslik { height: 1.3rem; width: 45%; border-radius: 6px; background: var(--iskelet); margin-bottom: .9rem; }
.sos-iskelet-satir { display: flex; justify-content: space-between; gap: 1rem; padding: .9rem; margin: .5rem 0;
  border-radius: 12px; background: var(--yuzey); border: 1px solid var(--kenar); }
.sos-iskelet-satir span { height: .9rem; border-radius: 5px; background: var(--iskelet); flex: 1; }
.sos-iskelet-satir span + span { flex: .4; }
.sos-acilis { padding-top: 2rem; }
@keyframes sos-serit { 0% { transform: scaleX(.1); } 50% { transform: scaleX(.8); } 100% { transform: scaleX(.1); } }

/* ---------- Çözüm yolu ---------- */
.sos-cozum {
  display: flex; gap: .8rem; padding: .9rem 1rem; margin: .7rem 0; border-radius: 12px;
  background: var(--yuzey); border: 1px solid var(--kenar);
}
.sos-cozum-eylem { border-left: 4px solid var(--vurgu); }
.sos-cozum-bekle { border-left: 4px solid var(--uyari-yazi); }
.sos-cozum-hazirlaniyor { border-left: 4px solid var(--odak); }
.sos-cozum-ikon { font-weight: 800; font-size: 1.1rem; width: 1.6rem; flex: none; text-align: center; }
.sos-cozum-metin p { margin: .3rem 0 0; color: var(--yazi-soluk); }
.sos-donen { display: inline-block; width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid var(--kenar); border-top-color: var(--vurgu); animation: sos-don 1s linear infinite; }
@keyframes sos-don { to { transform: rotate(360deg); } }

/* ---------- Giriş ---------- */
.sos-giris { padding-top: 1.5rem; }
.sos-giris-giris { color: var(--yazi-soluk); }
.sos-form { display: flex; flex-direction: column; gap: .8rem; max-width: 420px; }
.sos-form label, .sos-sifre { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.sos-form input, .sos-sifre input, .sos-secim select {
  min-height: 44px; padding: .5rem .7rem; border-radius: 10px; border: 1px solid var(--kenar);
  background: var(--yuzey); color: var(--yazi); font: inherit;
}

/* ---------- Yardım isteyen: göz önünde ---------- */
.sos-acil-kart {
  display: flex; align-items: center; gap: 1rem; padding: 1rem; margin: .8rem 0; border-radius: 14px;
  background: var(--acil-zemin); color: var(--acil-yazi); border: 2px solid var(--tehlike); box-shadow: var(--golge);
}
.sos-acil-kart b { font-size: 1.1rem; }
.sos-acil-kart p { margin: .2rem 0 0; }
.sos-acil-kart div { flex: 1; }
.sos-nabiz { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--tehlike);
  animation: sos-nabiz 1.2s ease-in-out infinite; flex: none; }
.sos-nabiz-buyuk { width: 22px; height: 22px; }
@keyframes sos-nabiz { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.82); } }
.sos-acil-satir { font-weight: 800; color: var(--acil-yazi); background: var(--acil-zemin); border-radius: 8px;
  padding: .5rem .7rem; }

/* ---------- Liste ---------- */
.sos-liste { list-style: none; padding: 0; margin: .5rem 0; display: flex; flex-direction: column; gap: .5rem; }
.sos-satir {
  width: 100%; display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center;
  min-height: 64px; padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--kenar);
  background: var(--yuzey); color: var(--yazi); font: inherit; text-align: left; cursor: pointer;
}
.sos-satir-acil { border: 2px solid var(--tehlike); }
.sos-satir-ad { min-width: 0; }
.sos-satir-ad b, .sos-acil-kart b, .sos-p-baslik h2 { overflow-wrap: anywhere; }
.sos-satir-ad small { display: block; color: var(--yazi-soluk); }
.sos-satir-tur, .sos-satir-yas, .sos-satir-not { color: var(--yazi-soluk); font-size: .88rem; }
.sos-cip { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.sos-cip-acil { background: var(--acil-zemin); color: var(--acil-yazi); }
.sos-cip-uyari { background: var(--uyari-zemin); color: var(--uyari-yazi); }
.sos-cip-etkin { background: var(--etkin-zemin); color: var(--etkin-yazi); }
.sos-cip-bitti { background: var(--bitti-zemin); color: var(--bitti-yazi); }
.sos-susturulanlar { margin-top: 1.2rem; }

/* ---------- Kart, bilgi ---------- */
.sos-kart { padding: 1rem; border-radius: 12px; background: var(--yuzey); border: 1px solid var(--kenar); }
.sos-bilgi { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .35rem .8rem; margin: .6rem 0; }
.sos-bilgi dt { color: var(--yazi-soluk); }
.sos-bilgi dd { margin: 0; overflow-wrap: anywhere; }
.sos-parmak, .sos-koordinat { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.sos-notu { white-space: pre-wrap; }

/* ---------- Pencere ---------- */
.sos-ortu {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 6, 18, .55); padding: 0;
}
.sos-pencere {
  width: 100%; max-width: 720px; max-height: 92vh; display: flex; flex-direction: column;
  background: var(--yuzey); color: var(--yazi); border-radius: 16px 16px 0 0; box-shadow: var(--golge);
}
@media (min-width: 720px) {
  .sos-ortu { align-items: center; padding: 16px; }
  .sos-pencere { border-radius: 16px; max-height: 88vh; }
}
.sos-pencere-acil { border-top: 4px solid var(--tehlike); }
.sos-p-baslik { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem;
  padding: 1rem 1rem .4rem; }
.sos-p-baslik-metin { min-width: 0; }
.sos-p-baslik-sag { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .4rem; }
.sos-onay-baslik { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sos-dikey { padding-left: 1.1rem; margin: .3rem 0; }
.sos-p-alt-baslik { margin: .2rem 0 0; color: var(--yazi-soluk); font-size: .9rem; }
.sos-kapat { min-width: 44px; min-height: 44px; border: 0; border-radius: 10px; background: var(--yuzey-2);
  color: var(--yazi); font-size: 1.4rem; cursor: pointer; }
.sos-sekmeler { display: flex; gap: .3rem; padding: 0 1rem; border-bottom: 1px solid var(--kenar); overflow-x: auto; }
.sos-sekme { min-height: 44px; padding: .4rem .8rem; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--yazi-soluk); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.sos-sekme.sos-secili { color: var(--yazi); border-bottom-color: var(--vurgu); }
.sos-p-govde { padding: .8rem 1rem; overflow-y: auto; flex: 1; outline: none; }
/* Alt çubuk uzun onay adımında (Bırak: metin, seçimler, şifre, hata) KAYAR: düğmeler görünür alanda kalır. */
.sos-p-alt { padding: .6rem 1rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--kenar);
  background: var(--yuzey); max-height: 55vh; overflow-y: auto; }
.sos-durum-satiri { margin: 0 0 .5rem; }
.sos-sabit-satir { margin-top: 1rem; font-size: .9rem; color: var(--yazi-soluk); border-top: 1px dashed var(--kenar);
  padding-top: .6rem; }
.sos-onay { display: flex; flex-direction: column; gap: .5rem; }
.sos-onay p { margin: 0; color: var(--yazi-soluk); }
.sos-secim { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-height: 44px; }
.sos-secim input[type="checkbox"] { width: 22px; height: 22px; }
.sos-karar { font-weight: 600; }
.sos-eksik { margin: 0; color: var(--uyari-yazi); font-size: .9rem; }
.sos-parla { animation: sos-parla .9s ease-in-out 2; border-radius: 8px; }
@keyframes sos-parla { 50% { background: var(--uyari-zemin); } }

/* ---------- Olaylar ---------- */
.sos-olaylar { list-style: none; padding: 0; margin: 0; }
.sos-olaylar li { padding: .6rem 0; border-bottom: 1px solid var(--kenar); }
.sos-olay-zaman { display: inline-block; min-width: 3.4rem; color: var(--yazi-soluk); font-variant-numeric: tabular-nums; }
.sos-olay-acil b { color: var(--acil-yazi); }
.sos-iz { padding-left: 1.2rem; color: var(--yazi-soluk); font-size: .9rem; }

/* ---------- Konum şeması (karosuz) ---------- */
.sos-sema { margin: .4rem auto; max-width: 260px; text-align: center; }
.sos-sema svg { width: 100%; height: auto; }
.sos-sema figcaption { color: var(--yazi-soluk); font-size: .85rem; }
.sos-sema-halka { fill: none; stroke: var(--kenar); stroke-width: 1; }
.sos-sema-eksen { stroke: var(--kenar); stroke-width: .6; stroke-dasharray: 3 3; }
.sos-sema-kuzey { fill: var(--yazi-soluk); font-size: 9px; }
.sos-sema-dogruluk { fill: var(--vurgu); fill-opacity: .14; stroke: var(--vurgu); stroke-width: 1; }
.sos-sema-iz { fill: none; stroke: var(--vurgu); stroke-width: 1.6; stroke-opacity: .7; }
.sos-sema-nokta { fill: var(--tehlike); }

/* ---------- Yaklaş: radar (halkalarda sayı yok; kaba konumda kesik çizgi) ---------- */
.sos-radar { margin: .4rem auto; max-width: 280px; }
.sos-radar svg { width: 100%; height: auto; }
.sos-radar-zemin { fill: var(--yuzey-2); stroke: var(--kenar); stroke-width: 1; }
.sos-radar-halka { fill: none; stroke: var(--kenar); stroke-width: 1; }
.sos-radar-kuzey { fill: var(--yazi-soluk); font-size: 9px; font-weight: 700; }
.sos-radar-belirsiz { fill: var(--tehlike); fill-opacity: .12; stroke: var(--tehlike); stroke-width: 1; }
.sos-radar-kaba { stroke-dasharray: 4 3; }
.sos-radar-ok { stroke: var(--tehlike); stroke-width: 2.5; stroke-linecap: round; }
.sos-radar-hedef { fill: var(--tehlike); }
.sos-radar-ben { fill: var(--vurgu); }
.sos-yaklas-metin p { margin: .35rem 0; }

/* ---------- Yardım: metin kopyalanamaz (başlık dahil bütün pencere) ---------- */
.sos-yardim, .sos-yardim-icerik { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sos-ornek { background: var(--yuzey-2); border-radius: 10px; padding: .6rem .8rem; margin: .5rem 0; }
.sos-ornek p { margin: .3rem 0 0; }

/* ---------- Bildirim teklifi ---------- */
.sos-bildirim { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .7rem 1rem; margin-top: 1rem; border-radius: 12px; background: var(--yuzey-2); }
.sos-bildirim p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .sos-nabiz, .sos-serit, .sos-donen, .sos-parla, .sos-iskelet { animation: none !important; }
  .sos-nabiz, .sos-iskelet { opacity: 1; }
  /* Eksik olan yine GÖSTERİLİR: hareket yerine sabit çerçeve. */
  .sos-parla { outline: 3px solid var(--uyari-yazi); outline-offset: 2px; background: var(--uyari-zemin); }
}
