/* 木頭爸直播搶購頁 */
:root {
  --paper: #f6f0e6; --card: #fffaf2; --line: #e8dcc6;
  --ink: #2b1e14; --ink-2: #5d4a3a; --ink-3: #8a7563;
  --walnut: #231812; --amber: #e0a050; --green: #068442; --red: #c2402c;
  --serif: "Noto Serif TC", "PingFang TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --wrap: 1200px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.6; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button { font: inherit; }

/* ---------- 上方深色橫幅 ---------- */
.lv-band {
  background:
    radial-gradient(55% 140% at 88% 0%, rgba(224, 160, 80, .2), transparent 62%),
    linear-gradient(160deg, #2e1e14, #1b120c);
  color: #fbf3e6;
}
.lv-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: var(--wrap); margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 20px 8px;
}
.lv-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.lv-brand b { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.2; letter-spacing: .08em; }
.lv-brand small { display: block; font-size: 12px; letter-spacing: .2em; color: var(--amber); }
.lv-user { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; color: #e0cfb6; }
.lv-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-user button {
  flex: none; padding: 2px 12px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px;
  background: none; color: inherit; font-size: 13px; cursor: pointer;
}

.lv-top {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: center;
  max-width: var(--wrap); margin: 0 auto; padding: 18px 20px 34px;
}
.lv-top.has-side { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); }
.lv-live {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 3px 12px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 13px; font-weight: 700; letter-spacing: .1em;
}
.lv-live i { width: 8px; height: 8px; border-radius: 50%; background: #fff; animation: lv-blink 1.2s infinite; }
@keyframes lv-blink { 50% { opacity: .25; } }
.lv-hero h1 {
  margin: 12px 0 8px; font-family: var(--serif); font-weight: 900;
  font-size: clamp(28px, 4.4vw, 46px); line-height: 1.25; letter-spacing: .04em; color: #fbf3e6;
}
.lv-lead { max-width: 34em; margin: 0; color: #e0cfb6; font-size: 16.5px; }

/* 右邊的卡片：LINE 登入、你的資料 */
.lv-login, .lv-me {
  padding: 18px 20px; border-radius: 18px; background: var(--card); color: var(--ink);
  box-shadow: 0 20px 44px -22px rgba(0, 0, 0, .7);
}
.lv-login p { margin: 0 0 12px; color: #05622f; }
.lv-login p span { display: block; margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.lv-login-btns { display: grid; gap: 8px; }
/* 有「在 LINE 裡打開」時，「用 LINE 登入」改成白底，主要按前面那顆 */
#lv-open-line:not([hidden]) + #lv-login-btn { background: #fff; color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }

.lv-me-title { margin: 0 0 8px; font-size: 14px; font-weight: 700; letter-spacing: .1em; color: var(--ink-3); }
.lv-me-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; }
.lv-me-list dt { color: var(--ink-3); font-size: 15px; }
.lv-me-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 17px; font-weight: 700; }
.lv-me-list dd.is-empty { color: var(--red); font-weight: 500; }
.lv-me-warn { margin: 0 0 12px; color: #8d2a21; font-size: 15px; font-weight: 700; }
.lv-me.is-warn { background: #fdeee9; box-shadow: 0 0 0 2px #f0b8a8, 0 20px 44px -22px rgba(0, 0, 0, .7); }

/* ---------- 商品 ---------- */
.lv-main { max-width: var(--wrap); margin: 0 auto; padding: 28px 20px 36px; }
.lv-msg { margin: 0 0 18px; padding: 12px 16px; border: 1px solid #efd58f; border-radius: 12px; background: #fff4d6; }
.lv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.lv-card {
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card);
  box-shadow: 0 14px 32px -22px rgba(43, 30, 20, .45);
}
.lv-card.is-open { border-color: #efb9a9; box-shadow: 0 0 0 2px rgba(194, 64, 44, .16), 0 14px 32px -22px rgba(43, 30, 20, .45); }
.lv-card.is-ended { opacity: .8; }

/* 照片：框固定 4:3。直的、橫的照片都完整放在中間，旁邊用同一張照片模糊放大鋪滿；點一下看大圖 */
.lv-photo { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #3a2a1e; }
.lv-strip {
  position: absolute; inset: 0; display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.lv-strip::-webkit-scrollbar { display: none; }
.lv-slide { position: relative; flex: 0 0 100%; overflow: hidden; scroll-snap-align: center; }
.lv-bg {
  position: absolute; inset: -10%; width: 120%; height: 120%; max-width: none;
  object-fit: cover; filter: blur(22px) brightness(.78) saturate(1.15);
}
.lv-img { position: relative; width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.lv-photo-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(120deg, #e3c28c, #c89456); color: #fffaf1;
  font-family: var(--serif); font-size: 44px; font-weight: 900;
}
.lv-no, .lv-badge { position: absolute; top: 10px; z-index: 1; padding: 2px 10px; border-radius: 999px; font-weight: 900; }
.lv-no { left: 10px; background: rgba(35, 24, 18, .82); color: #fff; font-size: 15px; }
.lv-badge { right: 10px; font-size: 13px; font-weight: 700; }
.is-open .lv-badge { background: var(--red); color: #fff; }
.is-ready .lv-badge { background: #f1ead9; color: #6b5a45; }
.is-ended .lv-badge { background: #ece9e4; color: #6d6862; }
.lv-count {
  position: absolute; right: 10px; bottom: 10px; z-index: 1; padding: 1px 10px; border-radius: 999px;
  background: rgba(35, 24, 18, .78); color: #fff; font-size: 13px; font-weight: 700;
}
.lv-nav {
  position: absolute; top: 50%; z-index: 1; display: none; place-items: center; width: 38px; height: 38px; margin-top: -19px;
  border: 0; border-radius: 50%; background: rgba(35, 24, 18, .55); color: #fff; font-size: 26px; line-height: 1; cursor: pointer;
}
.lv-prev { left: 8px; }
.lv-next { right: 8px; }
@media (hover: hover) { .lv-nav { display: grid; } }

.lv-body { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 16px 18px 18px; }
.lv-body h2 { margin: 0; font-size: 19px; line-height: 1.4; }
.lv-note {
  display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  margin: 0; color: var(--ink-3); font-size: 14.5px; white-space: pre-line;
}
/* 剩幾件：大字 */
.lv-stock { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 4px 0 0; }
.lv-rest { color: var(--red); font-size: 22px; font-weight: 900; letter-spacing: .02em; }
.lv-total { color: var(--ink-3); font-size: 14px; }
.lv-hint { color: var(--red); font-size: 14px; font-weight: 700; }
.is-ready .lv-rest, .is-ended .lv-rest { color: var(--ink-2); }
.is-ready .lv-hint, .is-ended .lv-hint { color: var(--ink-3); }
.lv-timer { margin: 0; color: #9a5b0b; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lv-winners { margin: 0; color: var(--ink-3); font-size: 13.5px; }
.lv-mine { margin: 4px 0 0; padding: 9px 12px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.lv-mine.win { background: #e3f4ea; color: #05622f; }
.lv-mine.wait { background: #fff4d6; color: #8a5a0a; }
.lv-actions { display: grid; gap: 8px; margin-top: auto; padding-top: 10px; }

/* ---------- 按鈕 ---------- */
.lv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 50px; padding: 0 18px; border: 0; border-radius: 14px;
  font-size: 17px; font-weight: 900; letter-spacing: .06em; text-decoration: none; cursor: pointer;
}
.lv-btn:disabled { cursor: default; }
.lv-btn svg { width: 20px; height: 20px; }
.lv-btn-grab { background: var(--red); color: #fff; box-shadow: 0 10px 22px -12px rgba(194, 64, 44, .9); }
.lv-btn-grab:active:not(:disabled) { transform: scale(.98); }
.lv-btn-wait { background: #c27c0e; color: #fff; }
.lv-btn-off { background: #ece4d8; color: #8a7c6c; font-size: 16px; font-weight: 700; }
.lv-btn-line { background: var(--green); color: #fff; font-size: 16px; }
.lv-btn-edit { height: 44px; background: #fff; color: var(--ink); font-size: 15.5px; box-shadow: inset 0 0 0 1.5px var(--line); }
.lv-btn-edit:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.lv-me.is-warn .lv-btn-edit { background: var(--red); color: #fff; box-shadow: none; }

.lv-empty { margin: 0; padding: 48px 16px; border: 1.5px dashed var(--line); border-radius: 16px; color: var(--ink-3); text-align: center; }
.lv-foot { max-width: var(--wrap); margin: 0 auto; padding: 8px 20px calc(32px + env(safe-area-inset-bottom)); color: var(--ink-3); font-size: 14px; text-align: center; }
.lv-foot p { margin: 4px 0; }
.lv-foot a { color: var(--ink-2); }

.lv-toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 50;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: rgba(35, 24, 18, .94); color: #fff; font-weight: 700; text-align: center;
  opacity: 0; transform: translate(-50%, 12px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.lv-toast.show { opacity: 1; transform: translate(-50%, 0); }
.lv-toast.bad { background: #8d2a21; }

/* ---------- 抖音名字填寫視窗 ---------- */
.lv-modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(20, 13, 9, .62); }
.lv-modal-box {
  display: grid; gap: 12px; width: min(100%, 420px); padding: 24px 20px 14px;
  border-radius: 20px; background: var(--card); box-shadow: 0 30px 80px rgba(0, 0, 0, .4);
}
.lv-modal-box h2 { margin: 0; font-size: 22px; line-height: 1.4; }
.lv-modal-box p { margin: 0; color: var(--ink-2); }
.lv-modal-box input {
  height: 52px; padding: 0 14px; border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font: inherit; font-size: 18px;
}
.lv-modal-box input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(194, 64, 44, .18); }
.lv-tt-later { padding: 8px; border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 15px; cursor: pointer; }

/* ---------- 看大圖 ---------- */
.lv-viewer { position: fixed; inset: 0; z-index: 45; background: rgba(10, 7, 5, .95); }
.lv-viewer-strip {
  position: absolute; inset: 0; display: flex; overflow-x: auto;
  scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain;
}
.lv-viewer-strip::-webkit-scrollbar { display: none; }
.lv-viewer-strip img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; cursor: zoom-out; }
.lv-viewer-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 2;
  width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #222; font-size: 30px; line-height: 1; cursor: pointer;
}
.lv-viewer .lv-nav { z-index: 2; }
.lv-viewer .lv-count { right: auto; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); }

/* ---------- 平板、手機 ---------- */
@media (max-width: 860px) {
  .lv-top.has-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .lv-head { padding-left: 16px; padding-right: 16px; }
  .lv-top { gap: 14px; padding: 8px 16px 22px; }
  .lv-hero h1 { margin: 8px 0 4px; font-size: 26px; }
  .lv-lead { font-size: 14.5px; }
  .lv-login, .lv-me { padding: 14px 16px; }
  .lv-main { padding: 20px 16px 28px; }
  .lv-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .lv-live i { animation: none; }
}
