*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

img {
  -webkit-user-drag: none;
  display: block;
}

:root {
  --radius-sm: 10px;
  --radius: 18px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --loading-bg: #f2f2f7;
  --loading-text: rgba(0, 0, 0, 0.45);
}

body.dark {
  --loading-bg: #1c1c1e;
  --loading-text: rgba(255, 255, 255, 0.45);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #fff;
  background: #000;
}

/* ---- prelude ---- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--loading-bg, #000);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s var(--ease-out);
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  font-size: 18px;
  font-weight: 400;
  color: var(--loading-text, rgba(255, 255, 255, 0.6));
  letter-spacing: 1px;
  animation: blink 0.8s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.loading-text.error {
  animation: none;
  opacity: 1;
}

/* ---- sheath ---- */
.js-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 28px 0;
}

/* ---- backdrop ---- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.bg-layer::before {
  content: "";
  position: absolute;
  inset: -60px;
  background-image: inherit;
  background-position: inherit;
  background-size: inherit;
  background-repeat: inherit;
  filter: blur(10px) brightness(0.65);
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}

/* ---- vessel ---- */
.container {
  width: min(1100px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeUp 0.7s var(--ease-out) both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- mast ---- */
.hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 68vh;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111;
  box-shadow: 0 2px 40px rgba(0, 0, 0, 0.45);
}

.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out);
}

.hero img.transitioning {
  opacity: 0;
  transform: scale(1.03);
}

/* ---- mast-veil ---- */
.hero-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 60px 36px 28px;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
  pointer-events: none;
}

.hero-overlay .title {
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.3px;
  line-height: 1.15;
  margin-bottom: 6px;
}

.hero-overlay .price {
  font-size: 26px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 8px;
  letter-spacing: -0.2px;
}

.hero-overlay .desc-wrap {
  position: relative;
  max-width: 480px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-sm);
}

.hero-overlay .desc {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.72);
  max-height: 72px;
  overflow-y: auto;
  pointer-events: auto;
}

/* ---- rail ---- */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ---- micros ---- */
.thumb-wrap {
  position: relative;
  max-width: 390px;
}

.thumb-wrap.has-overflow {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 6%, black 94%, transparent 100%);
}

.thumb-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.thumb-strip::-webkit-scrollbar {
  display: none;
}

.thumb {
  width: 88px;
  height: 58px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  opacity: 0.5;
  transition: opacity 0.3s var(--ease-out),
              border-color 0.3s var(--ease-out),
              transform 0.3s var(--ease-out);
  flex-shrink: 0;
}

.thumb:hover {
  opacity: 0.8;
}

.thumb.active {
  opacity: 1;
  border-color: rgba(255, 255, 255, 0.7);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---- triggers ---- */
.actions {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 34px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.2px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.3s var(--ease-out),
              border-color 0.3s var(--ease-out);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.btn-feedback {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.btn-feedback:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary {
  background: #0077ed;
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  background: #005bb5;
}

/* ---- flex-squash ---- */
@media (max-width: 900px) {
  .hero {
    aspect-ratio: 4 / 3;
    max-height: 55vh;
    border-radius: var(--radius-sm);
  }

  .hero-overlay {
    padding: 44px 24px 20px;
  }

  .hero-overlay .title {
    font-size: 26px;
  }

  .hero-overlay .price {
    font-size: 20px;
  }

  .hero-overlay .desc {
    font-size: 14px;
    max-height: 66px;
  }

  .thumb {

    width: 72px;
    height: 48px;
  }

  .thumb-wrap {
    max-width: 320px;
  }
  .bar {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .container {
    gap: 14px;
    padding: 0 6px;
  }
}

/* ---- img-dead-fallback ---- */
.hero-img-error {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #2c2c2e;
  color: #636366;
  font-size: 15px;
  font-weight: 400;
  font-family: inherit;
  line-height: 1.6;
  text-align: center;
  gap: 2px;
}

.thumb-img-error {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #2c2c2e;
  color: #636366;
  font-size: 10px;
  font-weight: 400;
  font-family: inherit;
  line-height: 1.4;
  text-align: center;
  gap: 1px;
}

@media (max-width: 480px) {
  .hero-overlay .title {
    font-size: 22px;
  }

  .hero-overlay .price {
    font-size: 18px;
  }

  .thumb {
    width: 60px;
    height: 40px;
    border-radius: 8px;
  }
    .thumb-wrap {
      max-width: 270px;
    }

  .thumb-img-error {
    font-size: 9px;
  }

  .btn {
    padding: 9px 18px;
    font-size: 14px;
  }

  .actions {
    gap: 8px;
  }
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}
