/* SeisGuard – ortak stil */
:root {
  --bg: #0a1f44;
  --bg2: #0d2a5c;
  --card: #1a2f5a;
  --card-hover: #223a6d;
  --text: #ffffff;
  --muted: #9db2d8;
  --accent: #007bff;
  --accent-hover: #0056b3;
  --danger: #ff2d2d;
  --ok: #22c55e;
  --warn: #ff9800;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  --nav-h: 72px;
}
:root[data-theme="light"] {
  --bg: #eef3fb;
  --bg2: #dde8f8;
  --card: #ffffff;
  --card-hover: #f2f6fd;
  --text: #0a1f44;
  --muted: #5a6f94;
  --border: rgba(10, 31, 68, 0.14);
  --shadow: 0 6px 20px rgba(10, 31, 68, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
html, body { height: 100%; }
body {
  min-height: 100dvh;
  background: radial-gradient(circle at 50% -10%, var(--bg2), var(--bg) 60%);
  background-attachment: fixed;
  color: var(--text);
  transition: background-color .3s, color .3s;
}
button { font: inherit; }

main {
  min-height: 100dvh;
  padding: 18px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
}
main.full { max-width: none; padding: 0; height: 100dvh; position: relative; }

h1 { text-align: center; font-size: 1.6em; margin-bottom: 18px; }
.muted { color: var(--muted); }

/* ---------- Alt menü ---------- */
.nav {
  position: fixed; bottom: 0; left: 0; width: 100%; z-index: 50;
  display: flex; justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #ff2a2a, #d90000);
  border-top: 2px solid rgba(255, 255, 255, .25);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, .35);
}
.nav a {
  flex: 1; text-align: center; text-decoration: none;
  color: rgba(255, 255, 255, .75); font-size: 13px; padding: 4px 0;
  position: relative; transition: color .2s, transform .2s;
}
.nav a i { display: block; font-size: 21px; margin-bottom: 4px; }
.nav a:hover { color: #fff; transform: translateY(-1px); }
.nav a.active { color: #fff; font-weight: 700; }
.nav a.active::before {
  content: ""; position: absolute; top: -9px; left: 25%; width: 50%; height: 3px;
  background: #fff; border-radius: 0 0 3px 3px;
}

/* ---------- Kartlar / butonlar ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px; box-shadow: var(--shadow);
}
.btn {
  border: none; border-radius: 25px; padding: 0 18px; height: 48px; min-width: 110px;
  font-size: 1em; font-weight: 600; color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, filter .2s, background-color .2s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.96); }
.btn:focus-visible, .key:focus-visible, .chip:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn-primary { background: var(--accent); }
.btn-ok { background: #1a9a3a; }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--warn); }
.btn-purple { background: #7b1fa2; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

.chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font-size: .9em; cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.chip:hover { background: var(--card-hover); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Ana sayfa ---------- */
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 4vh; }
.hero img.logo { width: 34%; max-width: 190px; height: auto; filter: drop-shadow(0 6px 14px rgba(0,0,0,.4)); }
.logo-fallback {
  display: none; width: 110px; height: 110px; border-radius: 50%; place-items: center;
  background: linear-gradient(145deg, #ff3b3b, #b30000); color: #fff; font-size: 48px;
  box-shadow: 0 0 0 8px rgba(255, 45, 45, .18), var(--shadow);
}
.hero h2 { font-size: 1.7em; letter-spacing: .5px; }
.hero p { color: var(--muted); max-width: 420px; line-height: 1.45; }
.languages { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.language-btn {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 25px;
  background: var(--card); border: 2px solid transparent; color: var(--text);
  cursor: pointer; font-size: 1em; transition: .2s;
}
.language-btn:hover { background: var(--card-hover); }
.language-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.language-btn .flag { width: 26px; height: auto; border-radius: 3px; }

.status-card { margin-top: 22px; display: flex; align-items: center; gap: 14px; }
.pulse-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); position: relative; flex: none; }
.pulse-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--ok);
  animation: ping 1.8s infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3.2); opacity: 0; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.stat { text-align: center; padding: 12px 6px; }
.stat b { display: block; font-size: 1.5em; }
.stat span { font-size: .78em; color: var(--muted); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.quick a, .quick button {
  text-decoration: none; color: var(--text); text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .95em;
  transition: transform .15s, background-color .2s;
}
.quick a:hover, .quick button:hover { transform: translateY(-2px); background: var(--card-hover); }
.quick i { font-size: 22px; color: var(--accent); }
.quick .danger i { color: var(--danger); }

/* ---------- Alarm penceresi ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .78); display: none;
  justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(3px);
}
.modal.open { display: flex; }
.modal-content {
  background: #1a2f5a; border: 2px solid var(--danger); border-radius: 16px;
  width: 92%; max-width: 800px; height: 92%; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 0 40px rgba(255, 45, 45, .55); color: #fff;
}
.modal-content.shake { animation: shake .5s infinite; }
@keyframes shake {
  0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -4px); } 60% { transform: translate(-4px, -3px); }
  80% { transform: translate(4px, 4px); }
}
.modal-header { padding: 12px 10px 8px; text-align: center; color: #ff5555; font-size: 1.5em; font-weight: 800; animation: pulseText 1.4s infinite; }
.modal-text { padding: 6px 10px; text-align: center; color: #ff5555; font-weight: 700; font-size: 1.1em; }
.modal-text:empty { display: none; }
.modal-iframe { flex: 1; width: 100%; border: none; min-height: 0; background: #0a1f44; }
.modal .btn { align-self: center; margin: 10px 0 14px; }
.progress { height: 5px; background: rgba(255, 255, 255, .15); }
.progress span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .6s; }
@keyframes pulseText { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px); transform: translate(-50%, 20px);
  background: #111c33; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 2000;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .3s; max-width: 90%; text-align: center;
  border: 1px solid rgba(255, 255, 255, .15);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Acil arama ---------- */
.screen {
  width: 100%; max-width: 320px; height: 64px; margin: 0 auto 18px; background: #fff; color: #0a1f44;
  border-radius: 12px; display: flex; align-items: center; justify-content: flex-end;
  font-size: 1.7em; padding: 0 14px; overflow-x: auto; white-space: nowrap; letter-spacing: 2px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .2);
}
.screen:empty::after { content: attr(data-placeholder); color: #9aa7bd; font-size: .6em; letter-spacing: 0; }
.keypad { display: grid; grid-template-columns: repeat(3, 78px); gap: 14px; justify-content: center; }
.key {
  width: 78px; height: 78px; background: var(--accent); color: #fff; font-size: 1.6em; border: none;
  border-radius: 50%; cursor: pointer; user-select: none; transition: background-color .15s, transform .1s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}
.key:hover { background: var(--accent-hover); }
.key:active { transform: scale(.92); background: #003d80; }
.quick-dial { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.loc-card { margin-top: 16px; display: none; }
.loc-card.show { display: block; }
.loc-card code { display: block; margin: 6px 0 10px; word-break: break-all; color: var(--muted); font-size: .9em; }
.loc-card .btn { height: 38px; min-width: 90px; font-size: .9em; }

body.sos-on::before {
  content: ""; position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background: rgba(255, 0, 0, .55); animation: sosFlash .6s infinite;
}
@keyframes sosFlash { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
.sos-active { animation: sosBtn .8s infinite; }
@keyframes sosBtn { 0%, 100% { box-shadow: 0 0 0 0 rgba(123, 31, 162, .8); } 50% { box-shadow: 0 0 0 14px rgba(123, 31, 162, 0); } }

/* ---------- Ayarlar ---------- */
.setting-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); padding: 15px; border-radius: 15px; margin-bottom: 12px;
}
.setting-item .desc { display: block; font-size: .8em; color: var(--muted); margin-top: 3px; }
.setting-item label { font-size: 1.05em; }
.setting-item select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-size: 1em;
}
.setting-item input[type="range"] { accent-color: var(--accent); width: 45%; cursor: pointer; }
.switch { position: relative; width: 50px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #5b6b8c; border-radius: 28px; transition: .25s; }
.switch span::before {
  content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 3px solid #fff; outline-offset: 2px; }

/* ---------- Harita sayfası ---------- */
#viewDiv { position: absolute; inset: 0; }
.map-top { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.map-top > * { pointer-events: auto; }
.map-top .chip { background: rgba(10, 31, 68, .85); color: #fff; backdrop-filter: blur(4px); }
.map-top .chip.active { background: var(--accent); }
.feed {
  position: absolute; left: 0; right: 0; bottom: var(--nav-h); z-index: 5; padding: 8px 10px;
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x proximity;
  background: linear-gradient(0deg, rgba(10, 31, 68, .85), transparent);
}
.q-item {
  flex: none; width: 200px; scroll-snap-align: start; cursor: pointer; text-align: left; color: #fff;
  background: rgba(26, 47, 90, .95); border: 1px solid rgba(255,255,255,.15); border-radius: 12px; padding: 10px;
}
.q-item:hover { background: #223a6d; }
.q-item .mag { font-size: 1.3em; font-weight: 800; }
.q-item .place { font-size: .85em; margin: 2px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.q-item .ago { font-size: .75em; color: var(--muted); }
.mag-low { color: #ffd54f; } .mag-mid { color: #ff9800; } .mag-high { color: #ff3d3d; }

/* ---------- Mobil ---------- */
@media (max-width: 600px) {
  .nav a { font-size: 12px; } .nav a i { font-size: 19px; }
  .keypad { grid-template-columns: repeat(3, 66px); gap: 12px; }
  .key { width: 66px; height: 66px; font-size: 1.4em; }
  .hero img.logo { width: 42%; }
  .setting-item { flex-wrap: wrap; }
  .modal-header { font-size: 1.2em; }
}
/* ================= v2: görsel cila ================= */
@keyframes blink { 50% { opacity: .3; } }

/* Hareketli arka plan ışıması */
html::before {
  content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 420px at 15% 10%, rgba(0, 123, 255, .20), transparent 70%),
    radial-gradient(520px 420px at 90% 35%, rgba(255, 45, 45, .15), transparent 70%);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(-3%, 2%) scale(1.08); } }

/* Cam efektli kartlar */
.card {
  background: linear-gradient(145deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .02)), var(--card);
  backdrop-filter: blur(8px);
}
:root[data-theme="light"] .card { background: var(--card); }

/* Sayfa girişinde kademeli yükselme */
main:not(.full) > * { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* Dokunma dalgası */
.btn, .key, .chip, .language-btn, .q-item { position: relative; overflow: hidden; }
.ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: scale(0); animation: rip .6s ease-out; pointer-events: none; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }

/* Alt menü */
.nav a i { transition: transform .2s; }
.nav a.active i { transform: scale(1.2); }

/* Logo + sismik dalga halkaları */
.logo-wrap { position: relative; display: grid; place-items: center; width: 150px; height: 150px; }
.logo-wrap .wave {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 70, 70, .65);
  opacity: 0; animation: wave 3.6s infinite;
}
.logo-wrap .wave:nth-child(2) { animation-delay: 1.2s; }
.logo-wrap .wave:nth-child(3) { animation-delay: 2.4s; }
@keyframes wave { 0% { transform: scale(.55); opacity: .85; } 100% { transform: scale(1.9); opacity: 0; } }
.logo-wrap img.logo { width: 100px; position: relative; }
.logo-wrap .logo-fallback { position: relative; width: 96px; height: 96px; font-size: 42px; }
.hero { padding-top: 2vh; }
.hero h2 {
  font-size: 2em; letter-spacing: 1px;
  background: linear-gradient(90deg, var(--text), #ff4d4d); -webkit-background-clip: text; background-clip: text; color: transparent;
}

.sec-title { font-size: .8em; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 24px 4px 10px; }

/* Canlı sismograf */
.seismo-card { padding: 12px 12px 10px; margin-top: 20px; }
.seismo-head { display: flex; justify-content: space-between; align-items: center; font-size: .78em; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.seismo-head .live { display: flex; align-items: center; gap: 7px; color: var(--ok); font-weight: 700; }
.seismo { width: 100%; height: 100px; display: block; border-radius: 10px; background: #071633; cursor: pointer; touch-action: manipulation; }
.seismo-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .85em; color: var(--muted); }
.seismo-foot .btn { height: 34px; min-width: 0; padding: 0 14px; font-size: .85em; flex: none; }
.meter { flex: 1; height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22c55e, #ff9800, #ff3d3d); transition: width .08s; }

/* Çök – Kapan – Tutun kartları */
.tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tip { text-align: center; padding: 14px 8px; transition: transform .3s, box-shadow .3s, border-color .3s; }
.tip i { font-size: 26px; color: var(--danger); margin-bottom: 8px; display: block; }
.tip b { display: block; font-size: .95em; }
.tip small { color: var(--muted); font-size: .74em; line-height: 1.3; display: block; margin-top: 4px; }
.tip.on { transform: translateY(-5px); border-color: var(--danger); box-shadow: 0 0 0 2px rgba(255, 45, 45, .35), var(--shadow); }

/* Hazırlık listesi */
.bar { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, .14); overflow: hidden; margin: 0 4px 12px; }
.bar span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .4s; }
.check { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; margin-bottom: 8px; }
.check input { position: absolute; opacity: 0; }
.check .box { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--muted); display: grid; place-items: center; transition: .2s; flex: none; color: transparent; font-size: 12px; }
.check input:checked + .box { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.1); }
.check input:checked ~ .txt { text-decoration: line-through; opacity: .6; }
.check input:focus-visible + .box { outline: 3px solid #fff; outline-offset: 2px; }
.prep-count { float: right; color: var(--ok); }

/* Alarm penceresi: geri sayım halkası */
.modal-top { display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; }
.modal-top .modal-header { flex: 1; padding: 0; text-align: left; font-size: 1.2em; }
.count { position: relative; width: 84px; height: 84px; flex: none; }
.count svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.count circle { fill: none; stroke-width: 8; }
.count .bg { stroke: rgba(255, 255, 255, .15); }
.count .fg { stroke: var(--warn); stroke-linecap: round; stroke-dasharray: 276.46; stroke-dashoffset: 0; transition: stroke-dashoffset .8s, stroke .4s; }
.count.urgent .fg, .count.now .fg { stroke: var(--danger); }
.count.now .fg { animation: blink .6s infinite; }
.count .num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.count .num b { font-size: 1.9em; }
.count .num small { font-size: .65em; color: var(--muted); }
.modal-iframe { min-height: 120px; }
.dch { display: flex; justify-content: space-around; padding: 6px 10px 2px; }
.dch div { text-align: center; font-size: .7em; font-weight: 800; letter-spacing: .5px; }
.dch i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 45, 45, .2); color: #ff6b6b; margin: 0 auto 3px; font-size: 16px; animation: bob 1.6s infinite; }
.dch div:nth-child(2) i { animation-delay: .25s; }
.dch div:nth-child(3) i { animation-delay: .5s; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.modal.open::after { content: ""; position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 90px rgba(255, 0, 0, .55); animation: pulseText 1.2s infinite; }

/* DEMO uyarı şeridi (alarm penceresinin en üstü) */
.demo-banner {
  background: #ffc107; color: #1a1a1a; text-align: center; font-weight: 800; font-size: .9em;
  padding: 8px 12px; letter-spacing: .3px; line-height: 1.3;
}

/* Harita göstergesi */
.live-badge { display: inline-flex; align-items: center; gap: 7px; background: rgba(10, 31, 68, .85); color: #fff; border-radius: 999px; padding: 7px 12px; font-size: .8em; font-weight: 700; letter-spacing: .5px; backdrop-filter: blur(4px); }
.legend { display: inline-flex; align-items: center; gap: 10px; background: rgba(10, 31, 68, .85); color: #fff; border-radius: 999px; padding: 7px 12px; font-size: .75em; backdrop-filter: blur(4px); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }

@media (max-width: 600px) {
  .count { width: 68px; height: 68px; }
  .modal-top .modal-header { font-size: 1.05em; }
  .tip small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
