/* The goshuin office (view #goshuin, js/stamps.js): the kiosk drawn large, the stamp book open on its
   counter, the seal stamps waiting on the tray; the "Stamp earned" toast; the Goshuin spot on the path. */

/* ---------- the kiosk ---------- */
/* the goshuin window: the left 400 of the office's 750 drawing units (css/omamori.css places the office) */
.gs-wrap { position: absolute; left: 0; top: 0; width: 53.3333%; height: 100%; }
.gs-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.gs-inside { fill: #f1ecfb; }
.gs-inside-line { fill: none; stroke: #e4dcf5; stroke-width: 2; stroke-linecap: round; }
.gs-noren-p { fill: #e5ddff; stroke: #b3a5f2; stroke-width: 2; stroke-linejoin: round; }
.gs-noren-t { font-family: var(--kanji); font-weight: 600; font-size: 9px; fill: var(--lilac-ink); letter-spacing: .06em; }
.gs-noren-t.big { font-size: 24px; letter-spacing: .14em; }
.gs-noren-wave { fill: none; stroke: #cfc4ff; stroke-width: 3; stroke-linecap: round; }
.gs-noren-big { transform-box: view-box; transform-origin: 200px 126px; animation: noren 3.4s ease-in-out infinite; }
.gs-noren { transform-origin: 44px 40px; }
.gs-tray-box { fill: #f6dcc2; stroke: #e2b58f; stroke-width: 2.4; }
.gs-tray-art { fill: #f6dcc2; stroke: #e2b58f; stroke-width: 1.2; }
.gs-pad { fill: #b9acf0; stroke: #9d8fe0; stroke-width: 1.6; }
.gs-pad-ink { fill: #f2a196; }
.gs-page { fill: #fffaf0; stroke: #e0cfb8; stroke-width: 1.2; stroke-linejoin: round; }
.gs-fold { fill: none; stroke: #e0cfb8; stroke-width: 1; }
.gs-seal-dot { fill: none; stroke: #ec8c82; stroke-width: 1.6; }
.gs-sign-t { font-family: var(--kanji); font-weight: 600; font-size: 9.5px; fill: var(--coral-ink); }
/* a seal stamp (hanko): knob colours, a wooden handle, its kanji on the label */
.gs-knob.a { fill: #c9ecd9; stroke: #93cdb2; stroke-width: 1.6; }
.gs-knob.b { fill: #ffd6cb; stroke: #eda28f; stroke-width: 1.6; }
.gs-knob.c { fill: #ffe7a6; stroke: #e5c070; stroke-width: 1.6; }
.gs-knob.d { fill: #ded6ff; stroke: #ab9cec; stroke-width: 1.6; }
.gs-st-body { fill: #f7dcc1; stroke: #dcae86; stroke-width: 1.6; }
.gs-st-foot { fill: #f2a196; stroke: #df8274; stroke-width: 1.4; }
.hk-kanji { font-family: var(--brush); fill: #e8877c; }
.gs-st-face { fill: #fffaf3; stroke: #f0bfb2; stroke-width: 1.2; }
.hanko { display: block; width: 100%; height: auto; overflow: visible; }

/* the book on the counter: the same page as the saved image, sized by the kiosk */
.gs-book { position: absolute; left: 5%; top: 30%; width: 60%; z-index: 1; touch-action: pan-y; }
.sb-page {
  position: relative; container-type: size;
  width: min(330px, 100vw - 66px, calc((100dvh - env(safe-area-inset-top) - var(--head) - 210px) * .72));
  aspect-ratio: .72; display: grid; grid-template-columns: 29% 1fr;
  border-radius: 10px; overflow: hidden;
  background: radial-gradient(circle at 30% 20%, #fffdf6, #fff8ec 70%), #fffaf0;
  box-shadow: inset 0 0 0 1.5px #ecdfcb;
}
.sb-page::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(200, 175, 140, .22), rgba(200, 175, 140, 0) 12%); }
/* the column of spot seals, each with its tiny English caption, the date in English at the foot */
.sb-seals { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; padding: 3cqh 0 2cqh 3cqw; min-height: 0; }
.sb-place { display: flex; flex-direction: column; align-items: center; gap: .4cqh; }
.sb-seal { display: block; width: min(21cqw, calc(78cqh / var(--n) - 6cqh)); aspect-ratio: 1; rotate: var(--turn, 0deg); }
.sb-cap { font-size: max(8px, 2.9cqw); font-weight: 700; color: #a3917f; line-height: 1; letter-spacing: .02em; }
.sb-endate { font-size: max(8px, 3cqw); font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
/* the goshuin: the round crest seal and the big square seal pressed first, the three brushed columns
   over them (right to left), the season's little picture stamps beside the columns and in the corners */
.gc { position: relative; container-type: size; border-left: 2px dashed rgba(200, 170, 150, .4); }
.gc-guide { position: absolute; inset: 7% 0; display: none; }
.gc:not(.written) .gc-guide { display: block; }
.gc-guide i { position: absolute; top: 0; bottom: 0; border-left: 2px dashed rgba(210, 190, 170, .22); }
.gc-guide i:nth-child(1) { left: 13%; } .gc-guide i:nth-child(2) { left: 50%; } .gc-guide i:nth-child(3) { left: 84%; }
.gc-ink { position: absolute; inset: 0; z-index: 2; }
.gc-col { position: absolute; display: flex; flex-direction: column; align-items: center; translate: -50% 0; font-family: var(--brush); color: #2e2738; line-height: 1.04; }
.gc-col.c1 { left: 84%; top: 17%; font-size: 7cqh; }
.gc-col.c2 { left: 50%; top: 6%; font-size: min(13.4cqh, 30cqw); }
.gc-col.c3 { left: 13%; top: 12%; font-size: 6.4cqh; }
.gc-ch { display: block; transition: color 1.2s ease, text-shadow 1.2s ease; }
/* a little paper round the strokes, so where the brush crosses the seal both stay readable */
.gc.written .gc-ch { text-shadow: 0 0 2px rgba(255, 250, 240, .9), 0 0 4px rgba(255, 250, 240, .6); }
.gc-ch.wet { color: #463a5e; text-shadow: 0 0 1px rgba(255, 255, 255, .9), .5px -.5px 0 rgba(255, 255, 255, .55); transition: none; }
.gc-seal, .gc-crest { position: absolute; z-index: 1; translate: -50% -50%; rotate: var(--turn, 0deg); mix-blend-mode: multiply; opacity: .9; pointer-events: none; }
.gc-seal { left: 51%; top: 62%; width: 62cqw; }
.gc-crest { left: 84%; top: 8.6%; width: 23cqw; }
.gc-seal-svg, .gc-crest-svg { display: block; width: 100%; height: auto; overflow: visible; }
.bs-wash { fill: rgba(255, 214, 204, .32); }
.bs-ring { fill: none; stroke: #e8705f; stroke-width: 4.4; stroke-linejoin: round; }
.bs-ring2 { fill: none; stroke: #e8705f; stroke-width: 1.7; stroke-linejoin: round; }
.bs-kanji { font-family: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif; font-weight: 800; fill: #e8705f; stroke: #e8705f; stroke-width: .7; stroke-linejoin: round; }
.bs-petal { fill: #e8705f; }
.bs-vein { stroke: #fffaf0; stroke-width: 1.4; stroke-linecap: round; }
.bs-eye { fill: #fffaf0; stroke: #e8705f; stroke-width: 2; }
.bs-eye-in { fill: #e8705f; }
.gc-pics { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.gc-pic { position: absolute; translate: -50% -50%; rotate: var(--turn, 0deg); aspect-ratio: 1; }
.gc-pic-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gc .sb-full { position: absolute; z-index: 2; right: 3%; bottom: 2%; width: 26cqw; display: block; }
.gc .sb-full.got { rotate: var(--turn, 0deg); }
.gc .sb-full .seal { width: 100%; height: auto; }
/* the brush that writes */
.gc-brush { position: absolute; left: 0; top: 0; width: 7cqw; margin-left: -3.5cqw; margin-top: -24cqw; z-index: 3; pointer-events: none; filter: drop-shadow(2px 4px 3px rgba(80, 60, 90, .25)); }
.gc-brush svg { display: block; width: 100%; height: auto; }
.br-handle { fill: #f3dfa6; stroke: #d9bd78; stroke-width: 1.2; } .br-node { stroke: #d9bd78; stroke-width: 1.2; }
.br-ferrule { fill: #cfc4ff; stroke: #a99bea; stroke-width: 1; } .br-tip { fill: #3a3248; }

/* ---------- the book on the counter: the stamp book page, sized by the kiosk ---------- */
.sb-cover {
  position: relative; padding: 10px 16px 10px 10px; border-radius: 20px; touch-action: pan-y;
  background: repeating-linear-gradient(45deg, #dad3f7 0 5px, #d1c8f2 5px 10px);
  box-shadow: 0 10px 26px rgba(60, 50, 110, .3), inset 0 0 0 2px #c2b8ef;
}
.sb-cover::before, .sb-cover::after { content: ''; position: absolute; top: 14px; bottom: 14px; border-radius: 0 8px 8px 0; background: #f6eedf; border: 1.5px solid #e4d6c0; border-left: 0; }
.sb-cover::before { right: 5px; width: 14px; }
.sb-cover::after { right: 9px; width: 12px; background: #fbf4e8; }
.sb-cover-in { position: relative; z-index: 1; perspective: 900px; }
.gs-book .sb-page { width: 100%; }
.gs-book .sb-cover { padding: 7px 12px 7px 7px; border-radius: 16px; box-shadow: 0 8px 14px rgba(120, 90, 70, .22), inset 0 0 0 2px #c2b8ef; }
.gs-book .sb-cover::before, .gs-book .sb-cover::after { top: 10px; bottom: 10px; }

/* the stand of hanko below the ink pad (drawn in the kiosk): three little shelves of two, the four
   spot hanko and room for two more */
.gs-tray {
  position: absolute; z-index: 2; left: 66.5%; top: 38%; width: 29.5%; height: 44.5%;
  display: grid; grid-template-rows: repeat(3, 1fr); padding: 0 1.5%;
}
.gs-shelf { position: relative; display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 9%; }
.gs-shelf::after { /* the shelf's wooden lip */
  content: ''; position: absolute; left: -2%; right: -2%; bottom: 3%; height: 11%; border-radius: 6px;
  background: #ecc39f; box-shadow: inset 0 0 0 1.6px #d9a47c, 0 2px 0 rgba(150, 100, 70, .15);
}
.gs-spare { position: relative; z-index: 1; width: 40%; height: 9%; margin-bottom: 2%; border-radius: 50%; background: rgba(214, 164, 124, .35); box-shadow: inset 0 1px 2px rgba(150, 100, 70, .25); }
.gs-stamp {
  position: relative; z-index: 1; width: 48.5%; padding: 0; border: 0; background: none; cursor: pointer;
  display: block; touch-action: manipulation;
}
.gs-stamp::before { content: ''; position: absolute; inset: -6px -3px -2px; }   /* a little more to tap than the drawing */
.gs-stamp[data-state="ready"] { animation: stampWait 1.5s ease-in-out infinite; }
.gs-shelf:nth-child(1) .gs-stamp:nth-child(2) { animation-delay: -.4s; } .gs-shelf:nth-child(2) .gs-stamp:nth-child(1) { animation-delay: -.8s; } .gs-shelf:nth-child(2) .gs-stamp:nth-child(2) { animation-delay: -1.1s; }
@keyframes stampWait { 0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 3px rgba(246, 207, 99, .6)); } 50% { transform: translateY(-6px); filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 9px #f6cf63); } }
.gs-stamp.away { visibility: hidden; }
.gs-stamp.flying { position: fixed; z-index: 72; animation: none; pointer-events: none; transform-origin: 50% 86.4%; }
.view-goshuin:not([data-state="idle"]) .gs-tray, .view-goshuin:not([data-state="idle"]) .gs-coin-row { pointer-events: none; }
/* done today: a slightly inked face and a small inked tick on its base */
.hk-done { display: none; }
.gs-stamp[data-state="done"] .hk-done { display: inline; }
.gs-stamp[data-state="done"] .gs-st-face { fill: #ffe6df; }
.hk-done-c { fill: #fffaf3; stroke: #ec8c82; stroke-width: 1.4; }
.hk-done-t { fill: none; stroke: #e57c71; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* not earned yet: a little quieter */
.gs-stamp[data-state="locked"] .hanko { opacity: .82; }
/* the tiny pictures on the knobs */
.hk-ic-water { fill: #a9d6f7; stroke: #6aa9da; stroke-width: 1.2; stroke-linejoin: round; }
.hk-ic-shine { fill: none; stroke: #fff; stroke-width: 1; stroke-linecap: round; }
.hk-ic-box { fill: #ffeab0; stroke: #d6a64c; stroke-width: 1.2; stroke-linejoin: round; }
.hk-ic-stick { stroke: #e98b7e; stroke-width: 1.8; stroke-linecap: round; }
.hk-ic-line { fill: none; stroke: #b98a52; stroke-width: 1; stroke-linecap: round; }
.hk-ic-bell { fill: #ffe39a; stroke: #d6a64c; stroke-width: 1.2; }
.hk-ic-dot { fill: #b98a52; }
.hk-ic-ema { fill: #f8deC4; stroke: #d39e74; stroke-width: 1.2; stroke-linejoin: round; }
.hk-ic-cord { fill: none; stroke: #e98b7e; stroke-width: 1.1; stroke-linecap: round; }
.gs-pad-shine { fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 2; stroke-linecap: round; }

/* ---------- the page brought forward: large, over a soft dimmed backdrop ---------- */
.gs-sheet {
  --bar-h: 150px;
  --sheet-w: min(92vw - 26px, (100dvh - env(safe-area-inset-top) - var(--head) - var(--bar-h) - 76px) * .72, 446px);
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center;
  padding-top: calc(env(safe-area-inset-top) + var(--head) + 54px);   /* room for the ✕ above the page */
}
.gs-sheet[hidden] { display: none; }
.gsh-dim { position: absolute; inset: 0; background: rgba(238, 232, 255, .78); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.gsh-box { position: relative; z-index: 1; margin: auto 0; touch-action: pan-y; }
.gsh-slot .sb-cover { transform-origin: 0 0; box-shadow: 0 18px 40px rgba(70, 55, 120, .28), inset 0 0 0 2px #c2b8ef; }
.gsh-slot .sb-page { width: var(--sheet-w); }
.gsh-close { position: absolute; z-index: 2; top: -50px; right: 0; width: 44px; height: 44px; }
.gsh-close svg { width: 20px; height: 20px; }
.gsh-close.wait { opacity: .45; pointer-events: none; }
.gsh-bar {
  position: relative; z-index: 1; pointer-events: none; flex: none; width: 100%; min-height: var(--bar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px;
  padding: 6px 14px calc(10px + env(safe-area-inset-bottom));
}
.gsh-bar > * { pointer-events: auto; }
.gsh-bar .hint { margin: 0; min-height: 22px; font-size: 15px; }
.gsh-bar .sb-count { color: var(--ink); text-shadow: none; min-width: 176px; }
.gsh-bar .sb-status { color: var(--ink-soft); text-shadow: none; }
.view-goshuin.sheet-open .gs-controls { visibility: hidden; }
body:has(.view-goshuin.sheet-open) .season-btn { visibility: hidden; opacity: 0; pointer-events: none; }
/* the book left on the counter while its page is forward */
.sb-cover.ghost { pointer-events: none; }
@media (min-width: 720px) and (min-height: 560px) {
  .gs-sheet { --bar-h: 64px; }
  .gsh-bar { flex-direction: row; justify-content: center; gap: 18px; padding-top: 10px; }
  .gsh-bar .hint { min-width: 220px; text-align: right; }
  .gsh-bar .gs-actions { min-width: 150px; align-items: flex-start; }
}

/* the little coin tray on the counter: the ¥500 is placed here; it calls while the coin waits */
.gs-cointray { position: absolute; z-index: 2; left: 65%; top: 84%; width: 22%; height: 7.4%; border-radius: 40%; pointer-events: none; }
.gs-cointray.call::after { content: ''; position: absolute; inset: -12% 4%; border-radius: 50%; border: 3px dashed rgba(255, 255, 255, .95); box-shadow: 0 0 0 4px rgba(246, 207, 99, .5); animation: ropeCall 1.3s ease-in-out infinite; }
.gs-cointray.over::after { box-shadow: 0 0 0 7px rgba(246, 207, 99, .95); background: rgba(255, 240, 186, .6); animation: none; }
.gs-ctray { fill: #ffc8ba; stroke: #e9988a; stroke-width: 2; stroke-linejoin: round; }
.gs-ctray-rim { fill: #ffd9cf; stroke: #e9988a; stroke-width: 2; }
.gs-ctray-shadow { fill: rgba(120, 80, 60, .12); }
.gs-ctray-t { font-family: var(--kanji); font-weight: 600; font-size: 11px; fill: var(--coral-ink); letter-spacing: .1em; }
/* the ¥500: a little larger than the others, pale gold with a silvery centre (two-tone, like the real one) */
.coin.yen500 {
  --size: 64px;
  border: 3px solid #e2c27a;
  background: radial-gradient(circle, #fbfaff 0 50%, #e4e2f0 51% 53%, #fff1c4 54%, #ffe39a 78%, #f6d27a 100%);
  box-shadow: inset 0 -3px 0 rgba(214, 170, 80, .35), 0 4px 8px rgba(160, 120, 60, .18);
}
.coin.yen500 .coin-face { width: 52%; height: 52%; background: radial-gradient(circle at 40% 35%, #ffffff, #e9e8f4); box-shadow: inset 0 0 0 1.5px #d5d2e6; }
.coin.yen500 b { font-size: 15px; font-weight: 700; color: #8f7a3a; letter-spacing: -.02em; }
.coin.yen500.placed { position: fixed; z-index: 71; display: grid; place-items: center; transform-origin: 0 0; pointer-events: none; }
.gs-coin-row { min-height: 0; height: auto; }
.gs-coin-row .coin-spot { min-width: 70px; }

/* the controls: the hint, the page arrows, the ¥500 or Save page */
.gs-controls { height: calc(var(--ctl) + 18px + env(safe-area-inset-bottom)); gap: 6px; padding-top: 8px; }
.gs-controls .sb-count { color: var(--ink); text-shadow: none; min-width: 176px; }
.gs-actions { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gs-controls .sb-status { color: var(--ink-soft); text-shadow: none; }
body[data-view="goshuin"] { --sb-bottom: 14px; }
@media (max-height: 620px) {
  body[data-view="goshuin"] { --sb-bottom: 8px; }
  .gs-controls { gap: 4px; padding-top: 4px; }
  .gs-controls .sb-nav .icon-btn { width: 40px; height: 40px; }
  .coin.yen500 { --size: 52px; } .coin.yen500 b { font-size: 13px; }
}

/* ---------- the Goshuin spot on the path: a dot and a little extra bounce while stamps wait ---------- */
.spot-dot { position: absolute; z-index: 2; right: 10%; top: 6%; width: 16px; height: 16px; border-radius: 50%; background: #ff9f94; box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(110, 95, 170, .3); display: none; }
.spot.waiting .spot-dot { display: block; animation: dotPulse 1.2s ease-in-out infinite; }
.spot.waiting .spot-sign { animation: signBobBig 1.1s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes signBobBig { 0%, 100% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-11px) rotate(-2deg); } 70% { transform: translateY(-4px) rotate(1.5deg); } }

/* ---------- "Stamp earned · collect it at Goshuin" ---------- */
.stamp-toast {
  position: fixed; z-index: 35; left: 50%; top: calc(env(safe-area-inset-top) + var(--head) + 16px); translate: -50% 0;
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 5px 16px 5px 7px; border-radius: 999px;
  width: max-content; max-width: calc(100vw - 24px);
  background: #fff6ea; border: 2.5px solid #f6cdb9; box-shadow: 0 4px 0 #f6cdb9, 0 10px 20px rgba(110, 95, 170, .18);
  color: var(--coral-ink); font-size: 15px; font-weight: 600; line-height: 1.2;
  opacity: 0; visibility: hidden; pointer-events: none;
}
.stamp-toast b { font-weight: 700; }
.stamp-toast.show { visibility: visible; animation: stampToast 2.4s ease both; }
@keyframes stampToast {
  0% { opacity: 0; transform: translateY(-14px) scale(.9); }
  10% { opacity: 1; transform: translateY(0) scale(1.05); }
  18%, 86% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-8px); }
}
.st-seal { width: 38px; height: 38px; flex: none; rotate: -8deg; }
.stamp-toast.show .st-seal { animation: toastPress .5s .12s cubic-bezier(.5, 0, .4, 1) both; }
@keyframes toastPress { 0% { transform: scale(1.8); opacity: 0; } 60% { transform: scale(.9); opacity: 1; } 100% { transform: none; opacity: 1; } }

/* ---------- the seals: kanji in a brush face, a ring with a slightly uneven edge ---------- */
.seal { display: block; width: 100%; height: 100%; overflow: visible; }
.seal.red { --ink: #ec8c82; --wash: #ffe9e4; }
.seal.gold { --ink: #dcaa45; --wash: #fff2cc; }
.se-ink { opacity: .93; }
.se-wash { fill: var(--wash); }
.se-ring { fill: none; stroke: var(--ink); stroke-width: 4.2; stroke-linejoin: round; }
.se-ring2 { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.se-kanji { font-family: var(--brush); }
.seal.red .se-kanji { fill: #e57c71; }
.seal.gold .se-kanji { fill: #c99636; }
.seal.empty .se-dash { fill: none; stroke: #dccfc0; stroke-width: 2; stroke-dasharray: 5 5; }

.sb-nav { display: flex; align-items: center; gap: 12px; }
.sb-arrow:disabled { opacity: .45; cursor: default; }
.sb-count { min-width: 168px; text-align: center; color: #fff; font-size: 15px; font-weight: 600; text-shadow: 0 1px 3px rgba(60, 50, 110, .5); }
.sb-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sb-status { margin: 0; color: #fff; text-shadow: 0 1px 3px rgba(60, 50, 110, .5); }
.sb-status:empty { display: none; }
.sb-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* a stamp waiting on the tray: its place glows a little */
.sb-place.waiting .se-dash { stroke: #f0b4a8; stroke-dasharray: 6 4; animation: placeCall 1.4s ease-in-out infinite; }
@keyframes placeCall { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .stamp-toast.show { animation: none; opacity: 1; }
  .stamp-toast.show .st-seal, .gs-stamp, .gs-stamp[data-state="ready"], .gs-noren-big, .spot.waiting .spot-dot, .spot.waiting .spot-sign, .sb-place.waiting .se-dash { animation: none !important; }
}
