@font-face {
  font-family: "IM Fell English";
  src: url("../fonts/im-fell-english-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IM Fell English";
  src: url("../fonts/im-fell-english-400-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IM Fell English SC";
  src: url("../fonts/im-fell-english-sc-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --ink: #0e1210;
  --peat: #1a2218;
  --ivory: #f3e6c8;
  --brass: #c4a35a;
  --copper: #c46a2b;
  --amber: #e8a84a;
  --flame: #ff5a18;
  --plum: #3a2438;
  --paper: rgba(14, 18, 16, 0.94);
  --type: #f3e6c8;
  --muted: #cbb892;
}

@media (prefers-color-scheme: light) {
  :root {
    --paper: rgba(243, 230, 200, 0.96);
    --type: #1a160e;
    --muted: #5a4a32;
    --ink: #231c12;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #140e0c;
  color: var(--type);
  font-family: "IM Fell English", Palatino, "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 42%, rgba(8, 6, 4, 0.55) 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(20, 12, 8, 0.03) 3px
    );
  z-index: 2;
}

#flash,
#inkveil {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0;
  z-index: 6;
}

#flash {
  background: #f4efe2;
  mix-blend-mode: screen;
}

#flash.on {
  opacity: 0.82;
}

#inkveil {
  background: radial-gradient(circle at 50% 40%, rgba(20, 10, 8, 0.12), #070605 78%);
}

#inkveil.on {
  opacity: 0.72;
}

#hud {
  position: fixed;
  top: 1rem;
  right: 1.1rem;
  left: 1.1rem;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

#fps {
  font-family: "Fraunces", "IM Fell English", Palatino, "Times New Roman", serif;
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  color: var(--type);
  background: var(--paper);
  border: 1px solid var(--brass);
  padding: 0.35rem 0.7rem 0.28rem;
  min-width: 5.4rem;
  text-align: right;
}

#hearts {
  display: flex;
  gap: 0.4rem;
}

#hearts span {
  width: 1.15rem;
  height: 1.15rem;
  border: 1px solid var(--brass);
  background:
    linear-gradient(135deg, transparent 42%, var(--copper) 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, var(--copper) 43% 57%, transparent 58%);
  box-shadow: inset 0 0 0 3px var(--paper);
}

#hearts span.gone {
  opacity: 0.28;
  background: transparent;
}

#hint {
  position: fixed;
  left: 50%;
  bottom: 1.3rem;
  transform: translateX(-50%);
  z-index: 8;
  margin: 0;
  max-width: min(44rem, 92vw);
  text-align: center;
  font-family: "Fraunces", "IM Fell English", Palatino, "Times New Roman", serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--type);
  background: var(--paper);
  border: 1px solid var(--brass);
  padding: 0.45rem 0.95rem;
  pointer-events: none;
}

.sheet {
  position: fixed;
  z-index: 10;
  color: var(--type);
  background:
    linear-gradient(180deg, rgba(255, 236, 200, 0.06), transparent 18%),
    var(--paper);
  border: 1px solid var(--brass);
  box-shadow:
    0 0 0 1px rgba(196, 163, 90, 0.25),
    0 18px 60px rgba(0, 0, 0, 0.45);
}

#title,
#webgl-fail {
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  width: min(40rem, 92vw);
  max-height: min(92vh, 54rem);
  overflow: auto;
  padding: 1.7rem 1.9rem 1.4rem;
}

#verse {
  left: 50%;
  bottom: 8.5%;
  transform: translateX(-50%);
  width: min(38rem, 92vw);
  max-height: min(46vh, 28rem);
  overflow: auto;
  padding: 1.25rem 1.55rem 1.1rem;
  cursor: pointer;
}

#title.hidden,
#verse.hidden,
#webgl-fail.hidden,
#hud[hidden],
#hint[hidden] {
  display: none;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-family: "Fraunces", Palatino, "Times New Roman", serif;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

h1 {
  margin: 0;
  font-family: "IM Fell English SC", "IM Fell English", Palatino, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  letter-spacing: 0.12em;
  line-height: 0.95;
  color: var(--amber);
}

.rule {
  height: 1px;
  margin: 0.85rem 0 1rem;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
}

blockquote {
  margin: 0;
  font-style: italic;
}

blockquote p {
  margin: 0 0 1rem;
  font-size: 1.22rem;
  line-height: 1.55;
}

.indent {
  display: inline-block;
  padding-left: 1.6rem;
}

.lead,
.keys {
  color: var(--muted);
}

.lead {
  margin: 0.2rem 0 1.15rem;
  font-size: 1.05rem;
  line-height: 1.45;
}

.keys {
  margin: 0.85rem 0 0;
  font-family: "Fraunces", Palatino, "Times New Roman", serif;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

#begin {
  font-family: "IM Fell English SC", "IM Fell English", Palatino, "Times New Roman", serif;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--brass);
  border: 0;
  padding: 0.7rem 1.1rem 0.6rem;
  cursor: pointer;
}

#begin:hover,
#begin:focus-visible {
  background: var(--amber);
  outline: 2px solid var(--ivory);
  outline-offset: 3px;
}

#verse p {
  margin: 0 0 0.75rem;
  font-size: 1.22rem;
  line-height: 1.55;
}

#verse p:last-child {
  margin-bottom: 0;
}

#verse .continue {
  margin-top: 0.85rem;
  font-family: "Fraunces", Palatino, "Times New Roman", serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brass);
  font-style: normal;
}

#snicker,
#callooh {
  pointer-events: none;
  position: fixed;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  z-index: 9;
  font-family: "IM Fell English SC", "IM Fell English", Palatino, "Times New Roman", serif;
  letter-spacing: 0.14em;
  color: var(--ivory);
  text-shadow:
    0 0 18px rgba(232, 168, 74, 0.55),
    0 2px 0 var(--ink);
  opacity: 0;
  white-space: nowrap;
}

#snicker {
  font-size: clamp(2.4rem, 8vw, 5.2rem);
}

#snicker.show {
  opacity: 1;
}

#callooh {
  top: 32%;
  font-size: clamp(2rem, 7vw, 4.4rem);
  color: var(--amber);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

#callooh.show {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  #flash.on {
    opacity: 0.28;
  }

  #begin,
  #snicker,
  #callooh,
  .sheet {
    transition: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  #begin {
    transition: background 0.15s ease;
  }

  #snicker,
  #callooh {
    transition: opacity 0.12s ease;
  }

  #flash {
    transition: opacity 0.08s linear;
  }
}
