* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: #dad4c6;
  color: #283c35;
  font-family: Georgia, serif;
}
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  touch-action: none;
}
header {
  position: fixed;
  left: 32px;
  top: 26px;
  font-size: 26px;
  letter-spacing: -1px;
  pointer-events: none;
}
header span {
  display: block;
  font: 9px system-ui;
  letter-spacing: 4px;
  margin-top: 8px;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}
button:focus-visible {
  outline: 2px solid #9e7843;
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
[hidden] {
  display: none !important;
}
#home {
  position: fixed;
  top: 24px;
  right: 28px;
  width: 48px;
  height: 48px;
  border: 1px solid #fff8e9;
  border-radius: 50%;
  background: #fffcf080;
  font-size: 25px;
  backdrop-filter: blur(12px);
}
#invite {
  position: fixed;
  bottom: 45px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
#invite p {
  font: 10px system-ui;
  letter-spacing: 3px;
  white-space: nowrap;
}
#invite button {
  font-size: 20px;
  border: 1px solid #fff9e8;
  background: #fff8e6c9;
  border-radius: 40px;
  padding: 17px 35px;
  box-shadow: 0 10px 40px #322a1710;
  backdrop-filter: blur(16px);
}
#dock {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(620px, 90vw);
  padding: 12px 20px;
  border: 1px solid #fff9e9;
  border-radius: 40px;
  background: #fff9e8d9;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px #24281820;
}
#dock > div {
  flex: 1;
}
#dock small {
  display: block;
  font: 9px system-ui;
  letter-spacing: 2px;
  color: #827755;
  margin-bottom: 5px;
}
#dock span {
  font-size: 21px;
}
#dock button {
  font-size: 24px;
  width: 36px;
  height: 42px;
}
#reader {
  position: fixed;
  left: 24px;
  bottom: 115px;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: #fff9eaf5;
  border: 1px solid #fffefa;
  border-radius: 16px;
  box-shadow: 0 10px 45px #302b1825;
  backdrop-filter: blur(18px);
  overflow: hidden;
}
#handle {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 18px 20px;
  text-align: left;
  font-size: 17px;
}
.grip {
  width: 25px;
  height: 3px;
  border-radius: 3px;
  background: #b7ac8e;
}
#chevron {
  margin-left: auto;
}
#reading {
  display: none;
  padding: 0 25px 22px;
  max-height: 60vh;
  overflow: auto;
  font-size: 17px;
  line-height: 1.65;
}
#reader.expanded #reading {
  display: block;
}
#reader.expanded #chevron {
  transform: rotate(180deg);
}
#eyebrow {
  font: 9px system-ui;
  letter-spacing: 2px;
  color: #927746;
}
h1 {
  font-size: 29px;
  line-height: 1.2;
  font-weight: normal;
}
#notation {
  font-size: 25px;
  color: #9f7744;
}
#task {
  font-size: 16px;
}
#choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#choices button {
  background: #e8e5d7;
  border: 1px solid #d1ccb8;
  border-radius: 20px;
  padding: 8px 16px;
  font: 14px system-ui;
}
#feedback {
  font: 14px/1.6 system-ui;
  min-height: 20px;
}
#hint {
  position: fixed;
  right: 30px;
  bottom: 122px;
  font: 10px system-ui;
  letter-spacing: 0.4px;
  color: #615e50;
  max-width: 210px;
  text-align: right;
}
@media (max-width: 650px) {
  header {
    font-size: 22px;
    top: 22px;
    left: 22px;
  }
  #dock {
    top: 85px;
    bottom: auto;
    gap: 8px;
    padding: 9px 12px;
  }
  #dock span {
    font-size: 17px;
  }
  #dock small {
    font-size: 8px;
  }
  #reader {
    left: 14px;
    bottom: 18px;
    max-width: none;
    width: calc(100vw - 28px);
  }
  #hint {
    bottom: 100px;
    right: 22px;
    font-size: 9px;
  }
  #invite {
    bottom: 55px;
  }
  #reading {
    max-height: 57vh;
  }
  #home {
    right: 20px;
    top: 17px;
  }
}

#reader.expanded ~ #hint {
  display: none;
}

@media (min-width: 651px) {
  #reader {
    display: none !important;
  }
  #hint {
    background: #fff9e9e8;
    border-radius: 12px;
    padding: 12px 18px;
    max-width: 350px;
    font: 14px/1.5 Georgia;
    bottom: 110px;
  }
  #dock {
    bottom: 18px;
  }
}

#celebrate {
  position: fixed;
  z-index: 30;
  top: 24%;
  left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  pointer-events: none;
  text-align: center;
  padding: 22px 38px;
  background: #fcf4dfef;
  border: 2px solid #c7a465;
  border-radius: 40% 12% 35% 16%;
  box-shadow: 0 14px 45px #60431826;
  color: #254b3f;
  animation: stamp 0.35s ease-out;
}
#celebrate strong {
  display: block;
  font: bold italic 32px Georgia;
}
#celebrate span {
  display: block;
  font: 14px system-ui;
  margin-top: 10px;
}
#celebrate i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  animation: ink-burst 1.1s ease-out forwards;
}
.ready-next {
  background: #d8e3bd !important;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #d8e3bd55;
}
@keyframes stamp {
  from {
    opacity: 0;
    transform: translateX(-50%) scale(0.8) rotate(-9deg);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1) rotate(-4deg);
  }
}
@keyframes ink-burst {
  to {
    transform: translate(var(--x), var(--y)) rotate(var(--r));
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #celebrate {
    animation: none;
  }
}
@media (max-width: 650px) {
  #celebrate {
    width: 85%;
    padding: 20px;
  }
  #celebrate strong {
    font-size: 24px;
  }
  #dock {
    gap: 2px;
  }
  #dock button {
    width: 29px;
  }
  #dock span {
    font-size: 15px;
  }
}
