:root {
  --shorts-red: #ed1c24;
  --shorts-red-bright: #ff3940;
  --shorts-surface: #141518;
  --shorts-surface-2: #1b1c20;
  --shorts-border: rgba(255, 255, 255, .1);
  --shorts-muted: #95979f;
}

body.shorts-is-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

body.shorts-is-open #authOverlay { z-index: 100100; }

.shorts-viewer[hidden] { display: none !important; }

.shorts-viewer {
  position: fixed;
  inset: 0;
  z-index: 100000;
  overflow: hidden;
  color: #f7f7f8;
  font-family: "Onest", system-ui, sans-serif;
  opacity: 0;
  transition: opacity .2s ease;
}

.shorts-viewer.is-open { opacity: 1; }

.shorts-viewer__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 48% 42%, rgba(237, 28, 36, .12), transparent 32%),
    linear-gradient(145deg, #0c0c0e, #050506 68%);
}

.shorts-viewer__header {
  position: absolute;
  z-index: 12;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  pointer-events: none;
}

.shorts-viewer__brand,
.shorts-viewer__close { pointer-events: auto; }

.shorts-viewer__brand {
  display: flex;
  align-items: center;
  width: 124px;
  height: 42px;
}

.shorts-viewer__brand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.shorts-icon-button,
.shorts-action,
.shorts-stage__sound,
.shorts-stage__play,
.shorts-panel button,
.shorts-comment-form button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.shorts-icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--shorts-border);
  border-radius: 50%;
  background: rgba(24, 25, 29, .82);
  backdrop-filter: blur(16px);
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}

.shorts-icon-button:hover {
  transform: rotate(4deg) scale(1.04);
  border-color: rgba(255, 255, 255, .2);
  background: #25262b;
}

.shorts-icon-button svg { width: 19px; height: 19px; }

.shorts-viewer__layout {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: auto 70px minmax(330px, 410px);
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 30px;
}

.shorts-stage {
  position: relative;
  height: min(880px, calc(100dvh - 36px));
  max-width: calc(100vw - 540px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 24px;
  background: #000;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .55);
  touch-action: pan-x;
  user-select: none;
}

.shorts-stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.shorts-stage__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .34), transparent 22%),
    linear-gradient(0deg, rgba(0, 0, 0, .82), transparent 32%);
}

.shorts-stage__copy {
  position: absolute;
  z-index: 3;
  left: 20px;
  right: 20px;
  bottom: 25px;
  pointer-events: none;
}

.shorts-stage__copy p {
  max-width: 90%;
  margin: 0 0 6px;
  color: #fff;
  font-size: 15px;
  font-weight: 620;
  line-height: 1.4;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .7);
}

.shorts-stage__copy span {
  color: rgba(255, 255, 255, .66);
  font-size: 11px;
}

.shorts-stage__sound {
  position: absolute;
  z-index: 5;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 50%;
  background: rgba(8, 8, 10, .46);
  backdrop-filter: blur(14px);
}

.shorts-stage__sound svg { width: 19px; height: 19px; }

.shorts-stage__play {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: rgba(10, 10, 12, .5);
  opacity: 0;
  pointer-events: none;
  transform: scale(.82);
  backdrop-filter: blur(14px);
  transition: opacity .18s ease, transform .18s ease;
}

.shorts-stage__play.is-visible {
  opacity: 1;
  transform: scale(1);
}

.shorts-stage__play svg { width: 30px; height: 30px; }

.shorts-progress {
  position: absolute;
  z-index: 8;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 9px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.shorts-progress::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .24);
}

.shorts-progress span {
  position: relative;
  display: block;
  width: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--shorts-red), var(--shorts-red-bright));
  box-shadow: 0 0 14px rgba(237, 28, 36, .55);
}

.shorts-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
}

.shorts-action {
  min-width: 62px;
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 0;
  background: transparent;
}

.shorts-action__icon {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  border: 1px solid var(--shorts-border);
  border-radius: 50%;
  background: var(--shorts-surface-2);
  box-shadow: 0 9px 22px rgba(0, 0, 0, .22);
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.shorts-action:hover .shorts-action__icon {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, .2);
  background: #25262b;
}

.shorts-action.is-active .shorts-action__icon {
  border-color: rgba(237, 28, 36, .46);
  background: rgba(237, 28, 36, .16);
  color: #ff4c53;
}

.shorts-action.is-active .shorts-action__icon svg { fill: currentColor; }
.shorts-action__icon svg { width: 22px; height: 22px; }
.shorts-action__icon b { font-size: 13px; letter-spacing: -.02em; }
.shorts-action small { color: #a2a4ac; font-size: 10px; font-weight: 570; }

.shorts-actions__navigation {
  display: grid;
  gap: 8px;
  margin-top: 7px;
}

.shorts-action--nav {
  min-width: 0;
  width: 47px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--shorts-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, .055);
  transition: background .18s ease, transform .18s ease;
}

.shorts-action--nav:hover { background: rgba(255, 255, 255, .12); transform: translateY(-1px); }
.shorts-action--nav svg { width: 20px; height: 20px; }

.shorts-panel {
  width: min(410px, 29vw);
  height: min(760px, calc(100dvh - 92px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--shorts-border);
  border-radius: 22px;
  background: rgba(20, 21, 24, .9);
  box-shadow: 0 28px 75px rgba(0, 0, 0, .38);
  backdrop-filter: blur(26px);
}

.shorts-panel__tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  min-height: 62px;
  padding: 0 12px;
  border-bottom: 1px solid var(--shorts-border);
}

.shorts-panel__tabs > button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  background: transparent;
  color: #8f9199;
  font-size: 12px;
  font-weight: 590;
}

.shorts-panel__tabs > button.is-active { color: #fff; }
.shorts-panel__tabs > button.is-active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--shorts-red);
}

.shorts-panel__tabs b {
  display: grid;
  min-width: 21px;
  min-height: 21px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: #c6c7cc;
  font-size: 9px;
}

.shorts-panel__mobile-close { display: none !important; }

.shorts-panel__view {
  min-height: 0;
  flex: 1;
  display: none;
}

.shorts-panel__view.is-active {
  display: flex;
  flex-direction: column;
}

.shorts-products {
  flex: 1;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: #3a3b40 transparent;
}

.shorts-product {
  min-width: 0;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 15px;
  background: rgba(255, 255, 255, .035);
  transition: border-color .18s ease, background .18s ease;
}

.shorts-product:hover {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
}

.shorts-product > img,
.shorts-product__placeholder {
  grid-row: 1 / 3;
  width: 84px;
  height: 84px;
  border-radius: 11px;
  object-fit: contain;
  background: #fff;
}

.shorts-product__placeholder {
  display: grid;
  place-items: center;
  color: #c8c9ce;
  background: #27282d;
  font-weight: 700;
}

.shorts-product__body {
  min-width: 0;
  align-self: center;
  display: grid;
  gap: 7px;
}

.shorts-product__body strong {
  overflow: hidden;
  color: #f5f5f6;
  font-size: 12px;
  font-weight: 590;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.shorts-product__price {
  color: #fff;
  font-size: 14px;
  font-weight: 690;
}

.shorts-product__price del {
  margin-left: 5px;
  color: #777981;
  font-size: 10px;
  font-weight: 450;
}

.shorts-product > a {
  align-self: end;
  justify-self: start;
  padding: 7px 10px;
  border-radius: 9px;
  background: #fff;
  color: #111216;
  font-size: 10px;
  font-weight: 670;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}

.shorts-product > a:hover { background: var(--shorts-red); color: #fff; }

.shorts-panel__empty {
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 30px;
  color: #777981;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.shorts-panel__empty b { color: #d7d8dc; font-size: 13px; }

.shorts-panel__retry {
  margin-top: 5px;
  padding: 8px 13px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .09);
  color: #f1f1f2;
  font-size: 10px;
  font-weight: 650;
}

.shorts-comments {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 18px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #3a3b40 transparent;
}

.shorts-comment {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.shorts-comment__avatar {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  background: linear-gradient(145deg, #2d2e34, #1d1e22);
  color: #dfe0e3;
  font-size: 11px;
  font-weight: 690;
}

.shorts-comment > div { position: relative; min-width: 0; padding-right: 28px; }

.shorts-comment p {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

.shorts-comment strong { color: #e9e9eb; font-size: 11px; font-weight: 620; }
.shorts-comment time { color: #6f7179; font-size: 9px; }

.shorts-comment__text {
  color: #b9bac0;
  font-size: 11px;
  line-height: 1.52;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shorts-comment__delete {
  position: absolute;
  top: -3px;
  right: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #676971;
  opacity: 0;
  transition: opacity .18s ease, color .18s ease, background .18s ease;
}

.shorts-comment:hover .shorts-comment__delete { opacity: 1; }
.shorts-comment__delete:hover { color: #ff696e; background: rgba(237, 28, 36, .1); }
.shorts-comment__delete svg { width: 14px; height: 14px; }

.shorts-comment-auth {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 65px;
  padding: 12px;
  border-top: 1px solid var(--shorts-border);
  background: rgba(12, 13, 15, .78);
  color: #b7b9c0;
  font-size: 11px;
}

.shorts-comment-auth button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--shorts-red);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}

.shorts-comment-auth[hidden],
.shorts-comment-form[hidden] { display: none !important; }

.shorts-comment-form {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--shorts-border);
  background: rgba(12, 13, 15, .78);
}

.shorts-comment-form > input,
.shorts-comment-form textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 11px;
  outline: 0;
  background: #1b1c20;
  color: #f3f3f4;
  font: inherit;
  font-size: 11px;
  line-height: 1.45;
}

.shorts-comment-form > input {
  min-height: 38px;
  padding: 0 11px;
}

.shorts-comment-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: end;
  gap: 8px;
}

.shorts-comment-form textarea {
  min-height: 43px;
  max-height: 110px;
  resize: vertical;
  padding: 10px 11px;
}

.shorts-comment-form input:focus,
.shorts-comment-form textarea:focus {
  border-color: rgba(237, 28, 36, .7);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, .1);
}

.shorts-comment-form button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--shorts-red);
  color: #fff;
  transition: transform .18s ease, background .18s ease;
}

.shorts-comment-form button:hover { transform: translateY(-1px); background: var(--shorts-red-bright); }
.shorts-comment-form button:disabled { opacity: .45; cursor: wait; }
.shorts-comment-form button svg { width: 18px; height: 18px; }

.shorts-mobile-products { display: none; }

.shorts-toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  max-width: min(90vw, 420px);
  padding: 10px 14px;
  border: 1px solid var(--shorts-border);
  border-radius: 999px;
  background: rgba(27, 28, 32, .94);
  color: #f6f6f7;
  font-size: 11px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  backdrop-filter: blur(16px);
  transition: opacity .18s ease, transform .18s ease;
}

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

.shorts-viewer.is-buffering .shorts-stage::after {
  content: "";
  position: absolute;
  z-index: 10;
  inset: 0;
  width: 34px;
  height: 34px;
  margin: auto;
  border: 3px solid rgba(255, 255, 255, .2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: shorts-spin .8s linear infinite;
}

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

@media (max-width: 1180px) {
  .shorts-viewer__layout {
    grid-template-columns: auto 68px;
    padding-inline: 24px;
  }

  .shorts-stage { max-width: calc(100vw - 130px); }

  .shorts-panel {
    position: absolute;
    z-index: 16;
    top: 50%;
    right: 24px;
    width: min(400px, calc(100vw - 100px));
    opacity: 0;
    pointer-events: none;
    transform: translate(18px, -50%);
    transition: opacity .2s ease, transform .2s ease;
  }

  .shorts-viewer.is-comments-open .shorts-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translate(0, -50%);
  }

  .shorts-panel [data-shorts-panel="products"] { display: none; }
  .shorts-panel__mobile-close { display: grid !important; width: 36px; margin-left: auto; padding: 0 !important; }
  .shorts-panel__mobile-close::after { display: none !important; }
  .shorts-panel__mobile-close svg { width: 17px; height: 17px; }

  .shorts-mobile-products {
    position: absolute;
    z-index: 8;
    left: 50%;
    bottom: 18px;
    width: min(580px, calc(100vw - 190px));
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 8px 2px;
    transform: translateX(calc(-50% - 34px));
    scrollbar-width: none;
  }

  .shorts-mobile-products::-webkit-scrollbar { display: none; }

  .shorts-product--compact {
    min-width: min(360px, 70vw);
    grid-template-columns: 48px minmax(0, 1fr) auto;
    align-items: center;
    padding: 7px;
    border-color: rgba(255, 255, 255, .14);
    border-radius: 13px;
    background: rgba(15, 15, 17, .78);
    backdrop-filter: blur(18px);
  }

  .shorts-product--compact > img,
  .shorts-product--compact .shorts-product__placeholder {
    grid-row: auto;
    width: 48px;
    height: 48px;
    border-radius: 9px;
  }

  .shorts-product--compact .shorts-product__body { gap: 3px; }
  .shorts-product--compact .shorts-product__body strong { display: block; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
  .shorts-product--compact .shorts-product__price { font-size: 11px; }
  .shorts-product--compact .shorts-product__price del { display: none; }
  .shorts-product--compact > a { align-self: center; padding: 7px 9px; }
  .shorts-stage__copy { bottom: 96px; }
}

@media (max-width: 760px) {
  .shorts-viewer__backdrop { background: #000; }

  .shorts-viewer__header {
    height: 58px;
    padding: max(8px, env(safe-area-inset-top)) 12px 0;
    align-items: flex-start;
  }

  .shorts-viewer__brand {
    width: 89px;
    height: 34px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 10px;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(12px);
  }

  .shorts-icon-button { width: 36px; height: 36px; }
  .shorts-icon-button svg { width: 17px; height: 17px; }

  .shorts-viewer__layout {
    display: block;
    padding: 0;
  }

  .shorts-stage {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .shorts-stage video { object-fit: cover; }
  .shorts-stage__sound { display: none; }

  .shorts-stage__copy {
    left: 14px;
    right: 78px;
    bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .shorts-stage__copy p { max-width: 100%; font-size: 13px; }
  .shorts-stage__copy span { font-size: 10px; }

  .shorts-progress {
    left: 0;
    right: 0;
    bottom: 0;
    height: 8px;
  }

  .shorts-progress::before { border-radius: 0; }

  .shorts-actions {
    position: absolute;
    z-index: 10;
    right: 8px;
    bottom: calc(95px + env(safe-area-inset-bottom));
    gap: 10px;
  }

  .shorts-action { min-width: 54px; gap: 3px; }
  .shorts-action__icon { width: 44px; height: 44px; background: rgba(24, 25, 29, .74); backdrop-filter: blur(14px); }
  .shorts-action__icon svg { width: 21px; height: 21px; }
  .shorts-action small { color: rgba(255, 255, 255, .82); font-size: 9px; text-shadow: 0 1px 5px #000; }
  .shorts-actions__navigation { display: none; }

  .shorts-mobile-products {
    left: 8px;
    right: 70px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: auto;
    padding: 0;
    transform: none;
  }

  .shorts-product--compact { min-width: min(315px, calc(100vw - 94px)); }

  .shorts-panel {
    position: absolute;
    z-index: 24;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: min(72dvh, 650px);
    border-width: 1px 0 0;
    border-radius: 22px 22px 0 0;
    background: rgba(20, 21, 24, .98);
    opacity: 0;
    pointer-events: none;
    touch-action: pan-y;
    overscroll-behavior: contain;
    transform: translateY(100%);
    transition: opacity .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
  }

  .shorts-viewer.is-comments-open .shorts-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .shorts-panel__tabs { min-height: 54px; }
  .shorts-panel__tabs > button { font-size: 11px; }
  .shorts-comments { padding: 15px; }
  .shorts-comment__delete { opacity: 1; }
  .shorts-comment-form { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .shorts-toast { bottom: calc(82px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .shorts-action__icon { width: 41px; height: 41px; }
  .shorts-action { min-width: 50px; }
  .shorts-actions { right: 5px; }
  .shorts-stage__copy { right: 68px; }
  .shorts-mobile-products { right: 62px; }
  .shorts-product--compact { min-width: calc(100vw - 78px); }
}

@media (prefers-reduced-motion: reduce) {
  .shorts-viewer,
  .shorts-panel,
  .shorts-stage__play,
  .shorts-action__icon,
  .shorts-toast { transition: none !important; }
}
