/* the Cans · Conserverie des Âmes */
:root {
  --cream: #F2E9DA;
  --paper: #FBF6EC;
  --oat: #E4D6BF;
  --shelf: #E7DAC4;
  --line: #D6C3A4;
  --line2: #C4AC88;
  --tan: #A88A6A;
  --ink: #3B2A22;
  --ink2: #5A4636;
  --muted: #6B5546;
  --wine: #8A3B3B;
  --wine-d: #5E2626;
  --brass: #A8763E;
  --sage: #5E6B47;
  --navy: #2E4A7D;
  --metal: linear-gradient(90deg, #B0A696 0%, #E8E1D5 30%, #D2C9BA 60%, #A0968A 100%);
  --lid: #DCD4C6;
  --lid-edge: #A3998A;
  --serif: 'Noto Serif TC', 'Songti TC', serif;
  --fr: 'Cormorant Garamond', 'Times New Roman', serif;
  --mono: 'Courier Prime', 'Courier New', monospace;
  --slab: 'Alfa Slab One', 'Rockwell', serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: #E2D5BF;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--wine); }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  background: var(--cream);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(60, 35, 15, .15);
}
.view { flex: 1; display: flex; flex-direction: column; padding-bottom: calc(78px + var(--safe-b)); }
.app.no-tab .view { padding-bottom: var(--safe-b); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(70px + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(242, 233, 218, .96); backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; align-items: center; z-index: 20;
}
.app.no-tab .tabbar { display: none; }
.tabbar a {
  text-decoration: none; color: var(--muted); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; min-height: 48px; justify-content: center;
}
.tabbar a.on { color: var(--ink); font-weight: 700; }
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }

/* ---------- common ---------- */
.screen { animation: fadeUp .4s var(--ease) both; display: flex; flex-direction: column; flex: 1; }
.topbar {
  padding: calc(14px + var(--safe-t)) 12px 6px 6px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 60px;
}
.back {
  display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 8px;
  color: var(--ink); text-decoration: none; background: none; border: 0; font-size: 15px;
}
.back svg, .ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.head { padding: calc(20px + var(--safe-t)) 20px 8px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.fr { font-family: var(--fr); font-style: italic; color: var(--muted); font-size: 17px; letter-spacing: .03em; }
.h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: .08em; line-height: 1.3; }
.h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .08em; }
.mono { font-family: var(--mono); }
.small { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.pad { padding: 0 16px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; }
.spacer { flex: 1; }

.btn {
  height: 48px; padding: 0 20px; border-radius: 24px; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); font-size: 15px; letter-spacing: .06em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: transform .12s, background .2s, opacity .2s; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.dark { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn.wine { background: var(--wine); color: var(--cream); border-color: var(--wine); }
.btn.soft { border-color: var(--tan); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 18px; letter-spacing: .02em; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line2); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink); flex: none;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.chip {
  height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid var(--ink);
  background: transparent; color: var(--ink); font-size: 13px; transition: background .2s, color .2s; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1.2;
}
.chip.on { background: var(--ink); color: var(--cream); }
.chip.soft { border-color: var(--tan); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

.seg { display: grid; grid-auto-columns: 1fr; grid-auto-flow: column; background: var(--oat); border-radius: 20px; padding: 3px; }
.seg button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; height: 34px; border-radius: 17px; border: 0; background: transparent; color: var(--muted); font-size: 13px; transition: background .2s, color .2s; }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(60, 35, 15, .12); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--wine); text-transform: uppercase; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 600; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line2); background: var(--paper); border-radius: 6px;
  padding: 10px 12px; font-size: 15px; color: var(--ink); outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); }
.textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.paper-input {
  width: 100%; border: 0; border-bottom: 1px dashed var(--tan); background: transparent; resize: none;
  font-size: 16px; line-height: 1.7; color: var(--ink); outline: none; padding: 4px 0;
}
.hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.empty { text-align: center; padding: 40px 24px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.progress { height: 8px; background: var(--oat); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brass); transition: width .6s var(--ease); }

/* ---------- toast & modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--cream); padding: 10px 18px; border-radius: 20px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 100; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-wrap {
  position: fixed; inset: 0; background: rgba(40, 25, 15, .45); z-index: 60;
  display: flex; align-items: flex-end; justify-content: center; animation: fade .2s both;
}
.modal {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; background: var(--cream);
  border-radius: 16px 16px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); animation: sheet .35s var(--ease) both;
  display: flex; flex-direction: column; gap: 14px;
}
.modal .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); align-self: center; margin-bottom: 2px; }
.modal-title { display: flex; justify-content: space-between; align-items: center; }
.modal-title h3 { margin: 0; font-size: 18px; letter-spacing: .06em; }

/* ---------- can (front view) ---------- */
.can { display: flex; flex-direction: column; align-items: center; position: relative; }
.can .lid { border-radius: 50%; background: var(--lid); border: 1.5px solid var(--lid-edge); position: relative; z-index: 2; box-shadow: inset 0 0 0 5px #CFC6B7; }
.can .body { background: var(--metal); border-radius: 0 0 10px 10px; display: flex; align-items: center; box-shadow: 0 6px 0 rgba(90, 60, 30, .14); position: relative; }
.can .label {
  width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-top: 3px double var(--band, var(--wine)); border-bottom: 3px double var(--band, var(--wine));
  background: var(--labelbg, #F1E8DA); overflow: hidden; position: relative;
}
.wax {
  width: 30px; height: 30px; border-radius: 50%; background: var(--wine); color: var(--cream); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 0 var(--wine-d), inset 0 0 0 3px #9E4747;
}

/* ---------- home: crates ---------- */
.shelfwrap {
  flex: 1; background: var(--shelf); box-shadow: inset 0 10px 14px -10px rgba(60, 35, 15, .35);
  padding: 14px 16px 30px; display: flex; flex-direction: column; gap: 12px;
}
.crate { display: flex; flex-direction: column; transition: transform .5s var(--ease), opacity .35s; position: relative; }
.crate.dim { opacity: .62; }
.crate-in {
  height: 0; overflow: hidden; transition: height .55s var(--ease);
  background-color: #9C6B3E;
  background-image: repeating-linear-gradient(90deg, rgba(50, 25, 8, .10) 0 2px, transparent 2px 11px);
  border-left: 9px solid #B98650; border-right: 9px solid #B98650; border-radius: 3px 3px 0 0;
  box-shadow: inset 0 12px 16px -6px rgba(40, 18, 4, .55);
}
.crate.walnut .crate-in { background-color: #5E3B22; border-color: #74492A; }
.crate.white .crate-in { background-color: #B9AD98; border-color: #CFC4B0; }
.crate-in .grid { padding: 20px 10px 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; column-gap: 6px; }
.crate-front {
  position: relative; height: 108px; border-radius: 2px;
  background-color: #C99A62;
  background-image: repeating-linear-gradient(0deg, rgba(95, 58, 25, .13) 0 1px, transparent 1px 7px),
                    repeating-linear-gradient(90deg, rgba(255, 240, 210, .05) 0 30px, rgba(95, 58, 25, .05) 30px 61px);
  border-top: 7px solid #B5824C; border-bottom: 3px solid #8E6034;
  box-shadow: 0 6px 8px -2px rgba(60, 32, 10, .45);
  display: flex; align-items: center; justify-content: center;
}
.crate.walnut .crate-front { background-color: #6E4527; border-top-color: #5A381F; border-bottom-color: #3E2614; }
.crate.white .crate-front { background-color: #D9D0C0; border-top-color: #C8BCA7; border-bottom-color: #A79A84; background-image: repeating-linear-gradient(0deg, rgba(95, 80, 60, .10) 0 1px, transparent 1px 7px); }
.crate-front .seam { position: absolute; left: 0; right: 0; top: 48px; height: 1px; background: rgba(80, 45, 15, .35); }
.crate-front .nail { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #6E5236; }
.crate-front .pull {
  position: absolute; inset: 0; border: 0; background: transparent; z-index: 3; width: 100%;
}
.crate-edit {
  position: absolute; right: 6px; bottom: 6px; z-index: 4; width: 36px; height: 36px; border-radius: 18px; border: 0;
  background: rgba(60, 35, 15, .35); color: #F7EAD3; display: flex; align-items: center; justify-content: center;
}
.crate-edit svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.crate-label {
  width: 82%; max-width: 300px; height: 72px; border-radius: 4px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  position: relative; z-index: 1; background-size: cover; background-position: center; pointer-events: none;
}
.crate-label .emblem { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--slab); font-size: 18px; flex: none; border: 2px solid; }
.crate-label .brand { font-family: var(--slab); font-size: 19px; letter-spacing: .04em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crate-label .zh { font-size: 13px; font-weight: 900; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crate-label .meta { font-family: var(--mono); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crate-label .txt { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.sticker { position: absolute; z-index: 2; pointer-events: none; }
.sticker.fragile { left: 8px; top: 6px; transform: rotate(-8deg); border: 2px solid #B23A2E; color: #B23A2E; font-family: var(--mono); font-weight: 700; font-size: 10px; padding: 1px 5px; background: rgba(255, 245, 230, .7); letter-spacing: .1em; }
.sticker.post { right: 44px; top: 4px; width: 40px; height: 40px; border-radius: 50%; border: 2px dashed rgba(60, 40, 90, .75); color: rgba(60, 40, 90, .85); font-family: var(--mono); font-size: 8px; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.1; transform: rotate(12deg); }
.sticker.star { left: 12px; bottom: 6px; color: #E2B23A; font-size: 22px; text-shadow: 0 1px 0 #8C6420; transform: rotate(-12deg); }
.sticker.note { right: 10px; top: -10px; background: #FFF6C9; color: var(--ink); font-size: 11px; padding: 4px 8px; transform: rotate(4deg); box-shadow: 0 2px 3px rgba(0, 0, 0, .2); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topcan { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; animation: canin .5s var(--ease) both; background: none; border: 0; padding: 0; }
.topcan .disc {
  width: 62px; height: 62px; border-radius: 50%; background: #D8D0C2; border: 3px solid var(--ring, #8A3B3B);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 4px rgba(30, 12, 2, .45); position: relative; overflow: visible;
}
.topcan .disc .in { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid #ADA392; box-shadow: inset 0 0 0 4px #CDC4B5; background-size: cover; background-position: center; }
.topcan .disc .tab { position: absolute; top: 9px; width: 16px; height: 9px; border-radius: 50%; border: 2px solid #9A9080; }
.topcan .disc .wax { position: absolute; right: -7px; bottom: -5px; width: 24px; height: 24px; font-size: 11px; }
.topcan .tag { padding: 1px 8px; font-size: 12px; font-weight: 600; border-radius: 2px; max-width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topcan.add .disc { background: transparent; border: 1.5px dashed #F1DDB8; box-shadow: none; color: #F7E9CF; }
.topcan.add { color: #F7E9CF; font-size: 12px; }
.topcan.add svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.standgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 8px; padding: 8px 0; }
.standcan { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; animation: canin .45s var(--ease) both; }

/* ---------- open flow ---------- */
.stage { flex: 1; display: flex; flex-direction: column; padding: 16px 24px 28px; gap: 16px; animation: fadeUp .45s var(--ease) both; }
.stage.center { align-items: center; }
.choice {
  text-align: left; padding: 20px; border-radius: 8px; border: 1px solid var(--line2); background: var(--paper);
  display: flex; gap: 16px; align-items: center; width: 100%;
}
.choice b { font-size: 18px; display: block; }
.choice span { font-size: 13px; color: var(--muted); }
.choice svg { width: 40px; height: 40px; flex: none; fill: none; stroke: var(--wine); stroke-width: 1.6; }
.wishpaper { background: var(--paper); border: 1px solid var(--line); padding: 16px; transform: rotate(-1deg); box-shadow: 0 3px 0 rgba(90, 60, 30, .12); display: flex; flex-direction: column; gap: 8px; }
.windzone { position: relative; width: 240px; height: 290px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.windzone .glow { position: absolute; top: 66px; left: 50%; margin-left: -80px; width: 160px; height: 16px; border-radius: 50%; background: #FFF4D6; opacity: 0; z-index: 1; }
.windzone .wlid { position: absolute; top: 62px; left: 30px; width: 180px; height: 28px; border-radius: 50%; background: var(--lid); border: 1.5px solid var(--lid-edge); transform-origin: 96% 50%; z-index: 3; box-shadow: inset 0 0 0 6px #CFC6B7; }
.windzone .wkey { position: absolute; top: 46px; right: -8px; z-index: 4; width: 54px; height: 54px; }
.holdbtn {
  width: 100%; height: 60px; border-radius: 30px; border: 0; background: var(--ink); color: var(--cream); font-size: 16px; letter-spacing: .15em;
  display: flex; align-items: center; justify-content: center; gap: 10px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .15s, background .15s;
}
.holdbtn.holding { background: var(--wine-d); transform: scale(.97); }
.holdbtn svg { width: 22px; height: 22px; }

/* ---------- can detail ---------- */
.bigcan { display: flex; justify-content: center; padding: 8px 0 6px; }
.oval-btn {
  width: 132px; height: 92px; border: 1.5px dashed var(--brass); border-radius: 50%; background: #FBF4E8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #7A5530; font-size: 11px;
  overflow: hidden; padding: 0; background-size: cover; background-position: center;
}
.oval-btn.has { border-style: solid; border-color: var(--band, var(--brass)); }
.oval-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.emboss {
  flex: 1; aspect-ratio: 1; border-radius: 50%; background: var(--lid); border: 1.5px solid var(--lid-edge);
  box-shadow: inset 0 0 0 8px #D2C9BA, inset 0 0 0 9px #B9AF9F;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; padding: 10px;
}
.emboss .e { font-family: var(--mono); color: #3B3127; text-shadow: 0 1px 0 #F2ECE2, 0 -1px 0 #9C9282; }
.ingredients { flex: 1; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; text-align: left; }
.ingredients .r { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.ingredients .r span:last-child { font-family: var(--mono); white-space: nowrap; }
.parts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.part {
  min-height: 66px; border-radius: 6px; border: 1px solid var(--line2); background: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px;
}
.part.empty { border-style: dashed; background: transparent; }
.part.locked { border-style: dashed; background: #EDE3D2; color: var(--muted); }
.part b { font-size: 14px; }
.part span { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; }
.frag { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.frag .t { font-weight: 700; font-size: 14px; }
.frag .x { font-size: 14px; white-space: pre-wrap; line-height: 1.7; }
.frag .acts { display: flex; gap: 6px; justify-content: flex-end; }
.quote { border-left: 0; background: var(--paper); border: 1px dashed var(--line2); padding: 10px 12px; font-size: 14px; line-height: 1.7; border-radius: 4px; position: relative; }

/* ---------- feed ---------- */
.suggest { animation: fadeUp .45s var(--ease) both; }
.suggest.done { background: #F7EEDC; }
.suggest.skipped { opacity: .5; }
.sectag { display: inline-block; padding: 2px 8px; border-radius: 2px; color: #F6EEDC; font-size: 11px; font-weight: 600; }

/* ---------- chat ---------- */
.chathead { padding: calc(10px + var(--safe-t)) 12px 10px 4px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); background: var(--cream); position: sticky; top: 0; z-index: 5; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #D8D0C2; border: 3px solid var(--ring, var(--brass)); flex: none; background-size: cover; background-position: center; }
.msgs { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; background-image: repeating-linear-gradient(0deg, rgba(168, 138, 106, .10) 0 1px, transparent 1px 28px); }
.msg { max-width: 82%; padding: 11px 14px; font-size: 15px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; animation: fadeUp .3s var(--ease) both; }
.msg.ai { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-radius: 2px 12px 12px 12px; box-shadow: 0 2px 0 rgba(90, 60, 30, .08); }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--cream); border-radius: 12px 2px 12px 12px; }
.msgacts { display: flex; gap: 6px; margin-top: -6px; }
.msgacts .btn { height: 30px; font-size: 12px; padding: 0 10px; border-style: dashed; border-color: var(--brass); color: #7A5530; }
.typing span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); margin: 0 2px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
.composer { position: sticky; bottom: 0; padding: 10px 12px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--cream); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 44px; max-height: 140px; border-radius: 22px; border: 1px solid var(--line2); background: var(--paper); padding: 10px 16px; font-size: 15px; resize: none; outline: none; line-height: 1.5; }

/* ---------- assets ---------- */
.masonry { columns: 2; column-gap: 8px; padding: 4px 16px 16px; }
.tile { break-inside: avoid; margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; background: none; border: 0; padding: 0; width: 100%; text-align: left; animation: fadeUp .4s var(--ease) both; }
.tile img { width: 100%; border-radius: 4px; background: var(--oat); }
.tile .who { font-size: 12px; color: var(--ink2); padding: 0 2px; }

/* ---------- receipt ---------- */
.printer { width: 316px; max-width: 100%; height: 16px; border-radius: 8px; background: var(--ink); position: relative; z-index: 2; }
.paperslot { overflow: hidden; margin-top: -6px; display: flex; justify-content: center; }
.paperslot canvas { display: block; max-width: 100%; height: auto; }
.printing { animation: print 1.6s steps(16) both; }

/* ---------- draw pad ---------- */
.drawpad { background: #FBF4E8; border: 1px solid var(--line2); border-radius: 8px; touch-action: none; width: 100%; aspect-ratio: 4 / 3; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--cream); box-shadow: 0 0 0 1px var(--line2); flex: none; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- keyframes ---------- */
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(16px); } 100% { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes canin { 0% { opacity: 0; transform: translateY(-10px) scale(.92); } 100% { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes shakeA { 0%, 100% { transform: none; } 15% { transform: rotate(-9deg) translateX(-6px); } 30% { transform: rotate(8deg) translateX(6px); } 45% { transform: rotate(-6deg); } 60% { transform: rotate(5deg); } 75% { transform: rotate(-2deg); } }
@keyframes chip { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes slip { 0% { transform: translateY(-30px) rotate(-5deg); opacity: 1; } 65% { transform: translateY(96px) rotate(0); opacity: 1; } 100% { transform: translateY(120px); opacity: 0; } }
@keyframes waxin { 0% { transform: scale(2.2) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes lidfly { 0% { transform: translateY(-8px) rotate(-30deg); opacity: 1; } 100% { transform: translate(150px, -150px) rotate(-220deg); opacity: 0; } }
@keyframes burst { 0% { transform: scale(.15); opacity: 0; } 35% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes rise { 0% { transform: translateY(120px) scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes canout { 0% { transform: none; } 100% { transform: translateY(20px) scale(.92); } }
@keyframes print { 0% { transform: translateY(-100%); } 100% { transform: none; } }
.a-shake { animation: shakeA .7s cubic-bezier(.36, .07, .19, .97); }
.a-chip { animation: chip .4s cubic-bezier(.3, 1.5, .5, 1) both; }
.a-slip { animation: slip 1.2s cubic-bezier(.55, 0, .35, 1) both; }
.a-wax { animation: waxin .45s 1.05s cubic-bezier(.3, 1.6, .5, 1) both; }
.a-lidfly { animation: lidfly .8s cubic-bezier(.25, .7, .3, 1) both; }
.a-burst { animation: burst 1s ease-out both; }
.a-rise { animation: rise 1.1s .25s var(--ease) both; }
.a-float { animation: float 3.2s 1.4s ease-in-out infinite; }
.a-cardin { animation: fadeUp .6s .85s var(--ease) both; }
.a-canout { animation: canout .6s .1s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
}

/* ---------- 開場布簾 ---------- */
input[type="range"] { accent-color: var(--ink); }
.curtain { position: fixed; inset: 0; z-index: 200; overflow: hidden; cursor: pointer; outline: none; background: transparent; }
.cur-panel {
  position: absolute; top: 0; bottom: 0; width: 51%;
  background:
    linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,0) 18%, rgba(0,0,0,0) 80%, rgba(0,0,0,.35)),
    repeating-linear-gradient(90deg, #4A1519 0px, #7A272B 12px, #9E3D3F 20px, #7A272B 28px, #4A1519 40px);
  transition: transform 1.6s cubic-bezier(.65, 0, .25, 1);
  box-shadow: 0 0 30px rgba(0,0,0,.45);
}
.cur-panel::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 18px;
  background: repeating-linear-gradient(90deg, #C9A24A 0 3px, #8C6A22 3px 5px);
  -webkit-mask: linear-gradient(#000 40%, transparent); mask: linear-gradient(#000 40%, transparent);
}
.cur-panel.l { left: 0; transform-origin: 0 0; }
.cur-panel.r { right: 0; transform-origin: 100% 0; }
.cur-panel.l::before, .cur-panel.r::before { content: ''; position: absolute; top: 0; bottom: 0; width: 40px; }
.cur-panel.l::before { right: 0; background: linear-gradient(90deg, transparent, rgba(0,0,0,.35)); }
.cur-panel.r::before { left: 0; background: linear-gradient(270deg, transparent, rgba(0,0,0,.35)); }
.curtain.open .cur-panel.l { transform: translateX(-96%) scaleX(.45) skewY(2deg); }
.curtain.open .cur-panel.r { transform: translateX(96%) scaleX(.45) skewY(-2deg); }
.cur-valance {
  position: absolute; left: 0; right: 0; top: 0; height: 74px; z-index: 2;
  background:
    radial-gradient(circle at 50% 0, transparent 0, transparent 0) ,
    linear-gradient(180deg, #5A1A1E, #8A2F33);
  -webkit-mask: radial-gradient(28px 22px at 28px 74px, transparent 98%, #000) -28px 0 / 56px 100%;
          mask: radial-gradient(28px 22px at 28px 74px, transparent 98%, #000) -28px 0 / 56px 100%;
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
  transition: transform 1s .7s cubic-bezier(.65, 0, .25, 1);
}
.cur-valance::after { content: ''; position: absolute; left: 0; right: 0; top: 46px; height: 4px; background: #C9A24A; opacity: .8; }
.curtain.open .cur-valance { transform: translateY(-110%); }
.cur-plaque {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.96); z-index: 3;
  width: min(270px, 74vw); padding: 26px 20px 20px; text-align: center;
  background: #EFE2C4; color: var(--ink); border-radius: 50% / 30%;
  box-shadow: 0 0 0 4px #EFE2C4, 0 0 0 6px #A8763E, 0 12px 30px rgba(0,0,0,.45);
  opacity: 0; transition: opacity .6s .2s, transform .6s .2s var(--ease);
}
.curtain.in .cur-plaque { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.curtain.open .cur-plaque { opacity: 0; transform: translate(-50%, -60%) scale(.96); transition: opacity .35s, transform .5s; }
.cur-fr { font-family: var(--fr); font-style: italic; font-size: 15px; color: var(--muted); }
.cur-title { font-family: var(--fr); font-style: italic; font-weight: 600; font-size: 46px; line-height: 1.1; letter-spacing: .02em; }
.cur-rule { width: 60px; height: 1px; background: var(--brass); margin: 10px auto 8px; }
.cur-hint { font-size: 12px; color: var(--muted); letter-spacing: .3em; animation: blink 2.4s infinite; }
@media (prefers-reduced-motion: reduce) { .cur-panel, .cur-valance, .cur-plaque { transition-duration: .2s !important; transition-delay: 0s !important; } }

/* ---------- 拼貼手帳 ---------- */
.tabbar a { min-width: 56px; }
.journal { min-height: 100vh; }
.jtitle { background: none; border: 0; font-size: 15px; font-weight: 700; letter-spacing: .06em; max-width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 8px; }
.jwrap { flex: 1; display: flex; justify-content: center; align-items: flex-start; padding: 4px 12px 0; }
.jpage { position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 2px 0 #D6C3A4, 0 10px 24px rgba(60,35,15,.22); border-radius: 2px; }
.jempty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; pointer-events: none; }
.jitem { position: absolute; cursor: grab; }
.jitem img { pointer-events: none; -webkit-user-drag: none; }
.jitem.on { outline: 1.5px dashed var(--wine); outline-offset: 4px; }
.jh { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: var(--wine); color: var(--cream); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.jh svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.jh-rot { right: -20px; bottom: -20px; cursor: nwse-resize; }
.jsel { display: flex; justify-content: center; gap: 8px; padding: 10px 12px 0; }
.jsel[hidden] { display: none; }
.jtools {
  position: sticky; bottom: 0; margin-top: auto; display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 8px 6px calc(10px + var(--safe-b)); background: rgba(242,233,218,.97); border-top: 1px solid var(--line);
}
.jtools button { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink); min-height: 50px; justify-content: center; }
.jtools svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.kitgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kitgrid.kg-tape { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kit { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }
.kit.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.kit img { height: 54px; width: 100%; object-fit: contain; }
.paperchip { width: 54px; height: 72px; border: 1px solid var(--line); border-radius: 2px; }
.tile.picked img { outline: 3px solid var(--wine); outline-offset: -3px; opacity: .85; }
.jlist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; padding: 4px 16px 24px; }
.jcard { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; animation: fadeUp .4s var(--ease) both; }
.jthumb { aspect-ratio: 3 / 4; border-radius: 2px; box-shadow: 0 2px 0 #D6C3A4, 0 6px 14px rgba(60,35,15,.18); display: flex; align-items: center; justify-content: center; background-position: center; }
.jmeta { display: flex; flex-direction: column; gap: 0; padding: 0 2px; }
.jmeta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
