:root {
  --bg: #050a12;
  --panel: rgba(8, 20, 34, 0.78);
  --ink: #e8fbff;
  --muted: #7ec8d6;
  --cyan: #19e7ff;
  --gold: #f3c14b;
  --line: rgba(25, 231, 255, 0.28);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Noto Sans", "Noto Sans SC", "Noto Sans Arabic", "Noto Sans Devanagari", system-ui, sans-serif;
  --tap: 56px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: #02050a;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(25, 231, 255, 0.12), transparent 55%),
    #02050a;
}
.phone {
  position: relative;
  width: min(430px, 100%);
  min-height: 100dvh;
  padding: calc(10px + var(--safe-t)) 16px calc(108px + var(--safe-b));
  background:
    radial-gradient(220px 220px at 50% 18%, rgba(25, 231, 255, 0.16), transparent 70%),
    linear-gradient(180deg, #07111c 0%, #050a12 55%, #04080e 100%);
  overflow: hidden;
}
.hud-frame {
  pointer-events: none;
  position: absolute;
  inset: 8px;
  border: 1px solid var(--line);
  border-radius: 36px;
  box-shadow: inset 0 0 40px rgba(25, 231, 255, 0.05);
}
.hud-frame:before, .hud-frame:after {
  content: "";
  position: absolute;
  width: 22px; height: 22px;
  border: 2px solid var(--cyan);
}
.hud-frame:before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.hud-frame:after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }

.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 6px 8px 2px;
}
.sig { color: var(--cyan); text-shadow: 0 0 10px rgba(25,231,255,.7); }
.dots { color: var(--gold); letter-spacing: 0.2em; }

.greet { display: flex; gap: 14px; align-items: center; margin: 10px 4px 14px; }
.orb {
  width: 72px; height: 72px; border-radius: 50%;
  border: 2px solid var(--cyan);
  background:
    radial-gradient(circle at 50% 45%, #fff 0 8%, #19e7ff 18%, #046b86 46%, #021018 70%);
  box-shadow: 0 0 24px rgba(25,231,255,.55), inset 0 0 16px rgba(255,255,255,.35);
  animation: pulse 2.6s ease-in-out infinite;
  flex-shrink: 0;
}
.orb.talk { animation: pulse 0.7s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 16px rgba(25,231,255,.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 32px rgba(25,231,255,.8); }
}
.greet-text h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.03em; }
.tag { margin: 4px 0 0; color: var(--muted); font-weight: 700; font-size: 1rem; }
.tag.warn { color: #ffb4a2; }

.langs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.langs::-webkit-scrollbar { display: none; }
.langs button { flex: 0 0 auto; padding: 0 14px; }
.langs button, .chip, .btn, .back, .sheet-close, .tab, .dock button {
  font: inherit; cursor: pointer;
}
.langs button {
  min-height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}
.langs button.on {
  background: rgba(25,231,255,.16);
  border-color: var(--cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(25,231,255,.25);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.tile {
  min-height: 132px;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(18,40,62,.9), rgba(7,16,28,.92));
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0,0,0,.28);
}
.tile i {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(25,231,255,.12);
  color: var(--cyan);
  font-style: normal;
  font-size: 1.2rem;
}
.tile span { font-size: 1.2rem; font-weight: 700; }
.tile.gold i { background: rgba(243,193,75,.14); color: var(--gold); }
.tile:active { transform: scale(0.98); }

.sheet-app {
  position: absolute;
  inset: calc(8px + var(--safe-t)) 8px calc(96px + var(--safe-b));
  background: rgba(4, 10, 18, 0.96);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 12px 14px 16px;
  overflow: auto;
  z-index: 8;
  -webkit-overflow-scrolling: touch;
}
.app-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.app-bar h2 { flex: 1; margin: 0; font-size: 1.25rem; }
.back, .sheet-close {
  min-width: 48px; min-height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 1.4rem;
}
.btn-text {
  background: none; border: 0; color: var(--cyan);
  font: inherit; font-weight: 700; min-height: 44px;
}
.hint { color: var(--muted); font-weight: 700; }
.h { margin: 16px 0 8px; font-size: 1.05rem; color: var(--gold); }

.cities, .chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px;
  scrollbar-width: none;
}
.cities::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.chip, .chips button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 700;
}
.chip.on { background: rgba(25,231,255,.18); border-color: var(--cyan); }

.search-row, .composer, .row-btns { display: flex; gap: 8px; margin: 8px 0 12px; }
.search-row input, .composer input {
  flex: 1; min-width: 0; min-height: var(--tap);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #071320;
  color: var(--ink);
  font: inherit;
  padding: 10px 14px;
}
.btn {
  min-height: var(--tap);
  padding: 10px 16px;
  border-radius: 16px;
  border: 1px solid var(--cyan);
  background: rgba(25,231,255,.16);
  color: #fff;
  font-weight: 700;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.big { width: 100%; min-height: 64px; font-size: 1.25rem; margin-bottom: 10px; }
.btn.full { display: flex; justify-content: center; text-decoration: none; }
.btn:disabled { opacity: .55; }

.feed { display: flex; flex-direction: column; gap: 10px; }
.story, .paper {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  color: inherit;
  font: inherit;
  text-align: left;
  width: 100%;
}
.story h3 { margin: 0 0 8px; font-size: 1.15rem; }
.story .local-sum { margin: 0 0 8px; color: #c9eef5; }
.story .meta { color: var(--muted); font-weight: 700; font-size: .95rem; }
.action-hint { color: var(--cyan); font-weight: 700; margin-top: 8px; }
.paper { min-height: 140px; font-size: 1.15rem; line-height: 1.6; white-space: pre-wrap; }

.chat { display: flex; flex-direction: column; gap: 10px; max-height: 46dvh; overflow: auto; }
.bubble { max-width: 94%; padding: 12px 14px; border-radius: 16px; white-space: pre-wrap; }
.bubble.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.bubble.user { align-self: flex-end; background: rgba(243,193,75,.12); border: 1px solid rgba(243,193,75,.35); }
.bubble .who { display: block; color: var(--cyan); font-size: .85rem; font-weight: 800; }

.bars { display: flex; align-items: end; gap: 8px; height: 160px; margin-top: 14px; padding: 8px; }
.bar {
  flex: 1;
  background: linear-gradient(180deg, var(--cyan), #0a4d5c);
  border-radius: 8px 8px 2px 2px;
  min-height: 8px;
  position: relative;
}
.bar span {
  position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%);
  font-size: .72rem; color: var(--muted); white-space: nowrap;
}
.link-list { display: flex; flex-direction: column; gap: 10px; }
.link-list a {
  display: block;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(12px + var(--safe-b));
  width: min(390px, calc(100% - 24px));
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  gap: 8px;
  background: rgba(6, 14, 24, 0.86);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 8px;
  backdrop-filter: blur(16px);
  z-index: 20;
}
.dock button {
  border: 0; background: transparent; color: var(--muted);
  min-height: 56px; border-radius: 18px;
  display: grid; place-items: center;
}
.dock button.on { color: var(--ink); background: rgba(25,231,255,.1); }
.dock b { font-size: .85rem; }
.dock-orb {
  width: 64px; height: 64px; border-radius: 50% !important;
  background: radial-gradient(circle at 50% 40%, #fff, #19e7ff 30%, #03384a) !important;
  box-shadow: 0 0 18px rgba(25,231,255,.6);
}

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
}
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; width: min(430px, 100%);
  max-height: 88dvh; overflow: auto;
  background: #07111c;
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  padding: 12px 16px calc(24px + var(--safe-b));
  z-index: 50;
}
.sheet[hidden], .sheet-backdrop[hidden], .sheet-app[hidden] { display: none !important; }
.sheet-handle { width: 46px; height: 5px; background: var(--line); border-radius: 99px; margin: 4px auto 12px; }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.sheet-title { margin: 8px 70px 8px 0; font-size: 1.3rem; }
.sheet-meta { color: var(--muted); font-weight: 700; }
.sheet-body { font-size: 1.2rem; line-height: 1.65; white-space: pre-wrap; margin: 10px 0 16px; }
.empty, .error { padding: 16px; text-align: center; font-weight: 700; }
.error { color: #ffb4a2; }
.skeleton {
  height: 92px; border-radius: 18px;
  background: linear-gradient(90deg, #0b1824, #123044, #0b1824);
  background-size: 200% 100%;
  animation: sh 1.2s infinite linear;
}
@keyframes sh { to { background-position: -200% 0; } }

html[dir="rtl"] .tile, html[dir="rtl"] .greet, html[dir="rtl"] .app-bar { text-align: right; }
html[dir="rtl"] .tile { align-items: flex-end; }

@media (min-width: 720px) {
  .phone {
    min-height: 860px;
    height: 860px;
    border-radius: 42px;
    border: 2px solid rgba(25,231,255,.25);
    box-shadow: 0 30px 80px rgba(0,0,0,.5);
  }
}
