/* 花店小老闆（像花美好的小遊戲）。顏色、字、按鈕跟網站的測驗／抽牌頁同一套，柯基和 18 盆是闆娘的圖。
   版面：手機一個畫面＝上面客人和紙條、中間你插的那一盆、下面花材選單和「交給客人」。電腦上置中成手機寬。 */
:root {
  --paper: #F6EEE0; --card: #FFFCF6; --ink: #4A3526; --ink-2: #806555; --cocoa: #8B4A2E;
  --coral: #E3876F; --coral-deep: #C25F45; --green: #4E8A62; --line: #EADFD0; --sage: #8C9F7A;
  --tape: #FBDDA0; --soft: #FFF3D6;
  --hand: "LXGW WenKai TC", "DFKai-SB", "KaiTi", serif;
  --body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --script: "Segoe Print", "Bradley Hand", "Chalkboard SE", cursive;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
.tone-yellow { --tape: #FBDDA0; --soft: #FFF3D6; }
.tone-pink { --tape: #F7CFD6; --soft: #FCE9EC; }
.tone-blue { --tape: #D2DFF2; --soft: #EBF1FA; }
.tone-red { --tape: #F5C6BD; --soft: #FBE5E0; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: #E8DDCB; color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
img, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible + span { outline: 3px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { position: fixed; top: 0; bottom: 0; left: 0; right: 0; width: 100%; max-width: 480px; margin: 0 auto; background: var(--paper); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 560px) and (min-height: 700px) {
  .app { top: 18px; bottom: 18px; border-radius: 30px; box-shadow: 0 34px 70px -34px rgba(79, 53, 41, .55); }
}
.screen { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }

.tape { display: inline-block; padding: 3px 16px 5px; border-radius: 4px 14px 5px 12px; background: var(--tape); transform: rotate(-2deg);
  font-family: var(--hand); font-weight: 700; font-size: 20px; color: var(--ink); letter-spacing: .04em; }
.script-en { font-family: var(--script); font-size: 13px; line-height: 1.2; color: var(--ink-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px; border-radius: 999px;
  font-family: var(--hand); font-weight: 700; font-size: 18px; letter-spacing: .06em; transition: transform .15s, background .2s, box-shadow .2s; user-select: none; -webkit-user-select: none; }
.btn:active { transform: scale(.97); }
.btn-coral { background: var(--coral); color: #fff; box-shadow: 0 14px 26px -16px rgba(200, 90, 60, .85); }
.btn-coral:disabled { background: #EBCABC; color: #FFF8F3; box-shadow: none; }
.btn-line { background: var(--green); color: #fff; box-shadow: 0 14px 26px -16px rgba(40, 90, 55, .8); }
.btn-line::before { content: "LINE"; padding: 2px 7px; border-radius: 999px; background: #fff; color: var(--green); font-family: var(--body); font-weight: 700; font-size: 11px; letter-spacing: 0; }
.btn-ghost { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.link { font-family: var(--hand); font-size: 15px; color: var(--coral-deep); text-decoration: underline; text-underline-offset: 4px; padding: 6px 2px; }
.pill { padding: 7px 16px; border-radius: 99px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-family: var(--hand); font-size: 15px; }

/* ---------- 開店畫面 ---------- */
.home { padding: calc(var(--safe-t) + 26px) 20px 24px; text-align: center; }
.home-title { margin-top: 2px; font-family: var(--hand); font-weight: 700; font-size: 38px; color: var(--cocoa); letter-spacing: .1em; line-height: 1.25; }
.home-brand { font-family: var(--hand); font-size: 15px; color: var(--ink-2); letter-spacing: .08em; }
.home-art { position: relative; width: 230px; margin: 14px auto 0; }
.home-art canvas { width: 230px; height: 230px; }
.home-corgi { position: absolute; right: -58px; bottom: -6px; width: 104px; height: auto; }
.home-sub { margin-top: 14px; font-size: 15px; line-height: 1.8; }
.home-stat { min-height: 1.6em; margin-top: 6px; font-family: var(--hand); font-size: 15px; color: var(--ink-2); }
.home-stat b { color: var(--coral-deep); }
.home-go { margin-top: 8px; }
.home-go .btn { min-width: 240px; }
.home-links { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.install-tip { display: flex; align-items: center; gap: 10px; margin: 22px auto 0; max-width: 400px; padding: 7px 4px 7px 9px; border-radius: 16px; background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--line); text-align: left; }
.install-tip img { flex: none; border-radius: 9px; }
.install-tip p { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.mini { flex: none; padding: 6px 13px; border-radius: 99px; background: var(--coral); color: #fff; font-family: var(--hand); font-weight: 700; font-size: 14px; }
.tip-x { flex: none; width: 30px; height: 34px; color: var(--ink-2); font-size: 20px; line-height: 1; }

/* ---------- 工作台 ---------- */
.bench { display: flex; flex-direction: column; overflow: hidden; padding: var(--safe-t) 0 calc(var(--safe-b) + 8px); }
.bar { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px 2px; }
.bar-home { flex: none; width: 36px; height: 36px; border-radius: 50%; font-size: 26px; line-height: 1; color: var(--ink-2); }
.bar-day { flex: 1; font-family: var(--hand); font-size: 15px; color: var(--ink-2); text-align: center; }
.bar-hearts { flex: none; min-width: 64px; padding: 3px 12px; border-radius: 99px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line);
  font-family: var(--hand); font-weight: 700; font-size: 15px; color: var(--coral-deep); text-align: center; }

.guest { flex: none; display: flex; align-items: flex-start; gap: 10px; margin: 4px 12px 0; }
.guest-face { flex: none; width: 60px; height: 60px; border-radius: 50%; box-shadow: 0 6px 12px -8px rgba(79, 53, 41, .7); }
.guest-face canvas { width: 60px; height: 60px; border-radius: 50%; }
.guest-note { position: relative; flex: 1; min-width: 0; padding: 8px 12px 9px; border-radius: 4px 16px 16px 16px; background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--line), 0 10px 18px -16px rgba(79, 53, 41, .7); }
.guest-name { font-family: var(--hand); font-weight: 700; font-size: 14px; color: var(--ink-2); line-height: 1.3; }
.guest-say { font-family: var(--hand); font-size: 16px; line-height: 1.45; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; list-style: none; }
.chip { padding: 1px 9px 2px; border-radius: 99px; background: #F4EBDD; color: var(--ink-2); font-family: var(--hand); font-size: 13.5px; line-height: 1.5;
  box-shadow: inset 0 0 0 1px #E4D6C2; transition: background .2s, color .2s; }
.chip.is-ok { background: #E3EDD8; color: #4E7A3E; box-shadow: inset 0 0 0 1px #BCD3A8; font-weight: 700; }
.patience { height: 5px; margin-top: 7px; border-radius: 99px; background: #EFE4D3; overflow: hidden; }
.patience i { display: block; height: 100%; width: 100%; border-radius: inherit; background: #9CC08A; transition: background .4s; }
.patience i.is-mid { background: #EBB75E; }
.patience i.is-low { background: #E3876F; }

.table { position: relative; flex: 1; min-height: 120px; display: flex; align-items: center; justify-content: center; margin: 6px 12px 0; border-radius: 22px;
  background: radial-gradient(120% 70% at 50% 108%, #E9D6BB 0 42%, rgba(233, 214, 187, 0) 70%), linear-gradient(#FBF7EF, #F5EBDB); box-shadow: inset 0 0 0 1.5px rgba(139, 74, 46, .1); }
.table-box canvas { width: 100%; height: 100%; touch-action: manipulation; cursor: pointer; user-select: none; -webkit-user-select: none; }
.helper { flex: none; display: flex; align-items: center; gap: 8px; min-height: 40px; margin: 6px 12px 0; padding: 3px 12px 3px 3px; border-radius: 99px; background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--line); font-family: var(--hand); font-size: 14.5px; line-height: 1.35; }
.helper img { flex: none; width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: 50% 35%; background: #FFF3D6; }

.picker { flex: none; margin: 6px 0 0; }
.tabs { display: flex; gap: 4px; padding: 0 12px; }
.tabs button { flex: 1; padding: 6px 0 5px; border-radius: 12px 12px 0 0; background: #EFE4D3; color: var(--ink-2); font-family: var(--hand); font-size: 15px; }
.tabs .is-on { background: var(--card); color: var(--coral-deep); font-weight: 700; box-shadow: inset 0 2px 0 var(--coral); }
.colors { display: flex; align-items: center; gap: 7px; padding: 8px 14px 4px; background: var(--card); margin: 0 12px; }
.colors.is-off .dot { opacity: .2; pointer-events: none; }
.dot { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 2px var(--d); transition: transform .15s; }
.dot.is-on { transform: scale(1.12); box-shadow: inset 0 0 0 2px var(--d), 0 0 0 2.5px var(--card), 0 0 0 4.5px var(--coral); }
.dot-name { flex: 1; min-width: 0; margin-left: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--hand); font-size: 13px; color: var(--ink-2); }
.items { display: flex; gap: 8px; overflow-x: auto; margin: 0 12px; padding: 6px 10px 8px; border-radius: 0 0 16px 16px; background: var(--card); scrollbar-width: none; overscroll-behavior-x: contain; }
.items::-webkit-scrollbar { display: none; }
.item { flex: none; display: flex; flex-direction: column; align-items: center; width: 68px; padding: 4px 2px 3px; border-radius: 14px; background: #FBF5EA;
  box-shadow: inset 0 0 0 1.5px var(--line); transition: transform .12s; }
.item:active { transform: scale(.92); }
.item.is-on { background: #FFF0E9; box-shadow: inset 0 0 0 2px var(--coral); }
.item canvas { width: 52px; height: 52px; }
.item span { font-family: var(--hand); font-size: 12.5px; line-height: 1.3; white-space: nowrap; }
.item-more { justify-content: center; color: var(--coral-deep); }
.item-more i { font-style: normal; font-size: 26px; line-height: 52px; }

.actions { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; }
.act-small { flex: none; min-height: 46px; padding: 0 14px; border-radius: 99px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-family: var(--hand); font-size: 15px; color: var(--ink-2); }
.act-give { flex: 1; min-height: 50px; padding: 0 12px; }
.act-give.is-ready { animation: ready 1.4s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 0 0 6px rgba(227, 135, 111, .25), 0 14px 26px -16px rgba(200, 90, 60, .85); } }

/* 交給客人以後：星星、小費 */
.result { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 10px; border-radius: inherit; background: rgba(251, 247, 239, .9); }
.res { width: 100%; max-width: 340px; text-align: center; animation: pop .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.94); } }
.res-say { font-family: var(--hand); font-weight: 700; font-size: 19px; line-height: 1.4; }
.res-stars { margin-top: 2px; font-size: 38px; line-height: 1.2; letter-spacing: .08em; color: #E7DCCB; }
.res-stars .on { color: #F2B544; display: inline-block; animation: star .5s cubic-bezier(.2, .9, .3, 1.4) both; animation-delay: calc(var(--i) * .15s); }
@keyframes star { from { transform: scale(0) rotate(-40deg); } }
.res-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin-top: 4px; list-style: none; font-family: var(--hand); font-size: 14px; }
.res-list .ok { color: #4E7A3E; }
.res-list .no { color: #B4553C; }
.res-tip { margin-top: 6px; font-family: var(--hand); font-size: 17px; color: var(--ink); }
.res-tip b { color: var(--coral-deep); font-size: 24px; }
.res-tip small { display: block; font-size: 13px; color: var(--ink-2); }
.res-go { margin-top: 10px; }
.res-go .btn { min-width: 210px; }

/* ---------- 打烊 ---------- */
.summary { padding: calc(var(--safe-t) + 22px) 18px 28px; text-align: center; }
.sum-title { font-family: var(--hand); font-weight: 700; font-size: 28px; color: var(--cocoa); letter-spacing: .06em; }
.sum-stars { margin-top: 6px; font-family: var(--hand); font-size: 18px; color: var(--ink-2); }
.sum-stars b { color: #E2A12E; font-size: 34px; }
.sum-hearts { font-family: var(--hand); font-size: 16px; }
.sum-hearts b { color: var(--coral-deep); font-size: 22px; }
.sum-best { margin: 12px auto 0; width: 220px; padding: 10px 10px 8px; border-radius: 22px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); }
.sum-best canvas { width: 200px; height: 200px; }
.sum-best figcaption { font-family: var(--hand); font-size: 14px; color: var(--ink-2); }
.sum-new { margin-top: 12px; font-family: var(--hand); font-weight: 700; font-size: 16px; color: var(--coral-deep); }
.sum-btns { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.real { margin-top: 22px; padding: 12px; border-radius: 20px; background: var(--soft); text-align: left; }
.real-head { font-family: var(--hand); font-weight: 700; font-size: 15px; color: var(--ink-2); text-align: center; }
.real-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.real-row img { flex: none; width: 96px; height: auto; }
.real-name { font-family: var(--hand); font-weight: 700; font-size: 19px; line-height: 1.4; }
.real-name em { font-style: normal; font-weight: 400; font-size: 14px; color: var(--ink-2); }
.real .btn-line { margin-top: 8px; min-height: 42px; padding: 0 14px; gap: 7px; font-size: 14.5px; letter-spacing: .02em; white-space: nowrap; }

/* ---------- 花材櫃 ---------- */
.cabinet { padding: var(--safe-t) 0 28px; }
.bar-plain { position: sticky; top: 0; z-index: 2; background: var(--paper); padding-top: 10px; padding-bottom: 6px; }
.cab-sub { margin: 4px 18px 0; font-size: 14px; color: var(--ink-2); text-align: center; }
.cab-h { margin: 20px 16px 8px; }
.cab-h .tape { font-size: 17px; }
.cab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 0 14px; }
.cab-item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 9px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); }
.cab-item canvas { width: 62px; height: 62px; }
.cab-name { font-family: var(--hand); font-weight: 700; font-size: 15px; }
.cab-have { font-family: var(--hand); font-size: 13px; color: #4E7A3E; }
.cab-buy { margin-top: 2px; padding: 3px 12px; border-radius: 99px; background: var(--coral); color: #fff; font-family: var(--hand); font-weight: 700; font-size: 13.5px; }
.cab-buy:disabled { background: #E7D9C9; color: #9C8879; }
.cab-item:not(.is-have) canvas { opacity: .75; }

/* ---------- 下面滑上來的卡片 ---------- */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; background: rgba(79, 53, 41, .45); }
.sheet-box { position: relative; width: 100%; max-width: 480px; max-height: 90%; overflow-y: auto; overscroll-behavior: contain;
  padding: 24px 18px calc(22px + var(--safe-b)); border-radius: 26px 26px 0 0; background: var(--paper);
  transform: translateY(40px); opacity: 0; transition: transform .28s cubic-bezier(.2, .8, .3, 1), opacity .2s; }
.sheet.is-open .sheet-box { transform: none; opacity: 1; }
.sheet-x { position: absolute; top: 8px; right: 8px; width: 42px; height: 42px; font-size: 26px; line-height: 1; color: var(--ink-2); }
.sheet-title { text-align: center; }
.sheet-sub { margin-top: 6px; text-align: center; font-family: var(--hand); font-size: 15px; color: var(--ink-2); }
.sheet-btns { margin-top: 16px; text-align: center; }
.sheet-row { margin-top: 18px; text-align: center; }
.switch { display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 14px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 14px; line-height: 1.6; cursor: pointer; }
.switch input { flex: none; width: 22px; height: 22px; margin-top: 2px; accent-color: var(--coral); }
.switch b { font-family: var(--hand); font-size: 17px; }
.about-logo { width: 140px; height: auto; margin: 14px auto 0; border-radius: 22px; }
.about-text { margin-top: 10px; text-align: center; font-size: 15px; line-height: 1.8; }
.about-btns { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; }
.about-btns .btn { min-width: 240px; }
.about-rows { margin-top: 18px; border-radius: 18px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px 18px; border-top: 1px solid var(--line); font-family: var(--hand); font-size: 16px; }
.row:first-child { border-top: 0; }
.row i { font-style: normal; font-size: 20px; color: #C4B2A0; }
.install-body { margin-top: 14px; font-size: 15px; line-height: 1.8; }
.how { margin: 4px 0 0 1.5em; }
.how li { padding: 2px 0; }
.ico { display: inline-block; width: 20px; height: 20px; vertical-align: -4px; fill: none; stroke: #3B7BD4; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.url-box { margin-top: 10px; padding: 10px; border-radius: 12px; background: var(--card); text-align: center; font-weight: 700; word-break: break-all; }
.install-icon { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 18px; font-size: 12px; color: var(--ink-2); }
.install-icon img { border-radius: 15px; box-shadow: 0 8px 16px -10px rgba(79, 53, 41, .6); }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 140px); z-index: 90; transform: translateX(-50%); max-width: 86%; padding: 10px 18px; border-radius: 99px;
  background: rgba(74, 53, 38, .92); color: #fff; font-size: 14px; text-align: center; }

/* 矮的手機（iPhone SE 這類）：客人紙條、花材小一點，盆子才有位置 */
@media (max-height: 700px) {
  .guest-face, .guest-face canvas { width: 48px; height: 48px; }
  .guest-say { font-size: 14.5px; }
  .chip { font-size: 12.5px; }
  .item { width: 60px; }
  .item canvas { width: 44px; height: 44px; }
  .helper { min-height: 34px; font-size: 13.5px; }
  .helper img { width: 28px; height: 28px; }
  .act-small { min-height: 42px; }
  .act-give { min-height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
