/* UCC 幸福咖啡時刻｜插畫風活動網站 */
:root {
  --red: #D10000;
  --red-dark: #A30F0A;
  --cream: #F8F5EE;
  --paper: #FBF3E4;
  --beige: #D9CFC2;
  --ink: #3B2418;
  --ink-soft: #7A6252;
  --brown: #6B3E26;
  --latte: #E8CBA4;
  --mustard: #F2B544;
  --sage: #8DB596;
  --white: #FFFDF8;
  --radius: 20px;
  --font-title: "Huninn", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --app-w: 480px;
  --header-h: 60px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: #EADCC6 url("../img/bg-pattern.svg") repeat;
  background-size: 240px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font-family: inherit; }

/* ---------- 手機版面框（電腦上置中） ---------- */
.app {
  position: relative;
  max-width: var(--app-w);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  box-shadow: 0 0 0 3px var(--ink), 0 20px 60px rgba(59, 36, 24, .25);
  overflow-x: clip; /* 用 clip 而不是 hidden，頂部列的 sticky 才會生效 */
}
@media (max-width: 480px) { .app { box-shadow: none; } }

/* ---------- 頂部列 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 16px;
  background: rgba(248, 245, 238, .94);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--ink);
}
.topbar .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar .logo img { height: 38px; width: auto; }
.topbar .logo span {
  font-family: var(--font-title); font-size: 13px; color: var(--ink-soft);
  padding-left: 10px; border-left: 2px solid var(--beige); line-height: 1.3;
}
.menu-btn {
  width: 46px; height: 46px; border-radius: 14px;
  border: 3px solid var(--ink); background: var(--mustard);
  box-shadow: 0 3px 0 var(--ink);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.menu-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.menu-btn i, .menu-btn i::before, .menu-btn i::after {
  display: block; width: 20px; height: 3px; border-radius: 3px; background: var(--ink);
  position: relative; transition: transform .25s, background .25s;
}
.menu-btn i::before, .menu-btn i::after { content: ""; position: absolute; left: 0; }
.menu-btn i::before { top: -7px; }
.menu-btn i::after { top: 7px; }
.menu-open .menu-btn i { background: transparent; }
.menu-open .menu-btn i::before { transform: translateY(7px) rotate(45deg); }
.menu-open .menu-btn i::after { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 選單 ---------- */
.menu {
  position: fixed; z-index: 25;
  top: var(--header-h); left: 50%;
  width: min(100%, var(--app-w));
  transform: translate(-50%, -12px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s, transform .25s, visibility .25s;
  background: var(--paper);
  border-bottom: 3px solid var(--ink);
  padding: 10px 20px 24px;
}
.menu-open .menu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu li + li { border-top: 2px dashed var(--beige); }
.menu a {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 4px; text-decoration: none;
  font-family: var(--font-title); font-size: 20px;
}
.menu a::before {
  content: ""; width: 12px; height: 16px; flex: none;
  background: var(--brown); border: 2px solid var(--ink); border-radius: 50%;
  transform: rotate(-20deg);
}
.menu a::after { content: "›"; margin-left: auto; font-size: 26px; color: var(--red); line-height: 1; }
.menu a.hot { color: var(--red); }
.menu-mask {
  position: fixed; inset: 0; z-index: 20; background: rgba(59, 36, 24, .35);
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.menu-open .menu-mask { opacity: 1; visibility: visible; }

/* ---------- 按鈕 ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 58px; padding: 10px 22px;
  border: 3px solid var(--ink); border-radius: 999px;
  font-family: var(--font-title); font-size: 21px; letter-spacing: .05em;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, filter .15s;
  user-select: none;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:hover { filter: brightness(1.04); }
.btn-primary { background: var(--red); color: #fff; }
.btn-secondary { background: var(--mustard); color: var(--ink); }
.btn-light { background: var(--white); color: var(--ink); }
.btn-fb { background: #1877F2; color: #fff; }
.btn-sm { min-height: 48px; font-size: 18px; }
.btn[disabled] { filter: grayscale(.8); opacity: .6; pointer-events: none; }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-row { display: grid; gap: 16px; }
.btn-row.two { grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-row.two .btn { font-size: 19px; padding: 10px 12px; }
.text-link {
  display: block; width: fit-content; margin: 18px auto 0; background: none; border: 0; cursor: pointer;
  font-family: var(--font-title); font-size: 16px; color: var(--ink-soft);
  text-decoration: underline; text-underline-offset: 4px;
}

/* ---------- 首頁 KV ---------- */
.kv { position: relative; padding: 22px 0 34px; background: #FBEBD3; border-bottom: 3px solid var(--ink); }
.kv-title { text-align: center; padding: 0 20px; position: relative; z-index: 2; }
.kv-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 6px;
  font-family: var(--font-title); font-size: 15px; letter-spacing: .1em;
  background: var(--white); border: 2.5px solid var(--ink); border-radius: 999px; padding: 2px 14px;
}
.kv-eyebrow b { color: var(--red); font-style: italic; font-family: Georgia, serif; font-size: 17px; }
.kv h1 {
  margin: 4px 0 0; font-family: var(--font-title); font-weight: 400;
  font-size: clamp(38px, 11.4vw, 54px); line-height: 1.15; letter-spacing: .02em;
  color: var(--white);
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  text-shadow: 0 6px 0 var(--ink);
}
.kv h1 small { display: block; font-size: .56em; color: var(--mustard); }
.kv h1 em { font-style: normal; color: #FF5A4E; }
.kv-art { width: 100%; margin-top: -6px; }
.kv-card {
  position: relative; z-index: 2;
  margin: -46px 20px 0; padding: 16px 18px 18px;
  background: var(--red); color: #fff; border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink); text-align: center;
}
.kv-card p { margin: 0; font-size: 15.5px; line-height: 1.65; }
.kv-card .period {
  display: inline-block; margin-top: 10px; padding: 3px 14px; border-radius: 999px;
  background: var(--white); color: var(--ink); font-weight: 700; font-size: 14px;
}
.kv .btn-row { padding: 26px 20px 0; }

/* ---------- 區塊共用 ---------- */
.section { padding: 46px 20px 50px; position: relative; }
.section + .section { border-top: 3px solid var(--ink); }
.section.alt { background: var(--paper); }
.sec-head { text-align: center; margin-bottom: 26px; position: relative; isolation: isolate; }
.sec-head .en {
  display: block; font-family: Georgia, serif; font-style: italic; font-weight: 700;
  font-size: 15px; letter-spacing: .25em; color: var(--red); text-transform: uppercase;
}
.sec-head h2 {
  position: relative; display: inline-block; margin: 4px 0 0; padding: 6px 30px 8px;
  font-family: var(--font-title); font-weight: 400; font-size: 28px; color: #fff;
  background: var(--red); border: 3px solid var(--ink); border-radius: 12px;
  box-shadow: 0 4px 0 var(--ink);
}
.sec-head h2::before, .sec-head h2::after {
  content: ""; position: absolute; top: 12px; width: 26px; height: 100%;
  background: var(--red-dark); border: 3px solid var(--ink); z-index: -1;
}
.sec-head h2::before { left: -18px; border-radius: 6px 0 0 6px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.sec-head h2::after { right: -18px; border-radius: 0 6px 6px 0; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
.sec-head p { margin: 14px 0 0; color: var(--ink-soft); font-size: 15px; }

.card {
  background: var(--white); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 5px 0 var(--ink);
}

/* ---------- 獎項 ---------- */
.prizes { display: grid; gap: 22px; }
.prize { position: relative; display: grid; grid-template-columns: 128px 1fr; align-items: center; gap: 12px; padding: 16px 16px 16px 10px; }
.prize img { width: 128px; height: auto; }
.prize .rank {
  position: absolute; top: -14px; left: 14px;
  font-family: var(--font-title); font-size: 16px; padding: 1px 14px;
  background: var(--mustard); border: 2.5px solid var(--ink); border-radius: 999px;
}
.prize:first-child .rank { background: var(--red); color: #fff; }
.prize h3 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 19px; line-height: 1.35; }
.prize .qty { display: inline-block; margin-top: 6px; font-weight: 900; color: var(--red); font-size: 17px; }
.prize .note { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }
.prize:first-child { grid-template-columns: 1fr; text-align: center; padding: 24px 18px 20px; background: #FFF3DE; }
.prize:first-child img { width: 220px; margin: 0 auto; }
.prize:first-child h3 { font-size: 23px; }

/* ---------- 產品 ---------- */
.products { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.product { padding: 12px 12px 14px; display: flex; flex-direction: column; text-decoration: none; transition: transform .15s; }
.product:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.product .pic { background: #F7EEDD; border-radius: 12px; border: 2px solid var(--beige); padding: 6px 4px 0; }
.product img { width: 100%; aspect-ratio: 300 / 340; }
.product .tag {
  align-self: flex-start; margin: 10px 0 4px; font-size: 12px; font-weight: 700;
  padding: 0 10px; border-radius: 999px; background: var(--ink); color: var(--cream);
}
.product h3 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 16.5px; line-height: 1.35; }
.product p { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.product .more { margin-top: auto; padding-top: 8px; font-size: 13px; font-weight: 700; color: var(--red); }

/* ---------- 活動辦法 ---------- */
.rules { padding: 6px 18px; }
.rule { border-bottom: 2px dashed var(--beige); }
.rule:last-child { border-bottom: 0; }
.rule summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 16px 2px; font-family: var(--font-title); font-size: 19px;
}
.rule summary::-webkit-details-marker { display: none; }
.rule summary .no {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--red); color: #fff; border: 2.5px solid var(--ink); font-size: 15px;
}
.rule summary::after { content: "+"; margin-left: auto; font-size: 26px; line-height: 1; color: var(--red); transition: transform .2s; }
.rule[open] summary::after { transform: rotate(45deg); }
.rule ol { margin: 0 0 16px; padding-left: 22px; font-size: 14.5px; }
.rule li { margin-bottom: 8px; }
.rule li::marker { color: var(--red); font-weight: 700; }

/* ---------- 頁尾 ---------- */
.footer { background: var(--ink); color: var(--latte); text-align: center; padding: 28px 20px 110px; font-size: 13px; }
.footer a { color: var(--latte); }
.footer .links { display: flex; justify-content: center; gap: 18px; margin-bottom: 8px; }
.footer p { margin: 4px 0; }

/* ---------- 浮動按鈕 ---------- */
.float-cta {
  position: fixed; z-index: 15; bottom: 0; left: 50%;
  width: min(100%, var(--app-w)); transform: translate(-50%, 120%);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(248, 245, 238, .95); border-top: 3px solid var(--ink);
  transition: transform .3s;
}
.float-cta.show { transform: translate(-50%, 0); }
.float-cta .btn { min-height: 50px; font-size: 18px; box-shadow: 0 4px 0 var(--ink); }

/* ---------- 心理測驗 ---------- */
.quiz { padding: 22px 20px 40px; min-height: calc(100dvh - var(--header-h)); display: flex; flex-direction: column; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.cup-progress { width: 64px; height: 64px; flex: none; }
.quiz-top .meta { flex: 1; }
.quiz-top .count { font-family: var(--font-title); font-size: 15px; color: var(--ink-soft); }
.quiz-top .count b { font-size: 30px; color: var(--red); font-weight: 400; }
.bar { height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--white); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--brown) 0 8px, #8A5434 8px 16px); transition: width .4s ease; }
.q-card { position: relative; padding: 34px 20px 24px; margin-top: 10px; text-align: center; }
.q-card .q-no {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 22px;
  background: var(--red); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 0 18px;
}
.q-card h2 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 24px; line-height: 1.45; }
.options { display: grid; gap: 16px; margin-top: 26px; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 16px 18px; text-align: left; cursor: pointer;
  font-family: var(--font-title); font-size: 18.5px; line-height: 1.45; color: var(--ink);
  background: var(--white); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 5px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s;
}
.option .ab {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 3px solid var(--ink); background: var(--mustard);
  font-family: Georgia, serif; font-weight: 700; font-style: italic; font-size: 20px;
}
.option:nth-child(2) .ab { background: var(--sage); }
.option:active, .option.picked { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); background: #FFE9C7; }
.q-anim { animation: qIn .35s ease both; }
@keyframes qIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.quiz-deco { margin-top: auto; padding-top: 26px; display: flex; justify-content: center; opacity: .9; }
.quiz-deco img { width: 150px; }
.analyzing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.analyzing img { width: 220px; animation: bob 1.2s ease-in-out infinite; }
.analyzing p { font-family: var(--font-title); font-size: 22px; margin: 0; }
.analyzing .dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }
@keyframes dots { 0% { content: ""; } 25% { content: "．"; } 50% { content: "．．"; } 75% { content: "．．．"; } }

/* ---------- 結果頁 ---------- */
.result { padding: 24px 20px 46px; }
.result-head { text-align: center; margin-bottom: 16px; }
.result-head p { margin: 0; font-family: var(--font-title); font-size: 18px; color: var(--ink-soft); }
.result-img { padding: 8px; overflow: hidden; }
.result-img img { width: 100%; border-radius: 12px; }
.save-tip { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; }
.result-body { margin-top: 26px; padding: 22px 20px; }
.result-body .type {
  display: inline-block; font-family: var(--font-title); font-size: 15px;
  padding: 1px 14px; border-radius: 999px; color: #fff; border: 2.5px solid var(--ink);
}
.result-body h1 { margin: 8px 0 6px; font-family: var(--font-title); font-weight: 400; font-size: 27px; line-height: 1.35; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.traits li { font-size: 13.5px; font-weight: 700; padding: 1px 10px; border-radius: 999px; background: #F3E6D2; }
.result-body p { margin: 0; font-size: 15.5px; }
.recommend { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; margin-top: 18px; padding: 12px; border-radius: 16px; background: #F7EEDD; border: 2px dashed var(--beige); }
.recommend img { width: 96px; }
.recommend small { display: block; font-weight: 700; color: var(--red); font-size: 13px; }
.recommend b { display: block; font-family: var(--font-title); font-weight: 400; font-size: 17px; line-height: 1.35; }
.recommend span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.result .btn-row { margin-top: 28px; }

/* ---------- 發票登錄 ---------- */
.register { padding: 26px 20px 46px; }
.register-intro { text-align: center; margin: 0 0 22px; font-size: 15px; color: var(--ink-soft); }
.register-intro b { color: var(--red); }
.notice-closed { padding: 18px; text-align: center; margin-bottom: 20px; background: #FFF0E8; font-weight: 700; }
.form { padding: 22px 18px 24px; }
.field { margin-bottom: 18px; }
.field label { display: flex; align-items: baseline; gap: 6px; font-family: var(--font-title); font-size: 17px; margin-bottom: 6px; }
.field label .req { color: var(--red); }
.field input {
  width: 100%; height: 52px; padding: 0 16px;
  font-size: 17px; font-family: var(--font-body); color: var(--ink);
  background: #fff; border: 2.5px solid var(--ink); border-radius: 14px;
  outline: none; transition: box-shadow .15s, border-color .15s;
}
.field input::placeholder { color: #B5A595; }
.field input:focus { box-shadow: 0 0 0 4px rgba(242, 181, 68, .45); }
.field.err input { border-color: var(--red); box-shadow: 0 0 0 4px rgba(209, 0, 0, .15); }
.field .hint { margin: 6px 2px 0; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.field.ok input { border-color: #3E8E5E; box-shadow: 0 0 0 4px rgba(94, 156, 118, .22); }
.field.ok #invoiceHint { color: #2F7A4C; font-weight: 700; }
.field.err #invoiceHint { color: var(--red); font-weight: 700; }
#invoice { text-transform: uppercase; letter-spacing: .08em; }
.guide { margin: -4px 0 18px; border: 2px dashed var(--beige); border-radius: 14px; background: #FFFBF3; }
.guide summary { cursor: pointer; padding: 10px 14px; font-weight: 700; font-size: 14px; color: var(--red); list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before { content: "？"; display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; }
.guide img { padding: 0 10px 12px; }
.guide p { margin: 0 14px 14px; font-size: 13px; color: var(--ink-soft); }
.agree { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0 22px; font-size: 14.5px; cursor: pointer; }
.agree input { appearance: none; -webkit-appearance: none; width: 26px; height: 26px; flex: none; margin: 0; border: 2.5px solid var(--ink); border-radius: 7px; background: #fff; cursor: pointer; display: grid; place-items: center; }
.agree input:checked { background: var(--red); }
.agree input:checked::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.agree.err input { box-shadow: 0 0 0 4px rgba(209, 0, 0, .2); }
.agree a { color: var(--red); font-weight: 700; }

/* ---------- 彈出視窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(59, 36, 24, .55); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.modal.show { opacity: 1; visibility: visible; }
.modal-box {
  width: min(100%, 400px); max-height: 86dvh; display: flex; flex-direction: column;
  background: var(--white); border: 3px solid var(--ink); border-radius: 24px; box-shadow: 0 6px 0 var(--ink);
  transform: scale(.92); transition: transform .2s;
}
.modal.show .modal-box { transform: none; }
.modal-icon { width: 76px; height: 76px; margin: -38px auto 0; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-size: 40px; font-family: var(--font-title); color: #fff; background: var(--red); }
.modal-icon.ok { background: var(--sage); }
.modal-icon.info { background: var(--mustard); color: var(--ink); }
.modal-body { padding: 16px 22px 6px; overflow-y: auto; text-align: center; }
.modal-body h3 { margin: 6px 0 8px; font-family: var(--font-title); font-weight: 400; font-size: 23px; line-height: 1.4; }
.modal-body p { margin: 0 0 8px; font-size: 15.5px; }
.modal-body.long { text-align: left; }
.modal-body.long h3 { text-align: center; }
.modal-body.long ol { padding-left: 20px; font-size: 14px; margin: 0 0 6px; }
.modal-body.long li { margin-bottom: 6px; }
.modal-body.long h4 { margin: 14px 0 6px; font-family: var(--font-title); font-weight: 400; font-size: 17px; color: var(--red); }
.modal-actions { display: grid; gap: 12px; padding: 14px 22px 22px; }
.modal-actions .btn { min-height: 50px; font-size: 19px; }

/* ---------- 其他 ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading-page { padding: 120px 20px; text-align: center; color: var(--ink-soft); font-family: var(--font-title); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
