:root {
  --brand: #0f766e;
  --brand-dark: #115e59;
  --price: #e11d48;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f3f4f6;
  --card: #fff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--bg);
  font: 14px/1.5 "Segoe UI", "Microsoft JhengHei", sans-serif;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.container { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }
main.container { flex: 1; }
.topbar {
  background: #134e4a;
  color: #ecfdf5;
  font-size: 12px;
  text-align: center;
  padding: 6px 12px;
}
.sticky-head { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "logo search links";
  gap: 16px;
  align-items: center;
  padding: 12px 0;
}
.logo { grid-area: logo; font-size: 22px; font-weight: 700; color: var(--brand); text-decoration: none; letter-spacing: 0.04em; }
.logo small { font-size: 16px; font-weight: 600; color: #111827; margin-left: 2px; }
.search { display: flex; min-width: 0; grid-area: search; }
.search input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--brand);
  border-right: 0;
  border-radius: 4px 0 0 4px;
  padding: 10px 12px;
}
.search button, .btn {
  border: 0;
  background: var(--brand);
  color: #fff;
  border-radius: 4px;
  padding: 10px 16px;
  cursor: pointer;
}
.search button { border-radius: 0 4px 4px 0; }
.btn:hover, .search button:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.header-links { display: flex; gap: 12px; align-items: center; justify-content: flex-end; justify-self: end; grid-area: links; }
.header-links a, .link-btn { color: var(--ink); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.points-link { color: var(--price); font-weight: 700; white-space: nowrap; }
.cart-link { position: relative; font-weight: 600; }
.badge {
  position: absolute;
  top: -8px;
  right: -12px;
  background: var(--price);
  color: #fff;
  border-radius: 99px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}
.catbar { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 10px; }
.catbar a {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--ink);
  padding: 4px 8px;
  border-radius: 99px;
}
.catbar a.on, .catbar a:hover { background: #ccfbf1; color: var(--brand-dark); }
.flash-msg { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; padding: 10px 12px; border-radius: 8px; margin: 12px 0; }
.flash-msg.success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
main { padding-bottom: 40px; }
.hero-grid { display: grid; grid-template-columns: 1fr 200px; gap: 12px; margin-top: 16px; }
.hero-main, .hero-side a, .panel, .card, .shop-card, .cart-shop, .account-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.hero-main {
  min-height: 230px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(6, 24, 22, .78) 0%, rgba(6, 24, 22, .42) 52%, rgba(6, 24, 22, .16) 100%),
    url("hero-market.jpg") center / cover no-repeat;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero-main h1 { margin: 0 0 8px; font-size: 32px; }
.hero-main p { margin: 0; max-width: 36em; }
.hero-side { display: grid; gap: 12px; }
.hero-side a { padding: 16px; text-decoration: none; display: flex; flex-direction: column; justify-content: center; }
.hero-side strong { font-size: 16px; }
.hero-side span { color: var(--muted); }
.section-head, .sortbar, .cart-bar, .line, .shop-head, .order-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.section-head { margin: 8px 0; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-head a { color: var(--brand); }
.panel { padding: 12px; margin-bottom: 16px; }
.flash-row, .product-grid, .shop-row { display: grid; gap: 10px; }
.flash-row { grid-template-columns: repeat(6, 1fr); }
.product-grid { grid-template-columns: repeat(6, 1fr); }
.shop-row { grid-template-columns: repeat(6, 1fr); margin-bottom: 16px; }
.card { text-decoration: none; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card:hover { border-color: #99f6e4; }
.thumb-wrap { position: relative; background: #f9fafb; }
.thumb-wrap img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.off {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--price);
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  padding: 2px 6px;
}
.card h3, .card p { margin: 8px 10px 0; font-size: 14px; font-weight: 400; }
.card h3 {
  height: 42px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.price-row, .meta { padding: 0 10px; }
.price-row { display: flex; gap: 6px; align-items: baseline; margin-top: 6px; }
.price-row b, .pay { color: var(--price); }
.price-row b { white-space: nowrap; }
.price-row s, .meta, .muted { color: var(--muted); }
.card .meta, .card .price-row { margin-bottom: 8px; }
.bar { height: 8px; background: #ffe4e6; border-radius: 99px; margin: 8px 10px 12px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--price); }
.list-page { margin-top: 16px; }
.buybox, .shopbox, .summary, .auth, .account-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.sortbar { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }
.sortbar a { text-decoration: none; padding: 6px 8px; border-radius: 6px; }
.sortbar a.on { background: #ccfbf1; color: var(--brand-dark); }
.pager { display: flex; gap: 12px; justify-content: center; margin-top: 16px; }
.pager a { color: var(--brand); }
.crumbs { color: var(--muted); margin: 16px 0; }
.crumbs a { color: var(--brand); }
.pdp { display: grid; grid-template-columns: minmax(280px, 420px) 1fr 240px; gap: 16px; }
.gallery-main { background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.gallery-main img { aspect-ratio: 1; width: 100%; object-fit: cover; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; }
.thumbs button { width: 64px; padding: 0; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; }
.thumbs button.on { border-color: var(--brand); }
.buybox, .shopbox, .summary { padding: 16px; }
.buybox h1 { font-size: 22px; margin: 8px 0; }
.big-price { color: var(--price); font-size: 28px; margin: 8px 0; }
.big-price .off { position: static; margin-left: 8px; }
.variants { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.variants label { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.variants input { margin-right: 4px; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.shopbox { align-self: start; text-align: center; }
.swatch { height: 64px; border-radius: 8px; margin-bottom: 8px; }
.tabs { display: flex; gap: 16px; margin: 20px 0 8px; }
.tabs a { color: var(--brand); font-weight: 600; }
.detail, .review, .order-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 12px; }
.review header { display: flex; justify-content: space-between; }
.stars { position: relative; display: inline-block; letter-spacing: 1px; }
.stars::before {
  content: "★★★★★";
  background: linear-gradient(90deg, #f59e0b var(--percent), #e5e7eb var(--percent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cart-shop { padding: 12px; margin-top: 12px; }
.shop-head, .line { padding: 8px 0; }
.line { border-top: 1px solid var(--line); }
.line img { width: 72px; height: 72px; border-radius: 6px; }
.line-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; }
.cart-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border: 1px solid var(--line);
  padding: 12px;
  margin-top: 12px;
}
.checkout-grid, .account-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field input, .field select, .auth input {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}
.check { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0; font-size: 14px; }
.auth input[type="checkbox"], .check input {
  width: auto;
  padding: 0;
  border: 0;
  margin-top: 3px;
}
.delete-account { margin-top: 16px; padding: 16px; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-row input { flex: 1; min-width: 0; }
.code-row .btn { white-space: nowrap; }
.choice { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.pay-note { background: #f9fafb; border-radius: 8px; padding: 10px; color: var(--muted); }
.auth { width: min(420px, 100%); margin: 24px auto; padding: 20px; }
main.container:has(.story-auth) {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
}
main.container:has(.story-auth) + .footer { margin-top: 0; }
.story-auth {
  flex: 1 0 auto;
  align-self: stretch;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 420px);
  gap: 40px;
  align-items: center;
  min-height: 560px;
  padding: 48px max(20px, calc((100% - 1200px) / 2));
  color: #fff;
  background:
    linear-gradient(90deg, rgba(6, 16, 22, .86) 0%, rgba(6, 16, 22, .58) 46%, rgba(6, 16, 22, .28) 100%),
    var(--story-image) center / cover no-repeat;
}
.story-auth.street { --story-image: url("auth-street.jpg"); }
.story-auth.market { --story-image: url("auth-market.jpg"); }
.story-kicker {
  margin: 0 0 8px;
  letter-spacing: 0.2em;
  font-size: 13px;
  color: #fecaca;
}
.story-copy h2 { margin: 0 0 12px; font-size: 36px; line-height: 1.25; }
.story-copy p { margin: 0 0 12px; max-width: 34em; font-size: 15px; line-height: 1.75; color: rgba(255, 255, 255, .92); }
.story-copy .story-lead { margin: 0; font-size: 20px; line-height: 1.85; }
.story-places { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.story-places li { border: 1px solid rgba(255, 255, 255, .4); border-radius: 99px; padding: 3px 10px; font-size: 13px; }
.story-auth .auth { margin: 0; width: 100%; color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, .25); }
.pill { border-radius: 99px; padding: 2px 8px; font-size: 12px; }
.pill.pending { background: #fff7ed; color: #c2410c; }
.pill.cancelled { background: #f3f4f6; color: #4b5563; }
.empty { background: #fff; border-radius: 8px; padding: 32px; text-align: center; margin-top: 16px; }
.shop-banner { padding: 20px; border-radius: 8px; margin-top: 16px; }
.footer-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-left: auto;
  flex-wrap: wrap;
}
.footer-links { white-space: nowrap; }
.line-dock {
  display: flex;
  align-items: center;
  gap: 10px;
}
.line-note {
  margin: 0;
  max-width: 220px;
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.line-fab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #06c755;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 16px 10px 12px;
  font-weight: 700;
  white-space: nowrap;
}
.footer .line-fab { color: #fff; }
.line-fab svg { width: 28px; height: 28px; flex: none; }
.footer { background: #111827; color: #e5e7eb; margin-top: 24px; }
.footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; flex-wrap: wrap; }
.footer a { color: #e5e7eb; }
@media (max-width: 1000px) {
  .hero-grid, .pdp, .checkout-grid, .account-grid { grid-template-columns: 1fr; }
  .product-grid, .flash-row { grid-template-columns: repeat(3, 1fr); }
  .shop-row { grid-template-columns: repeat(4, 1fr); }
  .hero-side { grid-template-columns: 1fr 1fr; }
  .story-auth {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 32px 16px 36px;
    background:
      linear-gradient(180deg, rgba(6, 16, 22, .45) 0%, rgba(6, 16, 22, .82) 42%, rgba(6, 16, 22, .88) 100%),
      var(--story-image) center / cover no-repeat;
  }
  .story-copy h2 { font-size: 28px; }
}
@media (max-width: 720px) {
  .header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "logo links"
      "search search";
    gap: 10px;
  }
  .product-grid, .flash-row, .shop-row { grid-template-columns: repeat(2, 1fr); }
  .line { align-items: flex-start; flex-wrap: wrap; }
  .header-links { gap: 8px; font-size: 13px; }
  .footer-links { white-space: normal; }
  .line-dock { flex-wrap: wrap; justify-content: flex-end; }
}
.admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #134e4a;
  color: #fff;
  padding: 14px 20px;
}
.admin-bar a, .admin-bar button { color: #fff; background: transparent; border: 0; cursor: pointer; font: inherit; }
.admin-wrap { width: min(1100px, calc(100% - 32px)); margin: 24px auto 48px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); }
.admin-table th, .admin-table td { border-bottom: 1px solid var(--line); text-align: left; padding: 10px 12px; vertical-align: top; }
.admin-table th { background: #f9fafb; }
.admin-login { min-height: 70vh; display: grid; place-items: center; }
.admin-wrap .field input { max-width: 220px; }
