html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #f6efe6;
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#tab-track-order {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
}

#tab-track-order a,
#tab-track-order button,
#tab-track-order input,
.pto-gift-btn,
.pto-parent-toast-close {
  -webkit-tap-highlight-color: transparent;
}

/* ─── OTP Panel ─── */
.cto-otp-panel {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(232, 214, 197, 0.8);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: ptoSlideDown 0.3s cubic-bezier(0.2, 0.9, 0.2, 1) both;
  box-shadow: 0 4px 16px rgba(42, 31, 20, 0.06);
}

@keyframes ptoSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cto-otp-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) auto auto;
  gap: 8px;
  align-items: center;
}

.cto-otp-row input {
  border: 1.5px solid rgba(216, 196, 175, 0.8);
  background: #fffdf9;
  border-radius: 10px;
  color: #3f3328;
  font: 600 14px "DM Sans", system-ui, sans-serif;
  padding: 10px 14px;
  transition: all 0.22s ease;
  box-shadow: inset 0 1px 3px rgba(42, 31, 20, 0.04);
}

.cto-otp-row input:focus {
  outline: none;
  border-color: #d1a26c;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(209, 162, 108, 0.15), inset 0 1px 3px rgba(42, 31, 20, 0.02);
}

.cto-otp-hint {
  margin-top: 8px;
  color: #7f6a54;
  font: 500 12px "DM Sans", system-ui, sans-serif;
}

@media (max-width: 720px) {
  .cto-otp-row {
    grid-template-columns: 1fr 1fr;
  }
  .cto-otp-row input {
    grid-column: 1 / -1;
  }
}

#tab-track-order.tab-panel {
  display: block;
}

/* ─── Gift Button ─── */
.pto-gift-btn {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  border: 1px solid rgba(232, 101, 74, 0.35);
  background: linear-gradient(135deg, #fffaf4, #fdeee5, #fde8dc);
  color: #5a4a3a;
  border-radius: 999px;
  padding: 10px 16px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow:
    0 12px 32px rgba(42, 31, 20, 0.2),
    0 4px 12px rgba(232, 101, 74, 0.14),
    0 0 0 0 rgba(232, 101, 74, 0);
  font: 600 13px "DM Sans", system-ui, sans-serif;
  overflow: hidden;
  animation: ptoGiftFloat 3s ease-in-out infinite;
  transition: box-shadow 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.9, 0.2, 1);
  will-change: transform;
}

.pto-gift-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 42%,
    rgba(255, 255, 255, 0.15) 55%,
    transparent 80%
  );
  transform: translateX(-150%);
  animation: ptoGiftShimmer 4.8s linear infinite;
}

.pto-gift-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.35) 0%, transparent 60%);
  pointer-events: none;
}

.pto-gift-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 18px 40px rgba(42, 31, 20, 0.24),
    0 6px 16px rgba(232, 101, 74, 0.2),
    0 0 0 4px rgba(232, 101, 74, 0.08);
}

.pto-gift-btn:active {
  transform: translateY(-1px) scale(0.99);
}

.pto-gift-icon {
  font-size: 18px;
  position: relative;
  z-index: 1;
  animation: ptoGiftPulse 1.8s ease-in-out infinite;
}

.pto-gift-label {
  position: relative;
  z-index: 1;
  letter-spacing: 0.01em;
}

/* ─── Parent Toast ─── */
.pto-parent-toast {
  position: fixed;
  right: 18px;
  bottom: 80px;
  z-index: 55;
  width: min(370px, calc(100vw - 28px));
  border-radius: 22px;
  border: 1px solid rgba(236, 217, 198, 0.9);
  background: linear-gradient(148deg, rgba(255, 255, 255, 0.97), rgba(254, 243, 234, 0.96));
  box-shadow:
    0 24px 56px rgba(42, 31, 20, 0.2),
    0 8px 20px rgba(42, 31, 20, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 16px 16px 14px;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.2, 0.9, 0.2, 1), transform 0.28s cubic-bezier(0.2, 0.9, 0.2, 1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.pto-parent-toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--coral, #e8654a), #d4983a, var(--coral, #e8654a));
  background-size: 200% 100%;
  border-radius: 22px 22px 0 0;
  animation: ptoToastLine 3.5s linear infinite;
  opacity: 0.7;
}

.pto-parent-toast.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pto-parent-toast-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.pto-parent-toast-icon {
  font-size: 16px;
  animation: ptoIconWiggle 3s ease-in-out infinite;
}

.pto-parent-toast-title {
  font: 700 14px "Fraunces", Georgia, serif;
  color: #2a1f14;
  flex: 1;
  letter-spacing: -0.01em;
}

.pto-parent-toast-close {
  border: 1px solid rgba(232, 214, 197, 0.8);
  background: rgba(255, 255, 255, 0.85);
  color: #6a5b4b;
  width: 26px;
  height: 26px;
  line-height: 22px;
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pto-parent-toast-close:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(210, 170, 130, 0.6);
  transform: rotate(90deg);
}

.pto-parent-toast-message {
  margin: 0;
  color: #5a4a3a;
  font-size: 13.5px;
  line-height: 1.6;
}

.pto-parent-toast-photo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.pto-parent-toast-photo {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 2px solid rgba(232, 214, 197, 0.8);
  object-fit: cover;
  box-shadow:
    0 6px 18px rgba(42, 31, 20, 0.16),
    0 0 0 4px rgba(255, 255, 255, 0.9);
  background: #fff;
  animation: ptoPhotoReveal 0.45s cubic-bezier(0.2, 0.9, 0.2, 1);
}

/* ─── Photo Flight ─── */
.pto-photo-flight {
  position: fixed;
  z-index: 90;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 2px solid rgba(240, 217, 194, 0.8);
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(42, 31, 20, 0.24), 0 0 0 0 rgba(232, 101, 74, 0.2);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.78) rotate(-6deg);
  filter: saturate(1.08);
}

.pto-photo-flight.run {
  animation: ptoPhotoFlyUp 1.2s cubic-bezier(0.2, 0.82, 0.2, 1) forwards;
}

/* ─── Sparkle Trail ─── */
.pto-photo-sparkle {
  position: fixed;
  z-index: 89;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle, #fff9e8 0%, #f5c785 50%, rgba(245, 199, 133, 0) 100%);
  box-shadow: 0 0 12px rgba(245, 199, 133, 0.6);
  transform: translate3d(0, 0, 0) scale(0.6);
  animation: ptoSparkleTrail 0.9s cubic-bezier(0.2, 0.82, 0.2, 1) forwards;
}

/* ─── Keyframes ─── */
@keyframes ptoGiftFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  33%       { transform: translateY(-3px) rotate(0.5deg); }
  66%       { transform: translateY(-1px) rotate(-0.3deg); }
}

@keyframes ptoGiftPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  40%       { transform: scale(1.15) rotate(-5deg); }
  55%       { transform: scale(1.1) rotate(3deg); }
}

@keyframes ptoGiftShimmer {
  0%       { transform: translateX(-150%); }
  50%, 100% { transform: translateX(160%); }
}

@keyframes ptoToastLine {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

@keyframes ptoIconWiggle {
  0%, 100%  { transform: rotate(0deg) scale(1); }
  10%        { transform: rotate(-8deg) scale(1.05); }
  20%        { transform: rotate(6deg) scale(1.08); }
  30%        { transform: rotate(-4deg) scale(1.04); }
  40%        { transform: rotate(2deg) scale(1); }
}

@keyframes ptoPhotoFlyUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.78) rotate(-6deg);
    box-shadow: 0 8px 20px rgba(42, 31, 20, 0.24), 0 0 0 0 rgba(232, 101, 74, 0.2);
  }
  10% {
    opacity: 1;
  }
  45% {
    opacity: 1;
    transform: translate3d(calc(var(--pto-fly-x) * 0.52), calc(var(--pto-fly-y) * 0.52 - 36px), 0) scale(1.1) rotate(2deg);
    box-shadow: 0 14px 28px rgba(42, 31, 20, 0.2), 0 0 0 12px rgba(232, 101, 74, 0.1);
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--pto-fly-x), var(--pto-fly-y), 0) scale(1) rotate(0deg);
    box-shadow: 0 6px 18px rgba(42, 31, 20, 0.14), 0 0 0 24px rgba(232, 101, 74, 0);
  }
}

@keyframes ptoPhotoReveal {
  0%   { opacity: 0; transform: translateY(10px) scale(0.88) rotate(-3deg); }
  70%  { transform: translateY(-2px) scale(1.03) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

@keyframes ptoSparkleTrail {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(0.4);
  }
  15% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--pto-sp-x), var(--pto-sp-y), 0) scale(1.2);
  }
}

@media (max-width: 640px) {
  .pto-gift-btn {
    right: 12px;
    bottom: 12px;
    padding: 10px 14px;
  }

  .pto-gift-label {
    display: none;
  }

  .pto-parent-toast {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 70px;
  }
}

/* 2026-03-25: performance mode */
.pto-gift-btn,
.pto-gift-btn::before,
.pto-gift-icon,
.pto-parent-toast,
.pto-parent-toast::before,
.pto-parent-toast-icon,
.pto-parent-toast-photo,
.pto-photo-flight,
.pto-photo-sparkle {
  animation: none !important;
  transition: none !important;
}

.pto-gift-btn,
.pto-parent-toast {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* 2026-03-28: phone lookup order switcher */
.cto-order-switcher {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #ecd8c4;
  border-radius: 16px;
  background: #fff9f3;
}
.cto-order-switcher-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.cto-order-switcher-title {
  font-weight: 700;
  color: #4d3a2b;
}
.cto-order-switcher-total {
  font-size: 12px;
  color: #8a6f56;
}
.cto-order-switcher-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.cto-order-switcher-tab {
  border: 1px solid #e6cfb8;
  background: #fff;
  color: #7b5f48;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cto-order-switcher-tab.active {
  background: #ef6a4c;
  border-color: #ef6a4c;
  color: #fff;
}
.cto-order-switcher-list {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}
.cto-order-switcher-list.active {
  display: grid;
}
.cto-order-switcher-row {
  border: 1px solid #ebd8c6;
  background: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cto-order-switcher-row.is-active {
  border-color: #ef6a4c;
  box-shadow: 0 0 0 1px rgba(239, 106, 76, 0.2) inset;
}
.cto-order-switcher-no {
  font-weight: 700;
  color: #4d3a2b;
}
.cto-order-switcher-date {
  font-size: 12px;
  color: #8a6f56;
}
.cto-order-switcher-empty {
  font-size: 13px;
  color: #8a6f56;
  padding: 8px 2px;
}
