/* 插一盆花（像花美好的小遊戲）。顏色、字、按鈕跟柯基接花、合成花束（merge-game/src/app.css）同一套；
   插花台的版面照網站 /arrange 的手機版（site.css 第 12 段 ar-）：盆黏在畫面上面，選單在下面往下捲。電腦上置中成手機寬。 */
:root {
  --paper: #F6EEE0; --card: #FFFCF6; --ink: #4A3526; --ink-2: #806555; --cocoa: #8B4A2E;
  --coral: #E3876F; --coral-deep: #C25F45; --green: #4E8A62; --line: #EADFD0;
  --tape: #FBDDA0; --soft: #FFF3D6; --pink-tape: #F7CFD6;
  --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);
}

* { 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; }
input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.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; }
.tape-pink { background: var(--pink-tape); }
.script-en { font-family: var(--script); font-size: 13px; line-height: 1.2; color: var(--ink-2); }
/* 撕下來的一張紙（網站測驗的 .pk-torn） */
.torn { background: #FFFDF7; clip-path: polygon(0 5%, 5% 0, 11% 4%, 17% 1%, 24% 4%, 31% 0, 38% 3%, 45% 1%, 52% 4%, 59% 0, 66% 3%, 73% 1%, 80% 4%, 87% 0, 94% 3%, 100% 1%,
  100% 96%, 94% 100%, 87% 97%, 80% 100%, 73% 96%, 66% 100%, 59% 97%, 52% 100%, 45% 96%, 38% 100%, 31% 97%, 24% 100%, 17% 96%, 10% 100%, 4% 97%, 0 100%); }

.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); }
.btn-outline { background: transparent; color: var(--coral-deep); box-shadow: inset 0 0 0 1.5px var(--coral); }
.btn-sm { min-height: 44px; padding: 0 20px; font-size: 16px; }
.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: 36px; 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; }
.sample { position: relative; width: min(300px, 100%); margin: 6px auto 0; }
.sample-cv { width: 100%; aspect-ratio: 1000 / 1020; }
/* 柯基（corgi.webp 560×457，腳掌底在 87% 高）：趴在盆的右下角，只露出腳掌以上 */
.sample-corgi { position: absolute; right: -14px; bottom: 6%; width: 104px; height: 74px; overflow: hidden; pointer-events: none; }
.sample-corgi img { width: 104px; height: auto; }
.note-paper { max-width: 320px; margin: 4px auto 0; padding: 18px 24px; transform: rotate(-1.5deg); }
.note-paper p { font-family: var(--hand); font-size: 17px; line-height: 1.85; color: var(--ink); }
.home-go { margin-top: 16px; }
.home-go .btn { min-width: 240px; }
.home-new { margin-top: 4px; }
.home-links { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.install-tip { display: flex; align-items: center; gap: 10px; margin: 18px 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; }

/* ---------- 插花台 ---------- */
.studio { padding-bottom: calc(var(--safe-b) + 24px); }
.ar-stage { position: sticky; top: 0; z-index: 5; padding-top: var(--safe-t); border-radius: 0 0 26px 26px;
  background: radial-gradient(ellipse at 50% 80%, #FFFCF6 0, #FBF5EA 55%, #F3E9D8 100%); box-shadow: 0 10px 18px -16px rgba(90, 61, 46, .6), inset 0 -1.5px 0 rgba(139, 74, 46, .08); }
.studio.is-note .ar-stage { position: relative; }   /* 寫字時盆不黏住，鍵盤跳出來才不會擋到格子 */
.stage-home { position: absolute; top: calc(var(--safe-t) + 8px); left: 10px; z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 252, 246, .9); box-shadow: inset 0 0 0 1.5px var(--line); font-size: 24px; line-height: 1; color: var(--ink-2); }
.ar-canvas { width: min(100%, 44svh); aspect-ratio: 1000 / 1020; margin: 0 auto; touch-action: none; cursor: pointer; }   /* 手指在盆上是拖花，不是捲畫面 */
.ar-empty { position: absolute; left: 0; right: 0; top: 38%; padding: 0 20px; font-family: var(--hand); font-size: 18px; color: var(--ink-2); text-align: center; pointer-events: none; }
.ar-edit { display: flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 4px 10px; }
.ar-edit-hint { font-family: var(--hand); font-size: 14px; color: var(--ink-2); text-align: center; }
.ar-edit-btns { display: flex; justify-content: center; gap: 4px; }
.ar-edit-btns button { min-height: 38px; padding: 0 9px; border-radius: 999px; background: var(--card); color: var(--ink); font-family: var(--hand); font-size: 15px;
  box-shadow: inset 0 0 0 1.5px var(--line); white-space: nowrap; }
.ar-edit-btns button:active { transform: scale(.95); }
.ar-edit-btns .ar-del { background: var(--coral); color: #fff; box-shadow: none; }
.ar-panel { display: grid; gap: 12px; padding: 14px 14px 0; }
.ar-tabs { display: flex; gap: 6px; }
.ar-tab { flex: 1 1 auto; min-height: 42px; padding: 0 8px; border-radius: 999px; background: var(--card); color: var(--ink-2); font-family: var(--hand); font-weight: 700; font-size: 15.5px;
  box-shadow: inset 0 0 0 1.5px var(--line); white-space: nowrap; }
.ar-tab[aria-selected="true"] { background: var(--tape); color: var(--ink); box-shadow: none; }
.ar-body { padding: 12px 10px 10px; border-radius: 20px; background: var(--card); box-shadow: 0 16px 30px -26px rgba(90, 61, 46, .6); }
.ar-hint { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px; font-size: 14px; color: var(--ink-2); }
.ar-cname { flex: none; font-family: var(--hand); font-weight: 700; font-size: 15px; color: var(--ink); }
.ar-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; padding: 0 2px; }
.ar-sw { width: 31px; height: 31px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--sw) 45%, var(--sw2)); box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); }
.ar-sw[aria-checked="true"] { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ink); }
.ar-items { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.ar-items-leaf, .ar-items-vase { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ar-item { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 5px 0 3px; border-radius: 14px; background: #FBF6EC; transition: transform .15s, background .15s; }
.ar-item:active { transform: scale(.95); }
.ar-item.is-on { background: var(--soft); box-shadow: inset 0 0 0 2px var(--coral); }
.ar-item canvas { width: 64px; max-width: 100%; height: auto; aspect-ratio: 1; }
.ar-item span { font-family: var(--hand); font-size: 12.5px; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.ar-count { min-height: 1.6em; font-family: var(--hand); font-size: 16px; line-height: 1.5; color: var(--cocoa); text-align: center; }
.ar-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.ar-tool { min-height: 40px; padding: 0 15px; border-radius: 999px; color: var(--ink-2); font-family: var(--hand); font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--line); }
.ar-tool:active { transform: scale(.96); }
.ar-next-row { text-align: center; }
.ar-next-row .btn { min-width: 240px; }

/* 寫一句話 */
.ar-note { display: grid; gap: 12px; padding: 2px 4px; text-align: left; }
.ar-field { display: grid; gap: 4px; }
.ar-field span { font-family: var(--hand); font-weight: 700; font-size: 16px; color: var(--ink); }
.ar-field em { margin-left: 8px; font-style: normal; font-weight: 400; font-size: 13px; color: var(--ink-2); }
.ar-field input, .ar-field textarea { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #FFFDF8; font-family: var(--hand); font-size: 17px; color: var(--ink); resize: none; }
.ar-field input:focus, .ar-field textarea:focus { outline: none; border-color: var(--coral); }
.ar-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.ar-chip { min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--soft); color: var(--ink); font-family: var(--hand); font-size: 14px; }

/* ---------- 插好了 ---------- */
.done { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: calc(var(--safe-t) + 22px) 18px calc(var(--safe-b) + 30px); text-align: center; }
.done > * { width: 100%; max-width: 420px; }
.invite { padding: 16px 18px 18px; border-radius: 20px; background: var(--soft); }
.invite p { margin-bottom: 10px; font-family: var(--hand); font-size: 19px; color: var(--ink); }
.done-head .tape { font-size: 22px; }
.final { width: min(330px, 100%); margin: -6px auto 0; }
.final img { width: 100%; height: auto; border-radius: 16px; box-shadow: 0 22px 40px -26px rgba(111, 56, 32, .75); }
.final .wait { display: grid; place-items: center; aspect-ratio: 9 / 16; border-radius: 16px; background: var(--card); font-family: var(--hand); color: var(--ink-2); }
.box-head { margin-bottom: 10px; }
.box { padding: 18px 18px 20px; border-radius: 20px; background: var(--card); box-shadow: 0 16px 30px -26px rgba(90, 61, 46, .6); }
.box p { font-size: 15px; line-height: 1.8; color: var(--ink-2); text-wrap: balance; }
.share-line { font-family: var(--hand); font-size: 18px; color: var(--coral-deep) !important; }
.share-btns { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; margin-top: 12px; }
.text-link { border-bottom: 1px solid currentColor; padding: 0 0 1px; color: var(--ink-2); font-size: 15px; }
.box .btn-line { margin-top: 12px; }
.end-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 20px; }
.more { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; }

/* ---------- 下面滑上來的卡片（像花美好、放到桌面、存成圖片） ---------- */
.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: 92%; 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 { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; text-align: center; }
.pic-img { width: auto; max-width: 100%; max-height: 56vh; margin: 12px auto 0; border-radius: 14px; box-shadow: 0 18px 34px -24px rgba(111, 56, 32, .8); }
.pic-tip { margin-top: 12px; text-align: center; font-family: var(--hand); font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.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; }

/* 窄的手機：選單的字小一點、按鈕排得下 */
@media (max-width: 374px) {
  .ar-edit-btns button { padding: 0 7px; font-size: 14px; }
  .ar-tab { font-size: 14.5px; padding: 0 6px; }
  .ar-sw { width: 28px; height: 28px; }
}
/* 矮的手機（iPhone SE 這類）：開場的盆小一點，按鈕才看得到 */
@media (max-height: 700px) {
  .home { padding-top: calc(var(--safe-t) + 14px); }
  .home-title { font-size: 31px; }
  .sample { width: 230px; }
  .sample-corgi { width: 84px; height: 60px; right: -18px; }
  .sample-corgi img { width: 84px; }
  .note-paper { padding: 12px 20px; }
  .note-paper p { font-size: 15.5px; line-height: 1.7; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .sheet-box { animation: none !important; transition: none !important; }
}
