* {
  box-sizing: border-box;
}
html,
body,
#view {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  background: #ecdfc3;
  color: #f4ecdc;
  font:
    clamp(12px, 1.8vmin, 22px) 'Apple SD Gothic Neo',
    'Pretendard',
    'Noto Sans KR',
    sans-serif;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
#view {
  position: relative;
  container-type: size;
}
#explore,
#book,
#overlay,
#hud,
#night,
#panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#book {
  display: none;
  background: #ecdfc3;
  cursor: crosshair;
}
.book-open #book {
  display: block;
}
#night {
  pointer-events: none;
  background: #1d2440;
  mix-blend-mode: multiply;
}
#hud {
  pointer-events: none;
  background: radial-gradient(ellipse at top left, #15100980, transparent 36%),
    radial-gradient(ellipse at top right, #15100980, transparent 34%),
    radial-gradient(ellipse at bottom right, #15100970, transparent 35%);
  text-shadow:
    0 1px 3px #100c09,
    0 0 4px #100c09;
}
#overlay text {
  paint-order: stroke;
  stroke: #140f0a;
  stroke-width: 3px;
  stroke-linejoin: round;
}
#overlay .k {
  stroke: none;
}
.book-open #prompt,
.paused #hud {
  visibility: hidden;
}
#slots {
  position: absolute;
  right: 3%;
  bottom: 6%;
  display: flex;
  align-items: end;
  gap: 1.1vw;
  pointer-events: auto;
}
.slot {
  position: relative;
  width: 4.8vmin;
  height: 4.8vmin;
  padding: 0.4vmin;
  border-radius: 100%;
  background: #171410ae;
  border: 1px solid #f4ecdc55;
}
.slot svg,
.runes svg {
  width: 100%;
  height: 100%;
}
.slot.sel {
  width: 6.8vmin;
  height: 6.8vmin;
  border: 2px solid #9ebfff;
  box-shadow: 0 0 12px #74a8ff;
}
.slot span {
  display: none;
}
.slot.sel span {
  display: block;
  position: absolute;
  bottom: 115%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  text-shadow: 0 1px 4px black;
}
.slot.locked {
  opacity: 0.48;
}
#modeTag,
#pickups {
  position: absolute;
  left: 3%;
  bottom: 2%;
  font-weight: 600;
}
#pickups {
  bottom: 9%;
}
#pickups div {
  animation: pickup 4s both;
}
#pickups svg {
  width: 1.6em;
  height: 1.6em;
  vertical-align: middle;
}
@keyframes pickup {
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
#toast {
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  opacity: 0;
}
#toast.show {
  opacity: 1;
}
.notebook {
  background: #120f0be8;
  padding: 5vh 6vw;
  display: flex;
  flex-direction: column;
}
.notebook nav,
.notebook footer,
.stats,
.row {
  display: flex;
  align-items: center;
  gap: 2vw;
}
.notebook nav {
  justify-content: center;
  border-bottom: 1px solid #ffffff28;
  padding-bottom: 2vh;
}
.notebook button {
  border: 0;
  background: none;
  color: #c6bcab;
  padding: 0.6em;
}
.notebook nav button.active {
  color: white;
  border-bottom: 3px solid #8fb3ff;
}
.pages {
  flex: 1;
  padding: 3vh 0;
  overflow: auto;
}
.pages h1 {
  font-size: 2.8em;
  margin: 0.15em 0;
}
.pages h2 {
  font-size: 2em;
  margin: 0;
}
.pages h3,
.pages small,
kbd {
  color: #b5ad9e;
}
.runes {
  display: grid;
  grid-template-columns: 42% 28% 30%;
  align-items: center;
  height: 100%;
}
.runes button {
  width: 28%;
  aspect-ratio: 1;
  margin-right: 3%;
  border: 1px solid #ffffff40;
  border-radius: 10px;
  background: #ffffff0b;
}
.runes button svg {
  height: 70%;
}
.runes small {
  display: block;
}
.runes button.active {
  border-color: #8fb3ff;
  box-shadow: 0 0 12px #8fb3ff66;
}
.emblem {
  padding: 12%;
  filter: drop-shadow(0 0 7px #7faaff);
}
hr {
  border: 0;
  border-top: 1px solid #ffffff33;
}
.row {
  border-bottom: 1px solid #ffffff24;
  padding: 1.2vh 0;
  min-height: 12vh;
}
.row b {
  margin-left: auto;
}
.row p {
  margin: 0.2em 0;
}
.face,
.visitor {
  object-fit: contain;
}
.face {
  width: 8vh;
  height: 11vh;
}
.stats {
  flex: 1;
}
.stats span {
  font-size: 0.85em;
  color: #d0c7b7;
}
.stats b {
  display: block;
  font-size: 1.35em;
  color: #f4ecdc;
}
.notebook footer {
  border-top: 1px solid #ffffff30;
  padding-top: 3vh;
}
.dialog {
  background: linear-gradient(transparent 36%, #100d0988 61%, #100d09f5);
}
.portrait {
  position: absolute;
  bottom: -3%;
  left: -1%;
  width: 41%;
  height: 88%;
  object-fit: contain;
  object-position: bottom right;
  pointer-events: none;
}
.dialog {
  overflow: hidden;
}
.speech {
  position: absolute;
  bottom: 4%;
  left: 41%;
  right: 4%;
}
.speech header {
  font-size: 0.85em;
}
.speech header strong {
  display: inline-block;
  transform: skewX(-9deg);
  background: var(--accent);
  padding: 0.35em 1em;
  margin-right: 0.6em;
  font-size: 1.6em;
  color: #141019;
}
.speech header small {
  font-size: 0.65em;
}
.speech p {
  font-size: clamp(16px, 3.1vmin, 32px);
  min-height: 2.7em;
  line-height: 1.5;
  margin: 2vh 0;
  text-shadow: 0 1px 3px #000;
}
#answers {
  display: flex;
  gap: 0.6em;
  min-height: 2.5em;
  flex-wrap: wrap;
}
#answers button {
  transform: skewX(-9deg);
  background: #161311b3;
  border: 1px solid #f4ecdc66;
  padding: 0.5em 0.9em;
}
#answers button.active {
  background: #f4ecdc;
  color: #221c17;
}
[hidden] {
  display: none !important;
}
.slot svg {
  display: block;
}
.slot {
  width: 6.7vmin;
  height: 6.7vmin;
}
.slot.sel {
  width: 9vmin;
  height: 9vmin;
}
.speech header,
.notebook,
#answers {
  font-size: clamp(14px, 2.5vmin, 28px);
}
.speech header {
  font-size: clamp(13px, 2.2vmin, 23px);
}
#pickups {
  font-size: clamp(14px, 2.6vmin, 24px);
}
#pageTurn,
#zoneTitle {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}
#pageTurn {
  background: #e8dec5;
  opacity: 0;
  transition: opacity 0.22s;
}
#pageTurn.turn {
  opacity: 1;
  pointer-events: auto;
}
#zoneTitle {
  display: grid;
  place-items: center;
  font:
    bold clamp(24px, 4vw, 52px) 'Apple SD Gothic Neo',
    sans-serif;
  color: #fff4d8;
  text-shadow: 0 2px 8px #322a20;
  letter-spacing: 0.18em;
  opacity: 0;
}
#zoneTitle.reveal {
  animation: arrival 2.6s both;
}
@keyframes arrival {
  0%,
  100% {
    opacity: 0;
  }
  20%,
  70% {
    opacity: 1;
  }
}
#vitals {
  display: none;
  position: absolute;
  top: 21%;
  left: 3.6%;
  font-weight: 700;
  font-size: clamp(13px, 1.55vw, 23px);
  color: #ffe0c1;
  text-shadow: 0 1px 4px #231a18;
}
.danger #vitals {
  display: block;
}
.danger #slots {
  display: none;
}
.bag-nav {
  display: flex;
  gap: 1em;
  margin-bottom: 1em;
}
.bag-nav .active {
  color: #e6c887;
  text-decoration: underline;
}
#blackout {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse, #20191e 10%, #100b11 75%);
  opacity: 0;
  transition: opacity 0.9s;
  z-index: 3;
}
.fallen #blackout {
  opacity: 0.98;
}
.danger #zoneTitle {
  font-family: inherit;
  font-size: clamp(19px, 3vw, 44px);
  align-items: start;
  padding-top: 14vh;
  letter-spacing: 0.08em;
}
.bag-nav button,
.pages .row button {
  background: transparent;
  border: 0;
  border-bottom: 1px solid #b69f7d;
  padding: 0.25em 0.5em;
}
.paused #zoneTitle {
  visibility: hidden;
}
.struck #hud {
  box-shadow: inset 0 0 12vmin 2vmin #39222bd9;
}
.danger #toast {
  top: 26%;
  white-space: nowrap;
}
#vitals {
  color: #fff5df;
  font:
    700 clamp(11px, 1.65vmin, 18px) / 1.25 system-ui,
    sans-serif;
  filter: drop-shadow(0 1px 2px #211918);
}
#vitals svg,
.ingredient svg {
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
}
.hearts,
.mana,
.quick {
  display: flex;
  align-items: center;
  gap: 0.18em;
}
.spent {
  filter: grayscale(1) brightness(0.43);
}
.struck .hearts {
  animation: heart-hit 0.12s steps(2) infinite alternate;
}
@keyframes heart-hit {
  to {
    filter: brightness(1.9);
  }
}
.mana {
  margin: 0.3em 0 0.6em;
}
.mana meter {
  height: 1em;
  width: 7em;
  appearance: none;
}
.mana meter::-webkit-meter-bar {
  background: #39313e;
  border: 1px solid #f6e8d0;
  border-radius: 1em;
}
.mana meter::-webkit-meter-optimum-value {
  background: linear-gradient(#ccb3ff, #9676c4);
}
.quick {
  gap: 0.6em;
}
.quick small {
  display: block;
  margin-top: 0.2em;
}
.quick-disc {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.8em;
  height: 2.8em;
  border: 2px solid #f6ecd7;
  border-radius: 50%;
  background: #352d35aa;
  color: #aee0e7;
}
.quick-disc b {
  position: absolute;
  right: -0.1em;
  bottom: -0.2em;
  color: white;
  text-shadow: 0 1px 2px black;
}
.quick kbd {
  font: inherit;
  border: 1px solid #fff9;
  border-radius: 0.25em;
  padding: 0 0.25em;
  background: #2b272a77;
}
.gear-tiles {
  display: flex;
  gap: 1em;
  margin: 1em 0;
}
.gear-tile {
  display: grid;
  justify-items: center;
  gap: 0.3em;
  width: clamp(7em, 13vw, 13em);
  padding: 0.8em;
  background: #332c25;
  color: #f4e5c6;
  border: 1px solid #85735d;
  border-radius: 0.4em;
}
.gear-tile[aria-pressed='true'] {
  background: #473b2c;
  border-color: #efd09c;
}
.gear-tile svg {
  width: 3em;
  height: 3em;
  color: #e4ca9d;
}
.ingredient {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  margin-right: 0.7em;
}
.ingredient.short,
.loss {
  color: #f1a5a1;
}
.gain {
  color: #a9dbad;
}
.pages .row button:disabled {
  opacity: 0.45;
  cursor: default;
}
#term {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: linear-gradient(110deg, #11181bea, #17191ae0 65%, #262626bd);
  color: #f2ecdf;
  font-family: system-ui, sans-serif;
}
#term[hidden] {
  display: none;
}
#term section {
  box-sizing: border-box;
  position: relative;
  width: min(92vw, 720px);
  padding: 2rem;
  max-height: 94vh;
  overflow: auto;
}
#term h1 {
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  letter-spacing: -0.05em;
  margin: 0 0 1.4rem;
}
#term p {
  line-height: 1.65;
  margin: 0.5rem 0;
}
#term footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.8rem;
}
#term button,
.pages [data-job] {
  font: inherit;
  color: inherit;
  background: #31403c;
  border: 1px solid #9aab93;
  padding: 0.4em 0.8em;
  cursor: pointer;
}
#term article,
.pages article {
  border-top: 1px solid #8887;
  padding: 0.7rem 0;
}
#term button:disabled,
.pages button:disabled {
  opacity: 0.65;
}
.lamps {
  display: flex;
  gap: 2%;
  margin: 2rem 0;
}
.lamps i {
  width: 9%;
  height: 60px;
  border-radius: 60% 60% 0 0;
  border: 2px solid #837664;
  background: repeating-linear-gradient(90deg, transparent 45%, #685f51 48%, transparent 53%), #343942;
}
.lamps .lit {
  background-color: #ffd77b;
  box-shadow: 0 0 18px #e5b45588;
}
.lamps .lit:has(.spark) {
  animation: kindle 0.3s 0.55s ease-out backwards;
}
@keyframes kindle {
  from {
    background-color: #343942;
    box-shadow: none;
  }
  to {
    background-color: #ffd77b;
  }
}
.visitor {
  width: 110px;
  height: 130px;
}
#term {
  background: radial-gradient(ellipse at 50% 42%, #192a2ad9, #0a1116f7 85%);
  text-align: center;
}
#term section {
  width: min(94vw, 880px);
  padding: 2rem 1rem;
}
#term h1 {
  font-size: clamp(32px, 5vw, 64px);
  line-height: 1.1;
  text-wrap: balance;
}
#term footer {
  justify-content: center;
}
#term footer button {
  appearance: none;
  transform: skew(-10deg);
  border: 0;
  border-left: 3px solid #a09d84;
  background: #243130;
  color: #fff5d9;
  padding: 0.65em 1.2em;
  font-weight: 700;
}
#term button:focus-visible,
#term footer button:hover {
  outline: 2px solid #eec775;
  outline-offset: 3px;
}
#term kbd {
  font: 700 0.78em system-ui;
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0.05em 0.32em;
  margin-right: 0.35em;
}
#term[data-scene='letter'] .scene-body {
  position: relative;
  width: min(100%, 510px);
  margin: auto;
  box-sizing: border-box;
  text-align: left;
  color: #443728;
  padding: 50px 9% 28px;
  transform: rotate(-2deg);
  background: linear-gradient(174deg, transparent 54%, #8d76412e 54.3%, #fffff330 55%, transparent 57%),
    repeating-linear-gradient(7deg, #62533509 0 1px, transparent 1px 4px), #eadfc3;
  box-shadow:
    3px 6px #af9c78,
    0 18px 50px #0007;
  animation: unfold 0.35s ease-out;
}
#term[data-scene='letter'] .scene-body:before {
  content: '✦';
  position: absolute;
  right: 6%;
  top: 18px;
  color: #edbd92;
  background: #943e38;
  border: 4px double #bd6d52;
  border-radius: 44% 51% 45% 48%;
  padding: 6px 9px;
  box-shadow: 1px 3px #65352b;
  transform: rotate(9deg);
}
#term[data-scene='letter'] h1 {
  font-size: clamp(24px, 3vw, 36px);
  max-width: 90%;
  border-bottom: 1px solid #77634366;
  padding-bottom: 0.55em;
}
#term[data-scene='letter'] p:last-child {
  text-align: right;
  font-style: italic;
  margin-top: 1.3em;
  font-weight: 750;
}
@keyframes unfold {
  from {
    transform: perspective(650px) rotateX(20deg) rotate(-4deg) scale(0.94);
  }
}
#term[data-scene='board'] h1 {
  font-size: 36px;
  color: #f1d7aa;
}
.pinboard {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 3%;
  padding: 32px 4% 25px;
  background: repeating-linear-gradient(2deg, #3e241f22 0 2px, transparent 2px 11px),
    repeating-linear-gradient(0deg, #533b2c 0 2px, #74533c 3px 60px);
  border: 5px ridge #624a36;
  box-shadow: 0 12px 24px #0005;
}
#term .pinned-note {
  position: relative;
  flex: 1;
  max-width: 240px;
  display: grid;
  gap: 0.7em;
  align-content: start;
  text-align: left;
  color: #473a2f;
  background: #d9cdaf;
  border: 0;
  padding: 24px 14px 14px;
  transform: rotate(2deg);
  box-shadow: 2px 4px 4px #0006;
  transition: transform 0.15s;
}
#term .pinned-note:before {
  content: '';
  position: absolute;
  top: 5px;
  left: 47%;
  background: #95534a;
  border-radius: 50%;
  width: 9px;
  height: 9px;
  box-shadow: 1px 2px 2px #332820;
}
#term .pinned-note[aria-pressed='true'] {
  transform: translateY(-8px) rotate(-3deg);
  background: #fff2d3;
  box-shadow: 5px 9px 9px #0006;
}
.pinned-note strong {
  font-size: 1.35em;
}
.pinned-note em {
  position: absolute;
  bottom: 10px;
  right: 8px;
  color: #914635;
  border: 3px double;
  transform: rotate(-13deg);
  font-weight: 800;
}
.pinned-note b {
  font-size: 0.8em;
}
.term-stats {
  display: flex;
  justify-content: center;
  gap: clamp(15px, 5vw, 70px);
  margin: 24px auto;
}
.term-stats div {
  display: grid;
  gap: 0.3em;
  max-width: 35%;
}
.term-stats b {
  font-size: 2.3rem;
}
.term-stats i {
  font-size: 0.65em;
  color: #d7b66b;
  font-style: normal;
}
.term-stats small {
  color: #cec6ad;
}
#term[data-scene='summary'] h1,
#term[data-scene='end'] h1 {
  font-size: clamp(52px, 8vw, 96px);
  color: #f2dfae;
}
#term[data-scene='summary'] section {
  animation: dawn 0.45s ease-out;
}
@keyframes dawn {
  from {
    opacity: 0.1;
    transform: translateY(8px);
  }
}
#term[data-scene='end'],
#term[data-scene='result'] {
  background: linear-gradient(0deg, #090e12 9%, transparent 10% 90%, #090e12 91%),
    radial-gradient(ellipse, #303e3aef, #0e1419fa);
}
.rank {
  display: block;
  margin: 22px auto 0;
  border: 5px double currentColor;
  border-radius: 48%;
  width: 1.4em;
  line-height: 1.4;
  font-size: 65px;
  color: #f0cb79;
  transform: rotate(-12deg);
  animation: stamp 0.38s ease-out;
}
@keyframes stamp {
  from {
    opacity: 0.3;
    transform: rotate(-20deg) scale(1.7);
  }
}
.lamps {
  justify-content: center;
}
.lamps i {
  position: relative;
  height: clamp(54px, 10vh, 90px);
}
.spark {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 10px;
  height: 10px;
  background: #fff8c5;
  border-radius: 50%;
  box-shadow:
    0 0 12px 5px #ffc451,
    0 0 30px #fea;
  animation: flight 0.75s ease-out both;
}
@keyframes flight {
  0% {
    transform: translate(65px, 130px) scale(0.5);
  }
  65% {
    opacity: 1;
    transform: translate(20px, 35px) scale(1.5);
  }
  100% {
    transform: scale(0.5);
    opacity: 0;
  }
}
@media (max-width: 600px) {
  .pinboard {
    gap: 5px;
    padding: 20px 5px;
  }
  #term .pinned-note {
    font-size: 12px;
    padding: 20px 6px 10px;
  }
  #term[data-scene='letter'] .scene-body {
    padding: 52px 7% 22px;
  }
}
.arrow-hint {
  align-self: center;
  color: #dfd3b6;
  font-size: 0.9rem;
}
.spark:after {
  content: '';
  position: absolute;
  top: 6px;
  left: 5px;
  width: 4px;
  height: 36px;
  transform: rotate(-25deg);
  transform-origin: top;
  background: linear-gradient(#ffdf87, transparent);
}
@media (prefers-reduced-motion: reduce) {
  #term *,
  #term *:after {
    animation-duration: 0.01ms !important;
    transition-duration: 0s !important;
  }
}
.lamps .spark {
  z-index: 2;
  pointer-events: none;
}
#bossHud {
  position: absolute;
  top: 10%;
  z-index: 3;
  letter-spacing: 0.12em;
  left: 50%;
  transform: translateX(-50%);
  width: min(38vw, 430px);
  color: #ffdfab;
  text-align: center;
  text-shadow: 1px 2px 2px #261b1a;
  pointer-events: none;
}
#bossHud meter {
  width: 100%;
  display: block;
  appearance: none;
  height: 7px;
  margin: 0.35rem auto;
  box-shadow: 0 1px 4px #1d111a;
}
body.paused #bossHud {
  visibility: hidden;
}
#term[data-scene='shop'] footer {
  display: none;
}
.wares {
  display: flex;
  align-items: end;
  justify-content: center;
  color: #f5e1bd;
  position: relative;
  gap: clamp(4px, 1.4vw, 20px);
  border: 0;
  border-bottom: 13px solid #825737;
  box-shadow:
    0 5px #352921,
    0 8px #aa8053;
  margin: 3rem auto 1.8rem;
  padding: 1em 0 0.25em;
  background: linear-gradient(0deg, #5d412c66, transparent 28%);
}
.ware {
  display: grid;
  justify-items: center;
  padding: 0.4em;
  transform: rotate(-2deg);
  position: relative;
  flex: 1;
  min-width: 0;
  outline: none;
  background: none;
}
.ware.selected {
  transform: translateY(-0.6em) rotate(2deg);
}
.ware small {
  font-size: 0.7em;
}
.ware svg {
  display: block;
  width: 100%;
  height: clamp(55px, 9vw, 104px);
  filter: drop-shadow(3px 5px 1px #211e1e);
}
.ware b,
.ware small {
  background: #534333;
  line-height: 1.35;
  padding: 0 0.3em;
}
.ware.selected b,
.ware.selected small {
  background: #d4ab70;
  color: #282122;
}
.ware em {
  position: absolute;
  top: 0;
  right: -0.5em;
  color: #ffe2a7;
  background: #8e4337;
  font-style: normal;
  font-size: 0.76em;
  padding: 0.2em 0.4em;
  transform: rotate(9deg);
}
#bossHud meter::-webkit-meter-bar {
  background: #35262a;
  border: 0;
  border-radius: 0;
}
#bossHud meter::-webkit-meter-optimum-value {
  background: linear-gradient(90deg, #8c414b, #df9a85);
}
.closed-book {
  width: min(45vw, 290px);
  height: auto;
  animation: book-settles 0.65s ease-out both;
}
@keyframes book-settles {
  from {
    transform: translateY(-22px) rotate(-9deg);
    opacity: 0.2;
  }
  to {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .closed-book {
    animation: none;
  }
}
.upgrades {
  display: flex;
  justify-content: center;
  gap: 1em;
  margin: 1.5em auto;
}
.upgrade {
  display: grid;
  gap: 0.55em;
  text-align: left;
  padding: 1em;
  border: 1px solid #bba67d;
  color: #f1e0bd;
  background: #282b29;
}
.upgrade.selected {
  border: 2px solid #f1cf81;
  background: #413a2d;
}
.upgrade strong {
  color: #edc880;
}
