/* Splash เลือกเวอร์ชันเว็บบนหน้า home — markup: resources/views/components/frontend/splash-version.blade.php */

html.cdv-splash-open,
html.cdv-splash-open body {
  overflow: hidden;
}

/* ปุ่มแชตของเว็บเดิมกับ chatbase ลอยทับ splash ได้ ซ่อนไว้ระหว่างเปิด */
html.cdv-splash-open .btn-chat-container,
html.cdv-splash-open #chatbase-bubble-button,
html.cdv-splash-open #chatbase-bubble-window,
html.cdv-splash-open #chatbase-message-bubbles {
  display: none !important;
}

.cdv-splash {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  /* ต่ำกว่ากล่อง consent ของ consentmanager.net (พื้นหลัง 8999999, กล่อง 9999999) ให้ขอความยินยอมคุกกี้ได้ก่อน
     แต่สูงกว่า fixed nav (1030) ส่วนปุ่มแชต (201000000) ถูกซ่อนไว้ด้านบนแล้ว */
  z-index: 8999990;
  display: flex;
  padding: 32px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  color: #fff;
  font-family: "Poppins", "Prompt", sans-serif;
  /* พื้นหลังสำรองตอน WebGL ยังไม่พร้อมหรือใช้ไม่ได้ */
  background:
    radial-gradient(55% 45% at 12% 88%, rgba(236, 196, 141, 0.12), transparent 70%),
    radial-gradient(60% 55% at 50% 50%, rgba(94, 54, 222, 0.3), transparent 70%),
    #07050f;
}

.cdv-splash[hidden] {
  display: none;
}

.cdv-splash:focus {
  outline: none;
}

.cdv-splash.is-leaving {
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}

.cdv-splash__gl {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.cdv-splash.has-gl .cdv-splash__gl {
  opacity: 1;
}

/* ---- popup ---- */

.cdv-splash__panel {
  position: relative;
  width: 100%;
  max-width: 940px;
  margin: auto;
  padding: 40px 40px 36px;
  text-align: center;
  background: rgba(14, 10, 31, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 40px 120px -30px rgba(94, 54, 222, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  /* พื้นหลัง splash ทึบตั้งแต่เฟรมแรก (ไม่ให้เห็นหน้าเว็บแวบ) เฟดแค่ popup */
  animation: cdv-splash-in 0.7s ease both;
}

.cdv-splash__brand {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.32em;
  color: #ecc48d;
}

.cdv-splash__title {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #fff 30%, #c792ea 75%, #9d0ce8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cdv-splash__nowrap {
  white-space: nowrap;
}

.cdv-splash__flow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  padding: 6px 18px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.cdv-splash__flow-human {
  color: #ecc48d;
}

.cdv-splash__flow-ai,
.cdv-splash__card--ai .cdv-splash__label {
  background: linear-gradient(90deg, #c792ea, #9d0ce8 55%, #5e36de);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cdv-splash__flow-arrow {
  color: #8a849c;
  font-size: 1.4em;
  line-height: 1;
  animation: cdv-splash-nudge 1.6s ease-in-out infinite;
}

.cdv-splash__why {
  max-width: 660px;
  margin: 20px auto 0;
  font-family: "Prompt", "Poppins", sans-serif;
}

.cdv-splash__lead {
  margin: 0;
  font-size: clamp(17px, 2.2vw, 20px);
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
}

.cdv-splash__sub {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.75;
  color: #b3adc4;
}

.cdv-splash__sub strong {
  font-weight: 500;
  color: #fff;
}

.cdv-splash__choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 30px;
}

.cdv-splash__card {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font: inherit;
  text-align: left;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.cdv-splash__card:hover,
.cdv-splash__card:focus {
  color: #fff;
  text-decoration: none;
  outline: none;
}

.cdv-splash__card:hover,
.cdv-splash__card:focus-visible {
  transform: translateY(-4px);
}

.cdv-splash__card:focus-visible {
  box-shadow: 0 0 0 3px #07050f, 0 0 0 5px #ecc48d;
}

.cdv-splash__card--human:hover {
  border-color: rgba(236, 196, 141, 0.6);
  box-shadow: 0 14px 40px -14px rgba(236, 196, 141, 0.45);
}

.cdv-splash__card--ai {
  background:
    linear-gradient(#0e0a1f, #0e0a1f) padding-box,
    linear-gradient(135deg, #5e36de, #9d0ce8 50%, #c792ea) border-box;
  border-color: transparent;
}

.cdv-splash__card--ai:hover {
  box-shadow: 0 14px 50px -12px rgba(157, 12, 232, 0.65);
}

.cdv-splash__card--ai:focus-visible {
  box-shadow: 0 0 0 3px #07050f, 0 0 0 5px #c792ea;
}

.cdv-splash__art {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #0e0a1f;
  -webkit-mask: linear-gradient(#000 62%, transparent);
  mask: linear-gradient(#000 62%, transparent);
  transition: transform 0.6s ease;
}

.cdv-splash__card:hover .cdv-splash__art,
.cdv-splash__card:focus-visible .cdv-splash__art {
  transform: scale(1.04);
}

.cdv-splash__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 26px 24px 22px;
}

/* มีภาพประกอบ: ข้อความซ้อนขึ้นไปบนขอบล่างที่จางของภาพ */
.cdv-splash__card.has-art .cdv-splash__body {
  margin-top: -36px;
  padding-top: 0;
}

.cdv-splash__label {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}

.cdv-splash__card--human .cdv-splash__label {
  color: #ecc48d;
}

.cdv-splash__url {
  font-size: 14px;
  color: #b3adc4;
  word-break: break-all;
}

.cdv-splash__desc {
  font-family: "Prompt", "Poppins", sans-serif;
  font-size: 14px;
  font-weight: 300;
  color: #8a849c;
}

.cdv-splash__cta {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
}

/* วงแหวน portal เล็กมุมขวาบนของการ์ด AI First */
.cdv-splash__ring {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(#5e36de, #9d0ce8, #c792ea, #ecc48d, #f78c6c, #5e36de);
  -webkit-mask: radial-gradient(closest-side, transparent 58%, #000 62%, #000 86%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 58%, #000 62%, #000 86%, transparent 100%);
  filter: drop-shadow(0 0 8px rgba(157, 12, 232, 0.8));
  animation: cdv-splash-spin 6s linear infinite;
}

.cdv-splash__card--ai:hover .cdv-splash__ring {
  animation-duration: 1.4s;
}

/* ---- portal warp (เลือก AI First) ---- */

.cdv-splash__portal {
  position: fixed;
  left: var(--px, 50%);
  top: var(--py, 50%);
  width: 180px;
  height: 180px;
  margin: -90px 0 0 -90px;
  border-radius: 50%;
  background: conic-gradient(#5e36de, #9d0ce8, #c792ea, #ecc48d, #f78c6c, #5e36de);
  -webkit-mask: radial-gradient(closest-side, transparent 60%, #000 66%, #000 84%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 60%, #000 66%, #000 84%, transparent 100%);
  filter: blur(1px) drop-shadow(0 0 28px rgba(157, 12, 232, 0.9));
  opacity: 0;
  pointer-events: none;
}

.cdv-splash__flash {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at var(--px, 50%) var(--py, 50%), #fff 0, #c792ea 30%, #5e36de 65%, #07050f 100%);
  opacity: 0;
  pointer-events: none;
}

.cdv-splash__flash span {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #07050f;
  opacity: 0;
  transition: opacity 0.3s ease 0.3s;
}

.cdv-splash.is-warping .cdv-splash__panel {
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.7, 0, 0.84, 0);
}

.cdv-splash.is-warping .cdv-splash__portal {
  animation: cdv-splash-portal 1.6s cubic-bezier(0.6, 0, 0.9, 0.3) forwards;
}

.cdv-splash.is-flashing .cdv-splash__flash {
  opacity: 1;
  transition: opacity 0.35s ease-in;
}

.cdv-splash.is-flashing .cdv-splash__flash span {
  opacity: 1;
}

@keyframes cdv-splash-in {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes cdv-splash-nudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

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

@keyframes cdv-splash-portal {
  0% { opacity: 0; transform: scale(0.2) rotate(0deg); }
  15% { opacity: 1; transform: scale(1) rotate(90deg); }
  100% { opacity: 1; transform: scale(var(--portal-scale, 18)) rotate(540deg); }
}

@media (max-width: 640px) {
  .cdv-splash {
    padding: 16px 12px;
  }

  .cdv-splash__panel {
    padding: 28px 16px 18px;
    border-radius: 22px;
  }

  .cdv-splash__sub {
    font-size: 14px;
  }

  .cdv-splash__choices {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 22px;
  }

  /* มือถือ: การ์ดแนวนอน ภาพซ้ายข้อความขวา ให้เห็นทั้งสองตัวเลือกโดยไม่ต้องเลื่อน */
  .cdv-splash__card.has-art {
    flex-direction: row;
    align-items: stretch;
  }

  .cdv-splash__art {
    flex: 0 0 34%;
    width: 34%;
    aspect-ratio: auto;
    min-height: 120px;
    -webkit-mask: linear-gradient(90deg, #000 55%, transparent);
    mask: linear-gradient(90deg, #000 55%, transparent);
  }

  .cdv-splash__body {
    padding: 18px 18px 16px;
  }

  .cdv-splash__card.has-art .cdv-splash__body {
    flex: 1;
    justify-content: center;
    margin: 0 0 0 -14px;
    padding: 16px 16px 16px 0;
  }

  .cdv-splash__label {
    font-size: 22px;
  }

  .cdv-splash__cta {
    margin-top: 8px;
  }

  .cdv-splash__ring {
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
  }

  .cdv-splash__desc {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cdv-splash,
  .cdv-splash * {
    animation: none !important;
    transition: none !important;
  }
}
