:root {
  --bg: #fff;
  --soft: #f7f7f7;
  --soft2: #f1f3f5;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --black: #111827;
  --blue: #1d7ff2;
  --radius: 14px;
  --sidebar-w: 224px;
  --topbar-h: 74px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.tt-topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 50;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 14px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tt-icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 22px;
}
.tt-icon-btn:hover { background: var(--soft2); }
.tt-logo-link { display: flex; align-items: center; flex: 0 0 auto; }
.tt-logo { width: 112px; max-height: 56px; object-fit: contain; display: block; }

.tt-search {
  width: 100%;
  min-width: 0;
  margin: 0;
  display: flex;
  height: 42px;
  border: 1px solid #d8dee8;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}
.tt-search-input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 0 18px;
  font-size: 16px;
}
.tt-search-btn {
  width: 62px;
  border: 0;
  border-left: 1px solid #d8dee8;
  background: #f8fafc;
  cursor: pointer;
  font-size: 24px;
}
.tt-search-btn:hover { background: #eef2f7; }

.tt-top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.tt-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f3f4f6;
  color: var(--black);
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.tt-pill:hover { background: #e9edf3; }
.tt-pill-primary { background: var(--blue); color: #fff; }
.tt-pill-primary:hover { background: #126dde; }
.tt-pill-ghost { background: #fff; border-color: var(--line); }
.tt-profile-link { background: #0f172a; color: #fff; }
.tt-profile-link:hover { background: #111827; }
.tt-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #e2e8f0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-weight: 900;
}
.tt-avatar img { width: 100%; height: 100%; object-fit: cover; }

.tt-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  z-index: 40;
  overflow-y: auto;
  padding: 14px 12px 28px;
  border-right: 1px solid var(--line);
  background: #fff;
  transition: transform .18s ease;
}
.sidebar-collapsed .tt-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }

.tt-side-nav { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.tt-side-nav a,
.tt-side-link,
.tt-side-filter {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 42px;
  width: 100%;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #111827;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.tt-side-nav a span { width: 20px; text-align: center; font-size: 18px; }
.tt-side-nav a:hover,
.tt-side-link:hover,
.tt-side-filter:hover,
.tt-side-nav a.active,
.tt-side-filter.active { background: var(--soft2); font-weight: 800; }
.tt-side-section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.tt-side-section h3 { margin: 0 0 8px 14px; font-size: 15px; }
.tt-side-filter { font-weight: 650; }
.tt-side-link { text-decoration: none; font-weight: 650; }

.tt-main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 24px) 28px 56px;
  transition: margin-left .18s ease;
}
.sidebar-collapsed .tt-main { margin-left: 0; }

.tt-feed-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.tt-feed-head h1 { margin: 0; font-size: clamp(26px, 3vw, 40px); line-height: 1.05; letter-spacing: -.04em; }
.tt-feed-head p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.tt-main-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  background: #111827;
  color: #fff;
  font-weight: 900;
}
.tt-home-face-upload {
  flex: 0 1 620px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 320px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.tt-home-face-preview {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.tt-home-face-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tt-home-face-copy strong {
  font-size: 14px;
  font-weight: 950;
}
.tt-home-face-copy span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}
.tt-home-face-btn,
.tt-home-face-clear {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  cursor: pointer;
}
.tt-home-face-btn {
  background: #111827;
  color: #fff;
}
.tt-home-face-secondary {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #111827;
  font-weight: 900;
  cursor: pointer;
}
.tt-home-face-secondary:hover { background: #f8fafc; }
.tt-home-face-clear {
  background: #f2f3f5;
  color: #111827;
}
.tt-home-face-clear[hidden],
.tt-home-face-preview[hidden] { display: none; }

.tt-status {
  margin: 8px 0 20px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tt-status.warn { background: #fff7ed; color: #9a3412; border-color: #fed7aa; }
.tt-status.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.tt-status[hidden] { display: none; }

.tt-section, .tt-results { margin-top: 16px; }
.tt-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tt-section-title h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.tt-section-title a, .tt-small-btn {
  border: 0;
  background: #f2f3f5;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
}
.tt-section[hidden], .tt-results[hidden] { display: none; }

.tt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 22px 14px;
  align-items: start;
}
.tt-product-card {
  min-width: 0;
  border-radius: var(--radius);
  overflow: visible;
}
.tt-card-image {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  min-height: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #edf0f4;
}
.tt-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .18s ease;
}
.tt-product-card:hover .tt-card-image img { transform: scale(1.025); }
.tt-missing-img {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}
.tt-card-body { padding: 8px 2px 0; }
.tt-card-title {
  display: block;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt-card-meta {
  min-height: 34px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}
.tt-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 7px;
  margin-top: 8px;
}
.tt-customize {
  text-align: center;
  padding: 7px 8px;
  border-radius: 999px;
  background: #d9d9d9;
  color: #111;
  font-weight: 900;
  white-space: nowrap;
  font-size: 13px;
}
.tt-customize:hover { background: #cfcfcf; }
.tt-price { flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 800; }
.tt-empty {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: var(--muted);
  background: #f8fafc;
}

.tt-result-group-full { grid-column: 1 / -1; }
.tt-result-group h3 { margin: 0 0 10px; }
.tt-brand-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.tt-brand-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.tt-brand-link { display: flex; align-items: center; gap: 12px; padding: 12px; }
.tt-brand-avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef2ff;
  font-weight: 900;
}
.tt-brand-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tt-brand-card span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }

.tt-modal[hidden] { display: none; }
.tt-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; }
.tt-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .48); }
.tt-modal-card {
  position: relative;
  width: min(420px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 90px rgba(15,23,42,.28);
}
.tt-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  cursor: pointer;
  font-size: 24px;
}
.tt-modal-card h2 { margin: 0; }
.tt-modal-card p { color: var(--muted); }
.tt-google {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}
.tt-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); }
.tt-divider::before, .tt-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.tt-auth-form { display: grid; gap: 12px; }
.tt-auth-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
.tt-auth-form input {
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
}
.tt-auth-error { min-height: 20px; color: #b91c1c !important; font-size: 13px; }

@media (max-width: 980px) {
  .hide-sm { display: none; }
  .tt-logo { width: 84px; }
  .tt-topbar { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px; padding-inline: 10px; }
  .tt-main { padding-inline: 16px; }
  .tt-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 760px) {
  :root { --sidebar-w: 220px; --topbar-h: 68px; }
  .tt-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  body:not(.sidebar-collapsed) .tt-sidebar { transform: translateX(0); box-shadow: 18px 0 50px rgba(15,23,42,.16); }
  .sidebar-collapsed .tt-sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); }
  .tt-main, .sidebar-collapsed .tt-main { margin-left: 0; }
  .tt-feed-head { display: block; }
  .tt-main-cta { margin-top: 12px; }
  .tt-home-face-upload {
    align-items: stretch;
    flex-wrap: wrap;
  }
  .tt-home-face-copy {
    flex-basis: calc(100% - 56px);
  }
  .tt-home-face-btn,
  .tt-home-face-secondary,
  .tt-home-face-clear {
    flex: 1 1 auto;
    text-align: center;
  }
  .tt-pill-ghost { display: none; }
  .tt-search-input { font-size: 14px; }
}

/* Product-card visual backgrounds on the root homepage.
   This is display-only: it does not touch designer/admin canvas, product data,
   cart items, previews, or print PNG exports. */
.tt-product-card .tt-card-image{
  position:relative;
  overflow:hidden;
  isolation:isolate;
  background:#f7f7f7;
}

.tt-product-card .tt-card-bg{
  position:absolute;
  inset:0;
  z-index:0;
  display:block;
  pointer-events:none;
  user-select:none;
  background-image:var(--home-card-bg-url, none);
  background-size:cover;
  background-position:var(--home-card-bg-position, center center);
  background-repeat:no-repeat;
  filter:var(--home-card-bg-filter, saturate(1.08) contrast(1.04) brightness(1.02));
  transform:scale(1.04);
}

.tt-product-card .tt-card-shirt{
  position:absolute;
  inset:-16% -14% -14% -14%;
  z-index:2;
  display:block;
  pointer-events:none;
  background:transparent !important;
}

.tt-product-card .tt-card-shirt img{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  background:transparent !important;
  transition:transform .18s ease;
}

.tt-product-card:hover .tt-card-shirt > img:not(.tt-card-face){ transform:scale(1.015); }
.tt-product-card .tt-card-shirt img.tt-card-face {
  inset: auto;
  left: var(--face-x, 50%);
  top: var(--face-y, 50%);
  width: var(--face-w, 20%);
  height: var(--face-h, 20%);
  z-index: 4;
  object-fit: contain;
  transform: translate(-50%, -50%) rotate(var(--face-rot, 0deg)) scale(var(--face-flip-x, 1), var(--face-flip-y, 1));
  transform-origin: center center;
  pointer-events: none;
}
.tt-product-card:hover .tt-card-shirt img.tt-card-face {
  transform: translate(-50%, -50%) rotate(var(--face-rot, 0deg)) scale(var(--face-flip-x, 1), var(--face-flip-y, 1));
}
.tt-product-card:hover .tt-card-image > img{ transform:none; }

.tt-product-card .tt-card-shirt .tt-missing-img{
  position:absolute;
  inset:0;
  z-index:3;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.76);
}


.tt-buy-now {
  text-align: center;
  padding: 7px 8px;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 900;
  white-space: nowrap;
  font-size: 13px;
}
.tt-buy-now:hover { background: #000; }
.tt-card-actions .tt-price {
  grid-column: 1 / -1;
  justify-self: center;
  max-width: 100%;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .tt-card-actions { grid-template-columns: 1fr 1fr; }
  .tt-card-actions .tt-price { grid-column: 1 / -1; justify-self: start; }
}


.tt-face-flyer {
  position: fixed;
  width: 56px;
  height: 56px;
  z-index: 9999;
  border-radius: 999px;
  object-fit: contain;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.72);
  filter: drop-shadow(0 12px 20px rgba(15, 23, 42, .26));
  animation: ttFaceFlyToCard .95s cubic-bezier(.18,.82,.21,1) forwards;
}

@keyframes ttFaceFlyToCard {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.55) rotate(-8deg);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12) rotate(6deg);
  }
  76% {
    opacity: 1;
    transform: translate(calc(-50% + var(--fly-x)), calc(-50% + var(--fly-y))) scale(.9) rotate(355deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--fly-x)), calc(-50% + var(--fly-y))) scale(.35) rotate(365deg);
  }
}

.tt-product-card.tt-face-pop .tt-card-image {
  animation: ttFaceCardPop .82s ease-out;
}

.tt-product-card.tt-face-pop .tt-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .95), transparent 18%),
    radial-gradient(circle at 72% 35%, rgba(56, 189, 248, .78), transparent 22%),
    radial-gradient(circle at 54% 72%, rgba(244, 114, 182, .70), transparent 24%),
    linear-gradient(135deg, rgba(250,204,21,.40), rgba(34,197,94,.20), rgba(168,85,247,.34));
  mix-blend-mode: screen;
  animation: ttFaceCardFlash .82s ease-out forwards;
}

@keyframes ttFaceCardPop {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(29, 127, 242, 0); }
  26% { transform: scale(1.035); box-shadow: 0 0 0 4px rgba(250, 204, 21, .55), 0 0 38px rgba(29, 127, 242, .42); }
  56% { transform: scale(1.015); box-shadow: 0 0 0 5px rgba(244, 114, 182, .35), 0 0 32px rgba(34, 197, 94, .30); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(29, 127, 242, 0); }
}

@keyframes ttFaceCardFlash {
  0% { opacity: 0; filter: hue-rotate(0deg) saturate(1.5); }
  18% { opacity: .95; filter: hue-rotate(80deg) saturate(2); }
  42% { opacity: .72; filter: hue-rotate(190deg) saturate(2.2); }
  72% { opacity: .35; filter: hue-rotate(310deg) saturate(1.8); }
  100% { opacity: 0; filter: hue-rotate(360deg) saturate(1); }
}

@media (prefers-reduced-motion: reduce) {
  .tt-face-flyer,
  .tt-product-card.tt-face-pop .tt-card-image,
  .tt-product-card.tt-face-pop .tt-card-image::after {
    animation: none !important;
  }
  .tt-face-flyer { display: none !important; }
}


@media (max-width: 560px) {
  .tt-card-actions {
    grid-template-columns: 1fr;
  }
  .tt-card-actions .tt-price {
    grid-column: auto;
  }
  .tt-home-face-upload {
    width: 100%;
    flex-wrap: wrap;
  }
  .tt-home-face-copy {
    flex-basis: calc(100% - 56px);
  }
}
