:root {
  --tt-accent: var(--accent, #5d5dff);
  --tt-text: var(--contrast, #101828);
  --tt-muted: #667085;
  --tt-border: #e8ecf3;
  --tt-soft: #f7f9fc;
  --tt-soft-2: #f3f6fb;
  --tt-white: #fff;
  --tt-success: #157347;
  --tt-success-bg: #ecfdf3;
  --tt-error: #b42318;
  --tt-error-bg: #fff1f0;
  --tt-radius: 16px;
  --tt-shadow: 0 10px 30px rgba(15, 23, 42, .04);
}

.ttpv {
  width: 100%;
  color: var(--tt-text);
  font: inherit;
}

.ttpv *, .ttpv *::before, .ttpv *::after { box-sizing: border-box; }
.ttpv a { text-decoration: none; }
.ttpv button, .ttpv input { font: inherit; }
.ttpv button { -webkit-tap-highlight-color: transparent; }

/* Search tool */
.ttpv .tt-tool-shell {
  width: 100%;
  padding: 18px;
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  background: var(--tt-white);
  box-shadow: var(--tt-shadow);
}

.ttpv form.tt-form {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: 0;
}

.ttpv .tt-input-wrap { position: relative; min-width: 0; }
.ttpv .tt-search-icon {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 20px;
  height: 20px;
  transform: translateY(-50%);
  color: #98a2b3;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}

.ttpv .tt-input {
  width: 100%;
  height: 56px;
  padding: 0 18px 0 48px;
  border: 1px solid #dfe4ec;
  border-radius: 12px;
  outline: 0;
  background: var(--tt-white);
  color: var(--tt-text) !important;
  font-size: 15px;
  font-weight: 400;
  text-transform: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ttpv .tt-input::placeholder { color: #98a2b3 !important; opacity: 1; }
.ttpv .tt-input:focus {
  border-color: var(--tt-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tt-accent) 14%, transparent);
}
.ttpv .tt-input:-webkit-autofill {
  -webkit-text-fill-color: var(--tt-text);
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
}

.ttpv .tt-btn, .ttpv .tt-load {
  border: 0;
  border-radius: 12px;
  background: var(--tt-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
}
.ttpv .tt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 158px;
  height: 56px;
  padding: 0 20px;
}
.ttpv .tt-btn-arrow { font-size: 18px; line-height: 1; transition: transform .15s ease; }
.ttpv .tt-btn:not([disabled]):hover .tt-btn-arrow { transform: translateX(3px); }
.ttpv .tt-btn:not([disabled]):hover, .ttpv .tt-load:not([disabled]):hover { opacity: .9; }
.ttpv .tt-btn:not([disabled]):active, .ttpv .tt-load:not([disabled]):active { transform: translateY(1px); }
.ttpv .tt-btn[disabled], .ttpv .tt-load[disabled] { opacity: .48; cursor: default; }

.ttpv .tt-form-note {
  margin: 10px 2px 0;
  color: var(--tt-muted);
  font-size: 13px;
  line-height: 1.5;
}

.ttpv .tt-ts-fly {
  position: absolute;
  right: 0;
  top: 66px;
  z-index: 20;
  display: none;
  padding: 8px;
  border: 1px solid var(--tt-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .12);
}
.ttpv .tt-ts-fly.show { display: block; }

/* Shared cards and messages */
.ttpv .tt-card {
  border: 1px solid var(--tt-border);
  border-radius: var(--tt-radius);
  background: var(--tt-white);
  box-shadow: var(--tt-shadow);
}
.ttpv .tt-sep { height: 1px; margin: 18px 0; background: var(--tt-border); }

.ttpv .tt-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 10020;
  display: none;
  min-width: 220px;
  max-width: min(90vw, 430px);
  padding: 12px 16px;
  transform: translateX(-50%);
  border: 1px solid transparent;
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 14px 40px rgba(15, 23, 42, .12);
}
.ttpv .tt-toast.ok { border-color: #abefc6; background: var(--tt-success-bg); color: var(--tt-success); }
.ttpv .tt-toast.err { border-color: #fecdca; background: var(--tt-error-bg); color: var(--tt-error); }

/* Profile result */
.ttpv #tt-results { margin-top: 22px; overflow: hidden; }
.ttpv .tt-profile {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border-bottom: 1px solid var(--tt-border);
}
.ttpv .tt-avatar-wrap {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  overflow: hidden;
  border: 1px solid var(--tt-border);
  border-radius: 16px;
  background: var(--tt-soft);
}
.ttpv .tt-avatar-wrap img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ttpv .tt-avatar-dl {
  position: absolute;
  right: 6px;
  bottom: 6px;
  left: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  color: var(--tt-accent);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}
.ttpv .tt-profile > div:last-child { flex: 1 1 auto; min-width: 0; }
.ttpv .tt-profile h3 {
  margin: 0;
  color: var(--tt-text);
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.ttpv .tt-profile p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--tt-muted);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.ttpv .tt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 22px 22px;
  background: var(--tt-soft);
  border-bottom: 1px solid var(--tt-border);
}
.ttpv .kpi {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--tt-border);
  border-radius: 14px;
  background: #fff;
}
.ttpv .kpi .ic {
  display: flex;
  flex: 0 0 40px;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--tt-soft-2);
  color: var(--tt-accent);
}
.ttpv .kpi .ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.ttpv .kpi .v { color: var(--tt-text); font-size: 16px; line-height: 1.2; font-weight: 600; }
.ttpv .kpi .l { margin-top: 4px; color: var(--tt-muted); font-size: 12px; line-height: 1.35; }
.ttpv .kpi .badge {
  position: absolute;
  top: 9px;
  right: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tt-accent) 10%, #fff);
  color: var(--tt-accent);
}
.ttpv .kpi .badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; }
.ttpv #kpi-peak:hover { border-color: var(--tt-accent); }

.ttpv .tt-content-head { padding: 22px 22px 14px; }
.ttpv .tt-content-head h4 { margin: 0; color: var(--tt-text); font-size: 18px; line-height: 1.3; font-weight: 600; }
.ttpv .tt-content-head p { margin: 5px 0 0; color: var(--tt-muted); font-size: 13px; line-height: 1.5; }

.ttpv .tt-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 0 22px 22px;
}
.ttpv .tt-item {
  display: flex;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--tt-border);
  border-radius: 14px;
  background: var(--tt-soft);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.ttpv .tt-item:hover { transform: translateY(-2px); border-color: var(--tt-accent); }
.ttpv .tt-thumb { position: relative; width: 100%; aspect-ratio: 3 / 4; overflow: hidden; background: #eef1f5; }
.ttpv .tt-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 0; transition: transform .25s ease; }
.ttpv .tt-item:hover .tt-thumb img { transform: scale(1.025); }
.ttpv .tt-play {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 50%;
  background: rgba(15, 23, 42, .55);
  color: #fff;
  backdrop-filter: blur(5px);
}
.ttpv .tt-play svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.ttpv .tt-info, .ttpv .tt-metrics { display: none !important; }
.ttpv .tt-pin-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 2;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--tt-accent);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  pointer-events: none;
}
.ttpv .tt-views-badge {
  position: absolute;
  bottom: 9px;
  left: 9px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 9px;
  background: rgba(15, 23, 42, .62);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  backdrop-filter: blur(5px);
  pointer-events: none;
}
.ttpv .tt-views-badge .tt-views-ic { display: flex; }
.ttpv .tt-views-badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.ttpv .tt-load {
  position: relative;
  left: 50%;
  min-height: 44px;
  margin: 0 0 22px;
  padding: 0 22px;
  transform: translateX(-50%);
  font-size: 14px;
}
.ttpv .tt-load:not([disabled]):active { transform: translateX(-50%) translateY(1px); }

/* Single-link result */
.ttpv #tt-video-result { margin-top: 22px; padding: 18px; overflow: hidden; }
.ttpv .tt-vr-wrap { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 14px; border-radius: 13px; background: var(--tt-soft); }
.ttpv #tt-vr-video, .ttpv #tt-vr-photo { display: block; max-width: 100%; max-height: min(56vh, 540px); border-radius: 10px; background: #111; object-fit: contain; }
.ttpv .tt-vr-title { margin: 15px 2px 12px; color: var(--tt-text); font-size: 15px; line-height: 1.55; font-weight: 500; overflow-wrap: anywhere; }
.ttpv .tt-vr-metrics, .ttpv .tt-lb-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.ttpv .tt-vr-metrics .tt-mx, .ttpv .tt-lb-metrics .tt-mx {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px;
  border: 1px solid var(--tt-border);
  border-radius: 10px;
  background: var(--tt-soft);
  color: var(--tt-muted);
  font-size: 13px;
  font-weight: 500;
}
.ttpv .tt-vr-metrics svg, .ttpv .tt-lb-metrics svg { width: 16px; height: 16px; fill: none; stroke: currentColor; }
.ttpv .tt-vr-dl, .ttpv .tt-lb-dl { display: flex; gap: 9px; margin-top: 12px; }
.ttpv .tt-vr-dl a, .ttpv .tt-lb-dl a, .ttpv .tt-story-bottom a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 9px 13px;
  border-radius: 10px;
  background: var(--tt-accent);
  color: #fff;
  text-align: center;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
}

/* Post and story dialogs */
.ttpv .tt-lightbox, .ttpv .tt-storybox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, .68);
  backdrop-filter: blur(6px);
}
.ttpv .tt-storybox { z-index: 10002; }
.ttpv .tt-lightbox.active, .ttpv .tt-storybox.active { display: flex; }
.ttpv .tt-lb-card, .ttpv .tt-story-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(94vw, 540px);
  max-height: 90vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--tt-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}
.ttpv #tt-video, .ttpv #tt-photo, .ttpv #tt-story-video, .ttpv #tt-story-photo {
  display: block;
  width: 100%;
  max-height: min(52vh, 500px);
  border-radius: 12px;
  background: #101828;
  object-fit: contain;
}
.ttpv #tt-photo { display: none; }
.ttpv .tt-lb-title, .ttpv .tt-story-title { margin: 2px 1px 0; color: var(--tt-text); font-size: 14px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
.ttpv .tt-lb-title .more { margin-left: 4px; color: var(--tt-accent); cursor: pointer; font-weight: 600; }
.ttpv .tt-dots { display: none; align-items: center; justify-content: center; gap: 5px; margin: 1px 0; }
.ttpv .tt-dots .dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #d0d5dd;
}
.ttpv .tt-dots .dot.active { width: 20px; background: var(--tt-accent); }
.ttpv .tt-x, .ttpv .tt-nav, .ttpv .tt-story-x, .ttpv .tt-story-nav {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.48);
  border-radius: 10px;
  background: rgba(15, 23, 42, .58);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(5px);
}
.ttpv .tt-x, .ttpv .tt-story-x { top: 22px; right: 22px; }
.ttpv .tt-nav.prev, .ttpv .tt-story-nav.prev { top: 50%; left: 22px; transform: translateY(-50%); }
.ttpv .tt-nav.next, .ttpv .tt-story-nav.next { top: 50%; right: 22px; transform: translateY(-50%); }
.ttpv .tt-story-top { min-width: 0; padding-right: 44px; }
.ttpv .tt-story-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttpv .tt-story-bottom { display: flex; }

.ttpv .tt-avatar-wrap.has-story {
  padding: 3px;
  border-color: transparent;
  background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, var(--tt-accent), #ff6b6b) border-box;
  cursor: pointer;
}

@media (max-width: 980px) {
  .ttpv .tt-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ttpv .tt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ttpv .tt-tool-shell { padding: 14px; border-radius: 14px; }
  .ttpv form.tt-form { grid-template-columns: 1fr; gap: 10px; }
  .ttpv .tt-input, .ttpv .tt-btn { width: 100%; height: 52px; }
  .ttpv .tt-btn { min-width: 0; }
  .ttpv .tt-ts-fly { right: 50%; top: 116px; transform: translateX(50%); }
  .ttpv .tt-form-note { font-size: 12px; }
  .ttpv #tt-results, .ttpv #tt-video-result { margin-top: 18px; border-radius: 14px; }
  .ttpv .tt-profile { align-items: flex-start; gap: 13px; padding: 16px; }
  .ttpv .tt-avatar-wrap { flex-basis: 76px; width: 76px; height: 76px; border-radius: 13px; }
  .ttpv .tt-avatar-dl { right: 4px; bottom: 4px; left: 4px; min-height: 22px; font-size: 9px; }
  .ttpv .tt-profile h3 { font-size: 16px; }
  .ttpv .tt-profile p { margin-top: 5px; font-size: 13px; line-height: 1.5; }
  .ttpv .tt-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px 16px 16px; }
  .ttpv .kpi { gap: 9px; padding: 11px; border-radius: 12px; }
  .ttpv .kpi .ic { flex-basis: 34px; width: 34px; height: 34px; border-radius: 10px; }
  .ttpv .kpi .ic svg { width: 17px; height: 17px; }
  .ttpv .kpi .v { font-size: 14px; }
  .ttpv .kpi .l { font-size: 10px; }
  .ttpv .kpi .badge { top: 6px; right: 6px; width: 18px; height: 18px; }
  .ttpv .tt-content-head { padding: 18px 16px 12px; }
  .ttpv .tt-content-head h4 { font-size: 16px; }
  .ttpv .tt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 0 16px 18px; }
  .ttpv .tt-item { border-radius: 11px; }
  .ttpv .tt-play { width: 34px; height: 34px; }
  .ttpv .tt-pin-badge { top: 7px; left: 7px; }
  .ttpv .tt-views-badge { bottom: 7px; left: 7px; padding: 5px 7px; font-size: 10px; }
  .ttpv #tt-video-result { padding: 12px; }
  .ttpv .tt-vr-wrap { min-height: 170px; padding: 8px; }
  .ttpv .tt-vr-metrics, .ttpv .tt-lb-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ttpv .tt-vr-dl, .ttpv .tt-lb-dl { flex-wrap: wrap; }
  .ttpv .tt-vr-dl a, .ttpv .tt-lb-dl a { flex-basis: 100%; }
  .ttpv .tt-lightbox, .ttpv .tt-storybox { padding: 8px; }
  .ttpv .tt-lb-card, .ttpv .tt-story-card { width: min(97vw, 520px); max-height: 92vh; padding: 10px; border-radius: 14px; }
  .ttpv #tt-video, .ttpv #tt-photo, .ttpv #tt-story-video, .ttpv #tt-story-photo { max-height: 47vh; border-radius: 10px; }
  .ttpv .tt-x, .ttpv .tt-story-x { top: 15px; right: 15px; }
  .ttpv .tt-nav.prev, .ttpv .tt-story-nav.prev { left: 15px; }
  .ttpv .tt-nav.next, .ttpv .tt-story-nav.next { right: 15px; }
}

@media (max-width: 380px) {
  .ttpv .tt-kpi-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .ttpv *, .ttpv *::before, .ttpv *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* V2: distinct profile dashboard */
.ttpv .tt-dashboard {
  display: grid;
  grid-template-columns: minmax(230px, .72fr) minmax(0, 2fr);
  border-bottom: 1px solid var(--tt-border);
  background: var(--tt-soft);
}
.ttpv .tt-dashboard .tt-profile {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  border: 0;
  border-right: 1px solid var(--tt-border);
  background: #fff;
}
.ttpv .tt-dashboard .tt-avatar-wrap {
  flex-basis: 86px;
  width: 86px;
  height: 86px;
  border-radius: 16px;
}
.ttpv .tt-profile-label {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--tt-accent);
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.ttpv .tt-dashboard .tt-kpi-grid {
  align-content: center;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 20px;
  border: 0;
  background: transparent;
}
.ttpv .tt-dashboard .kpi {
  min-height: 76px;
  padding: 13px;
  border-radius: 12px;
}
.ttpv .tt-dashboard .kpi .ic {
  flex-basis: 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
}
.ttpv .tt-dashboard .kpi .ic svg { width: 17px; height: 17px; }

/* V2: vertical, feed-style post viewer */
html.ttpv-feed-open { overflow: hidden; }
.ttpv .tt-lightbox {
  padding: 22px 76px 22px 22px;
  background: rgba(15, 23, 42, .82);
}
.ttpv .tt-lb-card {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(250px, .85fr);
  gap: 0;
  width: min(92vw, 940px);
  height: min(88vh, 760px);
  max-height: 760px;
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
}
.ttpv .tt-feed-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px 0 0 18px;
  background: #090b10;
}
.ttpv #tt-video, .ttpv #tt-photo {
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 0;
  object-fit: contain;
}
.ttpv .tt-feed-stage .tt-dots {
  position: absolute;
  right: 0;
  bottom: 16px;
  left: 0;
  z-index: 3;
}
.ttpv .tt-feed-stage .tt-dots .dot { border: 1px solid rgba(255,255,255,.55); background: rgba(255,255,255,.5); }
.ttpv .tt-feed-stage .tt-dots .dot.active { background: #fff; }
.ttpv .tt-feed-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 64px 24px 24px;
  overflow-y: auto;
  border-radius: 0 18px 18px 0;
  background: #fff;
}
.ttpv .tt-feed-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tt-border);
  color: var(--tt-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.ttpv .tt-feed-kicker span:first-child { color: var(--tt-accent); }
.ttpv .tt-feed-panel .tt-lb-title {
  margin: 18px 0;
  color: var(--tt-text);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 500;
}
.ttpv .tt-feed-panel .tt-lb-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ttpv .tt-feed-panel .tt-lb-metrics .tt-mx { justify-content: flex-start; }
.ttpv .tt-feed-panel .tt-lb-dl { margin-top: auto; padding-top: 18px; flex-direction: column; }
.ttpv .tt-feed-panel .tt-lb-dl a { flex: 0 0 auto; }
.ttpv .tt-feed-help { margin: 13px 0 0; color: #98a2b3; text-align: center; font-size: 11px; line-height: 1.4; }
.ttpv .tt-lb-card > .tt-x {
  top: 16px;
  right: 16px;
  border-color: var(--tt-border);
  background: var(--tt-soft);
  color: var(--tt-text);
  backdrop-filter: none;
}
.ttpv .tt-feed-nav {
  position: absolute;
  top: 50%;
  right: -58px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transform: translateY(-50%);
}
.ttpv .tt-feed-nav .tt-nav {
  position: static;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-size: 21px;
  transform: none;
  backdrop-filter: blur(8px);
}
.ttpv .tt-feed-nav .tt-nav:hover { background: #fff; color: var(--tt-text); }
.ttpv .tt-lb-card.tt-feed-up { animation: ttFeedUp .24s ease-out; }
.ttpv .tt-lb-card.tt-feed-down { animation: ttFeedDown .24s ease-out; }
@keyframes ttFeedUp {
  from { opacity: .45; transform: translateY(22px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ttFeedDown {
  from { opacity: .45; transform: translateY(-22px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 900px) {
  .ttpv .tt-dashboard { grid-template-columns: 1fr; }
  .ttpv .tt-dashboard .tt-profile {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid var(--tt-border);
  }
  .ttpv .tt-dashboard .tt-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ttpv .tt-lb-card { grid-template-columns: minmax(250px, 1fr) minmax(230px, .72fr); }
}

@media (max-width: 700px) {
  .ttpv .tt-lightbox { padding: 0; background: #090b10; }
  .ttpv .tt-lb-card {
    display: flex;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    background: #090b10;
    box-shadow: none;
  }
  .ttpv .tt-feed-stage {
    position: absolute;
    inset: 0;
    border-radius: 0;
  }
  .ttpv .tt-feed-stage::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 46%;
    background: linear-gradient(transparent, rgba(0,0,0,.78));
    pointer-events: none;
  }
  .ttpv .tt-feed-panel {
    position: absolute;
    right: 64px;
    bottom: 0;
    left: 0;
    z-index: 3;
    display: block;
    max-height: 47vh;
    padding: 22px 8px 18px 18px;
    overflow-y: auto;
    border-radius: 0;
    background: transparent;
    color: #fff;
  }
  .ttpv .tt-feed-kicker { justify-content: flex-start; border: 0; color: rgba(255,255,255,.7); }
  .ttpv .tt-feed-kicker span:first-child { color: #fff; }
  .ttpv .tt-feed-kicker span + span::before { content: "•"; margin-right: 10px; }
  .ttpv .tt-feed-panel .tt-lb-title { margin: 9px 0 12px; color: #fff; font-size: 13px; line-height: 1.5; }
  .ttpv .tt-feed-panel .tt-lb-metrics { display: flex; gap: 12px; }
  .ttpv .tt-feed-panel .tt-lb-metrics .tt-mx { min-height: 0; padding: 0; border: 0; background: transparent; color: #fff; font-size: 12px; }
  .ttpv .tt-feed-panel .tt-lb-dl { display: flex; flex-direction: row; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; padding: 0; }
  .ttpv .tt-feed-panel .tt-lb-dl a { flex: 1 1 120px; min-height: 36px; padding: 7px 9px; font-size: 11px; }
  .ttpv .tt-feed-help { display: none; }
  .ttpv .tt-lb-card > .tt-x { top: 14px; right: 14px; border-color: rgba(255,255,255,.35); background: rgba(15,23,42,.52); color: #fff; }
  .ttpv .tt-feed-nav {
    top: auto;
    right: 12px;
    bottom: 25px;
    z-index: 4;
    transform: none;
  }
  .ttpv .tt-feed-nav .tt-nav { width: 44px; height: 44px; }
  .ttpv .tt-feed-stage .tt-dots { bottom: auto; top: 18px; }
}

@media (max-width: 640px) {
  .ttpv .tt-dashboard .tt-profile { padding: 16px; }
  .ttpv .tt-dashboard .tt-avatar-wrap { flex-basis: 72px; width: 72px; height: 72px; }
  .ttpv .tt-dashboard .tt-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px 16px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ttpv .tt-lb-card.tt-feed-up, .ttpv .tt-lb-card.tt-feed-down { animation: none; }
}

/* V2.1: editorial content stream instead of a standard thumbnail gallery */
.ttpv .tt-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  grid-auto-rows: 172px;
  gap: 12px;
}
.ttpv .tt-grid .tt-item {
  position: relative;
  display: block;
  grid-row: span 2;
  min-height: 0;
  border: 0;
  border-radius: 15px;
  background: #101828;
}
.ttpv .tt-grid .tt-item:nth-child(10n + 1),
.ttpv .tt-grid .tt-item:nth-child(10n + 7) {
  grid-column: span 1;
  grid-row: span 2;
}
.ttpv .tt-grid .tt-item::after {
  content: "";
  position: absolute;
  inset: 38% 0 0;
  z-index: 1;
  background: linear-gradient(transparent, rgba(5, 9, 16, .9));
  pointer-events: none;
}
.ttpv .tt-grid .tt-thumb {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  aspect-ratio: auto;
}
.ttpv .tt-grid .tt-info {
  position: absolute;
  right: 13px;
  bottom: 42px;
  left: 13px;
  z-index: 2;
  display: block !important;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ttpv .tt-grid .tt-metrics {
  position: absolute;
  right: 13px;
  bottom: 13px;
  left: 13px;
  z-index: 2;
  display: flex !important;
  justify-content: space-between;
  gap: 5px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.82);
  font-size: 9.5px;
}
.ttpv .tt-grid .tt-mx {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 3px;
  min-width: 0;
  line-height: 1;
  white-space: nowrap;
}
.ttpv .tt-grid .tt-mx svg { flex: 0 0 12px; width: 12px; height: 12px; }
.ttpv .tt-grid .tt-views-badge { display: none; }
.ttpv .tt-grid .tt-play {
  top: 18px;
  right: 18px;
  left: auto;
  width: 34px;
  height: 34px;
  transform: none;
}
.ttpv .tt-grid .tt-item:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15,23,42,.16); }

.ttpv .tt-auto-loader {
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 58px;
  margin: -4px 22px 18px;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 500;
}
.ttpv .tt-loader-ring {
  width: 18px;
  height: 18px;
  border: 2px solid var(--tt-border);
  border-top-color: var(--tt-accent);
  border-radius: 50%;
  animation: ttLoaderSpin .7s linear infinite;
}
@keyframes ttLoaderSpin { to { transform: rotate(360deg); } }

@media (max-width: 980px) and (min-width: 641px) {
  .ttpv .tt-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .ttpv .tt-grid .tt-info { right: 10px; left: 10px; }
  .ttpv .tt-grid .tt-metrics { right: 10px; left: 10px; font-size: 8.5px; }
  .ttpv .tt-grid .tt-mx svg { flex-basis: 11px; width: 11px; height: 11px; }
}

@media (max-width: 640px) {
  .ttpv .tt-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: 10px;
  }
  .ttpv .tt-grid .tt-item,
  .ttpv .tt-grid .tt-item:nth-child(10n + 1),
  .ttpv .tt-grid .tt-item:nth-child(10n + 7) {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    grid-column: auto;
    grid-row: auto;
    min-height: 136px;
    overflow: hidden;
    border: 1px solid var(--tt-border);
    border-radius: 13px;
    background: #fff;
  }
  .ttpv .tt-grid .tt-item::after { display: none; }
  .ttpv .tt-grid .tt-thumb {
    position: relative;
    inset: auto;
    grid-row: 1 / 3;
    width: 104px;
    height: 100%;
    min-height: 136px;
  }
  .ttpv .tt-grid .tt-info {
    position: static;
    display: -webkit-box !important;
    align-self: end;
    min-height: 0;
    padding: 16px 14px 7px;
    overflow: hidden;
    color: var(--tt-text);
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }
  .ttpv .tt-grid .tt-metrics {
    position: static;
    align-self: start;
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 5px 14px 14px;
    color: var(--tt-muted);
    font-size: 10px;
  }
  .ttpv .tt-grid .tt-play {
    top: 50%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  .ttpv .tt-auto-loader { margin-right: 16px; margin-left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .ttpv .tt-loader-ring { animation-duration: 1.4s; }
}

/* V2.2: recent searches */
.ttpv .tt-input-wrap { z-index: 25; }
.ttpv .tt-recent {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid var(--tt-border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15,23,42,.12);
}
.ttpv .tt-recent[hidden] { display: none; }
.ttpv .tt-recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--tt-border);
  color: var(--tt-muted);
  font-size: 11px;
  font-weight: 600;
}
.ttpv .tt-recent-head button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tt-accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.ttpv .tt-recent-list { padding: 5px; }
.ttpv .tt-recent-item {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--tt-text);
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.ttpv .tt-recent-item:hover { background: var(--tt-soft); color: var(--tt-accent); }

/* Videos / reposts menu */
.ttpv .tt-feed-tabs {
  display: flex;
  gap: 24px;
  margin: 0 22px 14px;
  border-bottom: 1px solid var(--tt-border);
}
.ttpv .tt-feed-tab {
  position: relative;
  min-width: 74px;
  padding: 0 2px 12px;
  border: 0;
  background: transparent;
  color: var(--tt-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.ttpv .tt-feed-tab::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
}
.ttpv .tt-feed-tab.active { color: var(--tt-text); font-weight: 600; }
.ttpv .tt-feed-tab.active::after { background: var(--tt-accent); }

.ttpv .tt-repost-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  z-index: 3;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--tt-accent);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
}
.ttpv .tt-pin-badge + .tt-repost-badge { top: 38px; }

/* The gallery intentionally shows views only; full metrics stay in the viewer. */
.ttpv .tt-grid .tt-metrics { justify-content: flex-start; }
.ttpv .tt-grid .tt-metrics .tt-mx { font-size: 10px; }
.ttpv .tt-vr-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
.ttpv .tt-feed-panel .tt-lb-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }

.ttpv[data-mode="stories"] .tt-content-head,
.ttpv[data-mode="stories"] .tt-feed-tabs,
.ttpv[data-mode="stories"] .tt-grid,
.ttpv[data-mode="stories"] .tt-auto-loader { display: none !important; }

@media (max-width: 640px) {
  .ttpv .tt-feed-tabs { margin-right: 16px; margin-left: 16px; }
  .ttpv .tt-recent { top: calc(100% + 6px); }
  .ttpv .tt-vr-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ttpv .tt-feed-panel .tt-lb-metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
  .ttpv .tt-feed-panel .tt-lb-metrics .tt-mx { min-width: 0; }
}
