/* Results page (.r-) */
body[data-view="results"] { background: var(--c-bg); }

.r-page { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- header ---------- */
.r-head {
  position: sticky; top: 0; z-index: 5;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid #ebebeb;
  padding-top: env(safe-area-inset-top);
}
.r-head-row {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px var(--gutter) 6px;
}
.r-logo-link { text-decoration: none; border-radius: 8px; }
.r-logo { font-size: 30px; }

.r-box {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 14px 0 20px;
  border-radius: var(--radius-pill);
  background: var(--c-bg);
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.22);
}
.r-input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; padding: 0; background: transparent;
  font: inherit; font-size: 16px; color: var(--c-text);
  cursor: default; text-overflow: ellipsis;
}
.r-box-sep { width: 1px; height: 24px; background: var(--c-border); }
.r-box-ico { flex: none; color: var(--c-logo-1); }

.r-tabs {
  display: flex; gap: 22px;
  padding: 2px var(--gutter) 0;
  overflow-x: auto; scrollbar-width: none;
  font-size: 14px; color: var(--c-muted);
}
.r-tabs::-webkit-scrollbar { display: none; }
.r-tab {
  flex: none; padding: 10px 2px 9px;
  border: 0; border-bottom: 3px solid transparent; background: none;
  font: inherit; color: inherit;
  user-select: none;
}
.r-tab:hover { color: var(--c-text); }
.r-tab--on { color: var(--c-logo-1); border-bottom-color: var(--c-logo-1); font-weight: 600; }

@media (min-width: 760px) {
  .r-head-row { flex-direction: row; gap: 28px; padding: 20px 28px 8px; }
  .r-box { max-width: 640px; }
  .r-tabs { padding-left: calc(28px + 136px + 28px); gap: 26px; }
  .r-logo { font-size: 28px; min-width: 136px; justify-content: flex-start; }
}

/* ---------- body ---------- */
.r-main {
  flex: 1; width: 100%;
  padding: 12px var(--gutter) 24px;
}
@media (min-width: 760px) {
  .r-main { max-width: calc(652px + 28px + 136px + 28px); padding-left: calc(28px + 136px + 28px); padding-right: 28px; }
}

.r-stats { margin: 4px 0 18px; font-size: 13px; color: #70757a; }

.r-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 26px; }

.r-item {
  position: relative;
  max-width: 652px;
  overflow-wrap: anywhere;
}
/* highlight glow behind a freshly unlocked result */
.r-item::before {
  content: ""; position: absolute; inset: -12px -10px; z-index: -1;
  border-radius: 18px; pointer-events: none; opacity: 0;
}
.r-page { isolation: isolate; }

.r-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.r-ico {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 16px; line-height: 1;
  background: #f1f3f4; border: 1px solid #e6e8ea;
}
.r-ico-1 { background: #eaf1ff; border-color: #d6e3fd; }
.r-ico-2 { background: #fdeceb; border-color: #f8d6d2; }
.r-ico-3 { background: #fff5dc; border-color: #fbe6ad; }
.r-ico-4 { background: #e8f6ec; border-color: #cdebd6; }
.r-item--gram .r-ico {
  border: 0; padding: 2px;
  background: var(--g-gradient);
}
.r-item--gram .r-ico::before { content: none; }

.r-src { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.r-site { font-size: 14px; color: var(--c-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-url { font-size: 12px; color: #4d5156; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.r-badge {
  margin-left: auto; flex: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: linear-gradient(135deg, var(--c-logo-1), #8a6cf0);
  padding: 3px 9px; border-radius: var(--radius-pill);
  box-shadow: 0 2px 8px rgba(91, 141, 239, 0.35);
}

.r-title {
  display: inline-block; color: var(--c-link); text-decoration: none;
  border-radius: 4px;
}
.r-title::after { content: ""; position: absolute; inset: 0; } /* whole card is tappable */
.r-title:hover .r-h3, .r-title:focus-visible .r-h3 { text-decoration: underline; text-underline-offset: 3px; }
.r-title:focus-visible { outline: none; }
.r-item:has(.r-title:focus-visible)::before { opacity: 1; background: transparent; box-shadow: 0 0 0 3px var(--c-focus); }
.r-visited .r-title { color: var(--c-link-visited); }
.r-h3 { margin: 0; font-size: 20px; font-weight: 400; line-height: 1.3; }
.r-snip { margin: 4px 0 0; font-size: 14px; line-height: 1.58; color: #4d5156; }
.r-seen { margin: 4px 0 0; font-size: 12px; color: #70757a; }

.r-item:active .r-h3 { opacity: 0.75; }

/* ---------- new result entrance ---------- */
.r-new {
  animation: r-in 820ms var(--ease-spring) both;
  animation-delay: calc(var(--d) + 260ms);
}
.r-new::before {
  background: linear-gradient(120deg, rgba(91, 141, 239, 0.16), rgba(245, 184, 46, 0.16) 55%, rgba(232, 87, 74, 0.12));
  animation: r-glow 2600ms var(--ease-out) both;
  animation-delay: calc(var(--d) + 360ms);
}
@keyframes r-in {
  0% { opacity: 0; transform: translateY(22px) scale(0.97); filter: blur(3px); }
  60% { filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}
@keyframes r-glow {
  0% { opacity: 0; transform: scale(0.96); }
  18% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
.r-new .r-badge { animation: r-pop 520ms var(--ease-spring) both; animation-delay: calc(var(--d) + 820ms); }
@keyframes r-pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }

/* ---------- the final "letter" result ---------- */
.r-item--letter { padding: 14px 16px 16px; margin: 0 -4px; border-radius: 18px; background: linear-gradient(135deg, #fff4f6, #fff9ef); border: 1px solid #f9dbe2; }
.r-item--letter::before { inset: -2px; }
.r-item--letter .r-ico { background: #ffe1e8; border-color: #fbc9d5; animation: r-beat 1.8s ease-in-out infinite; }
.r-item--letter .r-title { color: #c2185b; }
.r-item--letter .r-h3 { font-weight: 600; }
.r-item--letter:not(.r-visited) { animation: r-pulse 2.6s ease-in-out infinite; }
.r-item--letter.r-new { animation: r-in 820ms var(--ease-spring) both, r-pulse 2.6s ease-in-out 1.6s infinite; animation-delay: calc(var(--d) + 260ms), calc(var(--d) + 1.4s); }
@keyframes r-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233, 30, 99, 0.0), 0 2px 10px rgba(233, 30, 99, 0.08); }
  50% { box-shadow: 0 0 0 6px rgba(233, 30, 99, 0.08), 0 6px 22px rgba(233, 30, 99, 0.16); }
}
@keyframes r-beat {
  0%, 60%, 100% { transform: scale(1); }
  20% { transform: scale(1.14); }
  40% { transform: scale(0.98); }
}

/* ---------- teaser ---------- */
.r-teaser { margin-top: 30px; max-width: 652px; }
.r-ghost {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 2px 0 0; opacity: 0.55;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.r-ghost-ico { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #eceff1; }
.r-ghost-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }
.r-ghost-lines i {
  display: block; height: 10px; border-radius: 6px;
  background: linear-gradient(90deg, #eceff1 0%, #f6f7f8 40%, #eceff1 80%);
  background-size: 200% 100%;
  animation: r-shimmer 1.8s linear infinite;
}
.r-ghost-lines i:nth-child(1) { width: 38%; }
.r-ghost-lines i:nth-child(2) { width: 82%; height: 14px; }
.r-ghost-lines i:nth-child(3) { width: 66%; }
@keyframes r-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.r-teaser-text {
  display: flex; align-items: center; gap: 6px;
  margin: 6px 0 0; font-size: 13px; color: #80868b;
}
.r-lock { flex: none; color: #9aa0a6; }

.r-done { margin: 34px 0 0; font-size: 14px; color: var(--c-muted); text-align: center; }

/* ---------- footer ---------- */
.r-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  font-size: 13px; color: var(--c-muted);
}
@media (min-width: 760px) {
  .r-foot { padding-left: calc(28px + 136px + 28px); padding-right: 28px; justify-content: flex-start; gap: 24px; }
}

/* ---------- Images tab ---------- */
.r-imgs {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 10px;
  max-width: 900px;
}
@media (min-width: 560px) { .r-imgs { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .r-imgs { grid-template-columns: repeat(4, 1fr); } }
.r-img-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none;
  text-align: left; cursor: zoom-in;
  animation: fade-up 420ms var(--ease-out) both;
}
.r-img-frame {
  display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: 12px;
  background: linear-gradient(100deg, #eef0f2 30%, #f7f8f9 50%, #eef0f2 70%);
  background-size: 300% 100%; animation: r-shimmer 1.4s linear infinite;
}
.r-img-tile.is-loaded .r-img-frame { animation: none; background: #eef0f2; }
.r-img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 400ms, transform 400ms var(--ease-out);
}
.r-img-tile.is-loaded .r-img { opacity: 1; }
.r-img-tile:hover .r-img { transform: scale(1.04); }
.r-img-src { font-size: 12px; color: #4d5156; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }

/* ---------- Videos tab ---------- */
.r-vids { display: flex; flex-direction: column; gap: 22px; max-width: 652px; }
.r-vid-card { display: flex; flex-direction: column; gap: 8px; }
.r-vid-frame { border-radius: 14px; overflow: hidden; background: #000; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12); }
.r-vid { width: 100%; max-height: 70dvh; background: #000; }
.r-vid-title { margin: 0; font-size: 18px; color: var(--c-link); }
.r-vid-src { margin: 0; font-size: 13px; color: #4d5156; }
.r-empty { color: var(--c-muted); font-size: 15px; }

/* ---------- search box ---------- */
.r-input { cursor: text; }
.r-input::-webkit-search-decoration { display: none; }
.r-box:focus-within { box-shadow: 0 1px 10px rgba(32, 33, 36, 0.3); }
.r-box-go { flex: none; display: grid; place-items: center; width: 36px; height: 36px; margin-right: -8px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.r-box-go:active { background: rgba(0, 0, 0, 0.06); }
