/* --- CSS DEĞİŞKENLERİ --- */
:root {
    --primary: #00ff9d;
    --danger: #ff4757;
    --warning: #ffa502;
    --purple: #7d5fff;
    --dark-bg: #1e1e2e;
    --panel-bg: rgba(30, 30, 46, 0.95);
    --modal-bg: rgba(25, 25, 40, 0.95);
    --text-main: #f1f2f6;
    --text-muted: #a4b0be;
    --border-color: #2f3542;
    --map-bg: #1e1e2e;
    
    --header-height: 60px;
    --panel-expanded-height: 45vh;
    --panel-collapsed-height: 55px;
    
    --font-ui: 'Inter', sans-serif;
    --font-head: 'Rajdhani', sans-serif;
}

body.light-mode {
    --primary: #009432;
    --danger: #ea2027;
    --dark-bg: #f1f2f6;
    --panel-bg: rgba(255, 255, 255, 0.98);
    --modal-bg: rgba(255, 255, 255, 0.95);
    --text-main: #2f3542;
    --text-muted: #57606f;
    --border-color: #dfe4ea;
    --map-bg: #ced6e0;
}

/* CRITICAL ALERT MODE (YENİ) */
body.critical-mode {
    --primary: #ff4757;
    --dark-bg: #2d0f0f;
    --panel-bg: rgba(40, 10, 10, 0.95);
    --border-color: #ff4757;
}
body.critical-mode .header-right, body.critical-mode header {
    border-bottom-color: #ff4757;
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
}

/* FONT BOYUTLARI */
body.font-small { font-size: 13px !important; }
body.font-medium { font-size: 15px !important; }
body.font-large { font-size: 18px !important; }

/* FONT TİPLERİ */
body.font-modern { font-family: 'Inter', sans-serif !important; }
body.font-system { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important; }

/* TEMEL AYARLAR */
html, body {
    height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden;
    background-color: var(--dark-bg); color: var(--text-main);
    font-family: var(--font-ui);
    transition: font-size 0.3s ease, background-color 0.5s;
}

/* HARİTA */
#map {
    position: absolute; top: 0; bottom: 0; left: 0; right: 0;
    width: 100%; height: 100%; z-index: 1; background: var(--map-bg);
}

/* TECTONIC PLATES */
.tectonic-line {
    stroke: var(--danger); stroke-width: 2; stroke-opacity: 0.4; stroke-dasharray: 5, 5; fill: none; pointer-events: none;
}

/* UI KATMANI */
.ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 1000;
}
.ui-layer > * { pointer-events: auto; }

/* BAŞLANGIÇ EKRANI */
#start-screen {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background-color: var(--dark-bg); 
    z-index: 20000; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: var(--text-main); 
    transition: opacity 0.6s ease, visibility 0.6s;
    opacity: 1; visibility: visible; pointer-events: auto;
}
#start-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.start-content { text-align: center; }

/* LOGO STILLERİ */
.big-logo { width: 200px; height: 200px; margin-bottom: 30px; overflow: visible; }
.big-logo .logo-ring { fill: none; stroke: var(--primary); opacity: 0; transform-origin: center; animation: pulse-ring-big 3s cubic-bezier(0.4, 0, 0.6, 1) infinite; stroke-width: 2px; }
.big-logo .logo-ring.ring-2 { animation-delay: 0.7s; }
.big-logo .logo-core { fill: var(--primary); filter: drop-shadow(0 0 10px var(--primary)); animation: breathe 3s ease-in-out infinite; transform-origin: center; }
.big-logo .logo-pulse { stroke: var(--dark-bg); fill: none; stroke-width: 4px; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw-pulse 3s ease-in-out infinite; }

.header-logo { width: 30px; height: 30px; overflow: visible; }
.header-logo .logo-ring { fill: none; stroke: var(--primary); opacity: 0; transform-origin: center; animation: pulse-ring 3s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.header-logo .logo-ring.ring-2 { animation-delay: 0.7s; }
.header-logo .logo-core { fill: var(--primary); }
.header-logo .header-pulse { stroke: var(--text-main); fill: none; stroke-width: 6px; stroke-linecap: round; stroke-dasharray: 200; stroke-dashoffset: 200; animation: draw-pulse 3s ease-in-out infinite; }

@keyframes pulse-ring { 0% { transform: scale(0.5); opacity: 0.8; stroke-width: 2px; } 100% { transform: scale(1.8); opacity: 0; stroke-width: 0px; } }
@keyframes pulse-ring-big { 0% { transform: scale(0.5); opacity: 0.8; stroke-width: 3px; } 100% { transform: scale(2.5); opacity: 0; stroke-width: 0px; } }
@keyframes draw-pulse { 0% { stroke-dashoffset: 200; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { stroke-dashoffset: -200; opacity: 0; } }
@keyframes breathe { 0%, 100% { transform: scale(0.9); } 50% { transform: scale(1.1); } }

/* HEADER */
header {
    height: var(--header-height); background: var(--panel-bg); 
    backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0 15px; transition: background 0.4s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 10001; position: relative; pointer-events: auto;
}
.logo-container { display: flex; align-items: center; gap: 10px; cursor: pointer; pointer-events: auto; }
.app-name { font-family: var(--font-head); font-weight: 700; letter-spacing: 1px; font-size: 1.4em; }
.app-name span { color: var(--primary); }

/* STATS TICKER */
.stats-ticker {
    display: flex; align-items: center; gap: 15px; font-size: 0.85em; color: var(--text-muted);
    margin-right: 10px; background: rgba(0,0,0,0.2); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border-color);
}
.stat-item { display: flex; align-items: center; gap: 5px; }
.stat-val { font-weight: 700; color: var(--text-main); font-family: var(--font-head); font-size: 1.1em; }
.stat-high { color: var(--danger); }

.header-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: none; border: none; color: var(--text-muted); font-size: 1.3em; cursor: pointer; transition: 0.3s; pointer-events: auto; }
.icon-btn:hover { color: var(--primary); transform: rotate(90deg); }

/* BUTONLAR */
.btn-start {
    margin-top: 40px; padding: 16px 50px; background: var(--primary); 
    color: #000; font-family: var(--font-head); font-size: 1.2em; font-weight: 700; 
    border-radius: 50px; border: none; cursor: pointer; 
    box-shadow: 0 0 30px rgba(0, 255, 157, 0.3); transition: transform 0.2s;
}
.btn-start:hover { transform: scale(1.05); }

/* USER RADAR ICON */
.user-radar-icon { background: transparent !important; border: none !important; }
.radar-core {
    width: 14px; height: 14px; background: var(--primary); border-radius: 50%;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--primary); z-index: 2;
}
.radar-sweep {
    width: 80px; height: 80px; border-radius: 50%;
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    border: 1px solid rgba(0, 255, 157, 0.3);
    background: conic-gradient(from 0deg, transparent 0deg, rgba(0, 255, 157, 0.1) 60deg, transparent 60deg);
    animation: radar-spin 4s linear infinite; z-index: 1;
}
@keyframes radar-spin { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }

/* SOLAR POPUP */
#solar-popup { position: absolute; top: 70px; left: 15px; background: var(--panel-bg); width: 200px; padding: 15px; border-radius: 16px; border: 1px solid var(--primary); z-index: 5000; display: none; }
.popup-header { text-align: center; font-size: 0.75em; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border-color); padding-bottom: 8px; margin-bottom: 10px; }
.info-item { display: flex; align-items: center; margin-bottom: 8px; font-size: 0.9em; }
.info-item i { width: 30px; text-align: center; color: var(--text-muted); margin-right: 10px; }
.info-item span { flex: 1; text-align: center; }
.warning-color { color: var(--warning) !important; }
.purple-color { color: var(--purple) !important; }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.8); z-index: 6000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-content { width: 90%; max-width: 360px; background: var(--modal-bg); backdrop-filter: blur(15px); border-radius: 20px; padding: 25px; border: 1px solid var(--border-color); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; font-family: var(--font-head); font-size: 1.2em; }
.btn-group { display: flex; border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; margin-top: 8px; }
.btn-option { flex: 1; background: transparent; border: none; padding: 12px; color: var(--text-muted); cursor: pointer; border-right: 1px solid var(--border-color); transition: 0.2s; }
.btn-option:last-child { border-right: none; }
.btn-option.active { background: var(--primary); color: #000; font-weight: 700; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 15px; width: 100%; border-radius: 10px; font-weight: 700; cursor: pointer; margin-top: 10px; }
.modal-footer { display: flex; justify-content: center; gap: 20px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--border-color); }
.modal-footer a { color: var(--text-muted); text-decoration: none; font-size: 0.8em; }

/* MESH BUTTON & CHAT */
.fab-group-left { position: absolute; bottom: calc(var(--panel-expanded-height) + 20px); left: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1500; transition: bottom 0.4s; }
#info-panel.panel-collapsed ~ .fab-group-left { bottom: calc(var(--panel-collapsed-height) + 20px); }

.felt-btn, .mesh-btn { background: rgba(255, 71, 87, 0.9); color: white; border: none; border-radius: 30px; padding: 10px 20px; display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; font-size: 1.1em; cursor: pointer; box-shadow: 0 4px 20px rgba(255, 71, 87, 0.4); backdrop-filter: blur(5px); animation: pulse-red 2s infinite; }
.mesh-btn { background: rgba(125, 95, 255, 0.9); box-shadow: 0 4px 20px rgba(125, 95, 255, 0.4); animation: pulse-purple 2s infinite; }

@keyframes pulse-purple { 0% { box-shadow: 0 0 0 0 rgba(125, 95, 255, 0.7); } 70% { box-shadow: 0 0 0 15px rgba(125, 95, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(125, 95, 255, 0); } }

.chat-layout { display: flex; flex-direction: column; height: 80vh; max-width: 500px; padding: 0; overflow: hidden; }
.modal-header .header-title { display: flex; flex-direction: column; gap: 2px; }
#mesh-status { font-size: 0.6em; padding: 2px 8px; border-radius: 4px; width: fit-content; }
.status-offline { background: var(--danger); color: white; }
.status-online { background: var(--primary); color: black; }

.mesh-id-box { padding: 15px 20px; background: rgba(125, 95, 255, 0.1); border-bottom: 1px solid rgba(125, 95, 255, 0.3); font-size: 0.85em; display: flex; flex-direction: column; gap: 8px; }
.mesh-global-status { display: flex; align-items: center; gap: 10px; color: var(--primary); font-weight: 700; }
.mesh-global-status i { animation: rotate-slow 5s linear infinite; }
@keyframes rotate-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.node-id-display { font-size: 0.7em; color: var(--text-muted); font-family: monospace; opacity: 0.8; }
#my-mesh-id { color: #fff; }
#mesh-nodes-count { font-size: 1.2em; }

#chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: rgba(0,0,0,0.2); }
.msg { padding: 10px 15px; border-radius: 12px; max-width: 80%; font-size: 0.9em; line-height: 1.4; }
.msg.system { align-self: center; background: rgba(255,255,255,0.1); color: var(--text-muted); font-size: 0.8em; text-align: center; max-width: 90%; }
.msg.user { align-self: flex-end; background: var(--primary); color: black; font-weight: 600; }
.msg.peer { align-self: flex-start; background: var(--border-color); color: var(--text-main); }

.chat-input-area { padding: 15px; display: flex; gap: 10px; border-top: 1px solid var(--border-color); background: var(--panel-bg); }
#chat-input { flex: 1; background: rgba(0,0,0,0.3); border: 1px solid var(--border-color); border-radius: 10px; padding: 10px 15px; color: white; outline: none; }
#send-msg-btn { background: var(--primary); border: none; width: 45px; border-radius: 10px; cursor: pointer; color: black; }

/* EARLY WARNING OVERLAY */
#early-warning-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 1000000; display: none; align-items: center; justify-content: center; }
.warning-card { background: #000; border: 4px solid var(--danger); border-radius: 30px; padding: 40px; text-align: center; box-shadow: 0 0 100px rgba(255, 71, 87, 0.5); width: 90%; max-width: 400px; animation: flash-bg 1s infinite; }
@keyframes flash-bg { 0%, 100% { border-color: var(--danger); } 50% { border-color: white; } }

.timer-ring { position: relative; width: 100px; height: 100px; margin: 0 auto 20px; }
.timer-ring svg { width: 100px; height: 100px; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke: var(--danger); stroke-width: 8; stroke-dasharray: 283; stroke-dashoffset: 0; }
#countdown-val { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 3em; font-family: var(--font-head); font-weight: 700; color: var(--danger); }

.warning-text h2 { font-family: var(--font-head); color: white; margin-bottom: 10px; font-size: 1.8em; }
#warning-meta { color: var(--text-muted); margin-bottom: 20px; }
.safety-instructions { background: var(--danger); color: white; padding: 15px; border-radius: 10px; font-weight: 900; font-size: 1.2em; letter-spacing: 2px; }

/* PANEL */
#info-panel { position: absolute; bottom: 0; left: 0; right: 0; height: var(--panel-expanded-height); background: var(--panel-bg); border-top: 1px solid var(--border-color); border-top-left-radius: 24px; border-top-right-radius: 24px; display: flex; flex-direction: column; transition: height 0.4s cubic-bezier(0.19, 1, 0.22, 1); z-index: 2000; }
#info-panel.panel-collapsed { height: var(--panel-collapsed-height); }
.panel-handle { height: var(--panel-collapsed-height); flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 0 25px; cursor: pointer; border-bottom: 1px solid var(--border-color); position: relative; }
#panel-chevron { position: absolute; right: 25px; color: var(--text-muted); transition: transform 0.4s; }
#info-panel.panel-collapsed #panel-chevron { transform: rotate(180deg); }
#log-list-container { flex: 1; overflow-y: auto; padding: 10px 0; position: relative; }
.log-item { padding: 15px 25px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: background 0.3s; }
.log-item.new-quake { animation: flash-green 2s ease; background: rgba(0, 255, 157, 0.1); }
@keyframes flash-green { 0% { background: rgba(0, 255, 157, 0.4); } 100% { background: transparent; } }
.empty-state { text-align: center; color: var(--text-muted); margin-top: 30px; }

/* DEMO PANEL */
#demo-panel { position: fixed; top: 70px; right: 15px; width: 250px; background: rgba(0,0,0,0.95); border: 1px solid var(--primary); border-radius: 16px; z-index: 100000; padding: 20px; display: none; flex-direction: column; gap: 12px; backdrop-filter: blur(15px); box-shadow: 0 10px 50px rgba(0,0,0,0.8); border-top-right-radius: 4px; }
.demo-header { font-family: var(--font-head); font-weight: 700; color: var(--primary); font-size: 1.1em; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; padding-bottom: 12px; }
#close-demo { background: none; border: none; color: white; cursor: pointer; font-size: 1.2em; padding: 5px; }
.demo-btns { display: flex; flex-direction: column; gap: 10px; }
.demo-btns button { background: #1a1a1a; border: 1px solid #333; color: #fff; padding: 10px; border-radius: 8px; cursor: pointer; font-size: 0.85em; text-align: left; transition: all 0.2s; font-weight: 600; }
.demo-btns button:hover { background: var(--primary); color: black; border-color: var(--primary); transform: translateX(5px); }

/* Animation for the Flask icon in header */
#demo-toggle-btn i { animation: flask-pulse 2s infinite; }
@keyframes flask-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Fix for re-login issue: ensure start screen stays hidden once started */
body.system-active #start-screen { display: none !important; pointer-events: none !important; opacity: 0 !important; }

/* RECENTER */
#recenter-btn { position: absolute; bottom: calc(var(--panel-expanded-height) + 20px); right: 20px; width: 50px; height: 50px; border-radius: 50%; background: var(--panel-bg); border: 1px solid var(--border-color); color: var(--primary); font-size: 1.4em; display: flex; align-items: center; justify-content: center; z-index: 1500; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.3); transition: bottom 0.4s; }
#info-panel.panel-collapsed ~ #recenter-btn { bottom: calc(var(--panel-collapsed-height) + 20px); }
#info-panel.panel-collapsed ~ .felt-btn { bottom: calc(var(--panel-collapsed-height) + 20px); }

/* ALARM */
#alarm-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(220, 20, 60, 0.95); z-index: 999999; display: none; flex-direction: column; align-items: center; justify-content: center; animation: flash 0.5s infinite; }
.alarm-box { text-align: center; color: white; }
.alarm-icon { font-size: 5rem; margin-bottom: 20px; animation: shake 0.5s infinite; }
#alarm-mag { font-size: 7rem; font-weight: 900; line-height: 1; font-family: var(--font-head); }
#alarm-loc { font-size: 1.5em; margin: 10px 0; max-width: 300px; }
.btn-outline { background: transparent; border: 3px solid white; color: white; padding: 15px 40px; border-radius: 50px; margin-top: 40px; font-weight: 700; font-size: 1.2em; cursor: pointer; }
@keyframes flash { 0%, 100% { background: rgba(220, 20, 60, 0.95); } 50% { background: rgba(30, 30, 46, 0.95); } }
@keyframes shake { 0% { transform: rotate(0deg); } 25% { transform: rotate(5deg); } 75% { transform: rotate(-5deg); } 100% { transform: rotate(0deg); } }
@keyframes popIn { from { opacity: 0; transform: translateY(-10px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* SKELETON / LOADING */
.skeleton-loader { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: var(--panel-bg); z-index: 10; display: none; flex-direction: column; }
.skeleton-loader.active { display: flex; }
.skeleton-item { height: 60px; margin: 15px 25px; background: rgba(255, 255, 255, 0.05); border-radius: 8px; position: relative; overflow: hidden; }
.skeleton-item::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; transform: translateX(-100%); background-image: linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,0.05) 20%, rgba(255,255,255,0.1) 60%, rgba(255,255,255,0)); animation: shimmer 2s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* DETAIL PANEL & TEXT MODALS */
#detail-panel { position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel-bg); border-top-left-radius: 24px; border-top-right-radius: 24px; box-shadow: 0 -10px 40px rgba(0,0,0,0.4); backdrop-filter: blur(20px); z-index: 3000; transform: translateY(100%); transition: transform 0.4s; padding: 20px; border-top: 1px solid var(--border-color); }
#detail-panel.active { transform: translateY(0); }
.sheet-handle { width: 40px; height: 5px; background: var(--border-color); border-radius: 5px; margin: 0 auto 20px auto; }
.sheet-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.sheet-header h2 { margin: 0; font-size: 1.4em; font-family: var(--font-head); width: 85%; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.sheet-actions { display: flex; gap: 15px; }
.action-btn { flex: 1; padding: 15px; border: none; border-radius: 12px; background: var(--primary); color: #000; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: 0.2s; }
.action-btn.outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }

/* Text Modals */
.text-modal .modal-content { max-width: 500px; }
.text-content { max-height: 60vh; overflow-y: auto; background: rgba(0,0,0,0.1); border-radius: 8px; padding: 15px; border: 1px solid var(--border-color); line-height: 1.6; user-select: text; }
.text-content p { margin-top: 0; }
.modal-version { text-align: center; font-size: 0.8em; color: var(--text-muted); opacity: 0.6; margin: 20px 0 5px 0; }

/* TOAST NOTIFICATION */
#toast-container { position: fixed; top: 80px; right: 15px; z-index: 9999; pointer-events: none; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel-bg); color: var(--text-main); padding: 12px 20px; border-radius: 50px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); backdrop-filter: blur(10px); border: 1px solid var(--border-color); font-size: 0.9em; font-weight: 600; opacity: 0; transform: translateX(20px); transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: auto; }
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-color: var(--primary); color: var(--primary); }
.toast-error { border-color: var(--danger); color: var(--danger); }
.toast-info { border-color: var(--text-muted); color: var(--text-muted); }

/* DUAL-WAVE ANIMATION (YENİ) */
.seismic-wave-icon { background: transparent !important; border: none !important; overflow: visible !important; pointer-events: none; }
.wave-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; opacity: 0; border-style: solid; box-sizing: border-box; }

/* P-Wave (Primary - Hızlı - Sarı) */
.p-wave { animation: p-wave-anim 2s ease-out infinite; border-width: 4px; border-color: var(--warning); }
@keyframes p-wave-anim { 
    0% { width: 0; height: 0; opacity: 0.8; } 
    100% { width: 300px; height: 300px; opacity: 0; } 
}

/* S-Wave (Secondary - Yavaş - Kırmızı) */
.s-wave { animation: s-wave-anim 3.5s ease-out infinite; border-width: 6px; border-color: var(--danger); animation-delay: 0.5s; }
@keyframes s-wave-anim { 
    0% { width: 0; height: 0; opacity: 0.9; } 
    100% { width: 200px; height: 200px; opacity: 0; } 
}

/* CUSTOM POPUP */
.leaflet-popup-content-wrapper { background: var(--panel-bg); color: var(--text-main); border-radius: 16px; border: 1px solid var(--border-color); backdrop-filter: blur(10px); padding: 0; overflow: hidden; }
.leaflet-popup-content { margin: 0; padding: 15px; }
.leaflet-popup-tip { background: var(--border-color); }
.map-popup-content { font-family: var(--font-ui); text-align: center; min-width: 180px; }
.popup-header { font-family: var(--font-head); font-size: 1.1em; margin-bottom: 8px; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.popup-meta { display: flex; justify-content: center; gap: 15px; font-size: 0.9em; margin-bottom: 8px; }
.popup-mag { font-weight: 700; font-size: 1.2em; }
.popup-depth { color: var(--text-muted); }
.popup-time { font-size: 0.8em; color: var(--text-muted); margin-bottom: 10px; }
.wave-est { font-size: 0.8em; background: rgba(255,255,255,0.05); padding: 6px; border-radius: 8px; margin-bottom: 10px; border: 1px solid var(--border-color); }
.wave-est strong { color: var(--warning); }
.popup-detail-btn { background: var(--primary); color: #000; border: none; border-radius: 20px; padding: 8px 20px; font-weight: 700; font-size: 0.85em; cursor: pointer; width: 100%; transition: transform 0.2s; }
.popup-detail-btn:active { transform: scale(0.95); }

/* TSUNAMI BANNER */
#tsunami-banner {
    position: fixed; top: var(--header-height); left: 0; right: 0;
    background: #004e92; color: white; padding: 12px; text-align: center;
    font-weight: 700; z-index: 9000; display: none; align-items: center; justify-content: center; gap: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3); border-bottom: 2px solid #00d2ff;
    animation: slideDown 0.5s easeOut;
}
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* INTENSITY MODAL */
.intensity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 10px; }
.intensity-item { 
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-color); 
    padding: 20px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;
    cursor: pointer; transition: 0.2s; color: var(--text-main);
}
.intensity-item:hover { background: var(--primary); color: #000; transform: translateY(-5px); }
.intensity-item i { font-size: 2.2em; }
.intensity-item span { font-weight: 700; font-size: 0.9em; }

/* ANALYTICS */
.stat-box { background: rgba(0,255,157,0.1); border: 1px solid var(--primary); padding: 20px; border-radius: 12px; text-align: center; margin-bottom: 20px; }
.stat-label { font-size: 0.8em; color: var(--text-muted); margin-bottom: 5px; }
.stat-val { font-size: 1.8em; font-weight: 700; font-family: var(--font-head); color: var(--primary); }
.dist-chart { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.chart-bar-row { display: flex; align-items: center; gap: 10px; }
.chart-label { width: 50px; font-size: 0.85em; font-weight: 700; }
.chart-bar-container { flex: 1; height: 12px; background: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden; }
.chart-bar { height: 100%; background: var(--primary); border-radius: 6px; transition: width 1s ease-in-out; }

/* SAFETY ACTIONS (ALARM) */
.safety-actions { display: flex; justify-content: center; gap: 20px; margin: 30px 0; }
.safety-item { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }
.safety-item:nth-child(2) { animation-delay: 0.2s; }
.safety-item:nth-child(3) { animation-delay: 0.4s; }
.safety-item i { font-size: 3em; width: 80px; height: 80px; border: 3px solid white; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.safety-item span { font-weight: 700; font-size: 1.1em; letter-spacing: 2px; }
