:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ink: #243730;
  --pine: #254438;
  --paper: #f3ead7;
  --rule: #c1af8f;
  --ochre: #884b27;
  --gutter: clamp(13px, 4.5vw, 28px);
  --turn: .38s;
  color: var(--ink);
  background: #142823;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 4%, #405950, #142823 74%);
}
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; text-wrap: pretty; }
p { text-wrap: pretty; }
button { font: inherit; -webkit-tap-highlight-color: transparent; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 2px solid #9b4c22; outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.shell {
  margin-inline: auto;
  width: min(100%, 615px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: radial-gradient(ellipse at 15% 0%, #fcf5e7 0, transparent 80%), var(--paper);
  box-shadow: 0 0 80px #08180f9c;
}
.masthead {
  background: #1b312a;
  color: #fff3d8;
  border-bottom: 1px solid #cca06d;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 11px;
}
.brand { font-size: .69rem; letter-spacing: .20em; font-weight: 750; display: flex; align-items: center; gap: 7px; }
.book { width: 16px; height: 10px; display: inline-block; position: relative; }
.book::before, .book::after {
  content: ""; position: absolute; top: 0; width: 8px; height: 8px; border: 1px solid currentColor;
}
.book::before { left: 0; transform: skewY(14deg); border-radius: 2px 0 0 1px; }
.book::after { right: 0; transform: skewY(-14deg); border-radius: 0 2px 1px 0; }
.title { font: 400 1.03rem/1.1 var(--serif); text-align: right; }
.book-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}
.sheet {
  display: flex;
  flex-direction: column;
  gap: clamp(7px, 1.5vh, 13px);
  gap: clamp(7px, 1.5dvh, 13px);
  padding: clamp(8px, 1.5vh, 15px) var(--gutter) clamp(7px, 1.4vh, 12px);
  padding: clamp(8px, 1.5dvh, 15px) var(--gutter) clamp(7px, 1.4dvh, 12px);
  min-height: 0;
}
.sheet > .part { flex: 0 0 auto; }
.sheet > .fluid { flex: 1 1 0; }
.sheet > .actions { margin-top: auto; }
.overline {
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--ochre);
  margin-bottom: 4px;
}
.heading h1 { font-size: 1.48rem; line-height: 1.09; }
.primary, .quiet, .option {
  min-height: 44px;
  padding: 7px 10px;
  border-radius: 3px;
  font-weight: 650;
  font-size: .98rem;
  line-height: 1.16;
}
.primary {
  background: var(--pine);
  color: #fff4dc;
  border: 1px solid #233f35;
  box-shadow: inset 0 0 0 2px #d9c29927;
}
.primary:hover:not(:disabled) { background: #34574a; }
.primary:disabled { color: #565a4e; background: #e6dfcc; border-color: #a99e85; box-shadow: none; }
.quiet {
  background: transparent;
  color: var(--pine);
  border: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: #71816f;
}
.quiet:hover { text-decoration-color: currentColor; }
.quiet:disabled { opacity: .48; }
.option {
  width: 100%;
  text-align: left;
  background: #fffbefb3;
  color: var(--ink);
  border: 1px solid #baac91;
  padding: 10px 12px;
}
.option[aria-pressed="true"] { background: #e0eadb; border-color: #426652; box-shadow: inset 3px 0 #426652; }
.theme-button { font: 500 1.24rem/1.13 var(--serif); }
.actions { display: grid; gap: 2px; }
.actions.inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions.inline .whole { grid-column: 1 / -1; }
.cover {
  position: relative;
  isolation: isolate;
  display: grid;
  align-content: end;
  min-height: 176px;
  padding: 15px;
  color: #fff2da;
  border: 1px solid #a09274;
  background: linear-gradient(0deg,#1b312af0, transparent 73%), url("rive.webp") center 44% / cover;
}
.cover h1 { font-size: clamp(2rem, 9vw, 3.25rem); line-height: .99; max-width: 9em; }
.cover .overline { color: #f3c78a; }
.choice-heading { padding-block: 3px; }
.cast-top { display: grid; grid-template-columns: 1fr minmax(72px, 29%); align-items: center; gap: 10px; }
.cast-top h1 { font-size: 1.68rem; line-height: 1.01; }
.cast-question { font: 400 1rem/1.16 var(--serif); margin-top: 6px; }
.figure {
  display: grid;
  gap: 5px;
  width: min(100%, 128px);
}
.figure .line { height: 6px; display: flex; justify-content: space-between; color: var(--pine); }
.figure .line span { width: 43.5%; border-radius: 1px; background: currentColor; }
.figure .line.full span { width: 50%; border-radius: 0; }
.figure .line.full span:first-child { border-radius: 1px 0 0 1px; }
.figure .line.full span:last-child { border-radius: 0 1px 1px 0; }
.figure .line.empty span { color: #c4b79d; }
.figure .line.changes { color: #a14b26; }
.board {
  min-height: 139px;
  max-height: 338px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(54px, 1fr));
  gap: clamp(3px, 1.2vh, 11px) 4px;
  gap: clamp(3px, 1.2dvh, 11px) 4px;
  align-items: stretch;
  padding: clamp(7px, 1.4vh, 12px) 4px;
  padding: clamp(7px, 1.4dvh, 12px) 4px;
  border: 1px solid #76543c;
  box-shadow: inset 0 0 0 2px #c29a694e, inset 0 1px 22px #342a2164;
  background: repeating-linear-gradient(169deg,#75523750 0 1px,#7e563d0a 1px 3px,#c0925a2a 3px 5px), radial-gradient(ellipse at 46% 22%, #9a6d4c, #553f31 94%);
}
.coin {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  padding: 0;
  background: none;
  perspective: 470px;
  touch-action: manipulation;
}
.coin:focus-visible { outline-color: #fff0c6; outline-offset: -3px; }
.coin-rotor {
  display: grid;
  position: absolute;
  inset: 1px;
  place-items: center;
  transform-style: preserve-3d;
}
.coin.selected .coin-rotor { transform: rotateY(180deg); transition: transform var(--turn) ease-in-out; }
.coin-back, .coin-front {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(calc(100% - 5px), 115px);
  aspect-ratio: 1;
  max-height: 100%;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.coin-back {
  height: auto;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 3px 2px #302218ad);
}
.coin-front {
  transform: translate(-50%, -50%) rotateY(180deg);
  background: url("pile.webp") center / contain no-repeat;
}
.cast-feedback { display: grid; text-align: center; align-content: center; min-height: 68px; gap: 1px; }
.cast-feedback p { font: 500 1.05rem/1.17 var(--serif); }
.coin-key { color: #6f4b32; font-size: .86rem; }
.coin-marks { display: flex; justify-content: center; align-items: start; gap: 13px; }
.coin-mark { display: grid; justify-items: center; gap: 2px; width: 38px; }
.engraved-line {
  display: flex;
  justify-content: space-between;
  width: 100%;
  height: 5px;
  color: var(--pine);
}
.engraved-line span { background: currentColor; width: 39%; }
.engraved-line.solid span { width: 50%; }
.engraved-line span:first-child { border-radius: 1px 0 0 1px; }
.engraved-line span:last-child { border-radius: 0 1px 1px 0; }
.engraved-line.broken span { border-radius: 1px; }
.mark-value { font-weight: 700; font-size: .875rem; line-height: 1.15; color: #624329; }
.coin-front .coin-marks {
  position: absolute;
  inset-inline: 10%;
  top: 50%;
  min-height: 22%;
  padding-inline: 5%;
  transform: translateY(-50%);
  align-items: center;
  gap: 7px;
  border-block: 1px solid #bfa6819e;
  border-radius: 2px;
  background: radial-gradient(ellipse at 25% 15%, #345a53, #183730 86%);
  box-shadow: inset 0 1px 1px #0b2924, 0 1px 1px #122821b0;
}
.coin-front .coin-mark { flex: 1 1 0; width: auto; min-width: 0; }
.coin-front .engraved-line {
  height: 4px;
  color: #fff0c4;
  filter: drop-shadow(0 1px 1px #132720);
}
.cast-actions { min-height: 44px; }
.art-panel {
  min-height: 118px;
  max-height: min(520px, 59vh);
  max-height: min(520px, 59dvh);
  width: 100%;
  display: grid;
  position: relative;
  background: #c5a783;
  border-block: 1px solid #8e7657;
}
.art-panel img { width: 100%; height: 100%; min-height: 0; position: absolute; object-fit: cover; object-position: center var(--subject, 50%); }
.reading-heading .overline { margin-bottom: 3px; }
.illustrated-advice {
  background: #fffae8d1;
  border: 1px solid #c3a57a;
  border-left: 3px solid #9d6137;
  padding: 7px 9px;
}
.illustrated-advice h2 { color: #75451f; font-size: 1.11rem; margin-bottom: 2px; }
.illustrated-advice p, .explainer p, .unavailable p { font: 400 1.055rem/1.24 var(--serif); }
.result-actions .quiet { padding-inline: 5px; font-size: .91rem; }
.figure-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.figure-pair.single { grid-template-columns: minmax(0, 1fr); }
.figure-card {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 7px 9px 10px;
  min-height: 99px;
  background: #e1e7d6b0;
  border: 1px solid #aab399;
}
.figure-card h2 { font-size: 1.03rem; line-height: 1.11; }
.figure-card .figure { justify-self: center; }
.unavailable { padding: 9px 11px; background: #fffae8b3; border-left: 3px solid #a1623c; }
.explainer { display: grid; gap: 6px; }
.river-panel {
  min-height: 104px;
  overflow: hidden;
  isolation: isolate;
  background: #52716c;
  position: relative;
}
.river-panel img { position: absolute; }
.river-background { width: 100%; height: 100%; object-fit: cover; object-position: 50% 65%; }
.river-panel .goose {
  width: clamp(46px, 15vw, 84px);
  left: 27%;
  bottom: 17%;
  filter: drop-shadow(0 2px 1px #3c4d386f);
}
.history-item { border-top: 1px solid var(--rule); padding-top: 4px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; }
.history-item p { font: 500 1rem/1.19 var(--serif); }
.history-item small, .history-meta { font-size: .81rem; color: #745139; }
.pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; margin-inline: var(--gutter); border-top: 1px solid var(--rule); padding: 4px 0 5px; }
.pager .quiet { justify-self: start; }
.pager .primary { justify-self: end; }
.pager span { font-size: .84rem; color: #725038; }
@media (prefers-reduced-motion: reduce) { :root { --turn: 0s; } }
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.result-actions .primary { flex: 1 1 max-content; }
.result-actions .quiet { flex: 0 0 auto; }
.result-actions button, .pager button { min-width: 0; overflow-wrap: anywhere; }
.board[data-locked] .coin:not(.selected) { opacity: .72; cursor: default; }
@media (max-height: 600px) {
  .river-background { object-position: 50% 70%; }
}
.coin-front .engraved-line.broken span { width: calc((100% - 3.5px) / 2); }
.private-prompt {
  display: grid;
  align-content: center;
  min-height: max-content;
  padding: 16px;
  background: linear-gradient(115deg, #e1e8d8, #fbf5e4 76%);
  border: 1px solid #afa883;
}
.private-prompt p { font: 500 clamp(1.19rem, 4vw, 1.65rem)/1.31 var(--serif); max-width: 36ch; }
.orientation h1 { font-size: clamp(1.6rem, 5vw, 2.24rem); }
.answer-copy {
  border-block: 1px solid var(--rule);
  padding: 9px 1px;
}
.answer-copy p, .line-note p { font: 400 1.09rem/1.29 var(--serif); }
.figure-role { font-size: .75rem; font-weight: 700; color: #63492f; }
.figure-card { grid-template-rows: auto 1fr auto; gap: 6px; }
.figure-card h2 { font-size: 1.11rem; }
[data-screen="reading"] .figure-pair { padding-block: 5px; }
[data-screen="reading"] .figure-card {
  min-height: 139px;
  padding-top: 11px;
  background: radial-gradient(ellipse at 75% 0%, #fbf3dd, #dce7d7 89%);
}
.art-panel:is(.art-panel-whole, [data-scene="atelier"], [data-scene="le-vase-au-seuil-a"]) img { object-fit: contain; object-position: center; }
.art-panel-whole { background: #e9ddc2; }
.art-panel[data-scene="atelier"] {
  background: radial-gradient(ellipse at center, #ceac70, #584d3c);
  max-height: none;
}
.line-note { border-left: 2px solid #a0643b; padding: 3px 9px; }
.line-note h3 { font-size: 1.03rem; color: #75451f; margin-bottom: 3px; }
.line-note p + p { margin-top: 4px; }
[data-screen="explanation"] .river-panel { max-height: 32dvh; }
[data-screen="explanation"] .actions button { overflow-wrap: anywhere; }
@media (max-width: 460px) {
  .reading-heading h1 { font-size: 1.35rem; }
  .illustrated-advice p { font-size: 1.03rem; }
}
.sheet[data-screen="reading"] > .figure-pair {
  flex: 1 1 0;
  min-height: 149px;
  max-height: 280px;
}
[data-screen="reading"] .figure-card .figure { align-self: end; margin-bottom: 6px; }

.art-panel[data-scene="le-vase-au-seuil-a"] { background: #e9ddc2; }

.cover-intro {
  margin-top: 8px;
  max-width: 34ch;
  font: 400 clamp(1rem, 4vw, 1.2rem)/1.28 var(--serif);
  color: #fff7e8;
}
.cover:has(.cover-intro) {
  background-image: linear-gradient(0deg, #142a23f5, #142a2388 42%, transparent 85%), url("rive.webp");
}
.sheet[data-screen="private-reading"] {
  gap: clamp(6px, 1.25vh, 12px);
  gap: clamp(6px, 1.25dvh, 12px);
}
[data-screen="private-reading"] .direct-title h1 {
  font-size: clamp(1.43rem, 6vw, 2.24rem);
  line-height: 1.12;
  text-wrap: balance;
}
[data-screen="private-reading"] .private-answer { padding-block: 7px; }
[data-screen="private-reading"] .first-step {
  font: 400 clamp(1.03rem, 4.35vw, 1.2rem)/1.25 var(--serif);
}
[data-screen="private-reading"] .art-panel,
[data-screen="private-reading"] .river-panel {
  min-height: 104px;
  max-height: none;
}
.art-panel-whole img { object-fit: contain; object-position: center; }
[data-screen="private-reading"] .figure-pair {
  flex: 1 1 auto;
  max-height: 230px;
  margin-block: auto;
}
[data-screen="private-reading"] .figure-card {
  background: radial-gradient(ellipse at 75% 0%, #fbf3dd, #dce7d7 89%);
  align-items: center;
}
[data-screen="private-reading"] .result-actions {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}
@media (max-height: 600px) {
  [data-screen="private-reading"] .direct-title h1 { font-size: 1.38rem; }
  [data-screen="private-reading"] .first-step { font-size: 1.015rem; }
}

.home-menu {
  gap: 7px;
  padding-top: 3px;
}
.home-menu .primary,
.home-menu .option {
  min-height: 47px;
  padding-inline: 16px;
  text-align: left;
  position: relative;
  padding-right: 32px;
}
.home-menu .quiet { justify-self: center; }
.home-menu .primary::after,
.home-menu .option::after,
.theme-button::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-top: 1.5px solid;
  border-right: 1.5px solid;
  transform: translateY(-50%) rotate(45deg);
}
[data-screen="themes"] .choice-heading,
[data-screen="questions"] .choice-heading {
  padding-block: clamp(5px, 2vh, 18px);
  border-bottom: 1px solid var(--rule);
}
.theme-choice .theme-button {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 6px 31px 6px 7px;
  min-height: 51px;
  background: #fbf5e7;
  border-color: #bbaa8d;
}
.theme-art {
  width: clamp(48px, 14vw, 72px);
  height: clamp(39px, 7vh, 62px);
  object-fit: cover;
  object-position: center 45%;
  border-radius: 1px;
}
.question-button {
  min-height: 52px;
  font: 500 clamp(1.05rem, 4.1vw, 1.24rem)/1.25 var(--serif);
  background: #fffbef;
  padding: 12px 14px;
}
.question-navigation { gap: 3px; }
.question-navigation .option { text-align: center; color: var(--pine); background: #e9ebdc; }
@media (max-height: 480px) {
  [data-screen="home"] .cover { min-height: 90px; }
  [data-screen="home"] .cover-intro { margin-top: 4px; font-size: .95rem; }
  [data-screen="home"] .cover h1 { font-size: 1.75rem; }
  [data-screen="themes"] .choice-heading,
  [data-screen="questions"] .choice-heading { padding-block: 2px; }
  .theme-choice .theme-button, .question-button { min-height: 44px; }
  .theme-art { height: 32px; }
  .question-button { padding-block: 7px; }
}
@media (orientation: landscape) and (max-height: 480px) {
  .question-button {
    font-size: 1.02rem;
    line-height: 1.2;
    padding: 5px 10px;
  }
  .question-navigation {
    display: flex;
    gap: 6px;
  }
  .question-navigation > button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    font-size: .92rem;
  }
}

#book-navigation {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-block: -8px;
}
#book-navigation button {
  min-height: 44px;
  padding: 5px 7px;
  font-size: .91rem;
  color: #fff3d8;
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#book-navigation button:focus-visible { outline-color: #f3c78a; outline-offset: -2px; }
[data-screen="private-reading"] .result-actions button:only-child { grid-column: 1 / -1; }
[data-screen="restart"] .home-menu { margin-top: .5rem; }

.direct-title h1, .cast-question, .history-item p, .explainer p { overflow-wrap: anywhere; }
.history-item { grid-template-columns: minmax(0, 1fr) auto; }

.cast-note-button {
  display: block;
  min-height: 44px;
  padding: 3px 6px 3px 0;
  background: transparent;
  border: 0;
  color: var(--pine);
  font: 500 .95rem/1.2 var(--serif);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.question-note-entry { display: grid; gap: 5px; }
.question-note-field {
  width: 100%;
  min-width: 0;
  min-height: 75px;
  border: 1px solid #a7997a;
  border-radius: 3px;
  padding: 9px 11px;
  background: #fffaf0;
  color: var(--ink);
  font: 400 1.08rem/1.3 var(--serif);
  resize: none;
}
.question-note-entry small { font-size: .81rem; color: #67543b; }

.source-links { display: grid; gap: 7px; margin-top: 5px; }

/* EVERLYS account and installation controls */
.masthead { background: #390a10; }
.masthead .brand { color: inherit; text-decoration: none; }
.access-status { text-align: center; font-size: .88rem; line-height: 1.3; }
.app-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 12px; }
.app-tools button { min-height: 44px; padding: 2px; border: 0; background: transparent; color: #59342f; text-decoration: underline; font-size: .87rem; }
.offer-links a, .access-link { color: #5a241d; }
.access-link { display: grid; place-items: center; text-align: center; }
.offer-links { font-size: .88rem; }
.app-checkout { display: grid; }
.installation-dialog { width: min(91vw, 530px); max-height: 86vh; max-height: 86dvh; padding: 22px; color: var(--ink); background: #fcf4e5; border: 1px solid var(--rule); border-radius: 6px; overflow: auto; }
.installation-dialog::backdrop { background: #1e070be0; }
.installation-dialog h2 { margin-bottom: 8px; font-size: 1.6rem; color: #390a10; }
.installation-dialog p, .installation-dialog dd { line-height: 1.4; }
.installation-dialog dt { font-weight: 700; margin-top: 12px; }
.installation-dialog dd { margin: 4px 0 0; }
.installation-dialog button { margin-top: 12px; }
.art-retry { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); }
