/* The postcard studio (10 Oct 2569): choose the postcard frames before saving photos. Used on /nexus and /gallery,
   so it carries its own colours: maroon #791B2B, deep #500616, gold #BF9040, cream #F3E9D8, paper #F7F1E4. */
html.fs-lock, html.fs-lock body { overflow: hidden; }
.fs { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; background: #F7F1E4; color: #2B0A10;
  font-family: 'Bai Jamjuree', 'Noto Sans Thai', system-ui, sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.fs[hidden] { display: none; }
.fs *, .fs *::before, .fs *::after { box-sizing: border-box; }
.fs button { font: inherit; color: inherit; }
.fs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }

.fs-top { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  background: linear-gradient(90deg, #500616, #791B2B); color: #F3E9D8; }
.fs-title { flex: 1; min-width: 0; display: grid; padding-left: 6px; }
.fs-eye { font-size: 10.5px; font-weight: 600; letter-spacing: .26em; color: #E3C27A; }
.fs-title h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; color: #fff; }
.fs-x, .fs-back { flex: none; min-width: 44px; height: 44px; border: 0; border-radius: 12px; background: rgba(243, 233, 216, .12);
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 10px; cursor: pointer; }
.fs-back[hidden] { display: none; }
.fs-back span { font-weight: 600; font-size: 14.5px; }

.fs-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px 24px; }
.fs-body > * { max-width: 980px; margin-left: auto; margin-right: auto; }
.fs-load { text-align: center; color: #7B5E63; padding: 40px 0; }
.fs-sec { margin-bottom: 22px; }
.fs-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 14px auto 8px; font-size: 16.5px; color: #791B2B; }
.fs-h span { font-size: 13px; font-weight: 600; color: #7B5E63; }
.fs-note { margin: -2px auto 10px; font-size: 13.5px; color: #7B5E63; }

/* the big preview of the frame in focus */
.fs-stage { display: grid; place-items: center; padding: 8px 0 2px; }
.fs-stage canvas { display: block; max-width: 100%; max-height: min(54vh, 560px); width: auto; height: auto; border-radius: 4px;
  box-shadow: 0 2px 4px rgba(58, 7, 16, .12), 0 14px 34px rgba(58, 7, 16, .22); background: #fff; }
.fs-stage canvas:not(.ok) { min-width: 60%; aspect-ratio: 4 / 3; background: #ebe0cc; }
.fs-cap { margin: 10px auto 0; text-align: center; font-size: 14.5px; color: #7B5E63; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.fs-cap b { color: #2B0A10; }
.fs-ok { color: #2F6E45; font-weight: 700; }
.fs-own { margin: 10px auto 0; padding: 8px 12px; border-radius: 12px; background: #F4E6C6; color: #6a4c14; font-size: 13.5px; text-align: center; }
.fs-link { border: 0; background: none; padding: 0 0 0 4px; color: #791B2B; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* the choices: every frame with the photo in it, a tick each */
.fs-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.fs-opt { position: relative; display: grid; gap: 6px; align-content: start; padding: 8px 8px 10px; border: 1.5px solid #E6D8C2;
  border-radius: 14px; background: #fff; cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s; }
.fs-opt:hover { border-color: #BF9040; }
.fs-opt:focus-visible { outline: 3px solid rgba(191, 144, 64, .55); outline-offset: 2px; }
.fs-opt.on { border-color: #791B2B; box-shadow: 0 0 0 1.5px #791B2B inset; }
.fs-opt.big { background: #FFFCF6; }
.fs-opt-pic { position: relative; aspect-ratio: 5 / 4; border-radius: 8px; background: #f1e8d8; overflow: hidden; }
.fs-opt-pic canvas { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: contain; display: block; }
.fs-opt-pic canvas:not(.ok) { background: #e6dac5; border-radius: 6px; }
.fs-opt-name { font-size: 13.5px; font-weight: 700; line-height: 1.35; padding-right: 26px; }
.fs-tick { position: absolute; right: 8px; bottom: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #D5C1A2;
  background: #fff; display: grid; place-items: center; color: transparent; }
.fs-tick svg { width: 15px; height: 15px; stroke-width: 3; }
.fs-opt.on .fs-tick { background: #791B2B; border-color: #791B2B; color: #fff; }

/* the photos picked, to change one */
.fs-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.fs-tile { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #eadfcb; cursor: pointer; aspect-ratio: 1; }
.fs-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* r19: presses and right clicks land on the buttons, not on the pictures */
.fs-tile img, .fs-opt-pic canvas, .fs-stage canvas { pointer-events: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.fs-tile:focus-visible { outline: 3px solid rgba(191, 144, 64, .7); outline-offset: 2px; }
.fs-tile-n { position: absolute; left: 6px; bottom: 6px; padding: 1px 8px; border-radius: 99px; background: rgba(36, 4, 10, .78);
  color: #F3E9D8; font-size: 12px; font-weight: 700; }
.fs-tile-own { position: absolute; right: 6px; top: 6px; padding: 1px 8px; border-radius: 99px; background: #E3C27A; color: #3a2a06;
  font-size: 11.5px; font-weight: 700; }
.fs-tile.own { box-shadow: 0 0 0 2.5px #BF9040 inset; }

/* the bar at the bottom */
.fs-bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid #E6D8C2; box-shadow: 0 -8px 24px rgba(58, 7, 16, .08); }
.fs.saving .fs-bar { display: none; }
.fs-sum { flex: 1; min-width: 0; display: grid; gap: 1px; }
.fs-sum b { font-size: 15px; }
.fs-sum span { font-size: 12.5px; color: #7B5E63; line-height: 1.45; }
.fs-go { flex: none; min-height: 50px; padding: 0 22px; border: 0; border-radius: 14px; background: #791B2B; color: #fff !important;
  font-weight: 700 !important; font-size: 16px !important; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(121, 27, 43, .3); }
.fs-go:disabled { background: #cdb8a6; box-shadow: none; cursor: default; }
.fs-spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid currentColor; border-right-color: transparent;
  animation: fs-spin .8s linear infinite; }
.fs-go.wait .fs-spin, .fs-spin.on { display: inline-block; }
@keyframes fs-spin { to { transform: rotate(360deg); } }

/* saving (r21): what is being saved, file by file, and plainly when all are saved and where */
.fs-session { display: grid; gap: 12px; padding: 16px 0 28px; max-width: 560px !important; }
.fs-sess-top { display: flex; gap: 14px; align-items: center; }
.fs-sess-t { min-width: 0; display: grid; gap: 2px; }
.fs-sess-t h3 { margin: 0; font-size: 20px; line-height: 1.3; color: #791B2B; }
.fs-sess-t p { margin: 0; color: #7B5E63; font-size: 14.5px; }
.fs-sess-t p:empty { display: none; }
.fs-done-mark { flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: #F3E9D8; color: #791B2B; }
.fs-done-mark.ok { background: #E4F0E6; color: #2F6E45; }
.fs-done-mark.warn { background: #F7EBCF; color: #8A6112; }
.fs-done-mark svg { width: 28px; height: 28px; stroke-width: 2.6; }
.fs-done-mark.ok svg { stroke-width: 2.9; }
.fs-done-mark.warn svg { stroke-width: 3.2; }
.fs-done-mark .fs-spin { width: 26px; height: 26px; border-width: 3px; }
.fs-prog { width: 100%; height: 8px; border-radius: 99px; background: #eadfcb; overflow: hidden; }
.fs-prog i { display: block; width: 0; height: 100%; background: #2F6E45; border-radius: 99px; transition: width .3s; }
.fs-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.fs-acts:empty { display: none; }
.fs-btn { min-height: 50px; padding: 0 20px; border-radius: 14px; border: 1.5px solid #D5C1A2; background: #fff; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.fs-btn.go { background: #791B2B; border-color: #791B2B; color: #fff; flex: 1 1 220px; font-size: 16px; }
.fs-btn:disabled { opacity: .6; cursor: default; }
.fs-files { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.fs-file { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 8px;
  background: #fff; border: 1px solid #E6D8C2; border-radius: 12px; }
.fs-file img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; background: #eadfcb; display: block;
  pointer-events: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.fs-file-t { display: grid; min-width: 0; line-height: 1.35; }
.fs-file-t b { font-size: 14px; overflow-wrap: anywhere; }
.fs-file-t small { font-size: 12.5px; color: #7B5E63; }
.fs-file.st-making small, .fs-file.st-saving small { color: #8A6112; }
.fs-file.st-saved { border-color: #b9d6c0; background: #f3faf4; }
.fs-file.st-saved small { color: #2F6E45; font-weight: 700; }
.fs-file.st-err { border-color: #efc2cc; }
.fs-file.st-err small { color: #A51536; font-weight: 700; }
.fs-mini { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1.5px solid #791B2B; background: #fff; color: #791B2B !important;
  font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.fs-file.st-saved .fs-mini { border-color: #D5C1A2; color: #7B5E63 !important; font-weight: 600; }
.fs-mini:disabled { opacity: .5; cursor: default; }
/* the apps' own browsers (LINE, Facebook) often cannot save files: the way to the phone's browser */
.fs-inapp { margin: 0 auto 12px; padding: 9px 12px; border-radius: 12px; background: #F4E6C6; color: #6a4c14; font-size: 13.5px; line-height: 1.5; }
.fs-session .fs-inapp { margin: 0; }
.fs-inapp a { color: #791B2B; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* r22: the big popup over the save. Not finished (gold), leaving before the end (gold), all saved (green). It dims the
   studio so the first round is never taken for the whole save. */
.fs-pop { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(36, 4, 10, .64); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); overscroll-behavior: contain; }
.fs-pop[hidden] { display: none; }
.fs-pop-card { width: min(440px, 100%); max-height: 100%; overflow-y: auto; display: grid; gap: 10px; justify-items: center;
  padding: 26px 22px 16px; border-radius: 24px; border-top: 7px solid #BF9040; background: #FFFCF6; text-align: center;
  box-shadow: 0 26px 64px rgba(20, 2, 6, .5); animation: fs-pop-in .32s cubic-bezier(.2, .9, .25, 1.15); outline: none; }
.fs-pop.ok .fs-pop-card { border-top-color: #2F6E45; }
@keyframes fs-pop-in { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
.fs-pop-mark { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: #F7EBCF; color: #8A6112;
  box-shadow: 0 0 0 8px rgba(191, 144, 64, .14); }
.fs-pop.warn .fs-pop-mark { animation: fs-pop-ring 1.8s ease-out infinite; }
@keyframes fs-pop-ring { 0% { box-shadow: 0 0 0 0 rgba(191, 144, 64, .45); } 100% { box-shadow: 0 0 0 18px rgba(191, 144, 64, 0); } }
.fs-pop.ok .fs-pop-mark { background: #E4F0E6; color: #2F6E45; box-shadow: 0 0 0 8px rgba(47, 110, 69, .12); }
.fs-pop-mark svg { width: 38px; height: 38px; stroke-width: 3.2; }
.fs-pop-t { margin: 4px 0 0; font-size: 27px; line-height: 1.25; font-weight: 700; color: #791B2B; text-wrap: balance; }
.fs-pop.ok .fs-pop-t { color: #2F6E45; }
.fs-pop-n { margin: 0; display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 4px 10px;
  font-size: 16px; font-weight: 600; color: #7B5E63; }
.fs-pop-n b { font-family: 'Anton', 'Bai Jamjuree', sans-serif; font-weight: 400; font-size: 54px; line-height: 1; color: #2B0A10;
  letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.fs-pop-bar { width: 100%; height: 16px; margin-top: 2px; border-radius: 99px; background: #EADFCB; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(58, 7, 16, .12); }
.fs-pop-bar i { display: block; width: 0; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #BF9040, #D9B25F);
  transition: width .45s ease; }
.fs-pop.ok .fs-pop-bar i { background: linear-gradient(90deg, #2F6E45, #3E8A58); }
.fs-pop-l { margin: 2px 0 4px; max-width: 34ch; font-size: 16px; line-height: 1.55; color: #4A2A30; text-wrap: balance; }
.fs-pop-l:empty { display: none; }
.fs-pop-l b { display: block; font-size: 18px; font-weight: 700; color: #791B2B; }
.fs-pop-l span { display: block; }
.fs-pop-acts { width: 100%; display: grid; gap: 8px; }
.fs-pop-acts .fs-btn { width: 100%; }
.fs-pop-acts .fs-btn.go { min-height: 58px; font-size: 17.5px; box-shadow: 0 8px 20px rgba(121, 27, 43, .3); }
.fs-pop.ok .fs-pop-acts .fs-btn.go { background: #2F6E45; border-color: #2F6E45; box-shadow: 0 8px 20px rgba(47, 110, 69, .28); }
.fs-pop-acts .fs-btn[data-plain] { min-height: 46px; border: 0; background: none; color: #791B2B; font-weight: 600;
  text-decoration: underline; text-underline-offset: 4px; }
.fs-pop-acts .fs-btn:focus-visible { outline: 3px solid rgba(191, 144, 64, .7); outline-offset: 2px; }

@media (max-width: 520px) {
  .fs-pop-card { padding: 22px 18px 14px; border-radius: 22px; }
  .fs-pop-t { font-size: 24px; }
  .fs-pop-n b { font-size: 48px; }
  .fs-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fs-opt { padding: 6px 6px 8px; border-radius: 12px; }
  .fs-opt-name { font-size: 12.5px; }
  .fs-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fs-go { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .fs-spin { animation-duration: 2.4s; }
  .fs-prog i, .fs-pop-bar i { transition: none; }
  .fs-pop-card, .fs-pop.warn .fs-pop-mark { animation: none; }
}
