:root {
  --wine: #8b2332;
  --wine-2: #a3364a;
  --orange: #e0673a;
  --cream: #fff7ef;
  --paper: #fffdfa;
  --ink: #2b201d;
  --muted: #7f6f68;
  --line: #efe2d7;
  --sky: #cdebf1;
  --shadow: 0 10px 30px rgba(60, 30, 20, 0.14);
  --panel-w: 372px;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --num: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--wine); }

.app {
  display: grid;
  grid-template-columns: 1fr var(--panel-w);
  height: 100vh;
  height: 100dvh;
}

/* ---------- 3D 舞台 ---------- */
.stage { position: relative; overflow: hidden; min-width: 0; }
.stage canvas { display: block; touch-action: none; }
.label-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

.brand {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  padding: 14px 20px 14px;
  border-radius: 20px;
  background: rgba(255, 250, 245, 0.94);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.brand-eyebrow {
  margin: 0;
  font: 600 11px/1 var(--font);
  letter-spacing: 0.16em;
  color: var(--orange);
}
.brand h1 {
  margin: 6px 0 2px;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--wine);
}
.brand-sub { margin: 0; font-size: 13px; color: var(--muted); }

.toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
}
.toolbar button {
  min-width: 44px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 250, 245, 0.94);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 14px;
}
.toolbar button:hover { background: #fff; color: var(--wine); }

.only-mobile { display: none; }

/* ---------- 島上的標籤 ---------- */
.rlabel {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 5px;
  border: 0;
  border-radius: 999px;
  background: #fffdf8;
  box-shadow: 0 6px 16px rgba(40, 20, 10, 0.2);
  font: 700 14px var(--font);
  white-space: nowrap;
  transition: transform 0.15s;
}
.rlabel:hover { transform: scale(1.06); }
.rlabel b {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--wine);
  color: #fff;
  font: italic 600 13px var(--num);
}
.rlabel em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--muted); }

.slabel {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 3px 10px rgba(40, 20, 10, 0.18);
  font: 700 12px var(--font);
  white-space: nowrap;
}
.slabel i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
/* 蓋過章的店：名牌後面一個小紅章 */
.slabel.is-stamped::after {
  content: '章';
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-right: -4px;
  border: 1.5px solid #b8323f;
  border-radius: 50%;
  color: #b8323f;
  font-size: 9px;
  transform: rotate(-12deg);
}
.slabel.is-active.is-stamped::after { border-color: #fff; color: #fff; }
.slabel:hover { color: var(--wine); }
.slabel.is-active { background: var(--wine); color: #fff; }
.slabel.is-hidden, .llabel.is-hidden, .ilabel.is-hidden { visibility: hidden; }

/* 領優惠券氣球人的名牌：金色、會一直跳，全景也看得到 */
.clabel { pointer-events: auto; padding: 0; border: 0; background: none; }
.clabel span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px 7px 10px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd25e, #f2a93b);
  box-shadow: 0 6px 18px rgba(160, 90, 0, 0.45);
  color: #6b2a0a;
  font: 900 16px var(--font);
  white-space: nowrap;
  animation: coupon-pulse 1.4s ease-in-out infinite;
}
.clabel i {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  background: var(--wine);
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 4px, #000 4.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 4px, #000 4.5px) right / 51% 100% no-repeat;
  mask: radial-gradient(circle at 0 50%, transparent 4px, #000 4.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 4px, #000 4.5px) right / 51% 100% no-repeat;
}
@keyframes coupon-pulse { 50% { transform: translateY(-4px) scale(1.06); } }
.coupon-cta { --c: #e9a23b; margin-top: 6px; color: #5a2a05; }

/* 景點、機場、離島的名牌 */
.llabel, .ilabel {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 6px;
  border: 0;
  border-radius: 6px;
  background: rgba(43, 78, 70, 0.88);
  box-shadow: 0 3px 10px rgba(20, 30, 25, 0.25);
  color: #fff;
  font: 700 12px var(--font);
  white-space: nowrap;
}
.llabel i, .ilabel i { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid #ffd36b; }
.llabel.airport { background: rgba(43, 70, 110, 0.9); }
.llabel.temple { background: rgba(170, 48, 34, 0.92); }
.llabel.temple i { border-bottom-color: #ffd36b; }
.card .deity { margin: 0 0 6px; font-size: 13px; font-weight: 700; color: #a33a2a; }
.llabel.airport i { border: 0; width: 8px; height: 8px; border-radius: 2px; background: #9fd0f2; }
.ilabel { background: rgba(255, 253, 248, 0.92); color: #2f6f84; border-radius: 999px; }
.ilabel i { border-bottom-color: #4fb3d1; }
.slabel.is-active i { background: #fff; }

/* ---------- 門市／區域卡 ---------- */
.card {
  position: absolute;
  z-index: 6;
  top: 128px;
  left: 16px;
  bottom: 16px;
  width: 340px;
  overflow-y: auto;
  padding: 22px 22px 24px;
  border-radius: 22px;
  background: rgba(255, 251, 246, 0.97);
  box-shadow: var(--shadow);
  animation: card-in 0.25s ease-out;
}
@keyframes card-in { from { opacity: 0; transform: translateX(-12px); } }

.card-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}
.card-close:hover { background: var(--line); color: var(--ink); }

.eyebrow {
  margin: 0;
  font: 600 11px/1.4 var(--font);
  letter-spacing: 0.14em;
  color: var(--orange);
}
.card h3 { margin: 6px 36px 6px 0; font-size: 24px; font-weight: 900; }
.card .lead { margin: 0 0 14px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.card .hint { font-size: 13px; color: var(--muted); }

.label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: #fde7c7;
  color: #a35b12;
  font-size: 11px;
  letter-spacing: 0;
}

.card section { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  text-decoration: none;
  border: 0;
  border-radius: 12px;
  background: var(--c, var(--wine)); /* 沒指定顏色的按鈕用品牌酒紅，不然底色透明、白字看不到 */
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
.cta:hover:not(:disabled) { filter: brightness(1.08); }
.cta:disabled { background: #eee6df; color: var(--muted); cursor: default; }

.plaza { border-top: 4px solid var(--orange) !important; }
.plaza p:not(.label) { margin: 0; font-size: 14px; line-height: 1.6; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}
.pill i, .chip i, .store-row i { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--c); }

.card-stores { list-style: none; margin: 0; padding: 0; }

/* ---------- 右側清單 ---------- */
.index {
  position: relative;
  overflow-y: auto;
  padding: 26px 22px 40px;
  background: var(--paper);
  border-left: 1px solid var(--line);
  z-index: 10;
}
.index-head h2 { margin: 6px 0 4px; font-size: 28px; font-weight: 900; }
.muted { margin: 0; color: var(--muted); font-size: 13px; }
.index-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--cream);
  font-size: 22px;
}

.search {
  width: 100%;
  height: 44px;
  margin: 18px 0 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-size: 15px;
}
.search:focus { outline: 2px solid var(--wine); outline-offset: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}
.chip em { font-style: normal; color: var(--muted); font-weight: 500; }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; }
.chip.on i { background: #fff; }
.chip.on em { color: rgba(255, 255, 255, 0.8); }

.region-list { list-style: none; margin: 0; padding: 0; }
.region { border-bottom: 1px solid var(--line); }
.region-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  width: 100%;
  padding: 14px 4px;
  border: 0;
  background: transparent;
  text-align: left;
}
.region-row i { font: italic 600 22px var(--num); color: var(--orange); }
.region-row span { font-size: 16px; font-weight: 700; }
.region-row em { font-style: normal; font-size: 12px; color: var(--muted); }
.region-row:hover span { color: var(--wine); }
.region.active .region-row { color: var(--wine); }

.store-list { display: none; list-style: none; margin: 0 0 10px; padding: 0 0 0 36px; }
.region.open .store-list { display: block; }

.store-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}
.store-row b { font-size: 14px; }
.store-row small { font-size: 12px; color: var(--muted); }
.store-row:hover { background: var(--cream); }
.store-row.active { background: var(--wine); color: #fff; }
.store-row.active small { color: rgba(255, 255, 255, 0.8); }
.store-row.active i { background: #fff; }
.store-row.stamped b::after {
  content: '章';
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-left: 6px;
  border: 1.5px solid #b8323f;
  border-radius: 50%;
  color: #b8323f;
  font-size: 10px;
  vertical-align: 1px;
  transform: rotate(-12deg);
}
.store-row.active.stamped b::after { border-color: #fff; color: #fff; }

/* ---------- 載入／錯誤 ---------- */
.loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--sky);
  color: var(--muted);
  text-align: center;
  padding: 24px;
}
.loading p { margin: 0; }
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(139, 35, 50, 0.2);
  border-top-color: var(--wine);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading.error { background: var(--cream); color: var(--ink); max-width: none; }
.loading.error b { font-size: 20px; color: var(--wine); }
.loading.error p { max-width: 460px; font-family: ui-monospace, monospace; font-size: 13px; }
.loading.error small { max-width: 420px; color: var(--muted); line-height: 1.6; }

.warn-badge {
  position: absolute;
  z-index: 5;
  right: 16px;
  bottom: 16px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fde7c7;
  color: #8a4a0c;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- 開場：登島邀請函 ---------- */
.intro {
  --hand: "LXGW WenKai TC", "Kaiti TC", "DFKai-SB", "BiauKai", serif;
  --kraft: #e9d3b0;
  --letter: #fffaf0;
  --rule: #e3c9a1;
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, rgba(43, 32, 29, 0.18), rgba(43, 32, 29, 0.48));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.4s ease-out both;
}
.intro.leaving { animation: fade-out 0.45s ease-in both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* 信封 */
.invite-stage { display: grid; justify-items: center; gap: 18px; }
.envelope {
  position: relative;
  width: min(340px, 84vw);
  aspect-ratio: 1.55;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  animation: env-float 3.2s ease-in-out infinite;
}
@keyframes env-float { 50% { transform: translateY(-8px) rotate(-1deg); } }
.envelope > span { position: absolute; inset: 0; border-radius: 10px; }
.env-back { z-index: 0; background: #dcc29b; box-shadow: 0 26px 50px rgba(30, 15, 8, 0.4); }
.env-paper {
  z-index: 1;
  inset: 7% 7% auto !important;
  height: 82%;
  border-radius: 6px !important;
  background: repeating-linear-gradient(transparent 0 15px, rgba(139, 35, 50, 0.12) 15px 16px) 0 36px / 100% calc(100% - 52px) no-repeat, var(--letter);
  box-shadow: 0 2px 6px rgba(60, 30, 20, 0.12);
}
.env-front {
  z-index: 3;
  background: linear-gradient(160deg, #f1dfc2, var(--kraft) 60%, #e2c69d);
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
}
.env-front b {
  position: absolute;
  left: 9%;
  bottom: 15%;
  font: 400 clamp(18px, 5.4vw, 22px) var(--hand);
  color: #5a3b2c;
  letter-spacing: 0.06em;
}
.env-front small {
  position: absolute;
  right: 8%;
  bottom: 11%;
  font: 400 12px var(--hand);
  color: #8a6a55;
}
.env-flap {
  z-index: 4;
  background: linear-gradient(#f4e4ca, #e4c9a1);
  clip-path: polygon(0 0, 100% 0, 50% 60%);
  transform-origin: 50% 0;
  filter: drop-shadow(0 3px 2px rgba(60, 30, 20, 0.2));
}
.wax-seal {
  z-index: 5;
  inset: calc(60% - 36px) auto auto calc(50% - 30px) !important;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 47% 53% 50% 50% / 52% 48% 52% 48% !important;
  background: radial-gradient(circle at 35% 30%, #c2465a, var(--wine) 55%, #5e1520);
  box-shadow: 0 3px 6px rgba(60, 10, 20, 0.45), inset 0 0 0 5px rgba(0, 0, 0, 0.12), inset 0 0 0 7px rgba(255, 255, 255, 0.08);
  color: rgba(255, 230, 230, 0.92);
  font: italic 600 20px var(--num);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.35);
}
.invite-hint {
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  color: var(--wine);
  font: 700 14px var(--font);
  animation: hint-pulse 1.6s ease-in-out infinite;
}
@keyframes hint-pulse { 50% { opacity: 0.55; } }

/* 拆信：封蠟裂開 → 封口打開 → 信紙往上抽出 → 信封退場 */
.envelope.opening { animation: none; }
.envelope.opening .wax-seal { animation: seal-break 0.35s ease-in both; }
.envelope.opening .env-flap { animation: flap-open 0.55s 0.25s ease-in-out both; }
.envelope.opening .env-paper { animation: paper-out 0.5s 0.7s cubic-bezier(0.3, 0.7, 0.3, 1) both; }
.envelope.opening + .invite-hint { visibility: hidden; }
.invite-stage.done { animation: env-away 0.45s ease-in both; }
@keyframes seal-break { 40% { transform: scale(1.18); } to { transform: scale(0.6) rotate(25deg); opacity: 0; } }
@keyframes flap-open {
  0% { transform: rotateX(0); z-index: 4; }
  49% { z-index: 4; }
  50% { z-index: 0; }
  100% { transform: rotateX(180deg); z-index: 0; }
}
@keyframes paper-out { to { transform: translateY(-48%); } }
@keyframes env-away { to { transform: translateY(70px) scale(0.92); opacity: 0; } }

/* 信紙＋登島證 */
.invite-wrap {
  width: min(460px, 100%);
  filter: drop-shadow(0 26px 40px rgba(30, 15, 8, 0.45));
  animation: letter-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.intro.leaving .invite-wrap { animation: letter-out 0.45s ease-in both; }
@keyframes letter-in { from { transform: translateY(60px) scale(0.9) rotate(-2deg); opacity: 0; } }
@keyframes letter-out { to { transform: translateY(-40px) scale(0.96); opacity: 0; } }
.invite-sheet {
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 6px 6px 0 0;
  scrollbar-width: thin;
}
.letter {
  position: relative;
  padding: 30px 30px 24px;
  border-radius: 6px 6px 0 0;
  background:
    radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.8), transparent 45%),
    linear-gradient(#fffcf4, #fbf0dc);
  box-shadow: inset 0 0 0 9px var(--letter), inset 0 0 0 10px var(--rule), inset 0 0 0 13px var(--letter), inset 0 0 0 14px var(--rule);
  color: #3a2a24;
}
.letter-head { padding-right: 92px; }
.letter-kicker { margin: 4px 0 6px; color: var(--wine); font: 600 12px var(--font); letter-spacing: 0.14em; }
.letter-kicker i { margin-right: 4px; font: italic 600 17px var(--num); letter-spacing: 0.02em; }
.letter h2 { margin: 0; font: 700 clamp(22px, 6vw, 30px)/1.3 var(--hand); letter-spacing: 0.04em; word-break: keep-all; text-wrap: balance; }
.postage {
  position: absolute;
  top: 24px;
  right: 26px;
  display: grid;
  place-items: center;
  align-content: center;
  width: 64px;
  height: 80px;
  padding: 4px;
  background: linear-gradient(var(--wine), var(--wine)) content-box, #fffdf6;
  color: #fff;
  -webkit-mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 2.6px, transparent 2.4px, #000 2.8px) -4px -4px / 8px 8px;
  -webkit-mask-composite: source-over;
  mask: linear-gradient(#000 0 0) content-box, radial-gradient(circle 2.6px, transparent 2.4px, #000 2.8px) -4px -4px / 8px 8px;
  mask-composite: add;
  transform: rotate(4deg);
}
.postage b { font: italic 600 22px/1 var(--num); }
.postage small { margin-top: 3px; font: 700 9px var(--font); letter-spacing: 0.12em; }
.postage em { margin-top: 6px; font: normal 600 8px var(--font); opacity: 0.8; }
.postmark {
  position: absolute;
  top: 70px;
  right: 58px;
  width: 78px;
  height: 78px;
  opacity: 0.78;
  pointer-events: none;
}
.letter-body { margin-top: 18px; font: 400 17px/34px var(--hand); }
.letter-body p { margin: 0; }
.letter-body .greet { font-size: 19px; }
.letter-body .para {
  text-indent: 2em;
  background: repeating-linear-gradient(transparent 0 33px, rgba(139, 35, 50, 0.13) 33px 34px);
}
.letter-list { display: grid; gap: 10px; margin: 18px 0 6px; padding: 0; list-style: none; }
.letter-list li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; }
.letter-list .mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #fffaf0, inset 0 0 0 3px currentColor;
  color: var(--c, var(--wine));
  font: 700 17px var(--hand);
  transform: rotate(var(--r, -8deg));
}
.letter-list b { display: block; font: 700 15px/1.4 var(--font); }
.letter-list small { display: block; font: 400 13px/1.5 var(--font); color: #7a6158; }
.letter-tip { margin: 14px 0 0; font: 400 14px/1.7 var(--hand); color: #8a6a55; }
.letter-sign { margin-top: 18px; text-align: right; font: 400 18px/1.7 var(--hand); }
.letter-sign small { display: block; font-size: 14px; color: #8a6a55; }

/* 邀請函上的「登島第一個任務」：黃色任務單用紙膠帶貼在信上 */
.letter-feature {
  position: relative;
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: start;
  margin: 20px -4px 6px;
  padding: 18px 16px 16px;
  border: 2px dashed #e0a92e;
  border-radius: 12px;
  background: #fff3c4;
  box-shadow: 0 6px 14px rgba(120, 80, 20, 0.16);
  transform: rotate(-1.2deg);
}
.letter-feature::before {
  content: '';
  position: absolute;
  top: -11px;
  left: calc(50% - 42px);
  width: 84px;
  height: 22px;
  background: rgba(214, 87, 140, 0.35);
  transform: rotate(3deg);
}
.lf-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font: 900 26px/1 var(--font);
}
.lf-mark::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 3px solid #f5a524;
  border-radius: 50%;
  animation: q-ring 1.4s ease-out infinite;
}
.lf-kicker { margin: 0 0 2px; color: #b5651d; font: 700 12px var(--font); letter-spacing: 0.1em; }
.letter-feature b { display: block; font: 900 19px/1.35 var(--font); color: var(--wine); }
.letter-feature p:not(.lf-kicker) { margin: 4px 0 10px; font: 400 14px/1.6 var(--font); color: #5a3b2c; }
.lf-go {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffd66b, #f5a524);
  box-shadow: 0 3px 0 #c98516;
  color: #5e1520;
  font: 900 14px var(--font);
  cursor: pointer;
}
.lf-go:active { transform: translateY(2px); box-shadow: 0 1px 0 #c98516; }

/* 登島證：上緣是虛線撕線，兩側是半圓缺口；信很長時黏在底部，登島按鈕一直看得到 */
.pass {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 28px 22px;
  border-top: 2px dashed #cdae82;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(#f7e7c9, #f1dcb6);
  -webkit-mask: radial-gradient(circle 11px at 0 0, transparent 10.5px, #000 11px) left / 51% 100% no-repeat, radial-gradient(circle 11px at 100% 0, transparent 10.5px, #000 11px) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 11px at 0 0, transparent 10.5px, #000 11px) left / 51% 100% no-repeat, radial-gradient(circle 11px at 100% 0, transparent 10.5px, #000 11px) right / 51% 100% no-repeat;
}
.pass-kicker { margin: 0 0 4px; color: var(--wine); font: 700 11px var(--font); letter-spacing: 0.12em; }
.pass-route { display: flex; align-items: center; gap: 8px; font: 700 16px var(--hand); }
.pass-route i { flex: 1; min-width: 26px; height: 0; border-top: 2px dotted #b58e5c; position: relative; }
.pass-route i::after { content: '✈'; position: absolute; left: 50%; top: -11px; transform: translateX(-50%); color: var(--wine); font-size: 14px; font-style: normal; }
.pass-meta { margin: 6px 0 0; font: 600 12px var(--num); color: #7a6158; letter-spacing: 0.06em; }
.pass-go {
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--wine-2), var(--wine));
  box-shadow: 0 4px 0 #5e1520;
  color: #fff;
  font: 900 15px var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.pass-go:hover { filter: brightness(1.08); }
.pass-go:active { transform: translateY(2px); box-shadow: 0 2px 0 #5e1520; }

@media (max-width: 480px) {
  .letter { padding: 26px 22px 20px; }
  .letter-head { padding-right: 76px; }
  .postage { right: 20px; transform: rotate(4deg) scale(0.86); transform-origin: top right; }
  .postmark { top: 62px; right: 44px; width: 66px; height: 66px; }
  .letter-body { font-size: 16px; }
  .pass { grid-template-columns: 1fr; gap: 10px; padding: 14px 22px 16px; }
  .pass-route { font-size: 15px; }
  .pass-go { width: 100%; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  .intro, .envelope, .invite-hint, .invite-wrap, .intro.leaving .invite-wrap, .intro.leaving { animation: none !important; }
}

/* ---------- 進店 ---------- */
.shop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(43, 32, 29, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

/* 兩扇酒紅色的門，進店時往兩邊滑開 */
.door {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 50.5%;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, #761b29, #8b2332 45%, #761b29);
  box-shadow: inset 0 0 0 10px #6a1824, inset 0 0 0 12px rgba(255, 255, 255, 0.22);
  color: #fff;
  pointer-events: none;
}
.door::before {
  content: '';
  position: absolute;
  top: 9%;
  left: 14%;
  right: 14%;
  height: 44%;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.06));
}
.door::after {
  content: '';
  position: absolute;
  top: 58%;
  width: 10px;
  height: 70px;
  border-radius: 6px;
  background: #e9c46a;
}
.door.left { left: 0; justify-content: flex-end; padding-right: 30px; transform: translateX(-101%); }
.door.right { right: 0; justify-content: flex-start; padding-left: 30px; transform: translateX(101%); }
.door.left::after { right: 14px; }
.door.right::after { left: 14px; }
.door b { position: relative; font: 700 64px/1 "Times New Roman", Georgia, serif; }
.door small { position: relative; font: 600 20px Georgia, serif; letter-spacing: 0.3em; }
.shop.opening .door.left { animation: door-left 0.95s 0.15s cubic-bezier(0.6, 0, 0.25, 1) both; }
.shop.opening .door.right { animation: door-right 0.95s 0.15s cubic-bezier(0.6, 0, 0.25, 1) both; }
.shop.opening .shop-inner { animation: shop-in 0.9s 0.3s ease-out both; }
@keyframes door-left { from { transform: none; } to { transform: translateX(-101%); } }
@keyframes door-right { from { transform: none; } to { transform: translateX(101%); } }
@keyframes shop-in { from { opacity: 0; transform: scale(1.06); } }

.shop-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: min(1040px, 100%);
  height: min(720px, 100%);
  overflow: hidden;
  border-radius: 26px;
  background: #fbf3e6;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  outline: none;
}

.shop-sign { display: flex; align-items: center; gap: 16px; padding: 16px 22px; background: var(--wine); color: #fff; }
.shop-logo {
  display: grid;
  place-items: center;
  align-content: center;
  width: 74px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  line-height: 1;
}
.shop-logo b { font: 700 30px/1 "Times New Roman", Georgia, serif; }
.shop-logo small { margin-top: 2px; font: 600 9px Georgia, serif; letter-spacing: 0.25em; }
.shop-title { flex: 1; min-width: 0; }
.shop-title .eyebrow { color: #ffc9a8; }
.shop-title h2 { margin: 2px 0 0; font-size: 26px; font-weight: 900; letter-spacing: 0.04em; }
.shop-exit {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.shop-exit:hover { background: rgba(255, 255, 255, 0.28); }

/* 波浪邊的條紋遮雨棚，顏色跟著這間店的玩法 */
.shop-awning {
  position: relative;
  z-index: 1;
  height: 30px;
  margin-bottom: -14px;
  background: repeating-linear-gradient(90deg, var(--c) 0 36px, #fffaf2 36px 72px);
  -webkit-mask: radial-gradient(18px at 18px 12px, #000 98%, transparent) 0 0 / 36px 100% repeat-x, linear-gradient(#000 0 0) 0 0 / 100% 12px no-repeat;
  mask: radial-gradient(18px at 18px 12px, #000 98%, transparent) 0 0 / 36px 100% repeat-x, linear-gradient(#000 0 0) 0 0 / 100% 12px no-repeat;
}

.shop-room {
  display: grid;
  grid-template-columns: 1.05fr 1.25fr 0.9fr;
  grid-template-areas: "wall counter corner" "wall counter stamp" "board board board";
  /* 每一列都跟內容一樣高：店裡比畫面高時，瀏覽器不會把櫃台壓扁、把店長的話擠到看不到的上面 */
  grid-auto-rows: max-content;
  align-content: start;
  gap: 18px;
  min-height: 0;
  overflow: auto;
  padding: 28px 22px 22px;
  background:
    repeating-linear-gradient(90deg, rgba(139, 35, 50, 0.035) 0 2px, transparent 2px 44px),
    #fbf3e6;
}
.shop-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* 櫃台：店長氣球人站在櫃台後面，頭上是店長的一句話 */
.shop-counter {
  grid-area: counter;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 380px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(to top, #d9b48a 0 40px, #c99f74 40px 45px, transparent 45px);
}
.bubble {
  position: relative;
  max-width: 300px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(60, 30, 20, 0.12);
  color: var(--wine);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  animation: bubble-in 0.5s 1.1s both;
}
.bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -9px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
}
.bubble.long { font-size: 16px; line-height: 1.55; }
.bubble.empty { color: var(--muted); font-size: 14px; font-weight: 500; }
.bubble .tag { margin-left: 6px; vertical-align: middle; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(0.92); } }
.mascot {
  position: relative;
  width: 170px;
  height: auto;
  margin-bottom: -86px;
  transform-origin: bottom center;
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe { 50% { transform: scale(1.03, 0.985); } }
.counter {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(320px, 100%);
  height: 96px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(#c58f5e, #a9744a);
  box-shadow: inset 0 8px 0 #d9a676;
}
.nameplate {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--wine);
  box-shadow: 0 3px 0 #5e1520;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

/* 鞋牆：店長推薦的鞋擺在木頭層板上 */
.shop-wall {
  grid-area: wall;
  align-self: start;
  padding: 14px 14px 6px;
  border: 1px solid #efdfcc;
  border-radius: 16px;
  background: #fff7ec;
  box-shadow: inset 0 0 0 6px #f4e6d3;
}
.shelves { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px; }
.shoe { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.shoe-img {
  display: grid;
  place-items: end center;
  height: 96px;
  border-bottom: 9px solid #c79a6a;
  box-shadow: 0 6px 6px -4px rgba(80, 40, 10, 0.35);
}
.shoe-img img { max-width: 100%; max-height: 88px; object-fit: contain; mix-blend-mode: multiply; transition: transform 0.2s; }
.shoe:hover .shoe-img img { transform: translateY(-4px) rotate(-3deg); }
.shoe-box {
  display: grid;
  place-items: center;
  width: 74px;
  height: 46px;
  margin-bottom: 2px;
  border-radius: 4px;
  background: var(--wine);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12);
  color: #fff;
  font: 700 18px "Times New Roman", Georgia, serif;
}
.shoe-tag { padding: 8px 2px 12px; }
.shoe-tag b { display: block; font-size: 13px; line-height: 1.4; }
.shoe-tag small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.5; color: #6b5a53; }
.shoe.waiting { opacity: 0.7; }

/* 玩法角落 */
.shop-corner {
  grid-area: corner;
  align-self: start;
  padding: 18px;
  border: 3px solid var(--c);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 0 color-mix(in srgb, var(--c) 30%, white);
}
.shop-corner h3 { margin: 0 0 6px; font-size: 20px; }
.shop-corner p:not(.shop-label) { margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: #5b4c46; }

/* 留言牆：木框軟木塞板，留言是便利貼 */
.shop-board { grid-area: board; }
.note-hint { font-weight: 500; letter-spacing: 0; color: #a08f87; }
.cork {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px 16px;
  min-height: 150px;
  padding: 22px 18px;
  border: 10px solid #8a5a3b;
  border-radius: 10px;
  background:
    radial-gradient(rgba(90, 55, 25, 0.25) 1px, transparent 1.5px) 0 0 / 9px 9px,
    radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1.5px) 4px 5px / 11px 11px,
    #c9a27a;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
}
.note {
  position: relative;
  margin: 0;
  padding: 16px 14px 12px;
  background: var(--n);
  box-shadow: 0 6px 10px rgba(60, 30, 10, 0.25);
  transform: rotate(var(--r));
  animation: note-in 0.4s ease-out both;
}
.note::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a7a, #c8452f);
  box-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
}
.note blockquote { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.55; color: #3d2b25; overflow-wrap: anywhere; }
.note figcaption { margin-top: 8px; font-size: 12px; color: #7a6258; text-align: right; }
.note.pending { opacity: 0.8; outline: 2px dashed rgba(139, 35, 50, 0.45); outline-offset: 3px; }
.note.ghost blockquote { font-weight: 500; color: var(--muted); }
.note-flag {
  position: absolute;
  top: -10px;
  right: -8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--wine);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
@keyframes note-in { from { opacity: 0; transform: rotate(var(--r)) translateY(-8px) scale(0.95); } }

.note-form {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
  margin-top: 14px;
}
.note-form input, .note-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  resize: none;
}
.note-form input:focus, .note-form textarea:focus { outline: 2px solid var(--wine); outline-offset: 1px; }
.note-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.note-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.note-count { font-size: 12px; color: var(--muted); }
.note-submit {
  height: 42px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--wine);
  color: #fff;
  font-weight: 700;
}
.note-submit:disabled { opacity: 0.6; cursor: default; }
.note-status { grid-column: 1 / -1; margin: 0; min-height: 1.2em; font-size: 13px; color: var(--wine); }

.shop-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}
.shop-info a { font-weight: 700; text-decoration: none; }

/* ---------- 客服任務島 ---------- */
.toolbar .btn-service { background: var(--wine); color: #fff; }
.toolbar .btn-service:hover { background: #a3364a; color: #fff; }
.llabel.service { background: rgba(80, 31, 127, 0.9); }
.llabel.service i { border-bottom-color: #f2b134; }
.llabel.service-ask { background: rgba(139, 35, 50, 0.92); }
.llabel.cinema { background: rgba(94, 21, 32, 0.92); }
/* 重點景點（玉山、阿里山神木）：名牌大一號、金色，全景也看得到 */
.llabel.featured {
  gap: 6px;
  padding: 5px 12px 5px 9px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: linear-gradient(135deg, #2f6b3f, #1f4f2e);
  box-shadow: 0 4px 14px rgba(20, 40, 25, 0.4);
  font-size: 14px;
  font-weight: 900;
}
.llabel.featured i { border-left-width: 6px; border-right-width: 6px; border-bottom: 10px solid #ffd36b; }
.llabel.cinema i { border-bottom-color: #ffd36b; }

.missions { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.mission {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--c);
  border-radius: 14px;
  background: #fff;
  text-align: left;
}
.mission:hover { background: var(--cream); }
.mission i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.mission b { display: block; font-size: 15px; }
.mission small { font-size: 12px; color: var(--muted); }
.mission em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); }
.mission em.soon { padding: 2px 8px; border-radius: 999px; background: #eee6df; }
.mission em.stamped { padding: 2px 8px; border-radius: 999px; background: #dff2e6; color: #2f7a4f; }

.shop.is-station .door { display: none; }
.shop.is-station .shop-inner { grid-template-rows: auto 1fr auto; }
.shop.is-station.opening .shop-inner { animation: station-in 0.45s ease-out both; }
@keyframes station-in { from { opacity: 0; transform: translateY(14px); } }
.station-sign { background: var(--c); }
.station-sign .eyebrow { color: rgba(255, 255, 255, 0.8); }
.station-body { min-height: 0; overflow: auto; padding: 18px 22px 24px; background: #fbf7f1; }

.st-lead { margin: 0 0 14px; font-size: 15px; line-height: 1.7; font-weight: 700; color: var(--ink); }
.st-text { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: #5b4c46; }
.st-section { margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.st-section h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 17px; }
.st-section h3 b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font: italic 600 14px var(--num);
}
.st-list, .st-steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.75; color: #4a3b35; }
.st-steps li { margin-bottom: 4px; }
.st-field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 13px; font-weight: 700; color: var(--muted); }
.st-field input { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 16px; }
.st-result { margin: 0 0 12px; font-size: 18px; font-weight: 900; color: #2f6f84; }
.st-result.warn { color: #a35b12; font-size: 15px; }
.st-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.st-note.warn { color: #a33a2a; font-weight: 700; }
.st-contact { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.st-contact a { font-weight: 700; text-decoration: none; }
.st-icon { display: inline-grid; width: 24px; height: 24px; flex: none; }
.st-icon svg { width: 100%; height: 100%; }
.st-done {
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--wine);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}
.st-done:disabled { background: #e6dcd3; color: var(--muted); cursor: default; }
.st-soon { padding: 30px 10px; text-align: center; }

/* 物流港口：付款完成 → 送達 的航線，貨輪照工作天往前開 */
.st-track { position: relative; margin: 6px 4px 4px; padding-top: 34px; }
.st-track ol { display: flex; justify-content: space-between; margin: 0; padding: 0; list-style: none; border-top: 3px dashed #bcd7e4; }
.st-track li { position: relative; display: grid; justify-items: center; gap: 6px; width: 25%; margin-top: -9px; font-size: 12px; color: var(--muted); }
.st-track li:first-child { justify-items: start; }
.st-track li:last-child { justify-items: end; }
.st-track li i { width: 15px; height: 15px; border-radius: 50%; background: #d9e7ee; border: 3px solid #fff; box-shadow: 0 0 0 1px #bcd7e4; }
.st-track li.on { color: #2f6f84; font-weight: 700; }
.st-track li.on i { background: #3F7FBF; }
.st-track:has(.st-road) { padding-top: 0; }
.st-track:has(.st-road) ol { margin-top: 14px; }
/* 物流車送貨：倉庫 → 公路 → 你家 */
.st-road {
  position: relative;
  height: 74px;
  margin-bottom: 4px;
  border-radius: 14px;
  background:
    linear-gradient(#cfe8c4 0 38px, #5b6066 38px 64px, #cfe8c4 64px),
    #cfe8c4;
  overflow: hidden;
}
.st-road::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50px;
  height: 2px;
  background: repeating-linear-gradient(90deg, #fff 0 14px, transparent 14px 26px);
}
.st-road-end {
  position: absolute;
  top: 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #4a5a52;
}
.st-road-end .st-icon { width: 24px; height: 24px; color: #8B2332; }
.st-road-end.start { left: 6px; }
.st-road-end.finish { right: 6px; }
.st-parcel { position: absolute; left: -22px; top: 10px; color: #b98a56; opacity: 0; transform: translateY(-10px); transition: 0.4s; }
.st-parcel.show { opacity: 1; transform: none; }
.st-truck { position: absolute; top: 32px; width: 64px; height: 36px; transition: left 1.2s cubic-bezier(0.4, 0, 0.2, 1); }
.st-truck svg { width: 100%; height: 100%; }
.st-truck.driving { animation: truck-bump 0.35s ease-in-out infinite; }
.st-truck.driving .wheel { transform-box: fill-box; transform-origin: center; animation: wheel-spin 0.5s linear infinite; }
@keyframes truck-bump { 50% { transform: translateY(-1.5px); } }
@keyframes wheel-spin { to { transform: rotate(360deg); } }

/* 退換貨中心 */
.st-checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.st-checks label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.6; cursor: pointer; }
.st-checks input { width: 20px; height: 20px; margin-top: 2px; accent-color: #3E9A6A; flex: none; }
.st-tabs { display: flex; gap: 8px; margin: 6px 0 10px; }
.st-tab { flex: 1; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; }
.st-tab.on { background: #E07A2E; border-color: #E07A2E; color: #fff; }
.st-rules { padding: 12px 14px; border-radius: 12px; background: #fff7ee; }

.pack-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pack-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  color: #4a3b35;
}
.pack-card:hover:not(:disabled) { border-color: #E07A2E; }
.pack-card.done { border-color: #3E9A6A; background: #eef8f1; color: #2f7a4f; opacity: 0.75; }
.pack-card.shake { animation: shake 0.4s; border-color: #c0392b; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.pack-status { margin: 0 0 10px; font-size: 14px; font-weight: 700; color: #2f6f84; }
.pack-status.warn { color: #a33a2a; }
.pack-stage {
  display: grid;
  gap: 6px;
  min-height: 56px;
  margin: 0;
  padding: 12px 12px 12px 34px;
  border: 2px dashed #e0c9ae;
  border-radius: 14px;
  background: #fffaf2;
  font-size: 13px;
  color: #6b5a53;
}
.pack-stage li span { margin-left: 6px; }
.pack-stage li { display: flex; align-items: center; animation: note-in 0.3s ease-out both; }
.pack-stage.sealed { border-style: solid; border-color: #c89a64; background: #f6e7d2; box-shadow: inset 0 -6px 0 rgba(139, 35, 50, 0.85); }

/* ---------- 島民角色 ---------- */
/* 右下角的浮動按鈕（幫路人挑鞋、集章冊、我的島民）疊成一欄，一直都在（桌機卡片在左邊，不會擋到） */
.fabs {
  position: absolute;
  z-index: 5;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  transform-origin: right bottom;
  transition: bottom 0.25s ease, transform 0.25s ease;
}
/* 手機的卡片從下面滑上來：按鈕縮小一點、移到卡片上方（--sheet 是卡片高度，ui.js 給） */
@media (max-width: 820px) {
  .app:has(.card:not([hidden])) .fabs { bottom: calc(var(--sheet, 0px) + 10px); transform: scale(0.82); }
}
.fab-me {
  height: 48px;
  padding: 0 20px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: linear-gradient(135deg, #a3364a, var(--wine));
  box-shadow: 0 8px 20px rgba(139, 35, 50, 0.4);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}
.fab-me:hover { filter: brightness(1.08); }

.nlabel {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 2px 6px rgba(40, 20, 10, 0.18);
  color: #4a3b35;
  font: 700 11px var(--font);
  white-space: nowrap;
}
.nlabel.me { background: var(--wine); color: #fff; font-size: 12px; }
.nlabel.is-hidden { visibility: hidden; }

.me-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.me-preview img { width: 64px; height: auto; }
.me-figure { flex: none; width: 120px; height: 140px; border-radius: 14px; background: radial-gradient(circle at 50% 70%, #fff 0, #f6efe6 70%); }
.me-preview ul { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.8; color: #4a3b35; }
.me-group { margin-bottom: 12px; }
.me-label { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.me-options { display: flex; flex-wrap: wrap; gap: 6px; }
.me-option {
  min-width: 44px;
  height: 38px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}
.me-option[aria-pressed="true"] { border-color: var(--wine); background: #fbeef0; color: var(--wine); }
.me-body .me-option { height: 64px; padding: 4px 8px; }
.me-body img { height: 52px; width: auto; }
.me-shoe .me-option { min-width: 38px; padding: 0; }
.swatch { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.15); vertical-align: middle; }
.me-name { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; font-size: 15px; }
.me-name:focus { outline: 2px solid var(--wine); outline-offset: 1px; }
.me-group .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.me-find { width: 100%; margin-top: 8px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; color: var(--wine); }

/* ---------- 遊戲視窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 15, 10, 0.5);
}
.modal-box {
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  height: min(88vh, 900px);
  height: min(88dvh, 900px);
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.modal-box header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 10px 10px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-box header b { flex: 1; font-size: 16px; }
.modal-box header a { font-size: 13px; font-weight: 700; text-decoration: none; }
.modal-box header button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--cream); font-size: 22px; }
.modal-box iframe { flex: 1; width: 100%; border: 0; }
.modal-box.portrait {
  width: min(500px, 100%, calc((88vh - 58px) * var(--aspect)));
  width: min(500px, 100%, calc((88dvh - 58px) * var(--aspect)));
  height: auto;
}
.modal-box.portrait iframe { flex: none; height: auto; aspect-ratio: var(--aspect); }

/* ---------- 手機 ---------- */
/* ---------- 集點蓋章 ---------- */
.fab-stamps {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 8px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #fffaf2;
  box-shadow: 0 8px 20px rgba(60, 30, 20, 0.22);
  color: var(--wine);
  font-size: 15px;
  font-weight: 900;
}
.fab-stamps i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #b8323f;
  border-radius: 50%;
  color: #b8323f;
  font-size: 13px;
  font-style: normal;
  transform: rotate(-12deg);
}
.fab-stamps:hover { filter: brightness(1.04); }
.fab-stamps.ready { background: linear-gradient(135deg, #ffe08a, #f5b642); color: #5e1520; animation: fab-pulse 1.6s ease-in-out infinite; }
@keyframes fab-pulse { 50% { transform: scale(1.06); box-shadow: 0 8px 26px rgba(245, 182, 66, 0.6); } }

/* 門市裡的蓋章台 */
.shop-stamp {
  grid-area: stamp;
  align-self: start;
  padding: 16px 18px 18px;
  border: 1px solid #efdfcc;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 0 #f1e2cf;
}
.stamp-paper {
  position: relative;
  display: grid;
  place-items: center;
  height: 160px;
  margin-bottom: 12px;
  border: 1px dashed #e2cfb6;
  border-radius: 12px;
  background: repeating-linear-gradient(#fffdf7 0 21px, #f3e9da 21px 22px);
}
.stamp-slot { display: grid; place-items: center; width: 124px; height: 124px; }
.stamp-empty {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border: 2px dashed #d9c3a8;
  border-radius: 50%;
  color: #b9a48f;
  font-size: 13px;
  font-weight: 700;
}
.stamp-svg { display: block; width: 100%; height: 100%; overflow: visible; transform: rotate(var(--r)); }
.stamp-slot.fresh .stamp-svg { animation: ink-in 0.35s ease-out both; }
@keyframes ink-in { from { opacity: 0; transform: rotate(var(--r)) scale(1.12); } }
.stamper {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 112px;
  height: 120px;
  margin: -66px 0 0 -56px;
  transform: translate(96px, -8px) rotate(14deg) scale(0.55);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 6px 4px rgba(60, 30, 20, 0.25));
  pointer-events: none;
}
.stamper svg { display: block; width: 100%; height: 100%; }
.stamper.pressing { animation: stamper-press 1s cubic-bezier(0.4, 0, 0.2, 1) both; }
@keyframes stamper-press {
  0% { transform: translate(96px, -8px) rotate(14deg) scale(0.55); }
  32% { transform: translate(0, -64px) rotate(0deg) scale(1); }
  46% { transform: translate(0, 0) scale(1.04, 0.94); }
  58% { transform: translate(0, 0) scale(1); }
  80% { transform: translate(0, -56px) rotate(0deg) scale(1); }
  100% { transform: translate(96px, -8px) rotate(14deg) scale(0.55); }
}
.stamp-msg { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: #5b4c46; }
.stamp-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; }
.stamp-progress b { white-space: nowrap; color: var(--wine); }
.stamp-progress.cheer { animation: cheer 0.6s ease-out 2; }
@keyframes cheer { 30% { transform: scale(1.05); } }
.stamp-bar { flex: 1; height: 8px; overflow: hidden; border-radius: 999px; background: #f1e4d3; }
.stamp-bar i { display: block; width: calc(var(--p) * 100%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #d0475a, var(--wine)); }
.stamp-open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--wine);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  cursor: pointer;
}
.stamp-open.ready { padding: 5px 12px; border-radius: 999px; background: linear-gradient(135deg, #ffe08a, #f5b642); color: #5e1520; text-decoration: none; }

/* 集章冊 */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 14px 0;
  padding: 14px;
  list-style: none;
  border: 1px solid #eadcc8;
  border-radius: 14px;
  background: repeating-linear-gradient(#fffdf7 0 21px, #f3e9da 21px 22px);
}
.stamp-cell { display: grid; place-items: center; aspect-ratio: 1; }
.stamp-cell button { width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.stamp-cell button:hover .stamp-svg { transform: rotate(var(--r)) scale(1.08); }
.stamp-cell.empty span {
  display: grid;
  place-items: center;
  width: 84%;
  height: 84%;
  border: 2px dashed #dccbb5;
  border-radius: 50%;
  color: #c4b29d;
  font-size: 13px;
  font-weight: 700;
}
.stamp-next p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: #5b4c46; }
.stamp-reward {
  padding: 16px;
  border: 2px solid #f0c661;
  border-radius: 16px;
  background: linear-gradient(135deg, #fff4d1, #ffe7a8);
  text-align: center;
}
.stamp-reward .label { margin: 0 0 6px; font-size: 18px; font-weight: 900; color: var(--wine); }
.stamp-reward p:not(.label):not(.note-status) { margin: 0 0 12px; font-size: 14px; line-height: 1.6; }
.stamp-reward small { display: block; margin-top: 8px; }
.reward-code { display: flex; justify-content: center; gap: 8px; margin-bottom: 12px; }
.reward-code code {
  padding: 8px 14px;
  border: 2px dashed var(--wine);
  border-radius: 10px;
  background: #fff;
  color: var(--wine);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.08em;
  user-select: all;
}
.reward-code button { padding: 0 14px; border: 0; border-radius: 10px; background: var(--wine); color: #fff; font-weight: 700; }
.plaza .cta { margin-top: 12px; --c: var(--wine); }

/* ---------- 有買鞋煩惱的路人 ---------- */
.qlabel { z-index: 100000 !important; pointer-events: auto; padding: 0; border: 0; background: none; cursor: pointer; } /* 永遠在其他名牌上面 */
/* 動畫放在裡面那層：CSS2D 標籤本身的 transform 是用來定位的，不能動它 */
.q-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 3px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd66b, #f5a524);
  box-shadow: 0 6px 16px rgba(60, 30, 20, 0.35);
  color: #5e1520;
  font: 900 13px/1 var(--font);
  white-space: nowrap;
  animation: q-bounce 1s ease-in-out infinite;
}
.q-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font-size: 18px;
}
.q-mark::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 3px solid #f5a524;
  border-radius: 50%;
  animation: q-ring 1.4s ease-out infinite;
}
.qlabel:hover .q-pill { filter: brightness(1.06); }
.qlabel.is-open .q-pill { animation: none; background: #fff; }
.qlabel.is-open .q-mark::after, .qlabel.happy .q-mark::after { display: none; }
.qlabel.happy .q-pill { animation: q-pop 0.5s ease-out both; background: #ffe1e8; }
.qlabel.happy .q-mark { background: #e8587a; }
@keyframes q-bounce { 50% { transform: translateY(-6px); } }
@keyframes q-ring { from { transform: scale(1); opacity: 0.8; } to { transform: scale(2.3); opacity: 0; } }
@keyframes q-pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.2); } }

/* 右下角「幫路人挑鞋」：直接飛到有煩惱的路人 */
.fab-shoppers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px 0 6px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffd66b, #f5a524);
  box-shadow: 0 8px 20px rgba(245, 165, 36, 0.5);
  color: #5e1520;
  font-size: 15px;
  font-weight: 900;
}
.fab-shoppers i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font-size: 18px;
  font-style: normal;
  animation: q-bounce 1s ease-in-out infinite;
}
.fab-shoppers em { padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.6); font-size: 12px; font-style: normal; }
.fab-shoppers:hover { filter: brightness(1.05); }

.q-bubble {
  margin: 4px 0 14px;
  padding: 12px 14px;
  border-radius: 4px 16px 16px 16px;
  background: #fff4d6;
  color: #5a3b2c;
  font-size: 15px;
  line-height: 1.7;
}
.q-prompt { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.q-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 8px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.q-option:hover:not(:disabled) { border-color: var(--wine); transform: translateY(-2px); }
.q-option:disabled { cursor: default; }
.q-img { display: grid; place-items: center; height: 76px; margin-bottom: 4px; }
.q-img img { max-width: 100%; max-height: 76px; object-fit: contain; mix-blend-mode: multiply; }
.q-option small { color: var(--wine); font-size: 11px; font-weight: 700; }
.q-option b { font-size: 13px; line-height: 1.35; }
.q-option ul { margin: 4px 0 0; padding-left: 14px; color: #6b5a53; font-size: 11px; line-height: 1.5; }
.q-option.wrong { border-color: #e2b3b3; opacity: 0.5; animation: q-shake 0.35s; }
.q-option.right { border-color: #3e9a6a; box-shadow: 0 0 0 3px rgba(62, 154, 106, 0.2); }
@keyframes q-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.q-actions { display: grid; gap: 8px; margin-top: 10px; }
.q-actions .cta { height: 42px; }
.q-next { --c: #8b2332; }
.q-count { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
/* 路人的反應：選錯變紅、搖頭；選對變綠 */
.q-bubble b { margin-right: 2px; }
.q-bubble small { display: block; margin-top: 4px; font-size: 13px; font-weight: 700; }
.q-bubble.no { background: #fdeeee; color: var(--wine); }
.q-bubble.yes { background: #eaf6ef; color: #23593d; font-weight: 700; }
.q-bubble.shake { animation: q-shake 0.4s; }
/* 優惠券進度條：卡片最上面 */
.q-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 12px;
  padding: 8px 12px;
  border: 2px solid #f0c661;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff4d1, #ffe7a8);
  color: #7a4a0c;
}
.q-strip-gift { font-size: 22px; line-height: 1; }
.q-strip-text { flex: 1; min-width: 0; }
.q-strip-text b { display: block; font-size: 14px; }
.q-strip-text small { display: block; margin-top: 1px; color: var(--wine); font-size: 13px; font-weight: 900; }
.q-pips { display: flex; gap: 6px; }
.q-pips i { width: 18px; height: 18px; border: 2px solid #e0a92e; border-radius: 50%; background: #fff; }
.q-pips i.on { border-color: #d98a0f; background: #f5a524; }
.q-pips i.new { animation: q-pop 0.6s 0.2s ease-out both; }
/* 挑對了的成功畫面 */
.q-success { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; color: #2f7a52; font-size: 22px; font-weight: 900; }
.q-check {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3e9a6a;
  color: #fff;
  font-size: 20px;
  animation: q-pop 0.5s ease-out both;
}
.q-chosen {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  margin: 10px 0 12px;
  padding: 10px;
  border: 2px solid #3e9a6a;
  border-radius: 14px;
  background: #fff;
}
.q-chosen .q-img { height: 80px; margin: 0; }
.q-chosen small { color: var(--wine); font-size: 11px; font-weight: 700; }
.q-chosen b { display: block; font-size: 15px; line-height: 1.35; }
.q-chosen p { margin: 4px 0 0; color: #5b4c46; font-size: 13px; line-height: 1.55; }
.q-link { display: inline-block; margin: 6px 10px 0 0; color: var(--wine); font-size: 13px; font-weight: 900; text-decoration: underline; text-underline-offset: 3px; }
/* 幫到了就送的優惠券：金色卡片 */
.q-reward {
  margin: 10px 0 4px;
  padding: 14px;
  border: 2px solid #f0c661;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff4d1, #ffe7a8);
  text-align: center;
  animation: q-pop 0.5s ease-out both;
}
.q-gift { display: block; font-size: 30px; line-height: 1.1; }
.q-reward b { display: block; margin: 4px 0; color: var(--wine); font-size: 16px; }
.q-reward p { margin: 0 0 10px; }
.q-reward .cta { height: 42px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: inline-block; }

  .brand { top: 12px; left: 12px; padding: 10px 14px; border-radius: 16px; }
  .brand h1 { margin: 4px 0 0; font-size: 20px; }
  .brand-sub { display: none; }
  .toolbar { top: 12px; right: 12px; gap: 6px; }
  .toolbar button { height: 38px; padding: 0 13px; }

  .card {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 56dvh;
    padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    animation-name: sheet-in;
  }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

  .index {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 74dvh;
    padding: 22px 18px calc(30px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 40px rgba(60, 30, 20, 0.2);
    transform: translateY(102%);
    transition: transform 0.3s ease;
    z-index: 30;
  }
  .index.open { transform: none; }
  .index-head h2 { font-size: 22px; }

  .warn-badge { bottom: auto; top: 64px; right: 12px; }

  .shop { padding: 0; }
  .shop-inner { width: 100%; height: 100%; border-radius: 0; }
  .shop-sign { gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; }
  .shop-logo { width: 54px; height: 42px; }
  .shop-logo b { font-size: 22px; }
  .shop-logo small { font-size: 7px; }
  .shop-title h2 { font-size: 20px; }
  .shop-exit { height: 36px; padding: 0 12px; font-size: 13px; }
  .shop-room {
    grid-template-columns: 1fr;
    grid-template-areas: "counter" "stamp" "wall" "corner" "board";
    padding: 26px 14px 20px;
  }
  .shop-counter { min-height: 300px; }
  .cork { grid-template-columns: 1fr 1fr; gap: 14px 10px; padding: 18px 12px; border-width: 8px; }
  .note blockquote { font-size: 14px; }
  .note-form { grid-template-columns: 1fr; }
  .mascot { width: 136px; margin-bottom: -66px; }
  .counter { height: 78px; }
  .shop-info { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .station-body { padding: 14px 12px 20px; }
  .st-section { padding: 14px; }
  .pack-cards { grid-template-columns: 1fr 1fr; }
  .toolbar .btn-service { padding: 0 11px; }
  .hide-mobile { display: none; }
  .brand-eyebrow { display: none; }
  .toolbar button { padding: 0 10px; }
  .door b { font-size: 40px; }
  .door small { font-size: 13px; }
  .door.left { padding-right: 18px; }
  .door.right { padding-left: 18px; }
}
