/* =====================================================================
   Tiny 3D Toy Shop — styles
   A "toy box" look: chunky sticker cards, candy colors, rounded type.
   ===================================================================== */

:root {
  /* palette */
  --paper:      #fdf7ff;
  --paper-2:    #fbeeff;
  --ink:        #2b2140;
  --ink-soft:   #6a5f86;
  --blue:       #3aa0ff;
  --blue-deep:  #1d6fd0;
  --sun:        #ffc43d;
  --pink:       #ff5d8f;
  --grass:      #33c26e;
  --grape:      #b191ff;
  --card:       #ffffff;
  --line:       #efe3f7;

  --shadow:     0 10px 0 rgba(43, 33, 64, .08), 0 18px 34px rgba(43, 33, 64, .14);
  --shadow-sm:  0 6px 0 rgba(43, 33, 64, .07), 0 10px 18px rgba(43, 33, 64, .12);

  --radius:     26px;
  --radius-sm:  16px;

  --font-display: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --font-body:    "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 80% -10%, #d9f0ff 0, transparent 60%),
    radial-gradient(900px 450px at -10% 0%, #ffe6f2 0, transparent 55%),
    var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

img { display: block; max-width: 100%; }

button { font-family: inherit; cursor: pointer; }

/* --- shared button --- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 5px 0 var(--blue-deep);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
}
.btn:hover  { filter: brightness(1.04); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--blue-deep); }
.btn.pink   { background: var(--pink);  box-shadow: 0 5px 0 #c73566; }
.btn.grass  { background: var(--grass); box-shadow: 0 5px 0 #1f8c4c; }
.btn.sun    { background: var(--sun);   box-shadow: 0 5px 0 #cf9410; color: var(--ink); }
.btn.ghost  { background: #fff; color: var(--ink); box-shadow: 0 5px 0 var(--line); }
.btn.big    { font-size: 1.2rem; padding: 16px 28px; }

:focus-visible { outline: 4px solid var(--grape); outline-offset: 3px; border-radius: 6px; }

/* =====================  HEADER  ===================== */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: rgba(253, 247, 255, .82);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: auto; text-decoration: none; color: var(--ink); }
.brand .logo {
  width: 52px; height: 52px; display: grid; place-items: center;
  font-size: 30px; border-radius: 16px;
  background: linear-gradient(135deg, var(--sun), var(--pink));
  box-shadow: var(--shadow-sm); transform: rotate(-6deg);
}
.brand .name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; }
.brand .name small { display: block; font-family: var(--font-body); font-weight: 700; color: var(--ink-soft); font-size: .72rem; }

.cart-btn { position: relative; }
.cart-count {
  position: absolute; top: -8px; right: -8px;
  min-width: 24px; height: 24px; padding: 0 6px;
  display: grid; place-items: center;
  background: var(--pink); color: #fff; border-radius: 999px;
  font-family: var(--font-display); font-weight: 800; font-size: .82rem;
  box-shadow: 0 3px 0 #c73566;
}
.cart-count.hidden { display: none; }
.cart-btn.bump { animation: bump .4s ease; }
@keyframes bump { 30% { transform: scale(1.18) rotate(-4deg); } 60% { transform: scale(.94); } }

/* =====================  HERO  ===================== */
.hero {
  text-align: center;
  padding: clamp(28px, 6vw, 60px) 20px clamp(10px, 3vw, 24px);
  max-width: 780px; margin: 0 auto;
}
.hero h1 { font-size: clamp(2.1rem, 7vw, 3.6rem); letter-spacing: -.5px; }
.hero h1 .pop { color: var(--pink); }
.hero p { font-size: clamp(1rem, 2.6vw, 1.25rem); color: var(--ink-soft); font-weight: 700; margin: 12px auto 20px; max-width: 44ch; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 3px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-weight: 800; font-size: .95rem; color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.chip b { color: var(--blue-deep); }

/* =====================  TOY GRID  ===================== */
.shelf {
  max-width: 1120px; margin: 0 auto;
  padding: clamp(20px, 4vw, 40px) clamp(14px, 4vw, 32px) 80px;
}
.shelf-head { display: flex; align-items: baseline; gap: 14px; margin: 6px 4px 22px; flex-wrap: wrap; }
.shelf-head h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
.shelf-head .count { color: var(--ink-soft); font-weight: 800; }

/* category filter pills */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 2px 24px; }
.filter-pill {
  border: 3px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 10px 18px;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  box-shadow: var(--shadow-sm); transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.filter-pill:active { transform: translateY(3px); }
.filter-pill.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 5px 0 var(--blue-deep); }
.filter-pill .n { opacity: .7; font-weight: 700; margin-left: 4px; }

.grid {
  display: grid; gap: clamp(18px, 3vw, 28px);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* category chip inside the card */
.cat-tag {
  display: inline-block; align-self: flex-start;
  background: var(--paper-2); color: var(--ink-soft);
  font-weight: 800; font-size: .72rem; letter-spacing: .2px;
  padding: 4px 10px; border-radius: 999px; margin-bottom: 8px;
}

.toy {
  position: relative;
  background: var(--card);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 18px;
  text-align: left;
  transition: transform .14s cubic-bezier(.34,1.56,.64,1);
  display: flex; flex-direction: column;
}
.toy:hover { transform: translateY(-6px) rotate(-1.2deg); }
.toy:nth-child(even):hover { transform: translateY(-6px) rotate(1.2deg); }

.toy .stage {
  position: relative;
  border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, #fff, var(--paper-2));
  aspect-ratio: 1 / 1; margin-bottom: 12px;
  border: 2px solid var(--line);
}
.toy .stage img { width: 100%; height: 100%; object-fit: cover; }
.price-tag {
  position: absolute; top: 10px; right: 10px;
  background: var(--sun); color: var(--ink);
  font-family: var(--font-display); font-weight: 800; font-size: 1.1rem;
  padding: 6px 12px; border-radius: 999px;
  box-shadow: 0 4px 0 #cf9410; transform: rotate(4deg);
}
.views-tag {
  position: absolute; bottom: 10px; left: 10px;
  background: rgba(43,33,64,.82); color: #fff;
  font-weight: 800; font-size: .74rem; letter-spacing: .3px;
  padding: 5px 10px; border-radius: 999px;
  display: flex; align-items: center; gap: 5px;
}
.toy h3 { font-size: 1.22rem; margin-bottom: 4px; }
.toy .desc { color: var(--ink-soft); font-weight: 600; font-size: .92rem; margin: 0 0 14px; flex: 1; }
.toy .toy-actions { display: flex; gap: 8px; }
.toy .toy-actions .btn { flex: 1; padding: 12px 10px; font-size: .98rem; }

/* =====================  MODAL SHELL  ===================== */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(43, 33, 64, .5);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  padding: 18px;
}
.overlay.open { display: flex; }
.sheet {
  background: var(--paper); border-radius: 28px;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
  width: min(680px, 100%); max-height: 92vh; overflow: auto;
  animation: pop .28s cubic-bezier(.34,1.56,.64,1);
}
@keyframes pop { from { transform: scale(.9) translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 18px; background: var(--paper);
  border-bottom: 3px solid var(--line);
}
.sheet-head h2 { font-size: 1.35rem; margin-right: auto; }
.iconbtn {
  border: none; background: #fff; width: 44px; height: 44px; border-radius: 50%;
  font-size: 1.3rem; color: var(--ink); box-shadow: var(--shadow-sm);
  display: grid; place-items: center; line-height: 1;
}
.iconbtn:active { transform: translateY(3px); }
.sheet-body { padding: 18px; }

/* =====================  TOY DETAIL / PHOTO BOOTH  ===================== */
.booth-main {
  position: relative;
  border-radius: 22px; overflow: hidden;
  border: 3px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--paper-2));
  aspect-ratio: 4 / 3;
}
.booth-main img { width: 100%; height: 100%; object-fit: contain; }
.booth-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.thumb {
  border: 3px solid var(--line); background: #fff; border-radius: 14px;
  padding: 4px; cursor: pointer; text-align: center;
}
.thumb img { border-radius: 9px; aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.thumb span { display: block; font-weight: 800; font-size: .68rem; color: var(--ink-soft); margin-top: 3px; }
.thumb.active { border-color: var(--blue); }
.thumb.active span { color: var(--blue-deep); }

.detail-info { margin-top: 16px; }
.detail-info h2 { font-size: 1.7rem; }
.detail-info .p { color: var(--ink-soft); font-weight: 600; margin: 8px 0 16px; }
.detail-buy { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-price { font-family: var(--font-display); font-weight: 800; font-size: 1.9rem; color: var(--blue-deep); }
.detail-buy .btn { margin-left: auto; }

/* =====================  CART  ===================== */
.cart-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 2px dashed var(--line); }
.cart-line img { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; border: 2px solid var(--line); }
.cart-line .cl-name { font-weight: 800; }
.cart-line .cl-price { color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.cart-line .cl-mid { flex: 1; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button {
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: #fff; box-shadow: var(--shadow-sm); font-weight: 800; font-size: 1.1rem; color: var(--ink);
}
.qty span { min-width: 22px; text-align: center; font-weight: 800; }

.cart-empty { text-align: center; padding: 30px 10px; color: var(--ink-soft); font-weight: 700; }
.cart-empty .big-emoji { font-size: 54px; }

.cart-total { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; }
.cart-total .amt { color: var(--grass); }
.cash-note {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 4px;
  background: #eafff2; border: 2px solid #bff0d3; color: #1f8c4c;
  border-radius: 14px; padding: 10px 12px; font-weight: 800; font-size: .92rem;
}
.cart-cta { display: grid; gap: 10px; margin-top: 14px; }

/* buyer name field */
.field { margin: 6px 0 2px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input {
  width: 100%; padding: 13px 15px; border-radius: 14px;
  border: 3px solid var(--line); font-family: inherit; font-size: 1rem; font-weight: 700; color: var(--ink);
  background: #fff;
}
.field input:focus { border-color: var(--blue); outline: none; }

/* =====================  ORDER TICKET  ===================== */
.ticket { text-align: center; }
.ticket .party { font-size: 46px; }
.ticket h2 { font-size: 1.8rem; margin: 6px 0; }
.ticket .num {
  display: inline-block; margin: 8px 0 4px;
  background: var(--ink); color: #fff; font-family: var(--font-display); font-weight: 800;
  letter-spacing: 2px; font-size: 1.5rem; padding: 8px 18px; border-radius: 14px;
}
.ticket .lead { color: var(--ink-soft); font-weight: 700; }
.ticket-list { text-align: left; margin: 16px 0; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 6px 14px; }
.ticket-list .row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 2px dashed var(--line); font-weight: 700; }
.ticket-list .row:last-child { border-bottom: none; }
.ticket-list .row.total { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
.ticket-cta { display: grid; gap: 10px; }
.order-status { min-height: 22px; margin: 4px 0 12px; font-weight: 800; font-size: .95rem; }
.order-status .sending { color: var(--ink-soft); }
.order-status .ok { color: var(--grass); }
.order-status .warn { color: #c76a00; }

/* =====================  SHARE / QR  ===================== */
.share-body { text-align: center; }
.qr-frame {
  display: inline-block; padding: 16px; background: #fff;
  border: 3px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-sm);
  margin: 8px auto 14px;
}
.qr-frame svg, .qr-frame img { width: 220px; height: 220px; }
.share-url {
  display: flex; gap: 8px; background: #fff; border: 3px solid var(--line);
  border-radius: 14px; padding: 6px 6px 6px 14px; align-items: center; max-width: 420px; margin: 0 auto 12px;
}
.share-url code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: .9rem; text-align: left; }
.share-hint { color: var(--ink-soft); font-weight: 700; font-size: .95rem; max-width: 40ch; margin: 6px auto 0; }
.share-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(140%);
  background: var(--ink); color: #fff; font-weight: 800;
  padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow);
  z-index: 80; transition: transform .3s cubic-bezier(.34,1.56,.64,1);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* footer */
.foot { text-align: center; padding: 30px 18px 50px; color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.foot a { color: var(--blue-deep); }
.owner-link { display: inline-block; margin-top: 8px; opacity: .6; font-size: .8rem; text-decoration: none; }
.owner-link:hover { opacity: 1; }

/* confetti canvas */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

@media (max-width: 480px) {
  .detail-buy .btn { margin-left: 0; width: 100%; }
  .booth-thumbs .thumb span { font-size: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; transition: none !important; }
}
