/* 阿利海產：溫暖手作感，米色底＋深海藍＋辣椒紅 */
:root {
  --bg: #faf6ef;
  --card: #ffffff;
  --ink: #23303a;
  --muted: #6b7680;
  --line: #e7e0d4;
  --sea: #1f4e6b;
  --sea-soft: #e3edf3;
  --chili: #c4412d;
  --chili-soft: #fbe9e5;
  --ok: #2f7a4f;
  --ok-soft: #e4f2ea;
  --warn: #a86a00;
  --warn-soft: #fdf1d8;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(35, 48, 58, .06);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); line-height: 1.6; font-size: 16px; }
a { color: var(--sea); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* 頁首 */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 246, 239, .94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%; background: var(--sea); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: .08em; }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.top nav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--ink); font-size: 15px; }
.top nav a:hover { background: var(--sea-soft); }

.hero { padding: 28px 0 8px; }
.hero h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: .04em; }
.hero p { margin: 0; color: var(--muted); }

.notice {
  margin: 16px 0 0; padding: 12px 14px; border-radius: var(--radius);
  background: var(--warn-soft); color: #6b4a00; white-space: pre-line;
}

/* 商品 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding: 20px 0 120px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.card .ph { aspect-ratio: 4 / 3; background: var(--sea-soft); display: grid; place-items: center; color: var(--sea); font-size: 40px; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 18px; }
.card .desc { margin: 0; color: var(--muted); font-size: 14px; white-space: pre-line; }
.card .row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; gap: 8px; }
.price { font-size: 20px; font-weight: 700; color: var(--chili); }
.price small { font-size: 13px; color: var(--muted); font-weight: 400; }

.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag.stock { background: var(--ok-soft); color: var(--ok); }
.tag.pre { background: var(--warn-soft); color: var(--warn); }
.tag.off { background: #eee; color: #777; }
.tag.red { background: var(--chili-soft); color: var(--chili); }
.tag.blue { background: var(--sea-soft); color: var(--sea); }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; min-height: 44px;
  background: var(--sea); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.chili { background: var(--chili); }
.btn.ghost { background: transparent; color: var(--sea); border-color: var(--line); }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: 14px; }
.btn.block { width: 100%; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 38px; height: 38px; border: 0; background: #fff; cursor: pointer; font-size: 18px; }
.qty span, .qty input { min-width: 36px; width: 48px; text-align: center; border: 0; font-weight: 600; }

/* 底部購物車列 */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--sea); color: #fff; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(0,0,0,.12);
}
.cartbar .wrap { display: flex; align-items: center; gap: 12px; }
.cartbar .sum { font-size: 15px; }
.cartbar .sum b { font-size: 20px; }
.cartbar .btn { margin-left: auto; background: #fff; color: var(--sea); }

/* 抽屜／對話框 */
.drawer-bg { position: fixed; inset: 0; background: rgba(20, 30, 38, .45); z-index: 40; display: none; }
.drawer-bg.open { display: block; }
.drawer {
  position: fixed; z-index: 50; background: var(--bg); overflow-y: auto;
  left: 0; right: 0; bottom: 0; max-height: 92vh; border-radius: 18px 18px 0 0;
  transform: translateY(100%); transition: transform .25s ease; padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: none; }
@media (min-width: 760px) {
  .drawer { left: auto; top: 0; bottom: 0; width: 460px; max-height: none; border-radius: 0; transform: translateX(100%); }
}
.drawer-head { position: sticky; top: 0; background: var(--bg); display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); z-index: 1; }
.drawer-head h2 { margin: 0; font-size: 19px; }
.drawer-head .x { margin-left: auto; border: 0; background: none; font-size: 26px; cursor: pointer; line-height: 1; padding: 4px 8px; }
.drawer-body { padding: 16px; }

.line { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.line .nm { flex: 1; }
.line .nm small { display: block; color: var(--muted); }

/* 表單 */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, .field input[type=text], .field input[type=tel], .field input[type=number], .field input[type=password],
.field input[type=date], .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-height: 44px;
}
.field textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--sea); outline-offset: 1px; }
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.choice input { margin-top: 4px; width: 18px; height: 18px; }
.choice small { display: block; color: var(--muted); }
.box { padding: 12px 14px; border-radius: 10px; background: var(--sea-soft); white-space: pre-line; font-size: 15px; }

.total-row { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; padding: 12px 0; }
.error { color: var(--chili); background: var(--chili-soft); padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 20px 0; }
.panel h2 { margin-top: 0; font-size: 20px; }

.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 34px; margin: 10px auto; }
.center { text-align: center; }
.order-no { font-size: 24px; font-weight: 700; letter-spacing: .06em; color: var(--sea); }

footer.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 16px 100px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.table td.num, .table th.num { text-align: right; }
.scroll-x { overflow-x: auto; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.hidden { display: none !important; }
