:root {
  color-scheme: dark;
  --ink: #f7f2e8;
  --muted: rgba(247, 242, 232, 0.72);
  --line: rgba(255, 255, 255, 0.24);
  --red: #ef3030;
  --teal: #7ed8c4;
  --gold: #f4c35e;
  --bg: #070b0b;
}

* {
  box-sizing: border-box;
}

html,
body {
  background: #050707;
  color: var(--ink);
  font-family: "Anek Devanagari", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
}

button {
  font: inherit;
}

.app-shell {
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  max-width: 520px;
  overflow: hidden;
  position: relative;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  left: 0;
  margin: 0 auto;
  max-width: 520px;
  padding: max(18px, env(safe-area-inset-top)) 18px 8px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 10;
}

.brand-wrap,
.top-actions {
  align-items: center;
  display: flex;
  gap: 14px;
}

h1 {
  color: #fff;
  font-size: clamp(1.9rem, 8vw, 2.65rem);
  font-weight: 800;
  line-height: 0.95;
  margin: 0;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.65);
}

.plain-icon {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: grid;
  font-size: clamp(1.8rem, 6vw, 2.2rem);
  font-weight: 700;
  height: 38px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.75);
  width: 38px;
}

.plain-icon:disabled {
  cursor: wait;
  opacity: 0.65;
}

.spinning {
  animation: spin 0.8s linear infinite;
}

.feed {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.feed::-webkit-scrollbar {
  display: none;
}

.news-card,
.empty-state {
  background: var(--bg);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
  scroll-snap-align: start;
}

.media-wrap {
  height: 27vh;
  left: 0;
  overflow: hidden;
  position: absolute;
  right: 0;
  top: 0;
}

.hero-image {
  filter: saturate(0.92) contrast(1.05);
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.hero-fallback {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(239, 48, 48, 0.8), rgba(126, 216, 196, 0.55)),
    #1c2525;
  color: #fff;
  display: flex;
  font-size: 3rem;
  font-weight: 800;
  height: 100%;
  justify-content: center;
}

.image-fade {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0%, rgba(0, 0, 0, 0.2) 28%, var(--bg) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.34), transparent 34%, rgba(0, 0, 0, 0.45));
  inset: 0;
  position: absolute;
}

.story-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 23vh 18px max(10px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.meta-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr auto;
  margin-bottom: 10px;
}

.category-pill {
  background: var(--red);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(239, 48, 48, 0.28);
  color: white;
  font-size: clamp(0.82rem, 3.3vw, 1rem);
  font-weight: 700;
  line-height: 1;
  padding: 8px 12px 6px;
}

.meta-row time {
  color: var(--teal);
  font-size: clamp(0.78rem, 3.2vw, 0.98rem);
  font-weight: 600;
  min-width: 0;
  white-space: nowrap;
}

.counter {
  color: #fff;
  font-size: clamp(0.8rem, 3.2vw, 1rem);
  font-weight: 800;
  white-space: nowrap;
}

.story-content {
  min-height: 0;
  overflow: hidden;
  padding: 0 2px 68px;
  scrollbar-width: none;
}

.story-content::-webkit-scrollbar {
  display: none;
}

h2 {
  color: #f5efe4;
  display: block;
  font-size: clamp(1.28rem, 5.1vw, 1.78rem);
  font-weight: 800;
  line-height: 1.24;
  margin: 0;
  padding-top: 0.14em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}

.divider {
  background: var(--line);
  height: 1px;
  margin: 8px 3px 8px;
}

.section-label {
  color: var(--gold);
  font-size: clamp(0.9rem, 3.5vw, 1.08rem);
  font-weight: 700;
  margin: 0 0 5px;
}

.brief {
  color: rgba(247, 242, 232, 0.92);
  font-size: clamp(0.9rem, 3.55vw, 1.07rem);
  font-weight: 500;
  line-height: 1.38;
  margin: 0;
  text-align: justify;
  text-justify: inter-word;
  white-space: pre-line;
  word-spacing: 0.02em;
}

.bottom-nav {
  align-items: end;
  background: linear-gradient(180deg, transparent, rgba(7, 11, 11, 0.72) 28%, rgba(7, 11, 11, 0.98));
  bottom: 0;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 46px 1fr;
  left: 0;
  padding: 22px 14px max(10px, env(safe-area-inset-bottom));
  position: absolute;
  right: 0;
  z-index: 4;
}

.bottom-nav button {
  align-items: center;
  appearance: none;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-size: clamp(0.82rem, 3.25vw, 1rem);
  font-weight: 600;
  gap: 10px;
  height: 40px;
  justify-content: center;
  min-width: 0;
  padding: 0 12px;
}

.bottom-nav button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav .center-nav {
  background: #171b1b;
  border: 2px solid #f2bd55;
  box-shadow: 0 0 0 1px rgba(242, 189, 85, 0.2), 0 8px 26px rgba(0, 0, 0, 0.55);
  color: #f2bd55;
  font-size: 1.72rem;
  height: 48px;
  margin-bottom: -4px;
  padding: 0;
  width: 48px;
}

.empty-state {
  align-content: center;
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 24px;
  text-align: center;
}

.empty-art {
  aspect-ratio: 1;
  background:
    linear-gradient(135deg, rgba(239, 48, 48, 0.92), rgba(126, 216, 196, 0.76)),
    #263c34;
  border-radius: 28px;
  width: min(42vw, 170px);
}

.empty-state p {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
}

.empty-state span {
  color: var(--muted);
  max-width: 280px;
}

.toast {
  background: rgba(18, 22, 22, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  bottom: max(82px, calc(env(safe-area-inset-bottom) + 82px));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  left: 50%;
  opacity: 0;
  padding: 9px 14px 7px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
  z-index: 20;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 390px) {
  .story-panel {
    padding-left: 15px;
    padding-right: 15px;
  }

  h2 {
    font-size: clamp(1.12rem, 5.6vw, 1.48rem);
    line-height: 1.26;
    padding-top: 0.16em;
  }

  .brief {
    font-size: clamp(0.78rem, 3.95vw, 0.92rem);
    line-height: 1.32;
  }

  .bottom-nav {
    grid-template-columns: 1fr 42px 1fr;
  }

  .bottom-nav button {
    height: 38px;
    padding: 0 9px;
  }

  .bottom-nav .center-nav {
    height: 44px;
    width: 44px;
  }
}

@media (min-width: 720px) {
  .app-shell {
    box-shadow: 0 0 70px rgba(0, 0, 0, 0.58);
  }
}
