:root {
  --chat: #0e1621;
  --header: rgba(23, 33, 43, 0.82);
  --text: #f4f7fb;
  --muted: #8e9eae;
  --accent: #6ec8ff;
  --accent-strong: #2aabee;
  /* Same family as map UAV region highlight (#f97316) — subtle only */
  --threat-orange: #f97316;
  --threat-orange-soft: rgba(249, 115, 22, 0.08);
  --threat-orange-glow: rgba(249, 115, 22, 0.055);
  --threat-amber: rgba(255, 160, 60, 0.045);
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.16);
  --glass-shine: rgba(255, 255, 255, 0.28);
  --danger: #ff8a80;
  --ok: #81c784;
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-btn: 14px;
}

* { box-sizing: border-box; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; opacity: 0.92; }

/* JavaScript fallback remains visible rather than being hidden for crawlers. */
.noscript-fallback {
  position: fixed;
  z-index: 100;
  inset: 50% auto auto 50%;
  width: min(560px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 20px;
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  background: rgba(14, 22, 33, 0.96);
  color: var(--text);
  line-height: 1.55;
  box-shadow: var(--shadow);
}
.hdr-title { margin: 0; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  background: #060a10;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* —— Full-screen live map backdrop (far + blurred) —— */
.bg-map {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
  background: #0a121a;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.bg-map.is-ready {
  opacity: 1;
}
/* Dim / unload GPU work when split map panel is open */
body.map-panel-open .bg-map {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s;
}
/* Smaller internal map, scaled up — cheaper paint + “far away” look */
.bg-map-inner {
  position: absolute;
  width: 62%;
  height: 62%;
  left: 19%;
  top: 19%;
  transform: scale(1.72);
  transform-origin: center center;
  filter: blur(11px) saturate(1.35) brightness(0.92) contrast(1.05);
  will-change: transform;
  backface-visibility: hidden;
}
.bg-map-inner iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0a121a;
  /* Avoid iframe focusing / scroll steal */
  pointer-events: none;
}
.bg-map-fog {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    /* Subtle warm hint (~1/5 of previous) */
    radial-gradient(ellipse 50% 42% at 42% 48%, rgba(249, 115, 22, 0.028), transparent 62%),
    radial-gradient(ellipse 36% 34% at 68% 58%, rgba(255, 140, 50, 0.02), transparent 58%),
    radial-gradient(ellipse 55% 50% at 50% 48%, transparent 0%, rgba(6, 10, 16, 0.22) 55%, rgba(6, 10, 16, 0.68) 100%),
    linear-gradient(180deg, rgba(8, 14, 22, 0.18) 0%, rgba(6, 10, 16, 0.42) 100%);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.32);
}
/* Soft fallback if iframe disabled (save-data / reduced-motion) */
.bg-map.is-fallback {
  opacity: 1;
  background:
    radial-gradient(900px 480px at 50% -8%, rgba(42, 120, 180, 0.28), transparent 60%),
    radial-gradient(700px 400px at 80% 100%, rgba(220, 100, 40, 0.12), transparent 50%),
    linear-gradient(180deg, #0a121a 0%, #060a10 100%);
}
.bg-map.is-fallback .bg-map-inner {
  display: none;
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  overflow: hidden;
}

.workspace {
  width: 100%;
  max-width: 400px;
  height: min(820px, calc(100dvh - 40px));
  height: min(820px, calc(100svh - 40px));
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  transition:
    max-width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    gap 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage.map-open .workspace {
  max-width: min(1440px, 100%);
  gap: 18px;
}

/* —— Phone shell —— */
.phone {
  width: min(400px, 100%);
  height: 100%;
  position: relative;
  flex: 0 0 auto;
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.5));
  transition:
    width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.4s ease;
  z-index: 2;
}

.stage.map-open .phone {
  width: min(380px, 34vw);
  transform: translateX(0);
}

/* —— Map split panel (desktop) —— */
.map-panel {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(40px) scale(0.96);
  pointer-events: none;
  background:
    linear-gradient(160deg, rgba(30, 48, 68, 0.55), rgba(12, 18, 28, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  transition:
    opacity 0.45s ease 0.08s,
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.stage.map-open .map-panel {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

.map-panel-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(40, 58, 78, 0.55), rgba(20, 30, 42, 0.35));
}
.map-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: 0.01em;
}
.map-panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.7);
}
.map-panel-actions {
  display: flex;
  gap: 8px;
}
.map-bar-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(165deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
  color: #9ad8ff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
}
.map-bar-btn:hover { color: #e8f7ff; }
button.map-bar-btn { font-family: inherit; }

.map-frame-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #0a1218;
}
.map-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #0a1218;
}
.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  background: rgba(8, 14, 20, 0.55);
  backdrop-filter: blur(4px);
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.map-loading.hide {
  opacity: 0;
}

.phone-bezel {
  height: 100%;
  border-radius: 42px;
  padding: 11px;
  background:
    linear-gradient(145deg, #3a3d42 0%, #1a1c1f 28%, #0c0d0f 70%, #2a2d32 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  position: relative;
}
.phone-side {
  position: absolute;
  width: 3px;
  background: linear-gradient(180deg, #555, #222 40%, #111);
  border-radius: 2px;
  z-index: 2;
}
.phone-side-l {
  left: -1px;
  top: 120px;
  height: 28px;
  box-shadow: 0 42px 0 #333, 0 78px 0 #333;
}
.phone-side-r {
  right: -1px;
  top: 160px;
  height: 56px;
}
.phone-island {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 108px;
  height: 28px;
  background: #0a0a0a;
  border-radius: 20px;
  z-index: 6;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tg-app {
  height: 100%;
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Cool glass base + very light warm threat tint */
  background:
    radial-gradient(ellipse 90% 55% at 18% 72%, rgba(249, 115, 22, 0.04), transparent 58%),
    radial-gradient(ellipse 70% 48% at 88% 28%, rgba(255, 150, 55, 0.024), transparent 55%),
    linear-gradient(
      165deg,
      rgba(22, 30, 40, 0.48) 0%,
      rgba(14, 18, 26, 0.52) 100%
    );
  backdrop-filter: blur(22px) saturate(1.45);
  -webkit-backdrop-filter: blur(22px) saturate(1.45);
  position: relative;
  isolation: isolate;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Soft orange “region glow” (~1/5 intensity) */
.tg-app::before,
.tg-app::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(32px);
  will-change: transform, opacity;
}
.tg-app::before {
  width: 78%;
  height: 52%;
  left: -12%;
  bottom: 6%;
  background:
    radial-gradient(circle at 40% 45%, rgba(249, 115, 22, 0.11) 0%, rgba(249, 115, 22, 0.036) 42%, transparent 70%);
  opacity: 0.55;
  animation: glow-drift-a 14s ease-in-out infinite alternate;
}
.tg-app::after {
  width: 62%;
  height: 44%;
  right: -14%;
  top: 22%;
  background:
    radial-gradient(circle at 55% 50%, rgba(255, 140, 50, 0.084) 0%, rgba(234, 88, 12, 0.028) 48%, transparent 72%);
  opacity: 0.45;
  animation: glow-drift-b 18s ease-in-out infinite alternate;
}
@keyframes glow-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.4; }
  to   { transform: translate3d(8%, -6%, 0) scale(1.08); opacity: 0.58; }
}
@keyframes glow-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); opacity: 0.32; }
  to   { transform: translate3d(-10%, 8%, 0) scale(1); opacity: 0.48; }
}

/* —— Header liquid glass —— */
.tg-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  /* Desktop phone mockup: space under dynamic island */
  padding: 44px 10px 12px;
  min-height: 92px;
  background: linear-gradient(
    180deg,
    rgba(28, 40, 52, 0.58) 0%,
    rgba(23, 33, 43, 0.45) 100%
  );
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid rgba(255, 170, 90, 0.04);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.14),
    inset 0 -1px 0 rgba(249, 115, 22, 0.02);
  z-index: 3;
}
.hdr-btn, .hdr-link {
  width: 38px;
  height: 38px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none !important;
  flex: 0 0 auto;
  box-shadow: inset 0 1px 0 var(--glass-shine);
}
.hdr-btn[hidden] { display: none; }
.hdr-main { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.hdr-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: radial-gradient(circle at 30% 30%, #3a6a8a, #12202c);
  box-shadow:
    0 0 0 1px var(--glass-border),
    inset 0 1px 0 var(--glass-shine);
  display: grid;
  place-items: center;
}
.hdr-avatar img {
  width: 38px;
  height: 38px;
  display: block;
}
.hdr-titles { min-width: 0; }
.hdr-title {
  font-weight: 650;
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hdr-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* —— Chat: orange threat wash + light pattern over glass —— */
.tg-chat {
  flex: 1 1 auto;
  overflow: auto;
  padding: 14px 12px 18px;
  position: relative;
  z-index: 1;
  -webkit-overflow-scrolling: touch;
  background-color: transparent;
  background-image:
    /* Soft region-like orange patches (~1/5) */
    radial-gradient(ellipse 55% 42% at 22% 78%, rgba(249, 115, 22, 0.055), transparent 62%),
    radial-gradient(ellipse 48% 36% at 78% 38%, rgba(255, 145, 55, 0.036), transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 55%, rgba(234, 88, 12, 0.024), transparent 70%),
    radial-gradient(ellipse 80% 50% at 10% 20%, rgba(42, 171, 238, 0.04), transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.03' stroke-width='1'%3E%3Cpath d='M10 30c12-8 20-8 32 0s20 8 32 0 20-8 32 0'/%3E%3Cpath d='M10 60c12-8 20-8 32 0s20 8 32 0 20-8 32 0'/%3E%3Cpath d='M10 90c12-8 20-8 32 0s20 8 32 0 20-8 32 0'/%3E%3Ccircle cx='24' cy='22' r='1.2' fill='%23ffffff' fill-opacity='0.03' stroke='none'/%3E%3Ccircle cx='78' cy='48' r='1' fill='%23ffffff' fill-opacity='0.03' stroke='none'/%3E%3Ccircle cx='52' cy='88' r='1.3' fill='%23ffffff' fill-opacity='0.03' stroke='none'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, auto, auto, 120px 120px;
}

/* Custom scrollbar */
.tg-chat {
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 200, 255, 0.35) transparent;
}
.tg-chat::-webkit-scrollbar {
  width: 6px;
}
.tg-chat::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}
.tg-chat::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(110, 200, 255, 0.45), rgba(42, 171, 238, 0.25));
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.tg-chat::-webkit-scrollbar-thumb:hover {
  background: rgba(110, 200, 255, 0.55);
}

.msg {
  max-width: 100%;
  margin: 0 0 10px;
  animation: rise 0.18s ease-out;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.bubble {
  display: block;
  width: 100%;
  background: linear-gradient(
    155deg,
    rgba(48, 64, 82, 0.52) 0%,
    rgba(24, 36, 50, 0.58) 100%
  );
  backdrop-filter: blur(16px) saturate(1.35);
  -webkit-backdrop-filter: blur(16px) saturate(1.35);
  border: 1px solid rgba(255, 190, 120, 0.04);
  border-radius: 16px 16px 16px 6px;
  padding: 11px 13px 9px;
  box-shadow:
    0 8px 22px rgba(0, 0, 0, 0.2),
    0 0 28px rgba(249, 115, 22, 0.012),
    inset 0 1px 0 var(--glass-shine);
  font-size: 14.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble b, .bubble strong { font-weight: 700; color: #fff; }
.bubble i, .bubble em { color: #b0c0d0; font-style: italic; }
.bubble a { text-decoration: none !important; color: var(--accent); }
.bubble .time {
  display: block;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  margin-top: 7px;
}

/* —— Liquid glass buttons —— */
.kb {
  margin-top: 8px;
  display: grid;
  gap: 7px;
}
.kb-row {
  display: grid;
  gap: 7px;
}
.kb-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-btn);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 200, 140, 0.016) 38%,
    rgba(18, 36, 54, 0.28) 100%
  );
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  color: #b8e6ff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 10px;
  cursor: pointer;
  text-align: center;
  text-decoration: none !important;
  line-height: 1.25;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.16),
    0 0 24px rgba(249, 115, 22, 0.016);
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.kb-btn:hover {
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 170, 90, 0.024) 42%,
    rgba(30, 55, 80, 0.38) 100%
  );
  color: #c5ecff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 0 28px rgba(249, 115, 22, 0.028);
}
.kb-btn:active {
  transform: scale(0.985);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.kb-btn.on {
  color: #e8f7ff;
  border-color: rgba(110, 200, 255, 0.4);
  background: linear-gradient(
    165deg,
    rgba(80, 180, 240, 0.35) 0%,
    rgba(42, 120, 180, 0.28) 50%,
    rgba(20, 50, 80, 0.4) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 0 0 1px rgba(42, 171, 238, 0.15),
    0 8px 20px rgba(42, 171, 238, 0.12);
}
.kb-btn.danger { color: #ffb4ae; }
.kb-btn.muted { color: var(--muted); }

.list-card {
  background: var(--glass);
  border-radius: 12px;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid var(--line);
}
.badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(42, 171, 238, 0.15);
  color: #9ad6ff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: linear-gradient(165deg, rgba(50, 70, 90, 0.95), rgba(30, 42, 56, 0.95));
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

.loading {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 4px;
}

/* —— Bottom nav —— */
.tg-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--glass-border);
  background: linear-gradient(
    180deg,
    rgba(23, 33, 43, 0.75) 0%,
    rgba(18, 26, 34, 0.92) 100%
  );
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  padding: 8px 6px 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  z-index: 3;
}
.tg-footer button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: -0.01em;
  padding: 7px 2px 5px;
  cursor: pointer;
  border-radius: 12px;
  text-decoration: none;
  line-height: 1.15;
}
.tg-footer button.active {
  color: var(--accent);
  background: rgba(42, 171, 238, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.tg-footer .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  color: inherit;
}
.tg-footer .ico .ico-svg {
  width: 20px;
  height: 20px;
}

/* Line icons */
.ico-svg {
  display: inline-block;
  vertical-align: -0.2em;
  flex: 0 0 auto;
  color: #8eb6d4;
}
.kb-btn .ico-svg {
  color: #7eb8dc;
}
.kb-btn.on .ico-svg {
  color: #c8ebff;
}
.kb-btn.danger .ico-svg {
  color: #ffb0aa;
}
.bubble .ico-svg {
  color: #8eb6d4;
  margin-right: 4px;
}
.inline-ico {
  display: inline-flex;
  vertical-align: -2px;
  margin-right: 2px;
}
.kb-btn.has-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.kb-btn .kb-label {
  min-width: 0;
}
.kb-btn.ico-only {
  min-width: 46px;
  padding-left: 10px;
  padding-right: 10px;
  gap: 0;
}

/* Full-bleed on mobile / tablet portrait — real browser chrome, no fake phone chrome */
@media (max-width: 960px) {
  html, body {
    height: 100%;
    height: 100dvh;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
    background: #060a10;
  }

  /* Mobile: same subtle orange (~1/5) */
  .bg-map-fog {
    background:
      radial-gradient(ellipse 55% 48% at 40% 52%, rgba(249, 115, 22, 0.04), transparent 65%),
      radial-gradient(ellipse 45% 40% at 70% 60%, rgba(255, 140, 50, 0.028), transparent 60%),
      radial-gradient(ellipse 70% 60% at 50% 45%, transparent 0%, rgba(6, 10, 16, 0.28) 50%, rgba(6, 10, 16, 0.72) 100%),
      linear-gradient(180deg, rgba(8, 14, 22, 0.22), rgba(6, 10, 16, 0.5));
  }
  .bg-map-inner {
    filter: blur(9px) saturate(1.3) brightness(0.9) contrast(1.05);
  }

  .tg-app::before {
    opacity: 0.5;
    width: 90%;
    height: 58%;
  }
  .tg-app::after {
    opacity: 0.4;
  }

  .stage {
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: 100svh;
    max-height: 100dvh;
    max-height: 100svh;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
  }

  .workspace {
    max-width: none;
    width: 100%;
    height: 100%;
    min-height: 0;
  }

  .stage.map-open .workspace {
    max-width: none;
    gap: 0;
  }

  .phone {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    filter: none;
    transform: none !important;
  }

  .stage.map-open .phone {
    width: 100% !important;
  }

  .phone-bezel {
    height: 100%;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .phone-side,
  .phone-island {
    display: none !important;
  }

  .tg-app {
    height: 100%;
    min-height: 0;
    border-radius: 0;
    border: 0;
    background: linear-gradient(
      180deg,
      rgba(14, 22, 33, 0.48) 0%,
      rgba(10, 16, 24, 0.55) 100%
    );
  }

  /* No Dynamic Island gap — only real notch safe-area */
  .tg-header {
    padding: max(6px, env(safe-area-inset-top, 0px)) 8px 8px;
    min-height: 0;
  }

  .tg-chat {
    flex: 1 1 auto;
    min-height: 0;
    /* room so last buttons aren’t under home indicator */
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .tg-footer {
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  }

  .map-panel {
    display: none !important;
  }
}

/* Low-power / reduced motion: skip heavy blur on map host */
@media (prefers-reduced-motion: reduce) {
  .bg-map-inner {
    filter: blur(6px) saturate(1.1) brightness(0.9);
    transform: scale(1.5);
  }
  .tg-app::before,
  .tg-app::after {
    animation: none;
    filter: blur(20px);
  }
}

/* Very short screens (landscape phone / browser bars) */
@media (max-width: 960px) and (max-height: 500px) {
  .tg-header {
    padding-top: max(4px, env(safe-area-inset-top, 0px));
    padding-bottom: 4px;
  }
  .hdr-avatar {
    width: 34px;
    height: 34px;
  }
  .hdr-avatar img {
    width: 30px;
    height: 30px;
  }
  .tg-footer button {
    font-size: 10px;
    padding: 4px 2px;
  }
}
