* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  color: var(--hh-ink);
  background: #211729;
  font: 16px/1.5 var(--hh-font-body);
  min-height: 100svh;
}
button,
a {
  font: inherit;
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #ffc975;
  outline-offset: 2px;
}
.box-sky.hh-night-sky {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
}
.box-sky > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.52;
  filter: brightness(0.72) saturate(0.88);
}
.box-sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #170d22bb, transparent 70%);
}
.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px clamp(12px, 4vw, 80px);
  min-height: 50px;
  gap: 10px;
}
.nav > div,
.menu-links,
.chapter-nav,
.play-head,
.tray-head,
.result-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav > div {
  margin-left: auto;
}
.nav .hh-tilt {
  display: none;
}
.hh-button {
  text-decoration: none;
  padding: 0.5em 0.95em;
  border-radius: 6px;
  line-height: 1.3;
}
.nav button,
.nav a {
  font-size: 14px;
}
.nav .hh-icon {
  width: 1em;
  height: 1em;
}
main {
  max-width: 1200px;
  margin: auto;
  padding: clamp(15px, 3vh, 35px) clamp(12px, 2vw, 34px) 26px;
}
h1,
h2,
p {
  margin: 0;
}
.menu-head {
  margin: 0 0 16px;
}
.menu-head .hh-ribbon {
  margin: 0;
  font-size: 13px;
}
.menu-head h1 {
  font-size: clamp(42px, 4.4vw, 72px);
  line-height: 1.3;
}
.atlas {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  border: 1px solid var(--hh-gold);
  border-radius: 10px;
  overflow: hidden;
  --hh-frame-inset: 4px;
}
.atlas-art {
  position: relative;
  min-height: 300px;
  background: #41253c;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  padding: 26px;
}
.atlas-art > img,
.result-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.atlas-art > img {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.atlas-art::before,
.result-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, #1f122bf2, transparent 64%);
  z-index: -1;
}
.atlas-art h2 {
  font: 600 clamp(28px, 3vw, 52px) var(--hh-title-brush);
  color: #ffe7a3;
}
.atlas-art small,
.result-body > small {
  color: #edcb83;
  letter-spacing: 0.18em;
}
.atlas-paper {
  padding: clamp(18px, 2.5vw, 35px);
}
.chapter-nav {
  justify-content: space-between;
  font: 600 16px var(--hh-font-title);
}
.chapter-nav button {
  padding: 4px 11px;
}
.atlas-paper p {
  margin: 16px 0;
  color: #563b44;
}
.atlas-paper #levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 18px;
}
#levels button {
  display: grid;
  place-content: center;
  gap: 3px;
  padding: 7px 1px;
}
#levels b {
  font:
    600 21px Georgia,
    serif;
}
#levels small {
  font-size: 10px;
}
#levels [aria-pressed="true"] {
  outline: 2px solid #ad741b;
  outline-offset: 2px;
}
#begin {
  font-weight: bold;
}
.menu-links {
  margin-top: 14px;
}
.play-head {
  justify-content: space-between;
  margin-bottom: 10px;
}
.play-head > div {
  display: flex;
  align-items: center;
  gap: 15px;
}
.play-head h1 {
  font-size: clamp(23px, 2.2vw, 37px);
  line-height: 1.1;
}
.play-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(215px, 19vw, 285px);
  gap: 16px;
  align-items: start;
}
.central {
  min-width: 0;
}
.case {
  --hh-frame-inset: 4px;
  position: relative;
  min-width: 0;
  border: 2px solid #ceac6c;
  border-radius: 13px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 48% 42%, #735062a6, #3c253bb5 61%, #1e1429dd),
    url("v3/ui/yozakura/waves.webp") center/260px,
    #3d2c44;
  box-shadow:
    inset 0 0 0 5px #432538,
    inset 0 0 0 7px #ac8051,
    0 13px 35px #130d1fb3;
}
.case::after {
  border-image-width: 32px;
}
.case canvas {
  width: 100%;
  aspect-ratio: 640/460;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}
#burst {
  position: absolute;
  left: 50%;
  top: 13%;
  transform: translateX(-50%);
  font: bold clamp(20px, 2.4vw, 38px) var(--hh-title-brush);
  color: #ffedb4;
  text-shadow:
    0 2px 3px #492138,
    0 0 12px #a63d17;
  pointer-events: none;
  white-space: nowrap;
}
.lacquer {
  max-width: 100%;
  margin: 9px auto 0;
  border: 2px solid #c9a660;
  border-radius: 12px;
  padding: 6px 12px 10px;
  background: linear-gradient(
    155deg,
    #85444b,
    #542939 43%,
    #2f1c2a 74%,
    #66363d
  );
  box-shadow:
    inset 0 0 0 2px #f3c88250,
    0 4px 12px #0e0a14aa;
}
.tray-head {
  justify-content: space-between;
  color: #ffdea0;
  font-family: var(--hh-font-title);
  font-size: 13px;
  margin-bottom: 4px;
}
.tray-head small {
  font: 12px var(--hh-font-body);
}
#tray {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cell {
  height: clamp(39px, 6.1vh, 68px);
  border-radius: 7px;
  border: 1px solid #b9975e;
  background: radial-gradient(ellipse at bottom, #58303f, #2e182d);
  box-shadow: inset 0 3px 7px #180e22b3;
  display: grid;
  place-items: center;
}
.cell img,
#shelf img,
.tool img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cell img {
  max-height: 100%;
  min-height: 0;
}
.cell.flash {
  animation: boxflash 0.58s ease-out;
}
@keyframes boxflash {
  25% {
    background: #eac37d;
    box-shadow: 0 0 22px #ffe398;
  }
}
#shelf {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  color: #ffe0aa;
}
#shelf button {
  width: 39px;
  height: 38px;
  padding: 3px;
}
.notebook {
  padding: 19px;
  border-radius: 10px;
  background-position:
    right 2px top 2px,
    center;
}
.tallies {
  display: flex;
  justify-content: space-between;
  color: #ffe6b1;
}
.tallies small {
  display: block;
  font-size: 12px;
  color: var(--hh-muted);
}
.tallies b {
  font:
    600 24px/1.4 Georgia,
    serif;
}
.meter {
  height: 4px;
  background: #281a33;
  margin: 8px 0 12px;
}
.meter i {
  display: block;
  height: 100%;
  background: var(--hh-metal);
  transition: width 0.2s;
}
.notebook #line {
  color: #f5e6d2;
  font-size: 14px;
  min-height: 3em;
}
.notebook h2 {
  font-size: 19px;
  margin: 12px 0 8px;
}
#tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.tool {
  display: grid;
  place-items: center;
  grid-template-rows: 35px auto auto;
  padding: 5px 0;
  font-size: 13px;
}
.tool small {
  color: #fbd69d;
  font-size: 11px;
}
#collection,
#result {
  width: min(93vw, 475px);
  max-height: 88svh;
  overflow: auto;
  border-radius: 12px;
}
dialog::backdrop {
  background: #100d1dba;
}
#collection article {
  padding: 9px 0;
  border-bottom: 1px solid var(--hh-edge);
}
#collection h3 {
  color: #fae3ae;
  margin: 0;
}
#closeCollection {
  margin-top: 15px;
}
#result {
  padding: 0;
}
.result-art {
  height: clamp(110px, 20vh, 195px);
  position: relative;
  isolation: isolate;
}
.result-body {
  padding: 17px 22px 23px;
}
.result-body h2 {
  font-size: 34px;
}
#stars {
  font-size: 35px;
  color: #ffd77a;
  letter-spacing: 0.2em;
}
#report,
#reward {
  margin: 6px 0 9px;
}
.result-actions {
  flex-wrap: wrap;
}
.flying {
  position: fixed;
  pointer-events: none;
  z-index: 9;
  object-fit: contain;
}
@media (min-width: 761px) {
  body:has(#play:not([hidden])) main {
    max-width: min(1250px, calc(115svh + 265px));
  }
}
@media (max-width: 760px) {
  .nav {
    padding: 5px 9px;
    min-height: 44px;
  }
  .nav .hh-button {
    font-size: 12px;
  }
  main {
    padding: 14px 9px 20px;
  }
  .menu-head {
    margin-bottom: 9px;
  }
  .atlas {
    display: block;
  }
  .atlas-art {
    min-height: 145px;
    padding: 17px;
  }
  .atlas-paper {
    padding: 15px;
  }
  .atlas-paper p {
    font-size: 14px;
    margin: 9px 0;
  }
  .play-grid {
    display: block;
  }
  .play-head > div {
    display: block;
  }
  .play-head .hh-tag {
    font-size: 10px;
    min-height: auto;
  }
  .play-head h1 {
    margin-top: 3px;
  }
  .play-head button {
    font-size: 13px;
  }
  .case canvas {
    aspect-ratio: 640/530;
  }
  .case::after {
    border-image-width: 22px;
  }
  .lacquer {
    padding: 4px 7px 6px;
    margin-top: 7px;
  }
  .cell {
    height: 42px;
  }
  #tray {
    gap: 3px;
  }
  .notebook {
    margin-top: 9px;
    padding: 10px 12px;
  }
  .tallies {
    gap: 18px;
    justify-content: flex-start;
  }
  .tallies > div {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .tallies b {
    font-size: 17px;
  }
  .meter {
    margin: 3px 0 7px;
  }
  .notebook #line {
    min-height: 0;
    font-size: 13px;
  }
  .notebook h2 {
    display: none;
  }
  #tools {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-top: 7px;
  }
  .tool {
    grid-template-rows: 24px auto auto;
    font-size: 12px;
  }
  .tool small {
    font-size: 10px;
  }
  .tray-head {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* The shop's iridescent box reflects the sunset in the chapter illustration. */
body {
  background-color: var(--hh-indigo, #23396f);
}
.box-sky > img {
  opacity: 1;
  filter: saturate(1.05);
}
.box-sky::after {
  background:
    linear-gradient(100deg, #17286150, transparent 58%, #a65a8730),
    linear-gradient(0deg, #332b6e60, transparent 48%);
  opacity: 1;
}
.case {
  background: var(--hh-violet) url("v3/tidy/box-lacquer.webp") center/100% 100%
    no-repeat;
  box-shadow:
    0 10px 32px #1c244477,
    0 0 3px #fff2bd;
}
.lacquer {
  background:
    linear-gradient(108deg, #102d70ab, #4f428791, #9a506c77),
    url("v3/tidy/box-lacquer.webp") center 86%/100% auto;
  border-color: var(--hh-gold);
}
.cell {
  background: linear-gradient(155deg, #182751ce, #484379ce 55%, #9e67889c);
  border-color: var(--hh-gold);
  box-shadow: inset 0 3px 6px #15234499;
}
#burst {
  color: #fff6cd;
  text-shadow:
    0 2px 4px #412656,
    0 0 12px #f088a2,
    0 0 22px #fff3be;
}

.case canvas,
.tool {
  -webkit-tap-highlight-color: transparent;
}

.case .box-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}
#cv {
  will-change: transform;
}
.lacquer {
  position: relative;
  overflow: hidden;
}
.tray-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 4%,
    #b0ddff8c 23%,
    #ffe8a4d9 46%,
    #ffbbd59e 65%,
    transparent 92%
  );
  animation: tray-comet 0.47s ease-out both;
}
@keyframes tray-comet {
  from {
    opacity: 0;
    transform: translateX(-70%);
  }
  32% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(70%);
  }
}
.case,
.lacquer {
  contain: paint;
}
#play .notebook {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.box-sky > img {
  filter: none;
}
