/* Jump Character Shop 代購 — 共用樣式（貼近官網：黑白底 + 酒紅重點色） */

:root {
  --red: #c8102e;
  --red-dark: #9c0c23;
  --ink: #1a1a1a;
  --text: #222;
  --muted: #777;
  --line: #e5e5e5;
  --bg: #f7f7f7;
  --card: #fff;
  --ok: #0a7d32;
  --warn: #b26a00;
  --radius: 10px;
  --max: 1160px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Hiragino Sans",
               "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ── 頁首 ───────────────────────────────── */
header.site {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
header.site .bar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
header.site .logo {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 1px;
  white-space: nowrap;
}
header.site .logo span { color: var(--red); }
header.site nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
header.site nav a {
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #ddd;
}
header.site nav a:hover { background: #333; color: #fff; }
.cart-badge {
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12px;
  margin-left: 5px;
  font-weight: 700;
}
.notice {
  background: var(--red);
  color: #fff;
  font-size: 13px;
  text-align: center;
  padding: 7px 16px;
}

/* ── 通用元件 ───────────────────────────── */
h1.page { font-size: 22px; margin: 26px 0 16px; }
h2.sec { font-size: 17px; margin: 28px 0 12px; padding-left: 10px; border-left: 4px solid var(--red); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  font-family: inherit;
  transition: background .15s;
}
.btn:hover { background: var(--red-dark); }
.btn:disabled { background: #ccc; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #ccc; }
.btn.ghost:hover { background: #f0f0f0; }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #000; }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 6px; }
.btn.block { display: block; width: 100%; text-align: center; }

input[type=text], input[type=email], input[type=tel], input[type=number],
input[type=password], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(200,16,46,.35); border-color: var(--red); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
label.field .hint { font-weight: 400; color: var(--muted); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  background: #eee;
  color: #555;
  margin-right: 4px;
  vertical-align: middle;
}
.tag.red { background: var(--red); color: #fff; }
.tag.dark { background: var(--ink); color: #fff; }

.state { font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; display: inline-block; }
.state.open     { background: #e8f5ec; color: var(--ok); }
.state.waitlist { background: #fff4e0; color: var(--warn); }
.state.full     { background: #fdeaea; color: var(--red); }
.state.closed   { background: #eee;    color: #888; }
.state.preparing{ background: #eef4fb; color: #1c4e80; }

.muted { color: var(--muted); font-size: 13px; }
.price { color: var(--red); font-weight: 800; }
.price .jpy { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert.err  { background: #fdeaea; color: #9c0c23; border: 1px solid #f3c9cd; }
.alert.ok   { background: #e8f5ec; color: #0a7d32; border: 1px solid #c3e6cf; }
.alert.info { background: #eef4fb; color: #1c4e80; border: 1px solid #cfe0f3; }

.loading { text-align: center; padding: 60px 0; color: var(--muted); }

/* ── 商品網格 ───────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 16px;
}
.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, transform .15s;
}
.item:hover { box-shadow: 0 6px 18px rgba(0,0,0,.09); transform: translateY(-2px); }
.item .thumb { aspect-ratio: 1/1; background: #fafafa; overflow: hidden; }
.item .thumb img { width: 100%; height: 100%; object-fit: contain; }
.item .body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.item .series { font-size: 11px; color: var(--muted); }
.item .name {
  font-size: 13.5px; line-height: 1.5; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.item .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 6px; }

/* ── 手機：兩欄、壓縮卡片，一個畫面看得到四件商品 ── */
@media (max-width: 640px) {
  .wrap { padding: 0 10px; }
  h1.page { font-size: 18px; margin: 14px 0 10px; }
  header.site .notice { font-size: 11.5px; padding: 5px 12px; }
  header.site .bar { padding: 9px 12px; }
  header.site .logo { font-size: 16px; }
  header.site nav a { padding: 6px 8px; font-size: 13px; }

  /* 篩選列縮成兩行：搜尋整行，作品與排序各半 */
  .filterbar { padding: 10px 12px; margin-bottom: 12px; }
  .filterbar .row { gap: 8px; }
  .filterbar .row > * { flex: 1 1 calc(50% - 4px); }
  .filterbar .row > *:first-child { flex: 1 1 100%; }
  .filterbar label.field > span { font-size: 11px; margin-bottom: 3px; }
  .filterbar input, .filterbar select { padding: 7px 9px; font-size: 14px; }

  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .item .body { padding: 8px 9px 10px; gap: 3px; }
  .item .series { font-size: 10px; }
  .item .name { font-size: 12.5px; line-height: 1.4; -webkit-line-clamp: 2; }
  .item .price { font-size: 14px; }
  .item .price .jpy { display: block; margin-left: 0; font-size: 10px; }
  .item .foot { gap: 4px; }
  .state { font-size: 10.5px; padding: 2px 6px; }
  .item .foot .muted { font-size: 11px; }
}

/* 更窄的機型（iPhone SE 等）再壓一點，維持兩欄不變成一欄 */
@media (max-width: 360px) {
  .item .name { font-size: 11.5px; }
  .grid { gap: 8px; }
}

/* ── 商品內頁 ───────────────────────────── */
.detail { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 32px; margin-top: 22px; }
@media (max-width: 800px) { .detail { grid-template-columns: 1fr; gap: 20px; } }
.gallery .main { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); aspect-ratio: 1/1; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gallery .thumbs img {
  width: 62px; height: 62px; object-fit: contain; background: #fff;
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.gallery .thumbs img.on { border-color: var(--red); border-width: 2px; }

.detail h1 { font-size: 21px; margin: 8px 0 14px; line-height: 1.5; }
.detail .bigprice { font-size: 30px; }
.factlist { border-top: 1px solid var(--line); margin: 16px 0; }
.factlist div { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.factlist div b { flex: 0 0 108px; color: var(--muted); font-weight: 600; font-size: 13px; }
.factlist div span { flex: 1; }

.buybox { background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px; margin-top: 18px; }
.qtyrow { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qtyrow select { width: 90px; }

pre.body-text {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.85;
  margin: 0;
  color: #333;
}
details.ja { margin-top: 10px; }
details.ja summary { cursor: pointer; font-size: 13px; color: var(--muted); }
details.ja pre { color: #666; font-size: 13px; margin-top: 8px; }

/* ── 表格 ───────────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; background: #fafafa; white-space: nowrap; }
table.tbl td.num { text-align: right; white-space: nowrap; }

/* ── 進度條 ─────────────────────────────── */
.steps { display: flex; gap: 4px; margin: 16px 0; flex-wrap: wrap; }
.steps .s {
  flex: 1 1 90px; text-align: center; font-size: 11.5px; padding: 7px 3px;
  background: #eee; color: #999; border-radius: 5px; line-height: 1.4;
}
.steps .s.done { background: var(--ink); color: #fff; }
.steps .s.now { background: var(--red); color: #fff; font-weight: 700; }

.countdown { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red); }

/* ── 頁尾 ───────────────────────────────── */
footer.site {
  margin-top: 50px; padding: 26px 16px 40px; background: var(--ink);
  color: #999; font-size: 12.5px; line-height: 1.9;
}
footer.site .wrap { max-width: var(--max); }
footer.site b { color: #ddd; }

/* ── 後台 ───────────────────────────────── */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.admin-tabs button {
  padding: 9px 16px; border: 1px solid var(--line); background: #fff; border-radius: 7px;
  cursor: pointer; font-size: 14px; font-family: inherit; font-weight: 600; color: #555;
}
.admin-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip { display:inline-block; font-size:12px; padding:2px 8px; border-radius:999px; background:#eee; margin-right:5px; }
.chip.on { background: var(--red); color:#fff; }
