:root {
  --bg: #eaf7ff;
  --surface: #ffffff;
  --surface-blue: #f2fbff;
  --text: #08223a;
  --muted: #67869e;
  --line: #cfe9fb;
  --primary: #148de3;
  --primary-dark: #0a68b9;
  --cyan: #36c4f3;
  --navy: #123b73;
  --shadow: 0 18px 50px rgba(10, 104, 185, 0.16);
}

:root.tg-dark {
  --bg: #0d1826;
  --surface: #162335;
  --surface-blue: #102b42;
  --text: #f3fbff;
  --muted: #9bb8ca;
  --line: #24465f;
  --primary: #36a8f5;
  --primary-dark: #2b8ddd;
  --cyan: #4ed7ff;
  --navy: #d8f0ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(54, 196, 243, 0.3), transparent 36rem),
    linear-gradient(180deg, var(--bg) 0%, #f8fcff 52%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

:root.tg-dark body {
  background:
    radial-gradient(circle at top left, rgba(54, 196, 243, 0.18), transparent 34rem),
    linear-gradient(180deg, #0d1826 0%, #101b2b 58%, #0d1826 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 92px;
}

.topbar,
.section-heading,
.composer-header,
.card-footer,
.search-row,
.composer-actions {
  display: flex;
  align-items: center;
}

.topbar,
.section-heading,
.composer-header,
.card-footer,
.composer-actions {
  justify-content: space-between;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.16;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.32;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button,
.filter-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid rgba(20, 141, 227, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--primary-dark);
  box-shadow: 0 8px 24px rgba(10, 104, 185, 0.1);
}

:root.tg-dark .icon-button,
:root.tg-dark .filter-button,
:root.tg-dark .search-box,
:root.tg-dark .chip,
:root.tg-dark .news-card,
:root.tg-dark .mini-panel,
:root.tg-dark .composer-panel,
:root.tg-dark .bottom-nav {
  background: rgba(22, 35, 53, 0.92);
}

.icon-button span {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff5d7d;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
}

.hero-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(54, 196, 243, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(20, 141, 227, 0.96), rgba(54, 196, 243, 0.9)),
    var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-panel p,
.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.hero-copy h2 {
  max-width: 290px;
  margin: 8px 0 10px;
  font-size: 24px;
}

.status-pill,
.source,
.metric,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.status-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.hero-stats {
  display: grid;
  gap: 10px;
  min-width: 78px;
}

.hero-stats div {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  text-align: center;
}

.hero-stats strong {
  display: block;
  font-size: 22px;
}

.hero-stats span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
}

.search-row {
  margin-top: 18px;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 48px;
  flex: 1;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--primary-dark);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder {
  color: #86a7bc;
}

.chips,
.composer-tools {
  display: flex;
  gap: 8px;
  margin: 14px -16px 0;
  padding: 0 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar,
.composer-tools::-webkit-scrollbar {
  display: none;
}

.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid #cfe9fb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.chip.active {
  border-color: transparent;
  background: var(--primary);
  color: #fff;
}

.section-heading {
  margin: 20px 0 12px;
}

.ghost-button {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-weight: 800;
}

.feed {
  display: grid;
  gap: 12px;
}

.news-card,
.mini-panel,
.composer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 34px rgba(18, 59, 115, 0.08);
}

.news-card {
  padding: 16px;
}

.news-card.featured {
  border-color: rgba(20, 141, 227, 0.38);
  background: linear-gradient(180deg, #ffffff 0%, #f3fbff 100%);
}

:root.tg-dark .news-card.featured,
:root.tg-dark .mini-panel.accent {
  background: linear-gradient(180deg, #162335 0%, #102b42 100%);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #7d9db2;
  font-size: 12px;
  font-weight: 700;
}

.source {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.source-x {
  background: #111827;
}

.source-r {
  background: #ff6a3d;
}

.source-m {
  background: #0a68b9;
}

.news-card p {
  margin-bottom: 14px;
  font-size: 14px;
}

.metric {
  min-width: 0;
  color: #6f91a7;
  font-size: 12px;
  font-weight: 700;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 26px rgba(20, 141, 227, 0.24);
}

.secondary-button {
  border: 1px solid #badff6;
  padding: 0 14px;
  background: #f3fbff;
  color: var(--primary-dark);
}

.workspace-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.mini-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
}

.mini-panel h3 {
  margin-bottom: 3px;
}

.mini-panel p {
  margin-bottom: 0;
  font-size: 13px;
}

.mini-panel.accent {
  background: linear-gradient(135deg, #ffffff, #e9f8ff);
}

.panel-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #dff4ff;
  color: var(--primary-dark);
}

:root.tg-dark .panel-icon,
:root.tg-dark .bottom-nav button.active {
  background: #123653;
}

.composer-panel {
  position: fixed;
  right: max(16px, calc((100vw - 480px) / 2 + 16px));
  bottom: 86px;
  left: max(16px, calc((100vw - 480px) / 2 + 16px));
  z-index: 4;
  display: none;
  padding: 16px;
  transform: translateY(18px);
  opacity: 0;
  transition: 180ms ease;
}

.composer-panel.visible {
  display: block;
  transform: translateY(0);
  opacity: 1;
}

.composer-tools {
  margin: 14px -16px 12px;
}

textarea {
  width: 100%;
  min-height: 176px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  padding: 14px;
  background: var(--surface-blue);
  color: var(--text);
  line-height: 1.55;
}

.composer-actions {
  margin-top: 12px;
}

.bottom-nav {
  position: fixed;
  right: max(12px, calc((100vw - 480px) / 2 + 12px));
  bottom: 12px;
  left: max(12px, calc((100vw - 480px) / 2 + 12px));
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(20, 141, 227, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 46px rgba(18, 59, 115, 0.18);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 54px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #80a3bb;
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav button.active {
  background: #e5f6ff;
  color: var(--primary-dark);
}

.bottom-nav svg {
  width: 19px;
  height: 19px;
  margin-bottom: 3px;
}

@media (min-width: 760px) {
  .app-shell {
    width: min(100%, 960px);
    padding-inline: 24px;
  }

  .hero-panel,
  .feed,
  .workspace-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-copy {
    grid-column: span 1;
  }

  .feed .featured {
    grid-row: span 2;
  }

  .workspace-grid {
    margin-bottom: 20px;
  }
}

@media (max-width: 360px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .card-footer,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
