/* Reset & Base - Clean Minimalist Design (Zero Flicker on iOS/Android) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: #EEF2F8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #0F172A;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  -webkit-user-drag: none;
  user-select: none;
}

input.footer_input {
  -webkit-user-select: text;
  user-select: text;
}

button, input, a {
  touch-action: manipulation;
  outline: none;
}

/* Confetti Canvas Overlay */
.confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1200;
}

/* Flicker-Free Modal System */
.modal__backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(15, 23, 42, 0.58);
  opacity: 0;
  visibility: hidden;
  z-index: 1050;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.modal__content {
  position: relative;
  width: 100%;
  max-width: 365px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  margin: 0 auto;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
  transform: translateY(10px) scale(0.96);
  opacity: 0;
  display: flex;
  flex-direction: column;
  background-color: #FFFFFF;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.24);
  padding: 24px 20px 20px;
  text-align: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.modal__show .modal__backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal__show .modal__content {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.modal__body {
  color: #0F172A;
  margin-bottom: 16px;
}

.modal__btn-close {
  text-align: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  cursor: pointer;
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 600;
  height: 46px;
  line-height: 46px;
  width: 100%;
  display: block;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.modal__btn-close:active {
  transform: scale(0.98);
}

/* Clean Borderless Status Text */
.tesla-pill {
  display: block;
  color: #2563EB;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.tesla-pill.win-pill {
  color: #10B981;
  font-size: 15px;
}

.sad-emoji {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 8px;
  display: inline-block;
  animation: sadWave 1.8s ease-in-out infinite;
}

@keyframes sadWave {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(-6deg); }
  75% { transform: translateY(-2px) rotate(6deg); }
}

.modal-headline {
  font-size: 21px;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  line-height: 1.25;
}

.modal-subtext {
  font-size: 14px;
  color: #334155;
  line-height: 1.45;
  margin: 0 auto;
  max-width: 315px;
}

.modal-loc-line {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #F1F5F9;
  font-size: 12.5px;
  color: #64748B;
  font-weight: 500;
}

.modal-loc-line b {
  color: #10B981;
}

.win-modal-car {
  width: 170px;
  height: auto;
  display: block;
  margin: 6px auto 8px;
  animation: carPop 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes carPop {
  0% { transform: scale(0.75); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.win-price-tag {
  font-size: 13.5px;
  color: #475569;
  margin-bottom: 8px;
}

.win-price-tag s {
  color: #94A3B8;
}

.win-price-tag b {
  color: #10B981;
  font-weight: 700;
}

.modal-timer-box {
  margin-top: 10px;
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}

.modal-timer-box b {
  color: #DC2626;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Header */
.wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  color: #0F172A;
  height: 54px;
  width: 100%;
  padding: 0 18px;
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.03);
  margin-bottom: 12px;
}

.tesla-wordmark {
  height: 13px;
  width: auto;
  display: block;
  fill: #0F172A;
}

.header-badge {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

#container {
  padding: 4px 12px;
  width: 100%;
}

#firstpage {
  margin: 0 auto 12px;
  padding: 18px 14px 20px;
  position: relative;
  width: 100%;
  max-width: 650px;
  text-align: center;
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

#topDate {
  width: 100%;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  color: #64748B;
  margin-bottom: 6px;
}

#subheadline {
  text-align: center;
  color: #0F172A;
  margin-bottom: 8px;
}

.title {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
  color: #0F172A;
}

.lucky {
  font-size: 15px;
  color: #2563EB;
  font-weight: 600;
}

.intro {
  color: #334155;
  text-align: center;
  font-size: 14px;
  margin: 0 auto 12px;
  max-width: 520px;
  font-weight: 400;
  line-height: 1.45;
}

/* Wheel Section & Proportioned Center Pointer (GPU Flicker-Free) */
#wheelCon {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: 10px auto 6px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(30, 58, 138, 0.14);
}

#wheel {
  z-index: 1;
  width: 100%;
  height: auto;
  display: block;
  transform-origin: 50% 50%;
  -webkit-transform-origin: 50% 50%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
}

#pressButton {
  position: absolute;
  background-image: url(assets/arrow.webp);
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  cursor: pointer;
  width: 15.5%;
  max-width: 60px;
  aspect-ratio: 105 / 128;
  height: auto;
  z-index: 2;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -56%);
  -webkit-transform: translate(-50%, -56%);
  border: none;
  background-color: transparent;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#pressButton.idle-pulse {
  animation: pointerPulse 1.6s ease-in-out infinite;
}

@keyframes pointerPulse {
  0%, 100% { transform: translate(-50%, -56%) scale(1); }
  50% { transform: translate(-50%, -56%) scale(1.08); }
}

#pressButton:disabled {
  opacity: 1;
}

#devMockup {
  display: none;
  position: absolute;
  max-width: 195px;
  width: 48%;
  height: auto;
  z-index: 3;
  left: 50%;
  top: 50%;
  margin-left: -24%;
  margin-top: -24%;
  pointer-events: none;
}

/* Spin Animations */
.spinAround, .spinAround2 {
  animation-timing-function: cubic-bezier(0.18, 0.82, 0.22, 1);
  animation-iteration-count: 1;
  animation-direction: normal;
  animation-fill-mode: forwards;
}

.spinAround {
  animation-name: spin;
  animation-duration: 6.2s;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  90% { transform: rotate(3110deg); }
  95% { transform: rotate(3108deg); }
  100% { transform: rotate(3109deg); }
}

.spinAround2 {
  animation-name: spin2;
  animation-duration: 6.4s;
}

@keyframes spin2 {
  0% { transform: rotate(3109deg); }
  90% { transform: rotate(6302deg); }
  95% { transform: rotate(6299deg); }
  100% { transform: rotate(6300deg); }
}

.animated {
  animation-duration: 0.75s;
  animation-fill-mode: both;
}

@keyframes rotateIn {
  0% {
    transform-origin: center;
    transform: rotate(-180deg) scale(0.3);
    opacity: 0;
  }
  100% {
    transform-origin: center;
    transform: rotate(0deg) scale(1);
    opacity: 1;
  }
}

.rotateIn {
  animation-name: rotateIn;
}

/* CSS Loading Spinner */
.loading-wrap {
  padding: 100px 0;
  text-align: center;
}

.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #DBEAFE;
  border-top-color: #2563EB;
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spinLoader 0.75s linear infinite;
}

.loading-text {
  font-size: 14px;
  font-weight: 600;
  color: #1D4ED8;
}

@keyframes spinLoader {
  to { transform: rotate(360deg); }
}

/* Second Page: Winner & Step-by-Step Guide */
#secondpage {
  display: none;
  position: relative;
  max-width: 650px;
  width: 100%;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #FFFFFF;
  padding: 20px 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

#secondpage a, .button, .pi_links a, a.button {
  text-decoration: none;
}

.congrats {
  font-size: 14px;
  color: #0F172A;
  line-height: 1.5;
  text-align: left;
}

.congrats h4 {
  text-align: center;
  font-size: 22px;
  margin-bottom: 10px;
  color: #0F172A;
}

.span-second {
  padding-top: 2px;
  display: inline-block;
  color: #2563EB;
}

ol {
  padding-left: 0;
  list-style: decimal inside;
  color: #334155;
}

ol li {
  padding: 6px 0 0 0;
  line-height: 1.45;
}

.important {
  padding: 12px 0 0 0;
  color: #0F172A;
}

.timer {
  padding: 8px 0 4px 0;
  line-height: 1.5;
  color: #475569;
  font-variant-numeric: tabular-nums;
}

.white-span {
  color: #DC2626;
  white-space: nowrap;
}

.prize {
  border-radius: 12px;
  color: #0F172A;
  font-size: 14px;
  line-height: 1.35;
  margin: 12px 0 0;
  padding: 14px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
}

.prize.selected-prize {
  border: 2px solid #2563EB;
  background: #F8FAFC;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.selected-badge {
  display: block;
  color: #10B981;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.prize table {
  width: 100%;
  border-collapse: collapse;
}

.name, .regular_price, .your_price {
  font-weight: 700;
}

.name {
  color: #1D4ED8;
  font-size: 16px;
}

.description {
  max-width: 320px;
  margin: 5px 0;
  color: #475569;
  line-height: 1.35;
  font-size: 13px;
}

.your_price span {
  color: #10B981;
}

.img-phone {
  width: 145px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.button {
  width: 155px;
  text-align: center;
  background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%);
  border-radius: 8px;
  cursor: pointer;
  color: #FFFFFF;
  font-weight: 600;
  height: 40px;
  margin: -38px 0 0 auto;
  line-height: 40px;
  display: block;
  border: none;
  font-size: 13.5px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.25);
  transition: transform 0.12s ease;
}

.button:active {
  transform: scale(0.97);
}

.pulse-btn {
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Social Reactions & Interactive Comments */
.container {
  padding: 0 0 75px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.comments {
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  margin: 0 auto;
  width: 100%;
  max-width: 650px;
  color: #0F172A;
  padding: 18px 18px 32px;
}

.comments_table {
  width: 100%;
  max-width: 546px;
  padding-top: 10px;
  font-size: 13px;
  margin: 0 auto;
}

.border_bottom {
  border-bottom: 1px solid #E2E8F0;
}

.like_people {
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.like_people_left {
  display: flex;
  align-items: center;
}

.like_people_text {
  font-size: 13px;
  line-height: 18px;
  color: #64748B;
  padding-left: 6px;
}

.like_people_comments {
  font-size: 13px;
  color: #64748B;
  padding-left: 12px;
}

.wi_buttons {
  height: 46px;
}

.wi_buttons_wrap {
  max-width: 430px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
  padding: 8px 0;
}

.item_like, .item_share, .item_views {
  color: #475569;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
  line-height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.item_like:active, .item_share:active, .item_views:active {
  background-color: #EFF6FF;
  transform: scale(0.95);
}

.wi_buttons b {
  color: #0F172A;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  margin-left: 6px !important;
}

.item_like.is-liked b {
  color: #2563EB;
  font-weight: 700;
}

.photo_avatar img {
  border-radius: 50%;
  height: 40px;
  width: 40px;
  margin: 15px 4px 0 0;
  object-fit: cover;
  display: block;
}

.comment_wrap {
  position: relative;
  padding: 10px 14px;
  margin: 15px 0 0;
  border-radius: 16px;
  background: #F1F5F9;
  word-break: break-word;
}

.comment_name {
  font-size: 13.5px;
  font-weight: 700;
  color: #0F172A;
}

.comment_text {
  font-size: 13.5px;
  line-height: 19px;
  margin-top: 2px;
  color: #334155;
}

.comment_like_badge {
  position: absolute;
  right: 10px;
  bottom: -10px;
  background: #FFFFFF;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.pi_links {
  font-size: 12.5px;
  color: #64748B;
  margin: 9px 0 0;
  line-height: 16px;
}

.pi_links span {
  font-weight: 600;
  cursor: pointer;
}

.pi_link.is-liked {
  color: #2563EB;
}

.pi_reply_wrap {
  padding: 0 20px 0 22px;
}

.pi_acts_link {
  float: right;
}

.pi_acts_link .i_icon {
  display: inline-block;
  background-image: url(assets/more.webp);
  background-repeat: no-repeat;
  background-size: 100% !important;
  width: 12px;
  height: 12px;
  margin-top: 2px;
}

.fixed_footer {
  position: fixed;
  bottom: 10px;
  height: 48px;
  border: 1px solid #CBD5E1;
  background-color: #FFFFFF;
  left: 0;
  right: 0;
  z-index: 10;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  width: calc(100% - 24px);
  max-width: 650px;
  margin: 0 auto;
  border-radius: 10px;
}

.footer_input {
  color: #0F172A;
  border: none;
  outline: none;
  font-size: 14px;
  position: absolute;
  left: 14px;
  top: 14px;
  width: calc(100% - 54px);
  background: transparent;
}

.btn_send {
  max-height: 24px;
  position: absolute;
  top: 12px;
  right: 12px;
  cursor: pointer;
}

/* Toast Notification */
.ai-toast {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0F172A;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.25);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ai-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  #header {
    height: 50px;
    padding: 0 14px;
    margin-bottom: 10px;
  }
  .tesla-wordmark {
    height: 12px;
  }
  #firstpage {
    padding: 14px 10px 16px;
  }
  .title {
    font-size: 24px;
  }
  .lucky {
    font-size: 14px;
  }
  .intro {
    font-size: 13.5px;
    padding: 0 4px;
  }
  #wheelCon {
    max-width: 340px;
    margin: 8px auto 4px;
  }
  #pressButton {
    width: 15%;
    max-width: 52px;
  }
  .comments {
    padding: 14px 12px 28px;
  }
  #secondpage {
    padding: 16px 12px;
  }
  .congrats h4 {
    font-size: 20px;
  }
  .prize {
    padding: 10px 8px;
  }
  .name {
    font-size: 14px;
  }
  .description {
    margin: 4px 0;
    font-size: 12px;
  }
  .remaining, .regular_price, .your_price {
    font-size: 12px;
  }
  .img-phone {
    width: 108px;
    margin-bottom: 4px;
  }
  .button {
    margin-top: 8px;
    margin-left: 0;
    width: 100%;
    max-width: 160px;
    height: 38px;
    line-height: 38px;
    font-size: 13px;
  }
}

@media screen and (max-width: 359px) {
  .img-phone {
    width: 90px;
  }
  .button {
    max-width: 140px;
  }
}
