/* The Almanac site: a dark night ground and a ruled-paper leaf, as in the games' notebooks.
   Range Fell & Range Fell SC: modified (subset, renamed) IM FELL English by Igino Marini, (c) 2007,
   licensed under the SIL Open Font License 1.1, https://openfontlicense.org */
@font-face { font-family: 'Range Fell'; src: url(../fonts/range-fell.woff2) format('woff2'); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Range Fell'; src: url(../fonts/range-fell-italic.woff2) format('woff2'); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: 'Range Fell SC'; src: url(../fonts/range-fell-sc.woff2) format('woff2'); font-style: normal; font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --night: #0e1016; --night-2: #171c26; --night-3: #222836;
  --bone: #e7ddc6; --dust: #989186; --lamp: #f1c57b; --ochre: #c69c56; --iron: #bb5a3b; --sage: #bccdb2;
  --paper: #d9d3c2; --paper-2: #cfc8b5; --paper-ink: #2a2c35; --paper-mute: #6c675c; --paper-red: #b2513d; --paper-rule: #a3b7c6;
  --f-body: "Range Fell", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --f-sc: "Range Fell SC", "Range Fell", "Palatino Linotype", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night); color: var(--bone);
  font: 1.08rem/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--lamp); }
button { font: inherit; }
.sc { font-family: var(--f-sc); letter-spacing: 0.04em; }
[hidden] { display: none !important; }

/* ── the shell around library and sign-in ── */
.wrap { max-width: 40rem; margin: 0 auto; padding: max(6vh, 32px) 16px 48px; }
.mast { text-align: center; margin-bottom: 28px; }
.mast h1 { font: 2.6rem/1 var(--f-sc); letter-spacing: 0.06em; margin: 0; color: var(--bone); }
.who { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--dust); font-size: 0.92rem; margin: 0 2px 14px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--lamp); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ── the paper leaf ── */
.leaf {
  background: var(--paper) repeating-linear-gradient(transparent 0 calc(1.75rem - 1px), color-mix(in srgb, var(--paper-rule) 55%, transparent) calc(1.75rem - 1px) 1.75rem);
  color: var(--paper-ink); border-radius: 3px; padding: 26px 24px 24px 40px;
  box-shadow: 0 1px 0 #0006, 0 18px 40px -18px #000c;
  position: relative;
}
.leaf::before { content: ""; position: absolute; top: 0; bottom: 0; left: 18px; border-left: 1px solid color-mix(in srgb, var(--paper-red) 45%, transparent); }
.leaf > * { position: relative; }
.leaf h2 { font: 1.15rem/1.3 var(--f-sc); letter-spacing: 0.05em; margin: 0 0 12px; color: var(--paper-ink); }

/* sign-in */
.field { display: block; margin: 0 0 14px; }
.field span { display: block; font: 0.92rem var(--f-sc); letter-spacing: 0.05em; color: var(--paper-mute); margin-bottom: 4px; }
.field input {
  width: 100%; font: 1.08rem var(--f-body); color: var(--paper-ink);
  background: #fffaf0b0; border: 1px solid var(--paper-mute); border-radius: 2px; padding: 8px 10px;
}
.field input:focus-visible { outline: 2px solid var(--ochre); outline-offset: 1px; }
.btn {
  font: 1.02rem var(--f-sc); letter-spacing: 0.06em; cursor: pointer;
  background: var(--paper-ink); color: var(--paper); border: 0; border-radius: 2px; padding: 9px 20px;
}
.btn:hover { background: #3a3d48; }
.btn:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn.quiet { background: transparent; color: var(--paper-ink); box-shadow: inset 0 0 0 1px var(--paper-mute); }
.fine { color: var(--paper-mute); font-size: 0.95rem; font-style: italic; margin: 16px 0 0; }
.err { color: var(--paper-red); margin: 0 0 12px; }

/* library */
.games { list-style: none; padding: 0; margin: 0; }
.game { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 6px 0 18px; }
.game + .game { border-top: 1px dashed var(--paper-mute); padding-top: 18px; }
.game h3 { margin: 0; font: 1.5rem/1.15 var(--f-sc); letter-spacing: 0.04em; }
.game .line { margin: 2px 0 0; font-style: italic; color: var(--paper-mute); }
.game .where { margin: 6px 0 0; font-size: 0.98rem; }
.game .where small { color: var(--paper-mute); font-size: 0.9rem; }
.game .go { grid-row: 1 / span 3; grid-column: 2; text-decoration: none; }
@media (max-width: 480px) {
  .game { grid-template-columns: 1fr; }
  .game .go { grid-row: auto; grid-column: 1; justify-self: start; margin-top: 8px; }
  .mast h1 { font-size: 2.1rem; }
  .leaf { padding: 22px 16px 20px 32px; }
  .leaf::before { left: 16px; }
}

/* ── the play page ── */
.play { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.strip {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 30px; padding: 0 12px; background: var(--night); color: var(--dust);
  font: 0.86rem/1 var(--f-sc); letter-spacing: 0.06em; border-bottom: 1px solid var(--night-3);
}
.strip a { color: var(--dust); text-decoration: none; }
.strip a:hover, .strip a:focus-visible { color: var(--bone); }
.sync { white-space: nowrap; }
.sync.pending { color: var(--ochre); }
.sync.pending::before { content: "◆ "; }
.stage { flex: 1; position: relative; min-height: 0; }
.stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--night); }
.notice { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--dust); font-style: italic; }
.notice .btn { margin-top: 14px; background: var(--bone); color: var(--night); font-style: normal; }

/* the "which life to keep?" question */
dialog.ask { border: 0; padding: 0; background: transparent; max-width: min(34rem, calc(100vw - 32px)); }
dialog.ask::backdrop { background: #05070bcc; }
dialog.ask .leaf p { margin: 0 0 12px; }
.choices { display: grid; gap: 10px; margin-top: 16px; }
.choices .btn { text-align: left; padding: 10px 14px; font-family: var(--f-body); letter-spacing: 0; line-height: 1.35; }
.choices .btn small { display: block; font-size: 0.88rem; opacity: 0.8; }

@media (prefers-reduced-motion: no-preference) {
  .notice span { animation: breathe 2.4s ease-in-out infinite; }
  @keyframes breathe { 50% { opacity: 0.45; } }
}
