/* Fixed overlay over the feed: tabs, rail, caption, progress line, burst. */

.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: calc(10px + var(--safe-top)) 16px 0;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.tabs {
  display: flex;
  gap: 20px;
}

.tab {
  min-height: 44px;
  padding: 0 4px;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-faint);
  text-shadow: var(--shadow-text);
  position: relative;
}

.tab[aria-pressed="true"] {
  color: var(--text);
}

.tab[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 24px;
  height: 3px;
  border-radius: 2px;
  background: var(--text);
  transform: translateX(-50%);
}

.topic-filter {
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.875rem;
}

.topic-filter-name {
  min-height: 32px;
  padding: 0 4px 0 14px;
}

.topic-filter-clear {
  min-width: 36px;
  min-height: 32px;
  color: var(--text-muted);
}

.rail {
  position: absolute;
  z-index: 10;
  right: max(8px, var(--safe-right));
  bottom: calc(132px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rail-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: var(--shadow-text);
}

.rail-btn svg {
  width: 48px;
  height: 48px;
  padding: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.rail-btn:active svg {
  transform: scale(0.9);
}

.rail-btn[data-action="known"][aria-pressed="true"] svg {
  background: var(--known);
}

.rail-btn[data-action="saved"][aria-pressed="true"] svg {
  color: #000;
  fill: var(--saved);
  stroke: var(--saved);
  background: rgba(255, 200, 61, 0.2);
}

.caption {
  position: absolute;
  z-index: 10;
  left: calc(16px + var(--safe-left));
  right: calc(84px + var(--safe-right));
  bottom: calc(20px + var(--safe-bottom));
  text-shadow: var(--shadow-text);
}

.topic-chip {
  min-height: 36px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.caption-text {
  margin: 4px 0 0;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.progress {
  position: absolute;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: var(--safe-bottom);
  height: 2px;
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--text);
  transition: width 0.25s ease;
}

.burst-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.burst {
  position: absolute;
  font-size: 88px;
  font-weight: 900;
  color: var(--known);
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  animation: burst 0.8s ease-out forwards;
}

@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-15deg); opacity: 0; }
  20% { transform: translate(-50%, -50%) scale(1.15) rotate(0); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(0.95); opacity: 1; }
  100% { transform: translate(-50%, -110%) scale(1.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .burst { animation: none; opacity: 0.9; }
  .progress-fill, .rail-btn svg { transition: none; }
}

/* Desktop: the rail sits beside the phone-width column once there is room
   (480px column + 2 x 80px rail gutter). */
@media (min-width: 720px) {
  .rail {
    right: -80px;
  }

  .caption {
    right: 16px;
  }

  .panel {
    padding-right: calc(24px + var(--safe-right));
  }
}
