:root {
  --ink: #120e26; --cream: #f6ecd8; --dim: #cdbfe0; --flame: #ffd27a; --rose: #e5825f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--cream); overflow: hidden; }
/* until the scene is drawn, the small still picture of the chapel stands in behind the question */
body { background: var(--ink) url(chapel.png) center top / cover no-repeat; image-rendering: pixelated; }
body { font-family: var(--serif); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
canvas { position: fixed; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
#none p.helpline { font-size: 11.5px; opacity: .85; }      /* on the calm screen the help sentence sits smaller, under the friendly line */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

header { position: fixed; z-index: 3; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 14px 0; pointer-events: none; }
header > * { pointer-events: auto; }
#mark { font-family: var(--mono); font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--dim); text-decoration: none; padding: 8px 4px; }
#mark:hover { color: var(--cream); }
#snd { position: relative; width: 40px; height: 40px; font-size: 18px; line-height: 1; color: var(--dim); background: rgba(18, 14, 38, .45);
  border: 2px solid rgba(205, 191, 224, .45); cursor: pointer; padding: 0; }
#snd[aria-pressed="false"]::after { content: ""; position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; background: currentColor; transform: rotate(-38deg); }
#snd[aria-pressed="true"] { color: var(--ink); background: var(--flame); border-color: var(--flame); }

main { position: fixed; z-index: 2; left: 0; right: 0; top: 0; padding: clamp(58px, 9vh, 96px) 18px 0; display: flex; justify-content: center; pointer-events: none; }
main > * { pointer-events: auto; width: 100%; max-width: 30rem; text-align: center; }

label { display: block; font-size: clamp(21px, 5.6vw, 28px); line-height: 1.2; margin: 0 0 14px; text-shadow: 0 2px 0 rgba(18, 14, 38, .7); }
.row { display: flex; gap: 0; }
input { flex: 1; min-width: 0; font: 18px var(--serif); color: var(--ink); background: var(--cream); border: 2px solid var(--cream); border-right: 0;
  border-radius: 0; padding: 12px 12px; outline: none; }
input::placeholder { color: #8a7f9c; font-style: italic; }
button { font: 600 13px var(--mono); letter-spacing: .04em; border-radius: 0; cursor: pointer; color: var(--cream); background: rgba(18, 14, 38, .72);
  border: 2px solid rgba(246, 236, 216, .7); padding: 11px 12px; min-height: 44px; }
button:hover { background: rgba(60, 40, 100, .8); }
#go, .primary { color: var(--ink); background: var(--flame); border-color: var(--flame); box-shadow: 0 3px 0 #b9703a; }
#go:hover, .primary:hover { background: #ffe2a4; }
#go:active, .primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #b9703a; }
.quiet { border-color: transparent; background: rgba(18, 14, 38, .45); color: var(--dim); }
:focus-visible { outline: 3px solid #8fd3ff; outline-offset: 2px; }
input:focus-visible { outline-offset: 0; }

#more { margin-top: 12px; display: grid; gap: 8px; animation: up .35s ease both; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; justify-content: center; }
.chips span { font: 11.5px var(--mono); color: var(--dim); min-width: 3.9em; text-align: right; padding-right: 2px; text-shadow: 0 1px 0 var(--ink); }
.chips button { font-weight: 400; font-size: 11.5px; letter-spacing: 0; padding: 6px 5px; min-height: 36px; border-color: rgba(205, 191, 224, .4); }
.chips button[aria-pressed="true"] { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.about { font: 11px var(--mono); color: var(--dim); margin: 8px 0 0; }
.about summary { cursor: pointer; width: max-content; text-decoration: underline; }
.about p { margin: 6px 0 0; }
.fine { font: 11.5px var(--mono); color: var(--dim); margin: 12px 0 0; text-shadow: 0 1px 0 var(--ink); }

#svc { max-width: 34rem; }
#line { font-size: clamp(20px, 5.4vw, 27px); line-height: 1.36; margin: 2vh 0 0; min-height: 5em; opacity: 0; transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease; text-shadow: 0 2px 0 rgba(18, 14, 38, .85), 0 0 18px rgba(18, 14, 38, .9); text-wrap: balance; }
#line.in { opacity: 1; transform: none; }
#hint { font: 11px var(--mono); color: var(--dim); opacity: .7; margin: 6px 0 0; }
#all { text-align: left; font-size: 14px; line-height: 1.38; max-height: var(--room, 46vh); overflow: auto; padding: 14px 16px; background: rgba(18, 14, 38, .78);
  border: 2px solid rgba(205, 191, 224, .28); animation: up .5s ease both; scrollbar-width: thin; }
#all p { margin: 0 0 .5em; }
#all p:last-child { margin: 0; }
#all p.q { color: var(--flame); }
#gtext { margin: 5vh 0 20px; }
#gentle p { font-size: clamp(19px, 5vw, 24px); line-height: 1.45; margin: 0 0 .7em; text-wrap: balance; text-shadow: 0 2px 0 rgba(18, 14, 38, .85), 0 0 18px rgba(18, 14, 38, .9); }
#gentle.care p { font-size: clamp(17px, 4.5vw, 21px); }
#carve { position: fixed; z-index: 1; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden; color: #2c2b47;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Noto Serif", "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", serif;
  font-weight: 700; line-height: 1.08; letter-spacing: .03em; overflow-wrap: anywhere; filter: grayscale(1);
  text-shadow: 0 2px 0 rgba(255, 255, 255, .42), 0 -1px 0 rgba(20, 18, 40, .35); transition: opacity .6s ease; cursor: default; }
#carve { display: none; }
.sug { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin-top: 10px; animation: up .25s ease both; }
.sug button { font-weight: 400; font-size: 12.5px; letter-spacing: 0; padding: 7px 9px; min-height: 36px; border-color: rgba(255, 210, 122, .55); color: var(--flame); }
.sug button:hover { background: var(--flame); color: var(--ink); }
#none > p:first-child { font-size: clamp(20px, 5.2vw, 25px); line-height: 1.4; margin: 5vh 0 4px; text-shadow: 0 2px 0 rgba(18, 14, 38, .85), 0 0 18px rgba(18, 14, 38, .9); }
#none .sug { margin: 8px 0 14px; }
#none p { margin: 0 0 10px; }
.tiny { font-size: 11px; font-weight: 400; min-height: 28px; padding: 4px 8px; border: 0; background: none; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
.tiny:hover { background: none; color: var(--cream); }
.heavier { font-size: 12.5px; color: var(--cream); margin-top: 14px; }
/* the help line: plain text, small and quiet, always in view on every screen that is not a service */
#gentle p.helpline, #none p.helpline, .nojs p.helpline { font: 400 12.5px/1.45 var(--mono); color: var(--cream); opacity: .92; max-width: 22rem; margin: 6px auto 16px; text-wrap: balance; text-shadow: 0 1px 0 var(--ink), 0 0 12px rgba(18, 14, 38, .9); }
.nojs p.helpline { font-family: ui-monospace, Menlo, Consolas, monospace; margin-top: 18px; }
#gentle p.help { font-size: clamp(16px, 4.2vw, 19px); margin: 0 0 .35em; }
#gentle a { color: var(--flame); text-underline-offset: 3px; }
#gentle p:has(.heavier), #none p:has(.heavier) { margin: 0; }
.nojs { max-width: 30rem; margin: 0 auto; padding: 8vh 18px; text-align: center; font-size: 19px; line-height: 1.45; }
.nojs img { width: min(84vw, 450px); height: auto; image-rendering: pixelated; image-rendering: crisp-edges; display: block; margin: 0 auto 22px; }

#acts { position: fixed; z-index: 3; left: 0; right: 0; bottom: 0; padding: 0 12px max(14px, env(safe-area-inset-bottom)); display: grid; gap: 9px; justify-items: center;
  animation: up .5s ease both; pointer-events: none; }
#acts > * { pointer-events: auto; }
.btns { display: flex; gap: 6px; flex-wrap: nowrap; justify-content: center; }
.btns button { white-space: nowrap; }
.btns button { font-size: 12px; padding: 10px 9px; }
body.short main { justify-content: flex-start; padding-left: 16px; }
body.short main > * { max-width: 47vw; }
body.short #acts { right: auto; width: 52vw; }
body.short #all { max-height: 52vh; }
#own { min-width: min(20rem, 86vw); font-size: 14px; }
#flower { border-color: #ff9fb0; color: #ffd9df; }
#flower:disabled { opacity: .75; cursor: default; }

@keyframes up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* the two quiet screens and the calm one may be taller than a small or zoomed screen: they scroll, so the help and the way back are always reachable */
#gentle, #none { max-height: calc(100vh - clamp(58px, 9vh, 96px) - 10px); max-height: calc(100dvh - clamp(58px, 9vh, 96px) - 10px); overflow-y: auto; overscroll-behavior: contain; padding-bottom: 12px; box-sizing: border-box; }
@media (max-width: 300px) {   /* a small phone at 200% zoom: buttons wrap and stay on the screen */
  #gentle p, #gentle.care p, #none > p:first-child { font-size: 16px; line-height: 1.35; }
  #gtext { margin-top: 1vh; }
  .btns { flex-wrap: wrap; }
  .btns button, button { white-space: normal; max-width: 100%; }
  main > *, #acts { max-width: 100%; box-sizing: border-box; }
}
/* the same small screen during and after a service: the eulogy keeps to the sky, the stone stands clear, the buttons sit beneath it */
body.tight main { padding-top: 44px; padding-left: 8px; padding-right: 8px; }
body.tight #all { max-height: var(--room, 30vh); font-size: 12.5px; line-height: 17px; padding: 0 9px; border: 0 solid transparent; border-width: 7px 0; box-sizing: border-box; scroll-snap-type: y proximity; }
/* the finished eulogy is paged: one whole part at a time, never cut in the middle; the small button under it turns the page */
body.tight #all { height: var(--room, 30vh); }
body.tight #all p { margin: 0; display: none; }
body.tight #all p.on { display: block; }
body.tight #line { font-size: 16px; line-height: 1.3; margin-top: 0; min-height: 0; }
body.tight #hint { display: none; }
#pager { display: block; margin: 0 auto; min-height: 22px; padding: 2px 8px; font: 10.5px var(--mono); color: var(--cream); text-decoration: none; }
#pager[hidden] { display: none; }
body.tight #acts { padding: 0 6px 6px; gap: 4px; }
body.tight .btns { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; }
body.tight .btns button { font-size: 11px; padding: 4px 3px; min-height: 0; height: 34px; }
body.tight #own { min-width: 0; width: 100%; font-size: 12px; padding: 4px; min-height: 0; height: 34px; }
@media (min-width: 760px) {
  #mark { font-size: 13px; }
  input { font-size: 20px; padding: 14px 16px; }
  #all { font-size: 16.5px; }
  .chips button { font-size: 13px; }
}
@media (max-height: 520px) {
  main { padding-top: 46px; }
  label { font-size: 19px; margin-bottom: 8px; }
  #all { max-height: 38vh; font-size: 13.5px; }
  .fine { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
