:root {
  --pink: #ff7fa6;
  --pink2: #ff9dbd;
  --deep: #7a3b62;
  --soft: #b0648a;
  --line: #ffd3e2;
  --cream: #fff7fa;
  --gold: #ffc23d;
  --font: "Arial Rounded MT Bold", "Nunito", "Varela Round", system-ui, sans-serif;
  --outline: 0 2px 0 var(--deep), 2px 0 0 var(--deep), -2px 0 0 var(--deep), 0 -2px 0 var(--deep), 1.5px 1.5px 0 var(--deep), -1.5px 1.5px 0 var(--deep), 1.5px -1.5px 0 var(--deep), -1.5px -1.5px 0 var(--deep), 0 4px 0 rgba(122, 59, 98, 0.45);
  --outline-s: 0 1.5px 0 var(--deep), 1.5px 0 0 var(--deep), -1.5px 0 0 var(--deep), 0 -1.5px 0 var(--deep), 1px 1px 0 var(--deep), -1px 1px 0 var(--deep), 1px -1px 0 var(--deep), -1px -1px 0 var(--deep);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f7dce8; }
body { font-family: var(--font); color: var(--deep); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; overflow: hidden; }
#bg { position: absolute; inset: 0; background: #f7dce8 center / cover no-repeat; transition: background-image 0.2s; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* the chosen photo frame, laid over the viewfinder exactly as it is drawn into the photo */
#frameOv { position: absolute; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; z-index: 2; }
body.shot.pframe #frameOv { display: block; }

/* ---------- title ---------- */
#title { position: absolute; inset: 0; z-index: 20; background: #f7dce8 url(assets/cover-bg.webp) center / cover no-repeat; cursor: pointer; overflow: hidden; }
#title .title-glow { position: absolute; left: 0; right: 0; bottom: 0; height: 48%; background: radial-gradient(ellipse at 50% 62%, rgba(255, 246, 250, 0.6), rgba(255, 246, 250, 0) 70%); pointer-events: none; }
/* code-drawn logo: rounded candy letters, white + plum outline, sky-blue hard shadow, bow on top, ribbon banner below */
.logo { position: absolute; left: 50%; width: 88%; display: flex; flex-direction: column; align-items: center; pointer-events: none; text-align: center; }
/* the logo sits in the lower third, just above the start button, so the girl's face and hair stay clear */
#logo { bottom: calc(9% + 52px + 26px + env(safe-area-inset-bottom)); transform: translate(-50%, -40px) scale(0.7); opacity: 0; }
#title.ready #logo { animation: logoIn 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) forwards, logoFloat 3.6s ease-in-out 0.8s infinite; }
.lg-main { position: relative; white-space: nowrap; font-weight: 900; line-height: 1.12; letter-spacing: 0.01em; transform: rotate(-5deg); padding: 0.18em 0.2em 0.24em; }
.lg-main span { display: inline-block; text-shadow:
  3px 0 0 #fff, -3px 0 0 #fff, 0 3px 0 #fff, 0 -3px 0 #fff, 2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff,
  6px 0 0 #7a3b62, -6px 0 0 #7a3b62, 0 6px 0 #7a3b62, 0 -6px 0 #7a3b62, 4px 4px 0 #7a3b62, -4px 4px 0 #7a3b62, 4px -4px 0 #7a3b62, -4px -4px 0 #7a3b62,
  2px 10px 0 #4aa3ef, 0 13px 14px rgba(74, 60, 140, 0.35);
  transform: rotate(var(--tilt, 0deg)); animation: letterBob 2.4s ease-in-out infinite; }
.lg-main span.sp { width: 0.32em; }
.lg-main span:nth-child(odd) { --tilt: -4deg; }
.lg-main span:nth-child(even) { --tilt: 4deg; }
@keyframes letterPop { from { transform: translateY(-40px) scale(0.3); opacity: 0; } to { transform: rotate(var(--tilt, 0deg)); opacity: 1; } }
@keyframes letterBob { 0%, 100% { transform: rotate(var(--tilt, 0deg)) translateY(0); } 50% { transform: rotate(var(--tilt, 0deg)) translateY(-4px); } }
.lg-sub { position: relative; margin-top: 2px; padding: 5px 30px 6px; font-weight: 900; letter-spacing: 0.08em; color: #fff; white-space: nowrap; transform: rotate(-3deg);
  text-shadow: 2px 0 0 #c94a82, -2px 0 0 #c94a82, 0 2px 0 #c94a82, 0 -2px 0 #c94a82, 0 3px 0 #c94a82;
  background: linear-gradient(180deg, #ff9cc4, #ff6fa3); border: 3px solid #fff; border-radius: 10px; box-shadow: 0 4px 0 #4aa3ef, 0 8px 14px rgba(74, 60, 140, 0.3); }
.lg-sub::before, .lg-sub::after { content: ""; position: absolute; top: 9px; width: 22px; height: 70%; background: #b98cff; border: 3px solid #fff; z-index: -1; }
.lg-sub::before { left: -16px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 40% 50%); }
.lg-sub::after { right: -16px; clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%); }
.lg-bow { position: relative; width: 74px; height: 34px; margin-bottom: -10px; z-index: 2; transform: rotate(-5deg); filter: drop-shadow(0 3px 0 #7a3b62); }
.lg-bow i { position: absolute; top: 2px; width: 34px; height: 28px; background: linear-gradient(180deg, #ffd23f, #ffb62e); border: 3px solid #fff; }
.lg-bow i.l { left: 0; border-radius: 60% 20% 20% 60%; transform: rotate(-12deg); }
.lg-bow i.r { right: 0; border-radius: 20% 60% 60% 20%; transform: rotate(12deg); }
.lg-bow i.k { left: 27px; top: 7px; width: 20px; height: 20px; border-radius: 50%; background: #ff6fa3; z-index: 1; }
.lg-star { position: absolute; color: #fff; font-style: normal; text-shadow: 0 0 6px #ffe680, 0 0 12px #ffb62e; animation: twinkle 1.8s ease-in-out infinite; }
.lg-star.s1 { left: 2%; top: 22%; font-size: 26px; }
.lg-star.s2 { right: 3%; top: 8%; font-size: 20px; animation-delay: 0.6s; color: #fff6b0; }
.lg-star.s3 { right: 6%; bottom: 4%; font-size: 24px; animation-delay: 1.1s; }
.lg-star.s4 { left: 9%; bottom: 0; font-size: 16px; animation-delay: 0.3s; color: #d9f0ff; }
@keyframes twinkle { 0%, 100% { transform: scale(0.6) rotate(0deg); opacity: 0.5; } 50% { transform: scale(1.15) rotate(20deg); opacity: 1; } }
#introLogo { bottom: calc(12% + env(safe-area-inset-bottom)); z-index: 2; opacity: 0; transform: translate(-50%, -30px) scale(0.6); }
#introLogo.on { animation: logoIn 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) forwards; }
#startPrompt { position: absolute; left: 50%; bottom: calc(9% + env(safe-area-inset-bottom)); transform: translateX(-50%); white-space: nowrap; min-height: 52px; display: flex; align-items: center; padding: 10px 32px; border-radius: 999px; font-size: 21px; font-weight: 900; letter-spacing: 0.04em; color: #fff;
  text-shadow: 2px 0 0 #c94a82, -2px 0 0 #c94a82, 0 2px 0 #c94a82, 0 -2px 0 #c94a82, 0 3px 0 #c94a82;
  background: linear-gradient(180deg, #ffa8cb 0%, #ff6fa3 55%, #ff5c97 100%); border: 4px solid #fff; box-shadow: 0 5px 0 #4aa3ef, 0 10px 20px rgba(74, 60, 140, 0.35), inset 0 3px 0 rgba(255, 255, 255, 0.45); opacity: 0; }
#title.ready #startPrompt { animation: promptIn 0.4s 0.5s ease-out forwards, pulse 1.6s 1s ease-in-out infinite; }
@keyframes logoIn { to { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes logoFloat { 0%, 100% { transform: translate(-50%, 0) scale(1); } 50% { transform: translate(-50%, -6px) scale(1.01); } }
@keyframes promptIn { to { opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; } 50% { transform: translateX(-50%) scale(1.06); opacity: 0.85; } }

/* ---------- HUD ---------- */
#hud { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; right: 64px; height: 46px; display: flex; align-items: center; gap: 8px; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
.btn { cursor: pointer; position: relative; }
.pill { height: 44px; border-radius: 22px; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 5px; font-size: 18px; font-weight: 900; color: var(--deep); background: linear-gradient(180deg, #ffffff, #ffe5ef); border: 3px solid #fff; box-shadow: 0 3px 0 #e7a0bb, 0 6px 14px rgba(122, 59, 98, 0.22); white-space: nowrap; }
.pill img { width: 34px; height: 34px; object-fit: contain; }
.pill .plus { width: 20px; height: 20px; border-radius: 50%; background: var(--pink); color: #fff; font-size: 16px; line-height: 19px; text-align: center; margin-left: 2px; }
.navpill { margin-left: auto; color: #fff; text-shadow: var(--outline-s); font-size: 16px; background: linear-gradient(180deg, var(--pink2), var(--pink)); box-shadow: 0 3px 0 #d0577f, 0 6px 14px rgba(122, 59, 98, 0.25); padding: 0 14px 0 4px; }
.navpill img { width: 36px; height: 36px; }
/* 上一步／下一步／暫存: a small row under the gold pill, only in the workshop */
/* small 32px candy buttons hugging the top-left corner; each keeps a 44px (transparent) tap area */
#wsTools { position: absolute; left: -6px; top: 48px; display: flex; gap: 0; pointer-events: auto; }
#wsTools.hidden { display: none; }
.tool { width: 44px; height: 44px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; padding: 0; background: transparent; border: 0; transition: transform 0.12s, opacity 0.2s, filter 0.2s; -webkit-tap-highlight-color: transparent; }
.tool::before { content: ''; position: absolute; left: 6px; top: 6px; width: 32px; height: 32px; box-sizing: border-box; border-radius: 50%; background: linear-gradient(180deg, #ffffff, #ffe5ef); border: 2px solid #fff; box-shadow: 0 2px 0 #e7a0bb, 0 3px 8px rgba(122, 59, 98, 0.22); }
.tool:hover::before { background: linear-gradient(180deg, #ffffff, #ffd3e2); }
.tool #draftLabel { display: none; }   /* the name shows as the tooltip (and is read out); 「已暫存」 still pops up */
.tool:active { transform: scale(0.88); }
.tool.off { opacity: 0.45; filter: grayscale(0.7); pointer-events: none; }
.tool.off::before { box-shadow: 0 1px 0 #d9c3cc; }
.tool .ti { position: relative; width: 19px; height: 19px; flex: none; background-position: center; background-size: contain; background-repeat: no-repeat; }
.ti-undo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6 3.5 11 9 16' fill='none' stroke='%23ff5f93' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M4.5 11H14a6 6 0 0 1 0 12h-3' fill='none' stroke='%23ff5f93' stroke-width='3.2' stroke-linecap='round' transform='translate(0 -3)'/%3E%3C/svg%3E"); }
.ti-redo { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg transform='matrix(-1 0 0 1 24 0)'%3E%3Cpath d='M9 6 3.5 11 9 16' fill='none' stroke='%23ff5f93' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M4.5 11H14a6 6 0 0 1 0 12h-3' fill='none' stroke='%23ff5f93' stroke-width='3.2' stroke-linecap='round' transform='translate(0 -3)'/%3E%3C/g%3E%3C/svg%3E"); }
.ti-save { width: 19px !important; height: 19px !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3h11l4 4v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5a2 2 0 0 1 1-2z' fill='%23ff7fa6' stroke='%23fff' stroke-width='1.5'/%3E%3Crect x='7' y='4' width='8' height='5' rx='1' fill='%23fff'/%3E%3Cpath d='M12 18.5s-3.6-2.2-3.6-4.4a1.9 1.9 0 0 1 3.6-.8 1.9 1.9 0 0 1 3.6.8c0 2.2-3.6 4.4-3.6 4.4z' fill='%23fff'/%3E%3C/svg%3E"); }
body.ws #toast { top: calc(108px + env(safe-area-inset-top)); }
/* workshop 放大檢視: ＋ / percent / － / 重設 down the right edge, under the pause button */
#wsZoom { position: absolute; right: -60px; top: 52px; display: flex; flex-direction: column; align-items: center; gap: 0; pointer-events: auto; }
#wsZoom.hidden { display: none; }
#zoomPct { position: relative; margin: 0; padding: 1px 6px; min-width: 34px; text-align: center; font: 900 12px/1.25 var(--font); color: var(--deep); background: #fff; border: 1.5px solid #ffc2d6; border-radius: 10px; pointer-events: none; z-index: 1; box-shadow: 0 1px 0 #f3b7cb; }
#zoomPct.on { color: #fff; background: var(--pink); border-color: #fff; }
.ti-plus, .ti-minus, .ti-fit { width: 18px !important; height: 18px !important; }
.ti-plus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v16M4 12h16' fill='none' stroke='%23ff5f93' stroke-width='3.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ti-minus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h16' fill='none' stroke='%23ff5f93' stroke-width='3.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.ti-fit { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 8V3h5M16 3h5v5M21 16v5h-5M8 21H3v-5' fill='none' stroke='%23ff5f93' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 16.5s-3.8-2.3-3.8-4.7a2 2 0 0 1 3.8-.9 2 2 0 0 1 3.8.9c0 2.4-3.8 4.7-3.8 4.7z' fill='%23ff7fa6'/%3E%3C/svg%3E"); }
.tool.saved { animation: toolSaved 0.45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes toolSaved { 0% { transform: scale(0.85); } 55% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(255, 127, 166, 0.35); } 100% { transform: scale(1); } }
.draftthumb { display: flex; justify-content: center; margin: 2px 0 4px; }
.draftthumb img { width: 112px; height: 112px; border-radius: 22px; background: radial-gradient(circle, #fff 30%, #ffe4ee 100%); box-shadow: 0 3px 0 #ffc2d6; animation: draftPop 0.35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes draftPop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- mascot ---------- */
#mascotWrap { position: absolute; left: 4px; bottom: 200px; width: 96px; height: 108px; z-index: 6; pointer-events: none; }
#mascot { width: 100%; height: 100%; display: block; }
#bubble { position: absolute; left: 88px; bottom: 46px; width: max-content; max-width: min(250px, calc(100vw - 150px)); padding: 9px 13px; border-radius: 16px; background: #fff; border: 2px solid var(--line); box-shadow: 0 4px 12px rgba(122, 59, 98, 0.2); font-size: 14px; font-weight: 800; line-height: 1.35; color: var(--deep); opacity: 0; transform: scale(0.6); transform-origin: 0 100%; transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1); }
#bubble::before { content: ""; position: absolute; left: -9px; bottom: 12px; border: 7px solid transparent; border-right: 9px solid #fff; border-left: 0; }
#bubble.show { opacity: 1; transform: scale(1); }
#mascot.hidden + #bubble { left: 8px; bottom: 6px; }

/* ---------- panel ---------- */
#panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; flex-direction: column; background: rgba(255, 248, 251, 0.95); border-radius: 26px 26px 0 0; border-top: 3px solid #fff; box-shadow: 0 -6px 22px rgba(122, 59, 98, 0.2); padding-bottom: env(safe-area-inset-bottom); }
#panel::before { content: ""; position: absolute; left: 22px; right: 22px; top: 5px; height: 6px; background: radial-gradient(circle at 5px 0, #ffc9da 3px, transparent 3.5px) 0 0 / 12px 6px repeat-x; opacity: 0.8; }
#panel.rise { animation: rise 0.35s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
#content { padding: 12px 10px 2px; max-height: 36vh; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
#content::-webkit-scrollbar { display: none; }
#content.slidein { animation: slideIn 0.24s ease-out; }
/* "more below / above" hints: never take space in the panel; extra room at the end only while content overflows */
#content { scroll-padding: 28px 0 48px; }
#content.more { padding-bottom: 42px; }
.more-hint { position: absolute; left: 0; right: 0; z-index: 3; display: flex; justify-content: center; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity 0.22s, transform 0.22s; }
.more-hint.on { opacity: 1; transform: none; }
#moreDown { height: 50px; align-items: flex-end; background: linear-gradient(180deg, rgba(255, 248, 251, 0), rgba(255, 248, 251, 0.94) 62%); }
#moreUp { height: 26px; align-items: flex-start; padding-top: 2px; background: linear-gradient(0deg, rgba(255, 248, 251, 0), rgba(255, 248, 251, 0.92) 70%); }
#moreDown .morebtn { min-height: 44px; min-width: 120px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#moreDown.on .morebtn { pointer-events: auto; }
#moreDown .pillface { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 14px; border-radius: 999px; background: linear-gradient(180deg, #ffd9e6, #ffb8cf); border: 2px solid #fff; box-shadow: 0 2px 0 rgba(122, 59, 98, 0.25); color: var(--deep); font-size: 13px; font-weight: 900; white-space: nowrap; }
#moreDown .morebtn:active .pillface { transform: scale(0.93); }
.chev { display: inline-block; width: 9px; height: 9px; border-right: 3px solid var(--pink); border-bottom: 3px solid var(--pink); transform: translateY(-2px) rotate(45deg); animation: chevBob 1.1s ease-in-out infinite; }
.chev.up { width: 8px; height: 8px; transform: translateY(3px) rotate(-135deg); animation: none; opacity: 0.8; }
@keyframes chevBob { 0%, 100% { margin-top: -3px; } 50% { margin-top: 5px; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.row { display: flex; flex-direction: row; align-items: center; gap: 4px; margin-bottom: 2px; }
.rowlabel { flex: none; width: 44px; font-size: 12px; font-weight: 900; line-height: 1.1; color: var(--soft); text-align: center; overflow-wrap: anywhere; white-space: pre-line; }
.row > .scroller { flex: 1; min-width: 0; }
.scroller { display: flex; align-items: center; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 4px 4px 7px; scrollbar-width: none; touch-action: pan-x pan-y; }
.scroller::-webkit-scrollbar { display: none; }
.sep { flex: none; width: 2px; height: 30px; border-radius: 1px; background: #f3c6d7; margin: 0 2px; }

.chip { flex: none; height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 15px; font-weight: 800; color: var(--deep); white-space: nowrap; background: linear-gradient(180deg, #ffffff, #fff0f5); border: 2px solid var(--line); box-shadow: 0 3px 0 #f0bccf; transition: transform 0.12s; }
.chip.sel { background: linear-gradient(180deg, var(--pink2), var(--pink)); color: #fff; border-color: #fff; text-shadow: var(--outline-s); box-shadow: 0 3px 0 #d0577f; }
.chip .prev { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; margin-left: -8px; border: 2px solid #fff; background: #fff; }
.chip.locked { opacity: 0.75; }
.chip.locked .prev { filter: grayscale(0.4); }
.toggle.is-on { background: linear-gradient(180deg, #a6e8c8, #6fd1a5); color: #fff; border-color: #fff; text-shadow: 0 1.5px 0 #2f8a67, 1.5px 0 0 #2f8a67, -1.5px 0 0 #2f8a67, 0 -1.5px 0 #2f8a67; box-shadow: 0 3px 0 #3fa57d; }
.seg { padding: 0 16px; }
.lock { position: absolute; top: -5px; right: -5px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #fff; background: var(--deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='3' y='7' width='10' height='7' rx='2' fill='%23fff'/%3E%3Cpath d='M5 7V5a3 3 0 0 1 6 0v2' stroke='%23fff' stroke-width='2' fill='none'/%3E%3C/svg%3E") center / 12px no-repeat; }
.gem .cnt { font-size: 11px; font-weight: 900; padding: 1px 6px; border-radius: 9px; background: #ffe6f0; color: var(--deep); text-shadow: none; }
.gem.empty { opacity: 0.6; }
.gacha { background: linear-gradient(180deg, #e8dcff, #cdb8ff); border-color: #fff; box-shadow: 0 3px 0 #a58ee0; }
.upload { height: 64px; border-radius: 18px; flex-direction: column; gap: 0; padding: 4px 10px; font-size: 12px; background: linear-gradient(180deg, #fff, #ffe6f0); border-style: dashed; border-color: var(--pink2); }
.upload .prev { margin: 0; width: 32px; height: 32px; border: 0; background: none; object-fit: contain; }

.sw { flex: none; width: 44px; height: 44px; border-radius: 50%; padding: 4px; background: #fff; box-shadow: 0 3px 0 #f0bccf, 0 0 0 2px var(--line) inset; transition: transform 0.12s; }
.sw i { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12), inset 0 3px 4px rgba(255, 255, 255, 0.5); }
.sw.sel { background: var(--pink); box-shadow: 0 3px 0 #d0577f; transform: scale(1.08); }
.sw.wsw i { box-sizing: border-box; border: 1.5px solid #f3c6d6; }
.sw.small { width: 38px; height: 38px; margin: 3px 0; }
.sw.metal i { background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0.15) 70%, rgba(255, 255, 255, 0.4)) !important; background-blend-mode: normal; }
.sw.metal i { position: relative; }
.sw.pearl i { background-image: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 45%) !important; }

.sliders { flex-direction: row; gap: 12px; padding: 0 4px; }
.slider { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; min-height: 48px; }
.sl-label { font-size: 13px; font-weight: 900; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; touch-action: none; }
.range::-webkit-slider-runnable-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #ffd0e0, var(--pink2)); box-shadow: inset 0 2px 2px rgba(122, 59, 98, 0.15); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; background: #fff; border: 4px solid var(--pink); box-shadow: 0 2px 4px rgba(122, 59, 98, 0.3); }
.range::-moz-range-track { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #ffd0e0, var(--pink2)); }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 4px solid var(--pink); }

.sliders.three { gap: 10px; }
.sliders.sizerow { align-items: flex-end; margin-top: 8px; }
.sliders.sizerow .slider { flex: 1; }
.sliders.sizerow .chip.reset { flex: none; }
.poshint { font-size: 12px; font-weight: 800; color: var(--soft); text-align: center; padding: 0 8px 4px; }
.chip.reset { background: linear-gradient(180deg, #fff8e6, #ffe9b8); border-color: #fff; box-shadow: 0 3px 0 #e2bf6e; }
.shapegrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 6px 6px 8px; }
.shapebtn { position: relative; min-height: 72px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 4px 2px; background: linear-gradient(180deg, #ffffff, #fff0f5); border: 2px solid var(--line); box-shadow: 0 3px 0 #f0bccf; font-size: 12px; font-weight: 900; color: var(--deep); transition: transform 0.12s; }
.shapebtn img { width: 44px; height: 44px; object-fit: contain; }
.shapebtn span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; font-size: 13px; letter-spacing: -0.2px; }
.shapebtn.sel { background: linear-gradient(180deg, var(--pink2), var(--pink)); color: #fff; border-color: #fff; text-shadow: var(--outline-s); box-shadow: 0 3px 0 #d0577f; transform: translateY(-2px); }
.stepper { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 0 2px; height: 48px; border-radius: 24px; background: #fff; border: 2px solid var(--line); }
.step { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; color: #fff; text-shadow: var(--outline-s); background: linear-gradient(180deg, var(--pink2), var(--pink)); box-shadow: 0 2px 0 #d0577f; }
.stepval { font-size: 15px; font-weight: 900; padding: 0 6px; white-space: nowrap; }

.photo { flex: none; width: 64px; height: 64px; border-radius: 16px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 3px 0 #f0bccf, 0 0 0 2px var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.sel { box-shadow: 0 3px 0 #d0577f, 0 0 0 3px var(--pink); transform: scale(1.05); }
/* the player's own photo + its delete button */
.pgroup { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 2px; }
.trash { flex: none; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #fff, #ffe6ef); border: 2px solid #ffc2d6; box-shadow: 0 3px 0 #f0bccf; cursor: pointer; }
.trash:active { transform: translateY(2px) scale(0.94); box-shadow: 0 1px 0 #f0bccf; }
.trashico { width: 22px; height: 22px; background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a3b62' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16'/%3E%3Cpath d='M9 7V4.5h6V7'/%3E%3Cpath d='M6 7l1 13h10l1-13'/%3E%3Cpath d='M10 11v5M14 11v5'/%3E%3C/svg%3E"); }
.chip.upload.full { opacity: 0.6; }
.privnote { padding-top: 2px; }
.privnote::before { content: "♡ "; color: var(--pink); }
.delthumb { display: flex; justify-content: center; margin: 6px 0 4px; }
.delthumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 20px; border: 4px solid #fff; box-shadow: 0 4px 0 #f0bccf, 0 0 0 2px var(--line); }

.card { flex: none; width: 96px; padding: 6px 4px 8px; border-radius: 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 #f0bccf; font-size: 13px; font-weight: 900; text-align: center; }
.card img { width: 78px; height: 78px; object-fit: contain; }
.card span { max-width: 100%; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.sel { border-color: var(--pink); background: linear-gradient(180deg, #fff, #ffe3ee); box-shadow: 0 3px 0 #d0577f; }
.card.locked img { filter: grayscale(0.5); opacity: 0.8; }

.thumb { flex: none; width: 76px; height: 76px; border-radius: 18px; background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 #f0bccf; }
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb.on { border-color: var(--pink); background: #ffe8f1; box-shadow: 0 3px 0 #d0577f; }
.check { position: absolute; top: -5px; right: -5px; width: 24px; height: 24px; border-radius: 50%; background: #6fd1a5; border: 2px solid #fff; }
.check::after { content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.thumb.sel { border-color: #fff; box-shadow: 0 3px 0 #d0577f, 0 0 0 4px var(--pink); transform: translateY(-2px) scale(1.04); }
/* badge placement on the bag */
.chip.mode { padding: 0 14px 0 8px; }
.row[data-key="mode"] .chip.mode { flex: 1 1 0; min-width: 0; padding: 0 6px 0 2px; gap: 3px; font-size: 13px; white-space: nowrap; }
.row[data-key="mode"] .chip.mode .prev { width: 30px; height: 30px; flex: none; }
.row[data-key="act"] .chip { flex: 1 1 0; min-width: 0; white-space: nowrap; padding: 0 6px; font-size: 14px; }
.layerbtn { flex: none; width: 50px; height: 48px; border-radius: 16px; border: 2px solid #ffc1d4; background: linear-gradient(#fff, #ffe6ef); box-shadow: 0 3px 0 #f3b3c8; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0; cursor: pointer; transition: transform 0.12s, filter 0.12s; }
.layerbtn:active { transform: scale(0.92); }
.layerbtn:hover, .layerbtn.focus { filter: brightness(1.05); transform: translateY(-1px); }
.layerbtn .licon { width: 26px; height: 26px; object-fit: contain; pointer-events: none; }
.layerbtn .llabel { font-family: var(--font); font-size: 12px; font-weight: 900; line-height: 1.1; color: var(--deep); white-space: nowrap; pointer-events: none; }
.layerbtn.dim { filter: grayscale(1) opacity(0.45); box-shadow: none; }
.chip.mode .prev { width: 34px; height: 34px; margin-left: 0; border: 0; border-radius: 0; background: none; object-fit: contain; filter: drop-shadow(0 1px 0 rgba(122, 59, 98, 0.25)); }
.step.arrow { flex: none; font-size: 17px; line-height: 1; }
.chip.done { background: linear-gradient(180deg, #a6e8c8, #6fd1a5); color: #fff; border-color: #fff; text-shadow: 0 1.5px 0 #2f8a67, 1.5px 0 0 #2f8a67, -1.5px 0 0 #2f8a67, 0 -1.5px 0 #2f8a67; box-shadow: 0 3px 0 #3fa57d; }
.chip.off { background: linear-gradient(180deg, #fff, #ffe1ea); border-color: #ffb3c9; }
.chip.movemode { font-size: 20px; padding: 0 10px; }
/* 複製: pink candy chip with a two-cards icon; greyed out when the bag is full */
.chip.copy { background: radial-gradient(circle at 50% 30%, #ffc4d8 0%, #ff8fb3 65%, #f46e9b 100%); color: #fff; border-color: #fff; text-shadow: var(--outline-s); box-shadow: 0 3px 0 #d0577f; gap: 3px; }
.chip.copy .cico { position: relative; flex: none; width: 15px; height: 15px; pointer-events: none; }
.chip.copy .cico::before, .chip.copy .cico::after { content: ""; position: absolute; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 3px; box-sizing: border-box; }
.chip.copy .cico::before { left: 0; top: 0; opacity: 0.75; }
.chip.copy .cico::after { right: 0; bottom: 0; background: #ff8fb3; }
.chip.copy .ckey { font: 800 10px var(--font); color: var(--soft); background: #fff; border-radius: 4px; padding: 0 3px; line-height: 14px; text-shadow: none; pointer-events: none; }
.chip.copy.dim { filter: grayscale(1) opacity(0.5); box-shadow: none; }
.poshint.full { color: #e2547f; font-size: 13px; }
.thumb .copies { position: absolute; left: 3px; bottom: 3px; min-width: 22px; padding: 0 4px; border-radius: 10px; background: #ff7fa6; border: 2px solid #fff; color: #fff; font: 900 12px/18px var(--font); text-align: center; text-shadow: var(--outline-s); pointer-events: none; }
.slotline { text-align: center; font-size: 14px; font-weight: 900; color: var(--soft); margin: 2px 0 0; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 10px; font-size: 15px; font-weight: 800; text-align: center; }

/* ---------- tabs ---------- */
#tabs { display: flex; gap: 3px; padding: 4px 6px 8px; }
.tab { flex: 1 1 0; min-width: 0; height: 62px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 12px; font-weight: 900; color: var(--soft); transition: transform 0.15s, background 0.15s; }
.tab img { width: 34px; height: 34px; object-fit: contain; }
.tab span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.tab.active { background: linear-gradient(180deg, #ffe6f0, #ffcadb); color: var(--deep); transform: translateY(-3px); box-shadow: 0 3px 0 #f0aac4; }
.tab.action { background: linear-gradient(180deg, var(--pink2), var(--pink)); color: #fff; text-shadow: var(--outline-s); box-shadow: 0 3px 0 #d0577f; }

/* ---------- candy buttons (ui-button 9-slice) ---------- */
.candy { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 26px; font-size: 18px; font-weight: 900; color: #fff; text-shadow: var(--outline-s); border: 1px solid #fff; border-radius: 28px; background: linear-gradient(180deg, var(--pink2), var(--pink)); box-shadow: 0 4px 0 #d0577f; white-space: nowrap; }
body.uiart .candy { background: none; box-shadow: none; border-radius: 0; border-color: transparent; border-image-source: var(--ui-button); border-image-slice: var(--ui-btn-cap) fill; border-image-width: 27px; border-image-repeat: stretch; }
.candy.big { min-height: 62px; font-size: 20px; }
body.uiart .candy.big { border-image-width: 31px; }
.candy.alt { filter: hue-rotate(-50deg) saturate(0.75) brightness(1.05); }
.candy.disabled { opacity: 0.5; pointer-events: none; }
.candy .ico { width: 34px; height: 34px; object-fit: contain; margin: -8px 0; }

/* ---------- overlays ---------- */
#overlay { position: absolute; inset: 0; z-index: 30; display: flex; justify-content: center; background: rgba(90, 40, 70, 0.42); animation: fadeIn 0.2s; }
#overlay.center { align-items: center; }
#overlay.bottom { align-items: flex-end; }
#overlay.top { align-items: flex-start; padding-top: calc(64px + env(safe-area-inset-top)); }
#overlay.vivid { background: rgba(90, 40, 70, 0.12); }
#overlay.vivid .dlg { animation: slideUp 0.28s cubic-bezier(0.3, 1.4, 0.5, 1); }
.vivstrip { display: flex; justify-content: center; gap: 6px; margin: 10px 0 4px; }
.vivstrip i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 2px 0 rgba(122, 59, 98, 0.35); }
#overlay.vivid .sl-label { font-size: 15px; color: var(--deep); }
@keyframes fadeIn { from { opacity: 0; } }
.dlg { width: min(92%, 380px); max-height: 88%; overflow-y: auto; scrollbar-width: none; padding: 30px 30px 26px; border-radius: 28px; background: linear-gradient(180deg, #fff9fb, #ffeef4); border: 4px solid #ffc2d6; box-shadow: 0 10px 30px rgba(122, 59, 98, 0.3); animation: pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1); }
body.uiart .dlg { background: none; box-shadow: none; border-radius: 0; border: 1px solid transparent; border-image-source: var(--ui-panel); border-image-slice: var(--ui-panel-cap) fill; border-image-width: 44px; border-image-repeat: stretch; filter: drop-shadow(0 8px 18px rgba(122, 59, 98, 0.3)); }
.dlg::-webkit-scrollbar { display: none; }
#overlay.bottom .dlg { margin-bottom: calc(14px + env(safe-area-inset-bottom)); animation: slideUp 0.32s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(60%); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-title { text-align: center; font-size: 26px; font-weight: 900; color: #fff; text-shadow: var(--outline); margin-bottom: 8px; }
.reward { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 0 6px; }
.reward img { width: 46px; height: 46px; object-fit: contain; animation: coinSpin 1.2s ease-in-out infinite; }
.reward .num { font-size: 36px; font-weight: 900; color: var(--gold); text-shadow: var(--outline); }
.reward.small img { width: 34px; height: 34px; animation: none; }
.reward.small .num { font-size: 26px; }
/* 貼紙組 unlock notice */
.stlock { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 2px 0 4px; }
.stlock .pack { width: 104px; height: 104px; object-fit: contain; animation: draftPop 0.35s cubic-bezier(.3, 1.6, .5, 1); }
.stlockicons { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.stlockicons img { width: 34px; height: 34px; object-fit: contain; border-radius: 10px; background: rgba(255, 255, 255, 0.75); box-shadow: 0 2px 0 #ffd3e2; }
.chip.seg.locked { position: relative; }
@keyframes coinSpin { 0%, 100% { transform: scale(1) rotate(-6deg); } 50% { transform: scale(1.12) rotate(6deg); } }
.dlg-msg { text-align: center; font-size: 14px; font-weight: 800; color: var(--deep); margin: 4px 0; line-height: 1.4; }
.btncol { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.btnrow { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.btnrow > * { flex: 1; }
.invgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.inv { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; background: #fff; border: 2px solid var(--line); text-align: center; min-height: 44px; }
.inv img { width: 48px; height: 48px; object-fit: contain; }
.inv .nm { font-size: 12px; font-weight: 900; line-height: 1.2; }
.inv .st { font-size: 11px; font-weight: 800; color: var(--soft); }
.inv.have { border-color: var(--pink2); background: #fff2f7; }
.help { margin: 6px 2px; font-size: 14px; font-weight: 700; line-height: 1.5; color: var(--deep); }

/* ---------- feedback layers ---------- */
#toast { position: absolute; left: 50%; top: calc(66px + env(safe-area-inset-top)); z-index: 35; max-width: 86%; transform: translate(-50%, -10px); padding: 10px 18px; border-radius: 20px; background: rgba(122, 59, 98, 0.92); color: #fff; font-size: 15px; font-weight: 800; text-align: center; line-height: 1.35; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#shotLayer { position: absolute; inset: 0; z-index: 40; display: none; cursor: pointer; }
body.shot #shotLayer { display: block; }
body.shot #hud, body.shot #panel, body.shot #mascotWrap { display: none !important; }
body.ovl #bubble { display: none !important; }
/* 我的照片 tab: a lighter candy pink than 拍照, with the number of photos in a pip */
.tab { position: relative; }
.tab.album { background: linear-gradient(180deg, #fff3f8, #ffc9de); color: var(--deep); text-shadow: none; box-shadow: 0 3px 0 #f0a3c2; border: 2px solid #ff9dbd; }
.tab .pip { position: absolute; top: 2px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 900; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
/* after a shot: 「拍好囉！」 + 查看照片, above the tap-to-return layer */
#shotBar { position: absolute; left: 50%; top: calc(18px + env(safe-area-inset-top)); z-index: 42; display: none; flex-direction: column; align-items: center; gap: 8px; transform: translate(-50%, -12px); opacity: 0; transition: opacity 0.25s, transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1); pointer-events: none; }
#shotBar.show { display: flex; }
#shotBar.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
/* photo framing (拍照取景) */
body.frame #shotLayer { display: none; }
#frameBar { position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 41; display: none; flex-direction: column; align-items: center; gap: 10px; transform: translateX(-50%); width: min(96%, 420px); }
#frameHint { position: absolute; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 41; display: none; transform: translateX(-50%); width: max-content; max-width: 90%; box-sizing: border-box; padding: 8px 16px; border-radius: 18px; background: rgba(122, 59, 98, 0.55); color: #fff; font-size: 14px; font-weight: 800; text-align: center; text-shadow: var(--outline-s); }
body.frame #frameBar { display: flex; animation: fbIn 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
body.frame #frameHint { display: block; }
@keyframes fbIn { from { opacity: 0; transform: translate(-50%, 30px); } to { opacity: 1; transform: translate(-50%, 0); } }
#frameBar .frow { display: flex; align-items: center; justify-content: center; gap: 12px; }
#frameBar .fbtn { width: 58px; min-width: 58px; min-height: 58px; height: 58px; padding: 0; border-radius: 50%; }
/* the round viewfinder buttons are drawn whole in CSS: a 9-slice plate stretched into a circle showed a white
   band through its middle */
#frameBar .fbtn, body.uiart #frameBar .fbtn { border-image: none; border: 3px solid #fff; border-radius: 50%; box-sizing: border-box;
  background: radial-gradient(circle at 50% 30%, #ffd0e0 0%, var(--pink2) 45%, var(--pink) 100%);
  box-shadow: 0 4px 0 #d0577f, inset 0 -4px 6px rgba(208, 87, 127, 0.35), inset 0 3px 4px rgba(255, 255, 255, 0.6), 0 6px 14px rgba(122, 59, 98, 0.25); }
#frameBar .fbtn:active, #frameBar .fbtn.press { transform: translateY(2px) scale(0.95); box-shadow: 0 2px 0 #d0577f, inset 0 -3px 5px rgba(208, 87, 127, 0.35), inset 0 3px 4px rgba(255, 255, 255, 0.6); }
#frameBar .fbtn.shutter { width: 78px; min-width: 78px; height: 78px; min-height: 78px; margin: 0 6px; border-width: 5px; box-shadow: 0 4px 0 #d0577f, 0 0 0 3px rgba(255, 127, 166, 0.55), inset 0 -5px 8px rgba(208, 87, 127, 0.35), inset 0 4px 5px rgba(255, 255, 255, 0.6), 0 8px 16px rgba(122, 59, 98, 0.3); }
#frameBar .fbtn.shutter .ico { width: 46px; height: 46px; margin: 0; display: block; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.9)) drop-shadow(0 2px 2px rgba(122, 59, 98, 0.35)); pointer-events: none; }
#frameBar .fico { font-size: 30px; font-weight: 900; line-height: 1; color: #fff; text-shadow: var(--outline-s); }
#frameBar .fbtn.off { opacity: 0.45; }
#frameBar .frow.frames { gap: 8px; width: 100%; }
.fchip { flex: 1 1 0; min-width: 0; max-width: 100px; height: 52px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px 4px; line-height: 1;
  border-radius: 24px; border: 3px solid #fff; background: linear-gradient(180deg, #fff 0%, #ffe6ef 100%); color: var(--deep); font: 900 14px var(--font); white-space: nowrap;
  box-shadow: 0 3px 0 #e9a8bf, 0 4px 10px rgba(122, 59, 98, 0.18); cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; transition: transform 0.12s, box-shadow 0.12s; }
.fchip canvas { width: 28px; height: 28px; flex: none; pointer-events: none; }
.fchip span { overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.fchip.sel { background: radial-gradient(circle at 50% 30%, #ffc4d8 0%, #ff8fb3 60%, #f46e9b 100%); color: #fff; text-shadow: var(--outline-s); transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 0 #d0577f, 0 0 0 3px rgba(255, 127, 166, 0.5), 0 6px 12px rgba(122, 59, 98, 0.25); }
.fchip:active, .fchip.press { transform: translateY(2px) scale(0.95); box-shadow: 0 1px 0 #d0577f; }
#fbBadges { min-height: 48px; padding: 0 18px; font-size: 16px; white-space: nowrap; }
#fbBadges .ico { width: 30px; height: 30px; }
/* 光照: the round-ish light button beside 只拍徽章 and its small panel above the frame chips */
#frameBar .frow.top { gap: 8px; }
#frameBar .frow.top #fbBadges { padding: 0 12px; }
#frameBar .frow.top #fbZoom { min-width: 52px; padding: 6px 8px; }
/* 光照 and 背景: compact candy buttons (icon over a short label) so the row keeps 只拍徽章 and the zoom % */
#fbLight, #fbBg { position: relative; flex-direction: column; justify-content: center; gap: 0; min-width: 58px; min-height: 52px; height: 52px; padding: 2px 8px; font-size: 12px; line-height: 1.1; white-space: nowrap; }
#fbLight .ico, #fbBg .ico { width: 26px; height: 26px; margin: 0; }
#fbLight.on, #fbBg.on { transform: translateY(-1px) scale(1.04); filter: drop-shadow(0 0 6px rgba(255, 194, 61, 0.8)); }
#fbLight kbd, #fbBg kbd { position: absolute; top: -6px; right: -4px; font: 800 11px var(--font); color: var(--soft); background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 0 4px; line-height: 15px; text-shadow: none; }
#fbLight kbd:empty, #fbBg kbd:empty { display: none; }
#frameBar .frow.top { gap: 6px; }
#frameBar .frow.top #fbBadges { font-size: 15px; padding: 0 10px; }
#frameBar .frow.top #fbZoom { min-width: 46px; padding: 6px 6px; font-size: 15px; }
.bgchip span { white-space: pre-line; }
#pbg { position: absolute; inset: 0; width: 100%; height: 100%; display: none; pointer-events: none; }
body.shot.pbgon #pbg { display: block; }
/* 背景 panel: the same place and look as the 光照 panel */
#bgPanel { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); z-index: 41; margin-left: calc(min(96vw, 420px) / -2); width: min(96vw, 420px); display: none; box-sizing: border-box; flex-direction: column; gap: 4px; padding: 10px 12px 8px; border-radius: 24px; border: 3px solid #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 228, 239, 0.95)); box-shadow: 0 4px 0 #e9a8bf, 0 8px 18px rgba(122, 59, 98, 0.25); }
body.frame.bgp #bgPanel { display: flex; animation: lpIn 0.24s cubic-bezier(0.3, 1.5, 0.5, 1); }
#bgPanel .lrow { display: flex; align-items: stretch; gap: 6px; }
#bgColors { justify-content: space-between; align-items: center; padding: 2px 2px 4px; }
.bgcap { font: 900 13px var(--font); color: var(--soft); padding: 2px 4px 0; }
.bgchip { flex: 1 1 0; min-width: 0; min-height: 76px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; padding: 4px 3px 5px; border-radius: 16px; border: 3px solid #fff;
  background: linear-gradient(180deg, #fff 0%, #ffe6ef 100%); color: var(--deep); font: 900 12px var(--font); line-height: 1.1; text-align: center; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #e9a8bf, 0 4px 10px rgba(122, 59, 98, 0.15); transition: transform 0.12s, box-shadow 0.12s; }
.bgchip .bth { display: block; width: 100%; height: 34px; border-radius: 10px; object-fit: cover; background: #f3e3ff; box-shadow: inset 0 0 0 1.5px rgba(122, 59, 98, 0.15); pointer-events: none; }
.bgchip span { pointer-events: none; overflow-wrap: anywhere; }
.bgchip.sel { background: radial-gradient(circle at 50% 30%, #ffc4d8 0%, #ff8fb3 60%, #f46e9b 100%); color: #fff; text-shadow: var(--outline-s); transform: translateY(-2px) scale(1.04);
  box-shadow: 0 4px 0 #d0577f, 0 0 0 3px rgba(255, 127, 166, 0.5), 0 6px 12px rgba(122, 59, 98, 0.25); }
.bgchip:active, .bgchip.press { transform: translateY(2px) scale(0.95); box-shadow: 0 1px 0 #d0577f; }
/* the panel sits at the top, under the hint, so the bag and its badges stay in view while the light changes */
#lightPanel { position: absolute; left: 50%; top: calc(64px + env(safe-area-inset-top)); z-index: 41; margin-left: calc(min(96vw, 420px) / -2); width: min(96vw, 420px); display: none; box-sizing: border-box; flex-direction: column; gap: 6px; padding: 10px 12px 8px; border-radius: 24px; border: 3px solid #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 228, 239, 0.95)); box-shadow: 0 4px 0 #e9a8bf, 0 8px 18px rgba(122, 59, 98, 0.25); }
body.frame.lp #lightPanel { display: flex; animation: lpIn 0.24s cubic-bezier(0.3, 1.5, 0.5, 1); }
@keyframes lpIn { from { opacity: 0; transform: translateY(-18px) scale(0.92); } to { opacity: 1; transform: none; } }
#lightPanel .lrow { display: flex; align-items: center; gap: 12px; }
#lpColors { justify-content: space-between; gap: 6px; padding: 2px 2px 4px; }
.lsw { width: 44px; height: 44px; flex: none; border-radius: 50%; box-sizing: border-box; border: 3px solid #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 0 #e9a8bf, 0 0 0 1.5px #f3c6d6; transition: transform 0.12s, box-shadow 0.12s; }
.lsw.sel { transform: scale(1.1); box-shadow: 0 0 0 3px var(--pink), 0 4px 0 #d0577f; }
.lsw:active { transform: scale(0.94); }
.lsl { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; border-radius: 14px; }
.lsl span { font: 900 14px var(--font); color: var(--deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; padding-left: 4px; }
.lsl .range { height: 44px; }
.lrw { flex: none; border-radius: 22px; }
#lpReset { min-height: 44px; padding: 0 14px; font-size: 15px; white-space: nowrap; gap: 4px; }
#lpReset b { font-size: 20px; line-height: 1; }
#lpReset.press, #lpReset:active { transform: translateY(2px) scale(0.95); }
#fbBadges kbd, #fbShutter kbd { font: 800 12px var(--font); color: var(--soft); background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 0 5px; line-height: 18px; text-shadow: none; }
#fbBadges kbd:empty { display: none; }
#fbZoom { min-width: 64px; padding: 6px 12px; border-radius: 16px; background: rgba(255, 255, 255, 0.85); border: 2px solid var(--line); color: var(--deep); font-size: 16px; font-weight: 900; text-align: center; }
#shotMsg { font-size: 24px; font-weight: 900; color: #fff; text-shadow: var(--outline); white-space: nowrap; }
#shotView { min-height: 52px; font-size: 18px; padding: 0 22px; white-space: nowrap; }
#shotBackHint { font-size: 13px; font-weight: 800; color: #fff; text-shadow: var(--outline-s); white-space: nowrap; }
/* album dialogs */
.albumcount { text-align: center; font-size: 14px; font-weight: 900; color: var(--soft); margin: -4px 0 8px; }
.albumgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shotthumb { position: relative; aspect-ratio: 9 / 14; border-radius: 14px; overflow: hidden; background: #fff; border: 3px solid #fff; box-shadow: 0 3px 0 #f0bccf, 0 0 0 2px var(--line); min-height: 44px; transition: transform 0.12s; }
.shotthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shotthumb:hover { transform: scale(1.04); }
.shotthumb.new { box-shadow: 0 3px 0 #d0577f, 0 0 0 3px var(--pink); }
.shotthumb .newtag { position: absolute; left: 4px; top: 4px; padding: 1px 6px; border-radius: 8px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 900; text-shadow: none; }
.albumnote { margin-top: 10px; }
.albumempty { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 4px 0; }
.albumempty .emptyico { width: 96px; height: 96px; object-fit: contain; animation: letterBob 2.4s ease-in-out infinite; }
#overlay.album .btnrow .candy { padding: 0 10px; font-size: 16px; min-height: 50px; }
#overlay.album .btnrow .candy .ico { width: 28px; height: 28px; }
.shotview { display: flex; justify-content: center; }
.shotview .big { max-width: 100%; max-height: 52vh; border-radius: 18px; border: 4px solid #fff; box-shadow: 0 4px 0 #f0bccf, 0 0 0 2px var(--line); display: block; -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto; pointer-events: auto; }
.shotnav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.shotidx { font-size: 16px; font-weight: 900; color: var(--deep); min-width: 64px; text-align: center; }
.dlico { width: 20px; height: 20px; position: relative; flex: none; }
.dlico::before { content: ""; position: absolute; left: 7px; top: 1px; width: 6px; height: 9px; background: #fff; border-radius: 2px; }
.dlico::after { content: ""; position: absolute; left: 3px; top: 9px; border-top: 8px solid #fff; border-left: 7px solid transparent; border-right: 7px solid transparent; }
.delthumb.shot img { width: 96px; height: 150px; }
#flash { position: absolute; inset: 0; z-index: 45; background: #fff; opacity: 0; pointer-events: none; }
#flash.go { animation: flash 0.55s ease-out; }
@keyframes flash { 0% { opacity: 0.95; } 100% { opacity: 0; } }
#fade { position: absolute; inset: 0; z-index: 50; background: #ffe4ef; opacity: 0; pointer-events: none; transition: opacity 0.28s; }
#fade.on { opacity: 1; }

#intro { position: absolute; inset: 0; z-index: 60; display: none; background: #f7dce8 url(assets/intro-bag.webp) center / cover no-repeat; }
#intro.show { display: block; }
#introSub { position: absolute; left: 50%; bottom: calc(5% + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); width: 86%; padding: 10px 16px; border-radius: 18px; background: rgba(122, 59, 98, 0.62); color: #fff; font: 800 17px/1.4 var(--font); text-align: center; text-shadow: 0 2px 0 rgba(90, 30, 70, 0.8); opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none; z-index: 3; }
#introSub.on { opacity: 1; transform: translate(-50%, 0); }
#introVideo { width: 100%; height: 100%; object-fit: cover; display: block; background: transparent; }
#intro.wait::after { content: ""; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; border: 5px solid rgba(255, 255, 255, 0.85); border-top-color: #ff7fa6; animation: introSpin 0.8s linear infinite; z-index: 2; }
@keyframes introSpin { to { transform: rotate(360deg); } }
/* title: small "replay intro" button in the top-left corner, quieter than the start button */
#replayBtn { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); z-index: 3; height: 44px; display: flex; align-items: center; gap: 7px; padding: 0 14px 0 5px; border-radius: 22px; font-size: 15px; font-weight: 900; color: var(--deep); white-space: nowrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 228, 239, 0.95)); border: 3px solid #fff; box-shadow: 0 3px 0 #f0a8c4, 0 6px 14px rgba(122, 59, 98, 0.22); opacity: 0; transition: transform 0.12s; }
#title.ready #replayBtn { animation: promptIn 0.4s 0.7s ease-out forwards; }
#replayBtn:hover { transform: scale(1.05); }
#replayBtn:active, #replayBtn.press { transform: translateY(2px) scale(0.95); }
#replayBtn .rp-ico { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(180deg, var(--pink2), var(--pink)); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45); position: relative; flex: none; }
#replayBtn .rp-ico::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
#replayBtn kbd { font: 800 12px var(--font); color: var(--soft); background: #fff; border: 2px solid var(--line); border-radius: 6px; padding: 0 5px; line-height: 18px; }
#replayBtn kbd:empty { display: none; }
#skipBtn { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; height: 44px; min-width: 76px; padding: 0 18px; border-radius: 22px; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 900; color: #fff; text-shadow: var(--outline-s); background: rgba(255, 127, 166, 0.85); border: 3px solid #fff; }

/* ---------- press + focus ---------- */
.btn.press { animation: squash 0.22s ease-out; }

/* ---------- 新手教學 (Ribbo) ---------- */
#tut { position: absolute; inset: 0; z-index: 44; pointer-events: none; }
#tut.hidden { display: none; }
body.shot:not(.frame) #shotBar:not(.on) ~ #tut { display: none; }   /* the moment of a shot: nothing of the tutorial shows */
#tutDim { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#tutDim .dimr { fill: rgba(74, 28, 58, 0.5); }
body.tuton #overlay.bottom { background: rgba(90, 40, 70, 0.06); }   /* the 完成 dialog during the tutorial: the badge stays bright */
#tutRing { position: absolute; display: none; box-sizing: border-box; border: 3px solid #fff; border-radius: 18px; box-shadow: 0 0 0 3px #ff7fa6, 0 0 20px 6px rgba(255, 127, 166, 0.85); animation: tutPulse 1.1s ease-in-out infinite; }
#tutRing.nudge { animation: tutPulse 1.1s ease-in-out infinite, tutShake 0.4s ease-out; }
@keyframes tutPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.75; } }
@keyframes tutShake { 0%, 100% { translate: 0 0; } 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
#tutArrow { position: absolute; display: none; width: 30px; height: 32px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 32'%3E%3Cpath d='M15 30 3 14h7V3h10v11h7z' fill='%23ff7fa6' stroke='%23fff' stroke-width='2.6' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; filter: drop-shadow(0 2px 2px rgba(122, 59, 98, 0.4)); animation: tutBob 0.8s ease-in-out infinite; }
#tutArrow.up { transform: rotate(180deg); animation-name: tutBobUp; }
@keyframes tutBob { 0%, 100% { translate: 0 0; } 50% { translate: 0 7px; } }
@keyframes tutBobUp { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
#tutCard { position: absolute; left: 10px; right: 10px; display: flex; flex-direction: column; gap: 2px; box-sizing: border-box; padding: 4px 6px 4px 6px; border-radius: 18px; background: linear-gradient(180deg, #fffafc, #ffeef5); border: 3px solid #ffc4d8; box-shadow: 0 5px 0 #f2a9c2, 0 10px 24px rgba(122, 59, 98, 0.3); pointer-events: auto; transition: top 0.25s cubic-bezier(.3, 1.3, .5, 1); }
#tutCard.pop { animation: tutPop 0.3s cubic-bezier(.3, 1.6, .5, 1); }
#tutCard.nudge { animation: tutShake 0.4s ease-out; }
@keyframes tutPop { from { translate: 0 12px; opacity: 0; } to { translate: 0 0; opacity: 1; } }
#tutCard .tcount:empty { display: none; }
#tutCard .trow { display: flex; gap: 6px; align-items: center; }
#tutCard .tava { width: 30px; height: 30px; flex: none; object-fit: cover; object-position: 50% 12%; border-radius: 50%; background: #ffe3ee; border: 2px solid #fff; box-shadow: 0 0 0 2px #ffb3cb; }
#tutCard .ttext { flex: 1; min-width: 0; font: 800 12.5px/1.3 var(--font); color: var(--deep); }
#tutCard.ws .ttext { min-height: 33px; display: flex; align-items: center; }   /* a steady height, so the badge's framing below it stays put */
#tutCard .tfoot { display: flex; align-items: center; gap: 6px; }
#tutCard .tcount { flex: none; font: 900 11px/1 var(--font); color: #fff; background: var(--pink); border-radius: 9px; padding: 3px 7px; }
#tutCard .tbtns { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
#tutAsk .tbtns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
#tut .tbtn { min-height: 44px; min-width: 44px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border-radius: 22px; cursor: pointer; font: 900 14px/1 var(--font); color: #fff; text-shadow: var(--outline-s); background: linear-gradient(180deg, #ffa3c2, #ff6f9c); border: 3px solid #fff; box-shadow: 0 4px 0 #d0577f, 0 6px 10px rgba(122, 59, 98, 0.25); user-select: none; -webkit-user-select: none; transition: transform 0.12s; }
#tut .tbtn.skip { background: linear-gradient(180deg, #ffffff, #ffe2ec); color: var(--deep); text-shadow: none; box-shadow: 0 4px 0 #f0a6c0, 0 6px 10px rgba(122, 59, 98, 0.18); }
#tut .tbtn:active, #tut .tbtn.press { transform: translateY(2px) scale(0.95); }
#tut .tbtn kbd { font: 900 11px/1 var(--font); padding: 3px 5px; border-radius: 6px; background: rgba(255, 255, 255, 0.85); color: var(--deep); text-shadow: none; }
#tut .tbtn.skip kbd { background: #ffd3e2; }
#tutCard.mini .tava { width: 28px; height: 28px; }
#tutCard.mini .ttext { font-size: 12.5px; }
#tutCard .tbtn { padding: 0 10px; font-size: 13px; }
#tutAsk { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(74, 28, 58, 0.5); pointer-events: auto; }
#tutAsk.hidden { display: none; }
#tutAsk .tpanel { width: min(86%, 340px); box-sizing: border-box; padding: 18px 20px 18px; border-radius: 26px; background: linear-gradient(180deg, #fffafc, #ffeef5); border: 4px solid #ffc4d8; box-shadow: 0 6px 0 #f2a9c2, 0 14px 30px rgba(74, 28, 58, 0.35); text-align: center; }
#tutAsk .tpanel.pop { animation: tutPop 0.28s cubic-bezier(.3, 1.6, .5, 1); }
#tutAsk .tava.big { width: 70px; height: 70px; object-fit: cover; object-position: 50% 12%; border-radius: 50%; background: #ffe3ee; border: 3px solid #fff; box-shadow: 0 0 0 2px #ffb3cb; }
#tutAsk .ttitle { margin-top: 6px; font: 900 22px/1.25 var(--font); color: #fff; text-shadow: var(--outline); }
#tutAsk .tmsg { margin: 6px 0 10px; font: 800 14px/1.45 var(--font); color: var(--deep); }
#tutAsk .tbtns { justify-content: center; }
#tutAsk .tbtns .tbtn { flex: 1; }
@keyframes squash { 0% { transform: scale(1); } 40% { transform: scale(0.9, 0.86); } 100% { transform: scale(1); } }
body.kbd .focus { outline: 3px solid #ffd76a; outline-offset: 2px; transform: scale(1.06); z-index: 1; }
/* ---------- multi decorations ---------- */
.chip.target.sel, .chip.placed.sel { box-shadow: 0 0 0 3px #ff7fa6, 0 3px 0 #d9638a; }
.chip.addbow.full { opacity: 0.5; }
.chip.letter { width: 44px; padding: 0; font-size: 20px; font-weight: 900; font-family: "Arial Rounded MT Bold", "Trebuchet MS", var(--font); }
.chip.del { min-width: 44px; min-height: 44px; background: linear-gradient(#ff9db4, #ff6f93); color: #fff; }
.chip.del .trashico { width: 18px; height: 18px; margin-right: 4px; }
@media (hover: hover) { .chip:hover, .sw:hover, .photo:hover, .card:hover, .thumb:hover, .tab:hover { filter: brightness(1.05); } }
