/* Reset, page shell and shared buttons. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper) var(--paper-grain);
  /* Lining figures read at a glance in dates; only real weights and italics, never synthesised. */
  font-variant-numeric: lining-nums;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body[data-mode='scene'], body[data-mode='envelope'] { overflow: hidden; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.script { font-family: var(--font-script); font-weight: 400; font-style: normal; }
.muted { color: var(--ink-soft); }
.hint { font-size: var(--fs-note); color: var(--ink-soft); }
:focus-visible { outline: 3px solid var(--rule); outline-offset: 2px; }

.scene { position: fixed; inset: 0; opacity: 0; pointer-events: none; transition: opacity 0.8s ease; }
.scene.is-visible { opacity: 1; pointer-events: auto; }
body[data-mode='quick'] .scene, body[data-mode='proof'] .scene, body[data-mode='quick'] .overlays { display: none; }
.scene canvas { touch-action: none; width: 100%; height: 100%; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: var(--tap); padding: 0.55em 1.1em; border-radius: 999px;
  border: 1.5px solid var(--rule); background: var(--paper); color: var(--ink);
  text-decoration: none; font-weight: 600; cursor: pointer; transition: transform 0.15s ease, background 0.2s ease;
}
.button:active { transform: scale(0.97); }
/* The main action is filled with the theme's accent (lemon), its text in the deep green. */
.button-primary { background: var(--accent); border-color: var(--accent-deep); color: var(--on-accent); }
.button-ghost { background: transparent; }
.button:disabled { opacity: 0.6; cursor: progress; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.icon-button {
  min-width: var(--tap); min-height: var(--tap); border: 0; background: transparent; font-size: 1.8rem;
  line-height: 1; cursor: pointer; color: var(--ink); border-radius: 50%;
}
.toast {
  position: fixed; left: 50%; bottom: calc(110px + var(--safe-bottom)); transform: translate(-50%, 20px);
  max-width: min(92vw, 460px); padding: 0.7em 1.1em; border-radius: 999px; background: rgba(var(--shadow-rgb), 0.92);
  color: var(--paper); text-align: center; opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; z-index: 60;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.noscript { padding: 2rem; text-align: center; }
body[data-test] *, body[data-test] *::before, body[data-test] *::after { transition: none !important; animation-duration: 0s !important; }
