/* phones: no double-tap zoom, no pull-to-refresh or rubber-banding, no text selection or callouts while praying */
html, body { touch-action: manipulation; overscroll-behavior: none; -webkit-touch-callout: none; }
/* The rosary's own pieces, on top of the game's style.css (its colours, .panel, .big-btn, .round-btn, #dialog). */
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; display: block; }
#title { z-index: 40; }
/* the title screen leaves Mary in the garden clearly in view: no blur; the title on the left of a wide screen,
   at the top of a tall one */
@media (min-aspect-ratio: 11/10) { #title { justify-content: flex-start; padding-left: 5vw; } }
@media (max-aspect-ratio: 11/10) { #title { align-items: flex-start; padding-top: calc(6vh + env(safe-area-inset-top)); } #title .title-foot { display: none; } }
#creator { z-index: 40; background: rgba(60, 40, 20, .35); }
/* the Rosary's wordmark is taller than BibleTown's (it has the ribbon) */
#title .wordmark { aspect-ratio: 562.7 / 166.06; }
#title-btns .title-link { color: #fff; }

/* the chooser (the game's character builder): picture chips with a label under each */
#creator-card { width: min(900px, 96vw); }
#creator-grid { grid-template-columns: 330px 1fr; }
#preview-wrap { height: 400px; }
#preview-caption { position: absolute; left: 10px; right: 10px; bottom: 10px; text-align: center; background: rgba(255, 250, 240, .9);
  border-radius: 16px; padding: 6px 10px 7px; box-shadow: 0 3px 8px rgba(40, 25, 10, .15); }
#preview-caption b { display: block; font: 600 19px/1.2 'Fredoka'; color: var(--brown); }
#preview-caption span { font: 700 13px 'Nunito'; color: var(--brown2); }
.pchip.mchip { width: 108px; height: auto; flex-direction: column; display: flex; padding: 0 0 5px; gap: 3px; position: relative; overflow: visible; }
.pchip.mchip img { width: 100%; height: 76px; object-fit: cover; border-radius: 15px 15px 0 0; }
.pchip.mchip .mlabel { font: 600 13px/1.15 'Fredoka'; color: var(--brown); padding: 0 5px; text-align: center; min-height: 2.3em; display: grid; place-items: center; }
.pchip.mchip.set { width: 96px; }
.pchip.mchip.set img { height: 68px; }
.pchip.mchip.set .mlabel { font-size: 15px; min-height: 0; }
.pchip.mchip em { position: absolute; top: -9px; right: -6px; font: 600 11px 'Fredoka'; font-style: normal; background: var(--gold); color: var(--brown);
  border-radius: 99px; padding: 1px 8px; border: 2px solid #fff; }
.pchip.mchip:disabled { opacity: .55; cursor: default; }
.pchip.mchip:disabled .mlabel { min-height: 76px; }
.pchip.mchip.all .allpic { height: 76px; display: grid; place-items: center; }
.pchip.mchip.all .allpic .ico { width: 54px; height: 54px; }
#creator-opts .chips { gap: 8px; }
#pick-go:disabled { filter: saturate(.3); opacity: .6; }
@media (max-width: 720px) { #creator-grid { grid-template-columns: 1fr; } #preview-wrap { height: 230px; } }
@media (max-width: 600px) and (min-height: 501px) { #preview-wrap { height: 190px; } .pchip.mchip { width: 92px; } .pchip.mchip img { height: 62px; } }

/* the end */
.end-btns { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 10px; }
/* a phone held upright: the scene on top, the words on warm paper below */
body.tall { background: linear-gradient(#a7cf72, #f6ead0 30%); }
body.tall #bars::before, body.tall #bars::after { display: none; }

body.tall #dialog, body.tall.cinema #dialog { bottom: calc(14px + env(safe-area-inset-bottom)); }
body.tall #mys-card { top: 26vh; padding: 12px 18px 14px; }
body.tall #end { place-items: end center; }
body.tall #ponder { font-size: 14px; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--sky); font: 600 22px 'Fredoka'; z-index: 50; }

/* letterbox bars while a mystery is told (the game's cutscenes, src/cutscene.js) */
#bars { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#bars::before, #bars::after { content: ''; position: absolute; left: 0; right: 0; height: 0; background: #1a120b; transition: height .45s ease; }
#bars::before { top: 0; } #bars::after { bottom: 0; }
body.cinema #bars::before, body.cinema #bars::after { height: min(9vh, 64px); }
body.cinema #dialog { bottom: calc(min(9vh, 64px) + 8px + env(safe-area-inset-bottom)); }
#fade { position: fixed; inset: 0; background: #fff8e6; opacity: 0; pointer-events: none; z-index: 8; transition: opacity .35s ease; }
#fade.on { opacity: 1; }

#hud { position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; left: auto; bottom: auto; inset-inline-start: auto; display: flex; gap: 10px; z-index: 30; pointer-events: auto; }
#hud .round-btn { display: grid; place-items: center; }
#hud .round-btn .ico { width: 26px; height: 26px; }
body.cinema #hud { top: calc(min(9vh, 64px) + 10px); }

/* the mystery's title, as a chapter title in the game */
#mys-card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 12; text-align: center;
  background: radial-gradient(circle at 50% 0%, #fffaf0, #f7e7c2); border: 6px solid #fff; border-radius: 30px; box-shadow: var(--shadow);
  padding: 18px 34px 20px; animation: tcIn .6s cubic-bezier(.34, 1.4, .64, 1); width: max-content; max-width: min(520px, 88vw); box-sizing: border-box;
}
@keyframes tcIn { from { opacity: 0; transform: translate(-50%, -40%) scale(.9); } }
#mys-card small { display: block; font: 600 14px 'Fredoka'; letter-spacing: .1em; text-transform: uppercase; color: #b8862a; }
#mys-card b { display: block; font: 600 34px/1.15 'Fredoka'; color: var(--brown); margin: 4px 0; }
#mys-card span { font: 600 14px 'Fredoka'; color: var(--brown2); letter-spacing: .06em; text-transform: uppercase; }

/* a thought while the Hail Marys are prayed: quiet, see-through, centred just above the words (can be turned off) */
#ponder {
  position: absolute; left: 50%; bottom: calc(100% + 56px); transform: translateX(-50%); width: max-content; max-width: min(520px, 86vw);
  background: rgba(40, 28, 16, .38); color: #fffaf0; border-radius: 14px; padding: 6px 14px 7px; text-align: center; pointer-events: none;
  font: 700 15px/1.3 Nunito, system-ui, sans-serif; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); animation: ponderIn 1.2s ease-out;
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
@keyframes ponderIn { from { opacity: 0; } }
#ponder::before { content: none; }
#dialog:has(#beads.hidden) #ponder { bottom: calc(100% + 14px); }

/* praying: the dialog box grows into a prayer card; the words light up as they're said */
#dialog.praying { width: min(820px, 96vw); cursor: default; }
#dialog.praying #dlg-text { font-family: 'Nunito'; font-weight: 700; font-size: 21px; line-height: 1.5; min-height: 0; }
#dialog.praying #dlg-text span { color: rgba(90, 68, 48, .45); transition: color .25s; }
#dialog.praying #dlg-text span.said { color: var(--brown); }
#dialog.praying #dlg-text span.clause { color: rgba(176, 72, 90, .5); font-style: italic; }
#dialog.praying #dlg-text span.clause.said { color: #b0485a; }
#hud #btn-pause { font: 700 17px 'Fredoka'; letter-spacing: -2px; }
#paused-note { position: fixed; left: 50%; top: calc(18px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 26; display: none; pointer-events: none;
  background: rgba(255, 248, 230, .95); border-radius: 999px; padding: 10px 22px; box-shadow: var(--shadow); font: 600 20px 'Fredoka'; }
body.paused #paused-note { display: block; }
body.paused #stage { filter: saturate(.6) brightness(.95); }
#dlg-choices:has(.pic-choice) { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
#dlg-choices button.pic-choice { display: flex; align-items: center; gap: 10px; text-align: left; }
#dlg-choices button.pic-choice::before { display: none; }
#dlg-choices button.pic-choice img { width: 78px; height: 52px; object-fit: cover; border-radius: 10px; border: 2px solid #fff; flex: none; }

/* the beads: an Our Father, ten Hail Marys that become roses, a Glory Be */
#beads {
  position: absolute; left: 50%; top: -26px; transform: translate(-50%, -50%); display: flex; gap: 8px; align-items: center;
  white-space: nowrap; padding: 8px 14px; border-radius: 999px; border: 2px solid rgba(138, 106, 72, .35);
  background: rgba(255, 248, 230, .82); box-shadow: 0 4px 12px rgba(40, 25, 10, .18);
}
.bead { width: 22px; height: 22px; border-radius: 50%; background: #fffaf0; border: 2.5px solid rgba(138, 106, 72, .5); display: grid; place-items: center; transition: transform .3s; font-size: 12px; color: var(--brown2); }
.bead.big { width: 28px; height: 28px; }
.bead.done { background: #d9c6a6; }
.bead.on { transform: scale(1.3); border-color: var(--brown); box-shadow: 0 0 0 5px rgba(242, 193, 78, .5); }
.bead.rose { border: 0; background: none; animation: bloomIn .8s ease-out; }
.bead.rose svg { width: 26px; height: 26px; }
@keyframes bloomIn { from { opacity: 0; } }

/* the end */
#end { position: fixed; inset: 0; display: grid; place-items: end center; padding: 0 12px calc(24px + env(safe-area-inset-bottom)); z-index: 25; pointer-events: none; }
#end .panel { pointer-events: auto; width: min(560px, 94vw); padding: 18px 22px 22px; text-align: center; animation: tcIn .5s ease-out; }
#end h3 { font: 600 16px 'Fredoka'; letter-spacing: .08em; text-transform: uppercase; color: #b8862a; margin: 0 0 10px; }
.fruit { background: #fff; border-radius: 16px; padding: 10px 14px; margin-bottom: 8px; }
.fruit b { display: block; font: 600 20px 'Fredoka'; }
.fruit span { font-size: 17px; }


@media (max-width: 560px) {
  #dlg-portrait.narrator { width: 56px; height: 56px; left: 12px; top: 12px; }
  #dlg-portrait.narrator .ico { width: 36px; height: 36px; }
  #dialog:has(#dlg-portrait:not(.hidden)) { padding-left: 84px; }
  #dialog.praying #dlg-text { font-size: 17px; }
  #mys-card b { font-size: 26px; }
  .bead { width: 18px; height: 18px; } .bead.big { width: 22px; height: 22px; } .bead.rose svg { width: 21px; height: 21px; }
  #beads { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { #mys-card, #ponder, #bubble, .bead.rose { animation: none; } }

/* once the prayer is under way the box drops the narrator's badge and name, for the words' sake */
#dialog.compact #dlg-portrait { display: none; }
#dialog.compact { padding-left: 22px; min-height: 0; }
#dialog.compact #dlg-name.hidden { display: none; }
/* words hidden: just the scene, the voice and the beads (the ✎ button in the corner brings them back) */
body.words-off #dialog { background: none; border-color: transparent; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
body.words-off #dialog > :not(#beads) { visibility: hidden; }
body.words-off #dlg-text { height: 0; min-height: 0; overflow: hidden; }
body.words-off #dialog { padding: 0; min-height: 0; height: 40px; }
body.words-off #dialog #beads { top: auto; bottom: 0; }
/* the welcome on the title screen */
#title-hello { margin: 4px 0 0; font: 600 20px/1.3 'Fredoka'; color: #fff; text-shadow: 0 1px 0 rgba(61, 38, 15, .55), 0 1px 6px rgba(40, 25, 10, .5); max-width: min(440px, 86vw); }
/* sets not open yet */
.pchip.mchip.soon img { filter: grayscale(.6); opacity: .7; }
.pchip.mchip.soon em { background: #e8dcc4; color: var(--brown2); white-space: nowrap; }

/* the chooser on a phone held upright: tiles keep their own height, smaller set tiles, a slimmer caption and prompt */
.chips.strip { align-items: flex-start; }
@media (max-width: 600px) {
  #creator-card h2 { font-size: 19px; line-height: 1.15; }
  #creator-prompt { font-size: 14px; margin: 2px 0 6px; }
  #preview-wrap { height: 170px; }
  #preview-caption { left: 6px; right: 6px; bottom: 6px; padding: 3px 8px 4px; border-radius: 12px; }
  #preview-caption b { font-size: 15px; }
  #preview-caption span { font-size: 11px; }
  .pchip.mchip { width: 86px; }
  .pchip.mchip img { height: 56px; }
  .pchip.mchip .mlabel { font-size: 12px; min-height: 2.3em; }
  .pchip.mchip.set { width: 80px; }
  .pchip.mchip.set img { height: 52px; }
  .pchip.mchip.set .mlabel { font-size: 13px; }
  .pchip.mchip:disabled .mlabel { min-height: 0; }
  .pchip.mchip em { font-size: 10px; padding: 0 6px; right: -2px; }
  .pchip.mchip.all .allpic { height: 56px; }
  #creator-opts .opt-row { margin-bottom: 8px; }
  #creator-opts .chip { font-size: 14px; padding: 4px 11px; }
}
