:root {
  /* Màu lấy từ erashop.com.vn (coral, peach), thêm vài nền pastel cho các ô quà */
  --coral: #FF937E;
  --coral-deep: #EE6F57;
  --peach: #E8B294;
  --ink: #2A211F;
  --ink-soft: #6E6260;
  --ground: #FFFFFF;
  --blush: #FFF1EC;
  --tile-1: #FFE2D9;
  --tile-2: #FFF0C7;
  --tile-3: #DDF0E4;
  --tile-4: #F6E1D2;
  --danger: #C8432E;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --r-sm: 12px;
  --r: 24px;
  --r-lg: 36px;
  --gutter: clamp(16px, 4vw, 48px);
  --font: "Montserrat", system-ui, sans-serif;
  --display: "Baloo 2", "Montserrat", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--coral-deep); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2 { font-family: var(--display); font-weight: 800; margin: 0; letter-spacing: -0.02em; line-height: 1.05; }

/* ---------- Logo thật của Era (PNG trắng dùng làm mask để đổi màu) ---------- */
.logo {
  display: block; width: 76px; aspect-ratio: 1126 / 512;
  background: var(--coral);
  -webkit-mask: url(img/logo-trang.png) center / contain no-repeat;
          mask: url(img/logo-trang.png) center / contain no-repeat;
}
.logo-xl { width: min(70vw, 520px); background: var(--ink); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: rgba(255, 255, 255, 0.92);
}
.brand { display: block; padding: 4px 0; }

.flow {
  position: relative; display: flex; gap: 2px; padding: 4px;
  border-radius: 99px; background: var(--blush);
}
.flow button {
  position: relative; z-index: 1;
  padding: 8px 16px; border: 0; border-radius: 99px; background: none;
  font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: default;
}
.flow button.is-done { cursor: pointer; color: var(--ink); }
.flow button.is-active { color: #fff; }
.flow-pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 99px; background: var(--coral); }

/* ---------- Buttons ---------- */
.btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 26px; border-radius: 99px; border: 0;
  font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
  transition: transform .18s var(--ease-out), background-color .2s var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--coral); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--coral-deep); }
.btn-soft { background: var(--blush); color: var(--coral-deep); }
.btn-soft:hover { background: var(--tile-1); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover:not(:disabled) { background: #000; }
.btn-zalo { min-height: 42px; padding: 0 18px; font-size: 14px; background: var(--ink); color: #fff; }
.btn-block { width: 100%; }
.btn-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.btn-file:focus-within { outline: 3px solid var(--coral-deep); outline-offset: 3px; }
.btn-text {
  position: relative; padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--coral-deep); text-decoration: underline; text-underline-offset: 3px;
}
.btn-text.danger { color: var(--danger); }
.link-back {
  padding: 6px 0; border: 0; background: none; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
}
.link-back:hover { color: var(--ink); }

/* ---------- Screens ---------- */
.screen { display: none; }
.screen.is-active { display: block; }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); align-items: center; gap: 24px;
  min-height: calc(100svh - 76px);
  padding: 24px var(--gutter) 56px;
}
.hero-copy { display: grid; gap: 28px; max-width: 680px; }
.hero-title { font-size: clamp(42px, 5.4vw, 84px); line-height: .98; }
.hero-title .line { display: block; overflow: hidden; padding-bottom: .16em; margin-bottom: -.1em; white-space: nowrap; }
.hero-title .line > span { display: inline-block; }
.mark { position: relative; color: var(--coral-deep); }
.scribble {
  position: absolute; left: -2%; bottom: -.08em; width: 104%; height: .28em; overflow: visible;
  fill: none; stroke: var(--peach); stroke-width: 7; stroke-linecap: round;
}
.hero-lead { margin: 0; max-width: 46ch; font-size: clamp(17px, 1.4vw, 20px); color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-stage { position: relative; height: min(78svh, 660px); }
.blob {
  position: absolute; inset: 8% 4% 6% 10%;
  border-radius: 46% 54% 42% 58% / 52% 40% 60% 48%;
  background: var(--blush);
}
.float {
  position: absolute; margin: 0; padding: 10px 10px 0;
  border-radius: var(--r); background: #fff;
  box-shadow: 0 24px 50px -24px rgba(110, 50, 35, .35);
  will-change: transform;
}
.float img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.float figcaption { padding: 8px 6px 12px; font-size: 14px; font-weight: 700; color: var(--ink); }
.float:not(:has(figcaption)) { padding-bottom: 10px; }
.f1 { width: 38%; left: 6%;  top: 4%;  transform: rotate(-6deg); }
.f2 { width: 34%; right: 2%; top: 0;   transform: rotate(5deg); }
.f3 { width: 26%; left: 38%; top: 36%; transform: rotate(-2deg); z-index: 2; }
.f4 { width: 32%; left: 2%;  bottom: 2%; transform: rotate(4deg); }
.f5 { width: 30%; right: 6%; bottom: 4%; transform: rotate(-7deg); }

/* ---------- Dải chữ chạy ---------- */
.band {
  overflow: hidden; margin: 8px -2vw 0; padding: 18px 0;
  background: var(--coral); color: #fff;
  rotate: -2deg;
}
.band-track { display: flex; width: max-content; gap: 28px; font-family: var(--display); font-weight: 700; font-size: clamp(20px, 2.4vw, 32px); white-space: nowrap; }
.band-track span { display: inline-flex; align-items: center; gap: 28px; }
.band-track span::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: #fff; opacity: .7; }

/* ---------- Catalogue ---------- */
.catalog { padding: clamp(96px, 12vw, 160px) var(--gutter) 40px; }
.catalog-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: end; margin-bottom: 40px; }
.catalog-head h2 { font-size: clamp(36px, 4.6vw, 64px); }
.catalog-head p { margin: 0; max-width: 40ch; justify-self: end; color: var(--ink-soft); }

.product-grid { position: relative; display: grid; gap: 22px 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.product {
  display: grid; gap: 12px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
}
.product.is-big { grid-column: span 2; grid-row: span 2; }
.product-tile {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1; padding: 14px; border-radius: var(--r-lg);
  background: var(--tile-1);
  transition: border-radius .4s var(--ease-out);
}
.product:nth-child(4n+2) .product-tile { background: var(--tile-2); }
.product:nth-child(4n+3) .product-tile { background: var(--tile-3); }
.product:nth-child(4n+4) .product-tile { background: var(--tile-4); }
.product.is-big .product-tile { aspect-ratio: auto; height: calc(100% - 64px); min-height: 280px; }
.product-tile img {
  height: auto;
  width: 100%; height: 100%; object-fit: cover; border-radius: 22px;
  transition: transform .6s var(--ease-out);
}
.product:hover .product-tile img { transform: scale(1.05) rotate(-1deg); }
.product:hover .product-tile { border-radius: 48px; }
.product-count {
  position: absolute; left: 24px; bottom: 24px;
  padding: 6px 14px; border-radius: 99px; background: #fff;
  font-size: 14px; font-weight: 700;
}
.product-body { display: grid; gap: 2px; padding: 0 6px; }
.product-name { font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.2; }
.product-meta { font-size: 14px; color: var(--ink-soft); }
.product-price { font-size: 15px; font-weight: 700; color: var(--coral-deep); }

/* ---------- Câu chuyện cuộn để tô màu ---------- */
.story { padding: clamp(96px, 14vw, 200px) var(--gutter); }
.story-text {
  margin: 0 auto; max-width: 22ch;
  font-family: var(--display); font-weight: 700; font-size: clamp(30px, 4.4vw, 60px); line-height: 1.15; letter-spacing: -0.01em;
}
.story-text .w { opacity: .18; }
.story-text em { font-style: normal; }
.story-text em .w { position: relative; }
.story-text .hl { background: var(--tile-2); border-radius: 12px; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 0 .12em; }

/* ---------- Footer ---------- */
.footer {
  display: grid; gap: 24px; justify-items: start;
  margin: 0 var(--gutter) var(--gutter); padding: clamp(32px, 5vw, 64px);
  border-radius: var(--r-lg); background: var(--coral);
}
.footer .logo-xl { background: #fff; }
.footer-info { display: grid; gap: 4px; color: #fff; font-weight: 600; }
.footer-info p { margin: 0; }
.footer-info a { text-decoration: none; border-bottom: 2px solid rgba(255,255,255,.5); }

/* ---------- Bước 2: workbench ---------- */
.workbench {
  display: grid; gap: 24px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 360px;
  padding: 16px var(--gutter) 64px;
}
.board-field {
  display: grid; gap: 16px; align-content: center;
  min-height: calc(100svh - 120px);
  padding: clamp(20px, 4vw, 56px); border-radius: var(--r-lg);
  background: var(--blush);
}
.board {
  position: relative; width: 100%; margin-inline: auto;
  border-radius: 10px; background: #fff;
}
.board-hint { margin: 0; text-align: center; color: var(--ink-soft); font-size: 14px; }

.slot {
  position: absolute; padding: 0; overflow: hidden;
  border: 2px dashed var(--peach); border-radius: 10px;
  background: #FFF8F5; cursor: pointer;
  touch-action: none;
  transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out);
}
.slot:hover { border-color: var(--coral); background: var(--tile-1); }
.slot img {
  position: absolute; max-width: none; left: 0; top: 0;
  pointer-events: none; user-select: none; opacity: 0;
}
.slot.has-photo { border-style: solid; border-color: transparent; cursor: grab; }
.slot.has-photo img { opacity: 1; }
.slot.has-photo .slot-empty { display: none; }
.slot.is-dragging { cursor: grabbing; }
.slot.is-selected { outline: 3px solid var(--coral); outline-offset: 3px; }
.slot.is-lowres::after {
  content: "!"; position: absolute; right: 6px; top: 6px;
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--danger); color: #fff; font-weight: 700; font-size: 13px;
}
.slot-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.slot-empty svg { width: 30%; max-width: 36px; stroke: var(--coral); stroke-width: 2.4; fill: none; stroke-linecap: round; }
.slot-index {
  position: absolute; left: 6px; bottom: 6px; z-index: 1;
  min-width: 22px; padding: 0 7px; border-radius: 99px;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 13px; font-weight: 700; line-height: 22px;
}

.panel { position: sticky; top: 92px; display: grid; gap: 18px; }
.panel-product { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; align-items: center; }
.panel-product img { width: 88px; height: 88px; object-fit: cover; border-radius: 20px; rotate: -4deg; }
.panel-title { font-size: 26px; }
.panel-spec { margin: 4px 0 0; color: var(--coral-deep); font-weight: 700; font-size: 14px; }
.panel-note { margin: 0; color: var(--ink); font-size: 15px; }

.counter {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 4px 12px;
  padding: 18px 20px; border-radius: var(--r); background: var(--tile-2);
}
.counter-num { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; }
.counter-num b { color: var(--coral-deep); }
.counter #progress-text { font-weight: 600; font-size: 15px; }
.progress-bar { grid-column: 1 / -1; height: 8px; margin-top: 6px; border-radius: 99px; background: #fff; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--coral); border-radius: inherit; }

.editor { display: grid; gap: 12px; padding: 18px 20px; border-radius: var(--r); background: var(--tile-3); }
.editor-title { margin: 0; font-weight: 700; font-size: 15px; }
.zoom { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; font-size: 14px; }
.zoom input { accent-color: var(--coral-deep); }
.editor-actions { display: flex; gap: 18px; }
.warn { margin: 0; font-size: 14px; color: var(--danger); }

/* ---------- Bước 3: thông tin ---------- */
.info-card {
  margin: 16px var(--gutter) 64px; overflow: hidden;
  border-radius: var(--r-lg); background: var(--coral);
}
.strip { overflow: hidden; padding: 36px 0 10px; }
.strip-track { display: flex; gap: 12px; width: max-content; }
.strip-track img { height: 132px; width: auto; border-radius: 16px; object-fit: cover; }
.strip-track img:nth-child(odd) { rotate: -3deg; }
.strip-track img:nth-child(even) { rotate: 2deg; }
.info-form { display: grid; gap: 22px; max-width: 880px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 48px) clamp(32px, 5vw, 56px); color: #fff; }
.info-form h2 { font-size: clamp(32px, 4.2vw, 54px); max-width: 18ch; }
.summary { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-weight: 600; }
.summary strong { padding: 6px 14px; border-radius: 99px; background: #fff; color: var(--ink); }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 8px; font-size: 14px; font-weight: 700; }
.field-wide { grid-column: 1 / -1; }
.field em { font-style: normal; font-weight: 500; opacity: .85; }
.field input, .field textarea {
  width: 100%; padding: 16px 18px; border: 0; border-radius: 18px;
  background: rgba(255, 255, 255, .28); color: #fff;
  font-weight: 500; font-size: 17px;
  transition: background-color .2s var(--ease-out);
}
.field input::placeholder, .field textarea::placeholder { color: rgba(255, 255, 255, .78); }
.field input:focus, .field textarea:focus { outline: none; background: #fff; color: var(--ink); }
.field input:focus::placeholder, .field textarea:focus::placeholder { color: var(--ink-soft); }
.field.is-invalid input { box-shadow: inset 0 0 0 3px var(--ink); }
.form-error { margin: 0; padding: 12px 16px; border-radius: 14px; background: #fff; color: var(--danger); font-weight: 600; font-size: 15px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.form-actions .link-back { color: #fff; }

/* ---------- Hoàn tất ---------- */
.done { position: relative; display: grid; justify-items: center; gap: 18px; max-width: 560px; margin: 4vh auto 64px; padding: 0 var(--gutter); text-align: center; }
.done h2 { font-size: clamp(34px, 5vw, 56px); }
.done p { margin: 0; color: var(--ink); max-width: 40ch; }
.done-stack { position: relative; width: 220px; height: 190px; margin-bottom: 4px; }
.done-stack img {
  position: absolute; left: 50%; top: 50%; width: 120px; height: 120px; object-fit: cover;
  margin: -60px 0 0 -60px; border: 6px solid #fff; border-radius: 14px;
  box-shadow: 0 14px 30px -14px rgba(110, 50, 35, .45);
}
.heart { position: absolute; top: 150px; left: calc(50% + 70px); width: 54px; fill: none; stroke: var(--coral); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 32px; }
  .hero-stage { height: 92vw; max-height: 560px; }
  .catalog-head { grid-template-columns: 1fr; }
  .catalog-head p { justify-self: start; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench { grid-template-columns: 1fr; }
  .board-field { min-height: 0; }
  .panel { position: static; }
  .fields { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .topbar { padding-block: 10px; }
  .logo { width: 62px; }
  .flow button { padding: 7px 10px; font-size: 13px; }
  .btn-zalo { display: none; }
  .hero-actions .btn { flex: 1 1 100%; }
  .float { padding: 6px; border-radius: 18px; }
  .float img { border-radius: 12px; }
  .float figcaption { display: none; }
  .product.is-big .product-tile { height: auto; aspect-ratio: 1; min-height: 0; }
  .product-name { font-size: 18px; }
  .product-count { left: 16px; bottom: 16px; font-size: 13px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .done-actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  .story-text .w { opacity: 1; }
}

/* ---------- Popup chờ gửi ảnh ---------- */
.sending {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: var(--gutter);
  background: rgba(42, 33, 31, .55);
}
.sending-card {
  display: grid; justify-items: center; gap: 12px;
  width: min(100%, 420px); padding: 36px 28px 28px;
  border-radius: var(--r-lg); background: #fff; text-align: center;
}
.sending-card h2 { font-size: 28px; }
.sending-card p { margin: 0; color: var(--ink-soft); font-size: 15px; }
.sending-photos { position: relative; width: 150px; height: 120px; margin-bottom: 8px; }
.sending-photos img {
  position: absolute; left: 50%; top: 50%; width: 84px; height: 84px; margin: -42px 0 0 -42px;
  object-fit: cover; border: 5px solid #fff; border-radius: 12px;
  box-shadow: 0 10px 24px -12px rgba(110, 50, 35, .5);
}
.sending-bar { width: 100%; height: 10px; margin-top: 8px; border-radius: 99px; background: var(--blush); overflow: hidden; }
.sending-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--coral); }
.sending-pct { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--ink) !important; }
.sending-pct b { color: var(--coral-deep); }

/* ---------- Popup căn chỉnh, cắt ảnh ---------- */
.crop {
  position: fixed; inset: 0; z-index: 55;
  display: grid; place-items: center; padding: 12px;
  background: rgba(42, 33, 31, .6);
}
.crop-card {
  display: grid; gap: 14px;
  width: min(100%, 560px); max-height: calc(100dvh - 24px); overflow: auto;
  padding: 22px; border-radius: var(--r-lg); background: #fff;
}
.crop-head h2 { font-size: 26px; }
.crop-head p { margin: 2px 0 0; color: var(--coral-deep); font-weight: 700; font-size: 14px; }
.crop-stage {
  position: relative; overflow: hidden;
  height: min(58dvh, 460px); border-radius: 18px;
  background: #1d1716; touch-action: none; cursor: grab;
}
.crop-stage.is-dragging { cursor: grabbing; }
.crop-stage img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; pointer-events: none; }
.crop-frame {
  position: absolute; pointer-events: none;
  border: 2px solid #fff; border-radius: 6px;
  box-shadow: 0 0 0 9999px rgba(29, 23, 22, .62);
}
/* Lưới chia ba để khách căn bố cục */
.crop-frame i { position: absolute; inset: 0; }
.crop-frame i:first-child { border-left: 1px solid rgba(255,255,255,.45); border-right: 1px solid rgba(255,255,255,.45); left: 33.33%; right: 33.33%; }
.crop-frame i:last-child { border-top: 1px solid rgba(255,255,255,.45); border-bottom: 1px solid rgba(255,255,255,.45); top: 33.33%; bottom: 33.33%; }
.crop-hint { margin: 0; color: var(--ink-soft); font-size: 14px; }
.crop-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }

/* ---------- Thanh lọc sản phẩm ---------- */
.filter {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin-bottom: 32px;
}
.chips {
  position: relative; display: flex; gap: 4px; padding: 6px;
  border-radius: 99px; background: var(--blush);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  position: relative; z-index: 1; flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border: 0; border-radius: 99px; background: none; cursor: pointer;
  font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap;
  transition: color .25s var(--ease-out), transform .18s var(--ease-out);
}
.chip:hover { color: var(--coral-deep); }
.chip:active { transform: scale(.95); }
.chip[aria-checked="true"] { color: #fff; }
.chip-count {
  min-width: 24px; padding: 0 7px; border-radius: 99px;
  background: #fff; color: var(--ink); font-size: 12px; line-height: 22px; text-align: center;
  transition: background-color .25s var(--ease-out), color .25s var(--ease-out);
}
.chip[aria-checked="true"] .chip-count { background: rgba(255,255,255,.28); color: #fff; }
.chip-pill { position: absolute; z-index: 0; top: 6px; bottom: 6px; left: 0; width: 0; border-radius: 99px; background: var(--coral); }

.search {
  display: flex; align-items: center; gap: 10px;
  width: min(100%, 300px); padding: 0 18px; border-radius: 99px;
  background: var(--blush);
  transition: background-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.search:focus-within { background: #fff; box-shadow: inset 0 0 0 2px var(--coral); }
.search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--coral-deep); stroke-width: 2.4; stroke-linecap: round; }
.search input {
  width: 100%; min-height: 52px; border: 0; background: none; outline: none;
  font-weight: 500; font-size: 16px;
}
.search input::placeholder { color: var(--ink-soft); }

.product.is-hidden { display: none; }
.empty { display: grid; justify-items: start; gap: 14px; padding: 40px 0 8px; }
.empty p { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; }

@media (max-width: 600px) {
  .filter { margin-bottom: 24px; }
  .chips { margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); border-radius: 0; background: none; }
  .chip { background: var(--blush); }
  .chip[aria-checked="true"] { background: none; }
  .chip-pill { top: 6px; bottom: 6px; }
  .search { width: 100%; }
}

/* Ô chọn file ẩn nhưng vẫn mở được trên iPhone (không dùng display:none) */
.file-hidden { position: fixed; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Bước chọn loại và số lượng ---------- */
.variant-wrap {
  display: grid; gap: clamp(24px, 4vw, 56px); align-items: start;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  padding: 16px var(--gutter) 64px;
}
.variant-head { position: sticky; top: 92px; display: grid; gap: 20px; }
.variant-head img {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  border-radius: var(--r-lg); transform: rotate(-2deg);
}
.variant-head h2 { font-size: clamp(30px, 3.6vw, 48px); }
.variant-head p { margin: 8px 0 0; color: var(--ink-soft); }
.variant-body { display: grid; gap: 28px; }
.variant-body h3 { margin: 0 0 14px; font-family: var(--display); font-weight: 700; font-size: 24px; }

.variant-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.variant {
  position: relative; display: grid; gap: 4px; padding: 18px 20px 18px 56px; text-align: left;
  border: 0; border-radius: var(--r); background: var(--blush); cursor: pointer;
  transition: background-color .2s var(--ease-out), transform .18s var(--ease-out);
}
.variant:nth-child(4n+2) { background: var(--tile-2); }
.variant:nth-child(4n+3) { background: var(--tile-3); }
.variant:nth-child(4n+4) { background: var(--tile-4); }
.variant:hover { transform: translateY(-2px); }
.variant:active { transform: scale(.97); }
.variant[aria-checked="true"] { background: var(--coral); color: #fff; }
.variant-name { font-weight: 700; font-size: 16px; line-height: 1.3; }
.variant-meta { font-size: 14px; opacity: .8; }
.variant-check {
  position: absolute; left: 18px; top: 20px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: inset 0 0 0 2px var(--peach);
}
.variant[aria-checked="true"] .variant-check { box-shadow: inset 0 0 0 7px var(--ink); }

.qty { padding: 22px; border-radius: var(--r); background: var(--tile-2); }
.qty-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.qty-row p { margin: 0; font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 6px; padding: 6px; border-radius: 99px; background: #fff; }
.stepper button {
  width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--blush);
  font-size: 24px; font-weight: 700; color: var(--coral-deep); cursor: pointer;
  transition: transform .15s var(--ease-out), background-color .2s;
}
.stepper button:hover:not(:disabled) { background: var(--tile-1); }
.stepper button:active:not(:disabled) { transform: scale(.9); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
#qty-num { min-width: 44px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 28px; }

/* Ô "thêm" (không bắt buộc) trên tấm in */
.slot.is-optional:not(.has-photo) { border-color: var(--line, #E3E3E3); background: #FCFAF9; }
.slot.is-optional:not(.has-photo) .slot-empty svg { stroke: var(--peach); }

@media (max-width: 860px) {
  .variant-wrap { grid-template-columns: 1fr; }
  .variant-head { position: static; grid-template-columns: 96px 1fr; align-items: center; }
  .variant-head h2 { font-size: 26px; }
}

/* Điện thoại: thanh bước chỉ hiện chữ ở bước đang làm, các bước khác là chấm tròn */
@media (max-width: 600px) {
  .flow button { white-space: nowrap; }
  .flow button:not(.is-active) { width: 26px; padding: 0; font-size: 0; }
  .flow button:not(.is-active)::before {
    content: ""; display: block; width: 8px; height: 8px; margin: auto; border-radius: 50%;
    background: currentColor; opacity: .5;
  }
  .flow button.is-done:not(.is-active)::before { opacity: 1; }
}


/* ---------- Xưởng thiết kế: Mẫu | Sản phẩm của bạn ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.studio figure { margin: 0; display: grid; gap: 10px; }
.studio figcaption {
  justify-self: start; padding: 6px 14px; border-radius: 99px; background: #fff;
  font-family: var(--display); font-weight: 700; font-size: 16px;
}
.studio-mine figcaption { background: var(--coral); color: #fff; }
.studio-sample img, .stage img { width: 100%; height: auto; border-radius: 18px; display: block; }
.stage { position: relative; border-radius: 18px; overflow: hidden; touch-action: none; user-select: none; }
.item-layer { position: absolute; inset: 0; }

.item {
  position: absolute; left: 50%; top: 50%;
  touch-action: none; cursor: move; transform-origin: center;
}
.item canvas, .item svg { display: block; width: 100%; height: 100%; pointer-events: none; }
.item[data-kind="photo"] { filter: drop-shadow(0 6px 10px rgba(42,33,31,.28)); }
.item[data-kind="text"] {
  padding: .05em .2em; white-space: pre; line-height: 1.15; text-align: center; color: #fff;
  text-shadow: 0 0 2px rgba(42,33,31,.45), 0 1px 3px rgba(42,33,31,.3);
}
.item[data-kind="sticker"] svg { overflow: visible; filter: drop-shadow(0 0 .6px rgba(42,33,31,.25)); }
.item.is-selected { outline: 2px dashed var(--coral-deep); outline-offset: 6px; }
.item .h-rot, .item .h-size {
  position: absolute; display: none; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px var(--coral-deep); touch-action: none;
}
.item.is-selected .h-rot, .item.is-selected .h-size { display: block; }
.item .h-rot { left: 50%; top: -42px; margin-left: -12px; cursor: grab; }
.item .h-rot::after { content: ""; position: absolute; left: 11px; top: 24px; width: 2px; height: 14px; background: var(--coral-deep); }
.item .h-size { right: -18px; bottom: -18px; background: var(--coral); cursor: nwse-resize; }

.tools { display: grid; gap: 14px; }
.tool { display: grid; gap: 10px; padding: 16px 18px; border-radius: var(--r); background: var(--blush); }
.tool-title { margin: 0; font-weight: 700; font-size: 15px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 0; border-radius: 99px; background: #fff; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink);
  transition: transform .15s var(--ease-out), box-shadow .2s;
}
.chip-row button:active { transform: scale(.95); }
.chip-row button[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--coral-deep); }
.chip-row .frame-ico { width: 16px; height: 16px; background: var(--peach); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--peach); }
.chip-row .ink-dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(42,33,31,.25); }
#text-fonts button { font-size: 18px; }
.sticker-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sticker-row button {
  aspect-ratio: 1; padding: 8px; border: 0; border-radius: 14px; background: #C9C3C1; cursor: pointer; color: #fff;
  transition: transform .15s var(--ease-out);
}
.sticker-row button:hover { transform: translateY(-2px) rotate(-4deg); }
.sticker-row button:active { transform: scale(.92); }
.sticker-row svg { width: 100%; height: 100%; overflow: visible; }
.item-editor { display: grid; gap: 12px; padding: 18px 20px; border-radius: var(--r); background: var(--tile-1); }
.item-editor textarea {
  width: 100%; padding: 12px 14px; margin-bottom: 10px; border: 0; border-radius: 14px; background: #fff;
  font: 500 16px/1.4 var(--font); resize: vertical;
}
.item-editor textarea:focus { outline: 2px solid var(--coral); }
.text-hint { margin: 0; font-size: 13px; color: var(--ink-soft); }

@media (max-width: 860px) {
  .studio { grid-template-columns: 1fr; }
}
.btn.is-disabled { opacity: .45; pointer-events: none; }
/* Cho các hàng công cụ co lại vừa màn hình điện thoại */
.panel, .tools, .tool, .item-editor { min-width: 0; }
.sticker-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 960px) { .workbench { grid-template-columns: minmax(0, 1fr); } }

/* Chọn cách làm: nằm trên cùng xưởng, 2 lựa chọn bằng nhau, viên coral trượt theo lựa chọn */
.mode-row {
  grid-column: 1 / -1; position: relative;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px;
  padding: 5px; border-radius: 22px; background: #fff;
}
.mode-row button {
  position: relative; z-index: 1; display: grid; gap: 2px; padding: 12px 14px;
  border: 0; border-radius: 18px; background: none; cursor: pointer; text-align: center; color: var(--ink);
  transition: color .25s var(--ease-out);
}
.mode-row button b { font-family: var(--display); font-size: 18px; line-height: 1.2; }
.mode-row button small { font-size: 13px; opacity: .75; }
.mode-row button[aria-checked="true"] { color: #fff; }
.mode-pill { position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 18px; background: var(--coral); }

/* Vùng bấm vô hình quanh hình vẽ nhỏ và chữ: hình 10px vẫn dễ bấm, dễ kéo (nhất là trên điện thoại) */
.item[data-kind="sticker"]::before, .item[data-kind="text"]::before {
  content: ""; position: absolute; inset: -14px;
}
.studio-note { margin: -4px 0 0; font-size: 13px; font-style: italic; color: var(--ink-soft); }
/* Khung Mẫu cũng chừa đúng một dòng như vậy để hai ảnh vẫn thẳng hàng */
@media (min-width: 861px) { .studio-sample figcaption { margin-bottom: calc(13px * 1.6 - 4px + 10px); } }
