/* Nekotel photo mode. While body.photo is set every game UI element is hidden and only #pmUI (plus the canvas) shows. */
body.photo > *:not(canvas):not(#pmUI):not(#boot):not(script) { display: none !important; }
body.photo #c { touch-action: none; cursor: grab; }
#pmUI[hidden] { display: none; }
#pmUI { position: fixed; inset: 0; z-index: 50; pointer-events: none; font-family: "Nunito", "Segoe UI", system-ui, sans-serif; color: var(--ink, #3f2f27); --pmbg: rgba(255, 253, 249, .92); --pmline: rgba(0, 0, 0, .1); }
:root[data-theme="dark"] #pmUI { --pmbg: rgba(32, 26, 38, .92); --pmline: rgba(255, 255, 255, .14); }
#pmUI button { pointer-events: auto; }

/* overlay effects (cheap CSS only) */
#pmFx { position: absolute; inset: 0; }
#pmFx.vig { background: radial-gradient(ellipse at center, rgba(20, 10, 10, 0) 45%, rgba(20, 10, 10, .5) 100%); }
#pmFx.soft:not(.lowq) { -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); -webkit-mask-image: radial-gradient(ellipse at center, transparent 28%, #000 85%); mask-image: radial-gradient(ellipse at center, transparent 28%, #000 85%); }
#pmFx.soft.lowq { background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, .28) 100%); }
#pmFx.soft.vig { background: radial-gradient(ellipse at center, rgba(20, 10, 10, 0) 45%, rgba(20, 10, 10, .5) 100%); }

/* live frame preview (the saved picture draws the same frame on the canvas) */
#pmFrame { position: absolute; inset: 0; display: none; box-sizing: border-box; }
#pmFrame.on { display: block; }
#pmFrame .pmcap { display: none; }
#pmFrame.f-polaroid { border: solid #fffdf8; border-width: var(--u) var(--u) calc(var(--u) * 4.4); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
#pmFrame.f-polaroid .pmcap { display: flex; position: absolute; left: 0; right: 0; bottom: calc(var(--u) * -4.4); height: calc(var(--u) * 4.4); flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * .25); color: #4a3a31; text-align: center; overflow: hidden; padding: 0 var(--u); box-sizing: border-box; }
#pmFrame .pmcap b { font: 400 calc(var(--u) * 1.5) Pacifico, Fredoka, "Segoe UI", sans-serif; white-space: nowrap; }
#pmFrame .pmcap small { font: 700 calc(var(--u) * .72) Nunito, "Segoe UI", sans-serif; color: #8a7668; white-space: nowrap; }
#pmFrame.f-paw { border: calc(var(--u) * 1.7) solid #f9d7de; box-shadow: inset 0 0 0 calc(var(--u) * .12) #e58aa0; }
#pmFrame.f-paw::after, #pmFrame.f-season::after { content: attr(data-icon); position: absolute; right: calc(var(--u) * .4); top: calc(var(--u) * -1.3); font-size: calc(var(--u) * 1); }
#pmFrame.f-paw::after { content: "\1F43E"; }
#pmFrame.f-season { border: calc(var(--u) * 1.6) solid var(--sc, #ffd9e6); }

/* top bar */
#pmTop { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0; }
.pm-round { width: 42px; height: 42px; padding: 0; border-radius: 50%; background: var(--pmbg) !important; color: var(--ink, #3f2f27) !important; border: 1px solid var(--pmline) !important; box-shadow: 0 4px 14px rgba(0, 0, 0, .18) !important; font-size: 17px; }
.pm-spacer { width: 42px; flex: none; }
#pmName { display: flex; align-items: center; gap: 2px; background: var(--pmbg); border: 1px solid var(--pmline); border-radius: 22px; padding: 3px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); max-width: calc(100vw - 120px); }
#pmName b { padding: 0 8px; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#pmName:not(.has) b { font-weight: 700; color: var(--muted, #8a7668); }
.pm-arrow { width: 34px; height: 34px; padding: 0; border-radius: 50%; background: transparent !important; color: var(--ink, #3f2f27) !important; box-shadow: none !important; font-size: 12px; }
.pm-arrow:active { background: rgba(128, 128, 128, .2) !important; }

/* bottom dock */
#pmDock { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 0 10px calc(env(safe-area-inset-bottom, 0px) + 12px); }
#pmOpts { pointer-events: auto; display: flex; gap: 6px; max-width: 100%; overflow-x: auto; padding: 6px 8px; background: var(--pmbg); border: 1px solid var(--pmline); border-radius: 18px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); scrollbar-width: none; }
#pmOpts::-webkit-scrollbar { display: none; }
.pm-chip { flex: none; padding: 8px 12px; font-size: 13px; border-radius: 14px; background: transparent !important; color: var(--ink, #3f2f27) !important; border: 1px solid var(--pmline) !important; box-shadow: none !important; white-space: nowrap; min-height: 36px; }
.pm-chip.on { background: var(--accent, #e76f51) !important; color: #fff !important; border-color: transparent !important; }
#pmBar { width: 100%; max-width: 460px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
#pmTabs { display: contents; }
.pm-tab { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; font-size: 11px; min-height: 48px; min-width: 52px; border-radius: 14px; background: var(--pmbg) !important; color: var(--ink, #3f2f27) !important; border: 1px solid var(--pmline) !important; box-shadow: 0 2px 8px rgba(0, 0, 0, .15) !important; }
.pm-tab span { font-size: 18px; line-height: 1.1; }
.pm-tab.on { border-color: var(--accent, #e76f51) !important; box-shadow: 0 0 0 2px var(--accent, #e76f51) !important; }
/* the four tabs flank the shutter: two left, two right */
#pmBar .pm-tab:nth-child(1) { grid-column: 1; justify-self: start; grid-row: 1; }
#pmBar .pm-tab:nth-child(2) { grid-column: 1; justify-self: end; grid-row: 1; }
#pmShutter { grid-column: 2; grid-row: 1; width: 72px; height: 72px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, .95) !important; border: 4px solid var(--accent, #e76f51) !important; box-shadow: 0 6px 18px rgba(0, 0, 0, .3) !important; display: grid; place-items: center; }
#pmShutter i { width: 52px; height: 52px; border-radius: 50%; background: var(--accent, #e76f51); display: block; transition: transform .1s; }
#pmShutter:active i { transform: scale(.82); }
#pmBar .pm-tab:nth-child(3) { grid-column: 3; justify-self: start; grid-row: 1; }
#pmBar .pm-tab:nth-child(4) { grid-column: 3; justify-self: end; grid-row: 1; }
.pm-spacer2 { display: none; }

#pmFlash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .35s ease-out; }
#pmFlash.on { opacity: .9; transition: none; }

/* result sheet */
#pmPrev { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 14px; background: rgba(15, 10, 12, .72); pointer-events: auto; }
#pmPrev[hidden] { display: none; }
.pm-card { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: min(94vw, 560px); max-height: 100%; background: var(--pmbg); border: 1px solid var(--pmline); border-radius: 20px; padding: 12px; box-shadow: 0 12px 40px rgba(0, 0, 0, .45); }
#pmImg { display: block; max-width: 100%; max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); border-radius: 10px; object-fit: contain; background: #0002; }
.pm-count { font-size: 12px; font-weight: 700; color: var(--muted, #8a7668); }
.pm-acts { display: flex; gap: 8px; width: 100%; justify-content: center; flex-wrap: wrap; }
.pm-btn { flex: 1 1 0; min-width: 96px; min-height: 44px; font-size: 14px; }
.pm-btn.ghost { background: transparent !important; color: var(--ink, #3f2f27) !important; border: 1px solid var(--pmline) !important; box-shadow: none !important; }

@media (min-width: 821px) {
  #pmBar { max-width: 520px; }
}
body.reduce-motion #pmFlash { transition: none; }
#pmFrame.f-hearts { border: calc(var(--u) * 1.7) solid #fde3ea; box-shadow: inset 0 0 0 calc(var(--u) * .12) #ef9ab0; }
#pmFrame.f-film { border: solid #1c1a20; border-width: calc(var(--u) * 2) 0; }
#pmFrame.f-card { border: solid #fffaf2; border-width: calc(var(--u) * .8) calc(var(--u) * .8) calc(var(--u) * 5.2); box-shadow: inset 0 0 0 1px #ecdcc6; }
.pm-sep { align-self: center; padding: 0 4px 0 10px; font-size: 11px; font-weight: 800; opacity: .7; white-space: nowrap; }
