:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #667085;
  --primary: #1250e6;
  --primary-dark: #0d46d0;
  --border: #e8eaf2;
  --shadow-soft: 0 6px 18px rgba(41, 47, 76, 0.06);
  --error-bg: #fef2f2;
  --error-text: #b42318;
  --success-bg: #ecfdf3;
  --success-text: #027a48;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body { min-height: 100vh; }

a,
button { color: inherit; font: inherit; }

a { text-decoration: none; }

.feed-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  padding: 18px 16px 10px;
  background:
    radial-gradient(circle at top right, rgba(18, 80, 230, 0.16), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f7f8fd 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: 14px;
}

.topbar__nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.topbar__nav .back-link { justify-self: start; }
.topbar__nav .support-link { justify-self: end; }

.back-link {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.brand--centered {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 0;
}

.brand__logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(18, 80, 230, 0.18);
  flex-shrink: 0;
}

.brand__name {
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.title-strip {
  padding: 14px 16px;
  border-radius: 18px;
  background: #eceff3;
  border: 1px solid #dde3eb;
}

.title-strip h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.feed-filter-strip {
  margin-top: -4px;
}

.feed-filter-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.feed-filter-field__label {
  color: #166534;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.feed-filter-field__control {
  width: 100%;
  min-height: 44px;
  border: 1px solid #0f8d2d;
  border-radius: 14px;
  padding: 0 14px;
  background: #0f8d2d;
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  outline: none;
}

.feed-filter-field__control:focus {
  border-color: #0f8d2d;
  box-shadow: 0 0 0 4px rgba(15, 141, 45, 0.16);
}

.feed-filter-field__control:disabled {
  background: rgba(15, 141, 45, 0.58);
  color: rgba(255, 255, 255, 0.8);
}

.feed-main {
  padding: 18px 16px 124px;
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.screen-message {
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 700;
}

.screen-message--error {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid rgba(180, 35, 24, 0.12);
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed #d5dbe5;
  color: var(--muted);
  text-align: center;
}

.feed-list {
  display: grid;
  gap: 16px;
}

.feed-card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fbfcff;
  overflow: hidden;
}

.feed-card__header {
  padding: 18px 18px 12px;
  display: grid;
  gap: 10px;
}

.feed-card__theme {
  margin: 0;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.feed-card__title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.feed-card__meta {
  display: grid;
  gap: 4px;
  color: #475467;
}

.feed-card__meta p {
  margin: 0;
  line-height: 1.45;
}

.feed-card__media {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

.feed-media-block {
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
}

.feed-media-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.feed-media-block__header h3 {
  margin: 0;
  font-size: 16px;
}

.feed-media-block__link {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.feed-video-frame,
.feed-video-native {
  width: 100%;
  min-height: 420px;
  height: 420px;
  border: 0;
  background: #000;
  display: block;
}

.feed-instagram-wrap {
  padding: 16px;
  display: flex;
  justify-content: center;
  background: #fff;
  overflow-x: auto;
}

.feed-instagram-wrap .instagram-media {
  margin: 0 !important;
  width: 100% !important;
  max-width: 540px !important;
  min-width: 0 !important;
}

.feed-instagram-wrap iframe {
  max-width: 100% !important;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px 24px 0 0;
  background: rgba(35, 48, 70, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 28px rgba(20, 24, 38, 0.18);
  z-index: 30;
}

.bottom-nav__item {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  min-height: 58px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  position: relative;
}

.bottom-nav__item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.bottom-nav__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bottom-nav__label {
  font-size: 11px;
  line-height: 1;
}

.bottom-nav__menu-wrap {
  position: relative;
  display: flex;
  width: 100%;
}

.bottom-nav__menu-wrap .bottom-nav__item {
  width: 100%;
}

.bottom-nav__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  min-width: 220px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(35, 48, 70, 0.98);
  box-shadow: 0 18px 38px rgba(20, 24, 38, 0.22);
  backdrop-filter: blur(16px);
}

.bottom-nav__menu[hidden] {
  display: none !important;
}

.bottom-nav__menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.bottom-nav__menu-item {
  appearance: none;
  display: block;
  border: none;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  padding: 14px 14px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav__menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.bottom-nav__menu-item--current {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  cursor: default;
}

.bottom-nav__menu-item--danger {
  color: #fecaca;
}

.bottom-nav__menu-item--danger:hover {
  background: rgba(185, 28, 28, 0.16);
}

@media (min-width: 768px) {
  .topbar,
  .feed-main {
    max-width: 980px;
    margin: 0 auto;
  }

  .feed-main {
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .topbar__nav {
    grid-template-columns: auto 1fr auto;
  }

  .brand__name {
    font-size: 16px;
  }

  .title-strip h1,
  .feed-card__title {
    font-size: 22px;
  }

  .feed-card__header {
    padding: 16px 16px 12px;
  }

  .feed-card__media {
    padding: 0 16px 16px;
  }

  .feed-media-block__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .feed-video-frame,
  .feed-video-native {
    min-height: 260px;
    height: 260px;
  }
}
