:root {
  --paper: #f6f1df;
  --ink: #38372a;
  --muted: #706e58;
  --green: #49614b;
  --line: #d4cbb4;
  --serif: Georgia, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  color: var(--ink);
  background: #393828;
  font: 14px/1.65 var(--sans);
}
button,
a,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
a {
  text-decoration: none;
}
button {
  border: 0;
  background: none;
  cursor: pointer;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #d3994b;
  outline-offset: 3px;
}
button:hover {
  filter: brightness(1.12);
}
[hidden] {
  display: none !important;
}
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#room,
#room > canvas,
#still,
#spots,
#lightwash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
#room {
  height: 100dvh;
  outline: none;
}
#room::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 48% 45%, transparent 55%, rgba(45, 31, 19, .095) 100%);
}
#room canvas {
  touch-action: none;
  cursor: grab;
}
#room canvas:active {
  cursor: grabbing;
}
#still {
  object-fit: cover;
}
#spots {
  pointer-events: none;
}
.spot {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  padding: 0;
}
.spot i {
  position: absolute;
  width: 8px;
  height: 8px;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  background: #fff5c7;
  border: 1px solid #ffefaa;
  box-shadow:
    0 0 0 4px #fff5cb40,
    0 0 12px #aa843b;
  animation: breath 3s infinite;
}
.spot span {
  display: none;
  position: absolute;
  bottom: 30px;
  left: 14px;
  padding: 3px 9px;
  border-left: 1px solid #f8eab4;
  background: #2b2b22c9;
  color: #fff9e6;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.spot:is(:hover, :focus-visible) span {
  display: block;
}
header {
  position: fixed;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 19px;
  padding: 0 clamp(15px, 3.5vw, 60px);
  color: #fff6df;
  background: linear-gradient(90deg, #272a24d9, #30332cd4 62%, #292d24dd);
  border-bottom: 1px solid #f6ecc143;
  backdrop-filter: blur(9px);
  box-shadow: 0 2px 12px #16150c12;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
}
.brand img {
  width: 31px;
  height: 31px;
  border-radius: 7px;
}
.brand strong {
  font: 600 19px/1 var(--serif);
  letter-spacing: 0.08em;
}
nav,
.tools {
  display: flex;
  align-items: center;
}
nav {
  gap: clamp(12px, 2vw, 34px);
  overflow-x: auto;
  scrollbar-width: none;
  height: 100%;
}
nav button {
  position: relative;
  font-size: 13px;
  letter-spacing: 0.07em;
  white-space: nowrap;
  padding: 0;
  height: 100%;
  color: #e0dccd;
}
nav button[aria-current] {
  color: #fff8e6;
}
nav button[aria-current]:after {
  content: "";
  width: 18px;
  height: 2px;
  background: #dfc68c;
  position: absolute;
  bottom: 8px;
  left: calc(50% - 9px);
}
.tools {
  gap: 8px;
  flex-shrink: 0;
}
.tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 27px;
  height: 31px;
  padding: 4px;
  gap: 6px;
}
.tools #clock {
  padding-inline: 8px;
  border: 1px solid #e3dabc55;
  border-radius: 4px;
}
.tools svg {
  width: 17px;
  height: 17px;
}
.tools b {
  font: 15px Georgia;
  letter-spacing: 0.06em;
}
.clock-tool {
  position: relative;
}
.clock-tool small {
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  color: #f5ebd3;
  background: #312e24cc;
  border-radius: 2px;
  white-space: nowrap;
  padding: 3px 9px;
  transition: opacity 0.3s;
}
.clock-tool:hover small,
.clock-tool:focus-within small,
.clock-tool.hint small {
  opacity: 1;
}
#mode {
  font-family: var(--serif);
  color: #ebc885;
  border: 1px solid #c9a86c8c;
  padding: 2px 6px;
  font-size: 11px;
}
.mute,
#sound[aria-pressed="false"] .waves {
  display: none;
}
#sound[aria-pressed="false"] .mute {
  display: block;
}
#enter {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: max(9vh, 35px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 11px;
  white-space: nowrap;
  padding: 10px 22px;
  background: #292a22bc;
  color: #fff7e3;
  border: 1px solid #efe1bc99;
  border-radius: 3px;
  font: 15px var(--serif);
  letter-spacing: 0.13em;
  box-shadow: 0 3px 14px #231d1436;
  backdrop-filter: blur(4px);
}
#enter svg {
  width: 16px;
  height: 16px;
  animation: breath 3s infinite;
}
#lightwash {
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  background: radial-gradient(ellipse, #e8d5a67a, #392e2470 85%);
}
#lightwash.play {
  animation: wash 1.3s both;
}
#notice {
  position: fixed;
  pointer-events: none;
  z-index: 6;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #282b23de;
  color: #faf2d8;
  border-radius: 3px;
  padding: 5px 13px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.25s;
}
#notice.show {
  opacity: 1;
}
#drawer {
  position: fixed;
  z-index: 4;
  right: 16px;
  top: 72px;
  bottom: 16px;
  width: min(395px, 43vw);
  border: 1px solid #c8b998;
  border-radius: 4px;
  background: var(--paper);
  background-image: url("assets/grain.svg");
  background-blend-mode: soft-light;
  box-shadow: 0 14px 48px #16160d38;
  display: flex;
  flex-direction: column;
  transition:
    transform 0.45s cubic-bezier(0.23, 0.72, 0.27, 1),
    opacity 0.3s;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
}
#drawer.open {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 19px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.drawer-head small,
article > small {
  font: 10px Georgia;
  letter-spacing: 0.18em;
  color: var(--green);
}
.drawer-head h1 {
  font: 600 25px/1.4 var(--serif);
  margin: 4px 0 0;
}
.drawer-head button {
  font: 26px Georgia;
  line-height: 1;
  width: 32px;
  height: 32px;
}
.drawer-body {
  padding: 17px 22px 25px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a99e83 transparent;
}
.drawer-body h2 {
  font: 600 22px/1.5 var(--serif);
  margin: 3px 0 6px;
}
.drawer-body p {
  color: var(--muted);
  line-height: 1.9;
}
.latin {
  font: italic 16px Georgia;
  color: var(--green);
}
blockquote {
  margin: 16px 0;
  border-left: 2px solid var(--green);
  padding-left: 12px;
  color: var(--green);
  font-family: var(--serif);
}
.filters,
.paging {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filters button,
.paging button,
.readtools button,
.back {
  font-size: 12px;
  color: var(--green);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 4px 8px;
}
.filters button[aria-pressed="true"],
.ink {
  background: var(--green);
  color: var(--paper);
}
.ink {
  padding: 7px 13px;
  border-radius: 3px;
}
.product {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
  text-align: left;
}
.product img {
  width: 60px;
  height: 54px;
  object-fit: cover;
  border-radius: 2px;
}
.product strong {
  display: block;
  font: 600 16px var(--serif);
}
.product small {
  color: var(--muted);
}
.product em {
  margin-left: auto;
  font: italic 14px Georgia;
  color: var(--green);
}
#cakeArt,
.endcover,
.frontispiece img,
#story img {
  display: block;
  max-width: 100%;
  max-height: 290px;
  margin: 14px auto;
  object-fit: contain;
}
.attendance,
form,
.frontispiece,
#clues {
  border-top: 1px solid var(--line);
  margin: 18px 0;
  padding-top: 12px;
}
summary {
  cursor: pointer;
  color: var(--green);
}
#stamps {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 2px;
  margin-top: 10px;
}
#stamps i {
  aspect-ratio: 1;
  background: url(assets/fish.svg) center/contain no-repeat;
  opacity: 0.7;
}
form label {
  display: grid;
  gap: 4px;
  margin-bottom: 9px;
}
input,
textarea,
select {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 7px;
}
textarea {
  resize: vertical;
}
form small,
form output {
  display: block;
  margin: 8px 0;
  color: var(--muted);
}
#sent.sealed {
  border: 2px solid #984c40;
  color: #984c40;
  font: 600 15px var(--serif);
  padding: 9px;
  transform: rotate(-2deg);
  animation: stamp 0.35s ease-out;
}
.readtools {
  position: sticky;
  top: -17px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  padding: 8px 0 12px;
  z-index: 1;
  font-size: 12px;
}
.readtools select {
  max-width: 165px;
  font-size: 12px;
}
.readtools progress {
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 100%;
  height: 2px;
  accent-color: var(--green);
}
article {
  font: var(--reading-size, 17px) / 1.94 var(--serif);
}
article h2 {
  margin-top: 12px !important;
}
#story p {
  margin: 0.65em 0;
  text-indent: 2em;
  color: var(--ink);
}
#story > * {
  scroll-margin-top: 58px;
}
article a {
  color: var(--green);
  border-bottom: 1px solid;
}
.photo {
  background: #d6cfb0;
  color: #634b3a !important;
  font-family: var(--serif);
  padding: 22px 12px;
  box-shadow: 1px 3px 5px #201c151c;
  transform: rotate(-3deg);
}
body.night {
  --paper: #242b25;
  --ink: #e9dfc8;
  --muted: #c3bba5;
  --green: #c5ad76;
  --line: #525548;
}
body.night #drawer {
  background-color: #242b25f4;
  backdrop-filter: blur(9px);
}
@keyframes breath {
  50% {
    opacity: 0.5;
  }
}
@keyframes wash {
  0%,
  100% {
    opacity: 0;
  }
  36% {
    opacity: 0.9;
  }
}
@keyframes stamp {
  from {
    opacity: 0;
    transform: scale(1.22) rotate(-6deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(-2deg);
  }
}
