/* 合成花束（像花美好的小遊戲）。顏色、字、按鈕跟柯基接花（corgi-game/src/app.css）同一套。
   版面：開始畫面 → 合成（整個畫面一張畫布，上面一條分數）→ 花器滿了。電腦上置中成手機寬。 */
:root {
  --paper: #F6EEE0; --card: #FFFCF6; --ink: #4A3526; --ink-2: #806555; --cocoa: #8B4A2E;
  --coral: #E3876F; --coral-deep: #C25F45; --green: #4E8A62; --line: #EADFD0; --gold: #E2A12E;
  --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; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { 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-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) + 24px) 20px 24px; text-align: center;
  background: radial-gradient(90% 40% at 85% 6%, rgba(255, 226, 160, .45), rgba(255, 226, 160, 0) 70%), var(--paper); }
.home-title { margin-top: 2px; font-family: var(--hand); font-weight: 700; font-size: 40px; color: var(--cocoa); letter-spacing: .12em; line-height: 1.25; }
.home-brand { font-family: var(--hand); font-size: 15px; color: var(--ink-2); letter-spacing: .08em; }
.home-art { width: 250px; height: 210px; margin: 8px auto 0; }
.rules { display: inline-flex; flex-direction: column; gap: 6px; margin-top: 10px; list-style: none; text-align: left; font-family: var(--hand); font-size: 15.5px; line-height: 1.45; }
.rules li { display: flex; align-items: center; gap: 10px; }
.rules b { color: var(--coral-deep); }
.rule-ico { flex: none; width: 34px; height: 34px; }
.rule-ico canvas { width: 34px; height: 34px; }
.ladder-label { margin-top: 10px; font-family: var(--hand); font-size: 13px; color: var(--ink-2); letter-spacing: .1em; }
.home-ladder { width: 330px; max-width: 100%; height: 36px; margin: 2px auto 0; }
.home-best { min-height: 1.6em; margin-top: 6px; font-family: var(--hand); font-size: 15px; color: var(--ink-2); }
.home-best b { color: var(--coral-deep); font-size: 18px; }
.home-go { margin-top: 6px; }
.home-go .btn { min-width: 240px; }
.home-new { margin-top: 4px; }
.home-links { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.install-tip { display: flex; align-items: center; gap: 10px; margin: 20px 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; }

/* ---------- 合成 ---------- */
.play { position: relative; overflow: hidden; background: #FBF6EC; }
.play canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 8px) 12px 6px;
  pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-home { flex: none; width: 38px; height: 38px; border-radius: 50%; background: rgba(255, 252, 246, .85); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 24px; line-height: 1; color: var(--ink-2); }
.hud-score { flex: none; padding: 3px 14px; border-radius: 99px; background: rgba(255, 252, 246, .9); box-shadow: inset 0 0 0 1.5px var(--line);
  font-family: var(--hand); font-size: 15px; color: var(--ink-2); }
.hud-score b { font-size: 21px; color: var(--coral-deep); }
.hud-best { flex: none; font-family: var(--hand); font-size: 14px; color: var(--ink-2); }
.hud-best b { font-size: 16px; color: var(--ink); }
.big-say { position: absolute; left: 0; right: 0; top: 34%; z-index: 2; text-align: center; font-family: var(--hand); font-weight: 700; font-size: 76px; line-height: 1;
  color: var(--cocoa); text-shadow: 0 0 18px #FFFCF6, 0 0 6px #FFFCF6; pointer-events: none; opacity: 0; }
.big-say.is-on { animation: say 1s ease-out forwards; }
.big-say.is-go { font-size: 54px; color: var(--coral-deep); }
.big-say.is-new { font-size: 40px; color: var(--coral-deep); letter-spacing: .04em; }
.big-say.is-end { font-size: 54px; animation-duration: 1.4s; }
@keyframes say { 0% { opacity: 0; transform: scale(.6); } 18% { opacity: 1; transform: scale(1.08); } 30% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }
.big-say.is-end.is-on { animation-name: say-end; }
@keyframes say-end { 0% { opacity: 0; transform: scale(.6); } 20% { opacity: 1; transform: scale(1.06); } 35%, 100% { opacity: 1; transform: scale(1); } }

/* ---------- 花器滿了 ---------- */
.end { padding: calc(var(--safe-t) + 22px) 18px 28px; text-align: center; }
.end-box { animation: pop .4s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.end-title { font-family: var(--hand); font-weight: 700; font-size: 30px; color: var(--cocoa); letter-spacing: .08em; }
.end-score { margin-top: 2px; font-family: var(--hand); font-size: 20px; color: var(--ink-2); }
.end-score b { font-size: 52px; line-height: 1.1; color: var(--coral-deep); }
.end-record { display: inline-block; margin-top: 2px; padding: 2px 14px; border-radius: 99px; background: #FFE9B3; color: #9A6A12; font-family: var(--hand); font-weight: 700; font-size: 16px; }
.end-sub { margin-top: 4px; font-family: var(--hand); font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.end-bouquet { position: relative; margin: 66px auto 0; width: 240px; padding: 10px 10px 8px; border-radius: 22px; background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line); }
.end-bouquet canvas { width: 220px; height: 220px; }
/* 柯基（corgi.webp 560×457，腳掌底在 87% 高）：只露出腳掌以上，搭在卡片上緣 */
.end-corgi { position: absolute; right: 16px; bottom: 100%; width: 100px; height: 71px; overflow: hidden; pointer-events: none; }
.end-corgi img { display: block; width: 100px; height: auto; }
.end-bouquet figcaption { font-family: var(--hand); font-size: 14px; color: var(--ink-2); }
.end-btns { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.end-btns .btn { min-width: 150px; }
.end-home { margin-top: 14px; }
.real { margin-top: 20px; 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: 8px; }
.real-row img { flex: none; width: 104px; height: 130px; object-fit: cover; border-radius: 14px; box-shadow: 0 8px 16px -12px rgba(79, 53, 41, .7); }
.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; }

/* ---------- 下面滑上來的卡片 ---------- */
.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; }
.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; font-family: var(--hand); font-size: 16px; }
.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) + 120px); 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) {
  .home { padding-top: calc(var(--safe-t) + 14px); }
  .home-title { font-size: 34px; }
  .home-art { width: 200px; height: 168px; }
  .rules { font-size: 14.5px; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .end-box, .btn { animation: none !important; transition: none !important; }
}
