@font-face {
  font-family: Logo;
  src: url(archivo-black-latin-400-normal.woff2);
}
@font-face {
  font-family: Barlow;
  src: url(barlow-latin-600-normal.woff2);
}
@font-face {
  font-family: Condensed;
  src: url(barlow-condensed-latin-700-normal.woff2);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: #082e2c;
  color: #fff6d7;
  font: 18px Barlow;
  overflow: hidden;
  --title-bg: url(island.webp);
  --accent: #ffce42;
  --panel-bg: #092f2eed;
  --panel-border: #b9d4ac92;
}
body[data-theme="hollow"] {
  background: #090c1c;
  --accent: #45f5ff;
  --panel-bg: #111834ed;
  --panel-border: #6de8f588;
}
#scene,
#title,
#hud {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#title {
  background:
    linear-gradient(90deg, #042827a8, #04282744 48%, transparent 72%),
    var(--title-bg) center/cover;
  transition: background-image 0.28s ease;
}
body[data-theme="hollow"] #title {
  background:
    linear-gradient(90deg, #070b1fd6, #0d153677 50%, transparent 76%),
    var(--title-bg) center/cover;
}
.menu {
  position: absolute;
  left: 26%;
  top: 49%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  flex-direction: column;
  font-size: min(8.2vw, 13.5vh);
}
header {
  transform: rotate(-4deg);
  text-align: center;
  margin-bottom: 0.24em;
}
h1 {
  margin: 0;
  font: 1em/0.88 Logo;
  letter-spacing: -0.075em;
  filter: drop-shadow(0 0.045em 0 #132e27)
    drop-shadow(0 0.07em 0.05em #001918aa);
}
h1 span {
  display: block;
  white-space: nowrap;
}
h1 em {
  display: inline-block;
  font-style: normal;
  position: relative;
  color: #fff4ce;
  -webkit-text-stroke: 0.072em #193529;
  paint-order: stroke;
  text-shadow:
    0 0.045em #bfa875,
    0 0.07em #193529;
}
h1 span + span {
  font-size: 1.12em;
}
h1 span + span em {
  color: #ffc438;
  text-shadow:
    0 0.045em #c7791c,
    0 0.07em #193529;
}
body[data-theme="hollow"] h1 span + span em {
  color: #5ef5ff;
  text-shadow:
    0 0.045em #6c38d6,
    0 0.07em #131836;
}
h1 em:nth-child(3n + 1) {
  transform: rotate(-5deg) translateY(0.014em);
}
h1 em:nth-child(3n) {
  transform: rotate(4deg);
}
h1 em:first-child {
  font-size: 1.08em;
}
h1 span + span em:nth-child(2):after {
  content: "";
  position: absolute;
  inset: 21% 11% 20% 21%;
  background: #193529;
  clip-path: polygon(
    50% 0,
    62% 35%,
    100% 50%,
    65% 62%,
    50% 100%,
    37% 65%,
    0 50%,
    37% 37%
  );
}
.island {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  margin-top: 0.45em;
  font: 0.2em Condensed;
  letter-spacing: 0.22em;
  text-shadow: 0 2px 6px #05251c;
  white-space: nowrap;
}
.island b {
  width: 2.1em;
  height: 3px;
  background: var(--accent);
  position: relative;
}
.island b:after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 0.34em;
  height: 0.34em;
  transform: translateY(-50%) rotate(45deg);
  background: inherit;
}
.island b:last-child {
  transform: rotate(180deg);
}
.selector-group {
  width: clamp(240px, min(28vw, 44vh), 410px);
  margin-bottom: min(1.5vh, 13px);
  text-align: center;
}
.selector-label {
  font: 13px Condensed;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff6da;
  opacity: 0.88;
  text-shadow: 0 1px 4px #000c;
  margin-bottom: 5px;
}
.picker-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
}
.picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 10px;
  height: auto !important;
  width: 100% !important;
  font: 16px Condensed;
  letter-spacing: 0.05em;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  color: #fff6da;
  opacity: 0.84;
}
.picker-btn small {
  font: 11px Barlow;
  text-transform: none;
  letter-spacing: 0.01em;
  opacity: 0.8;
}
.picker-btn.selected {
  opacity: 1;
  border-color: var(--accent);
  box-shadow:
    0 0 0 2px #0005,
    0 4px #051e20a8,
    inset 0 0 16px #ffffff18;
  background: #134a46f2;
}
body[data-theme="hollow"] .picker-btn.selected {
  background: #23205cf2;
}
.explorer-row .picker-btn {
  padding: 6px 6px;
  font-size: 15px;
}
button,
.score,
#guide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.58em;
  background: var(--panel-bg);
  color: #fff6da;
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 4px #051e20a8;
}
button {
  font: 22px Condensed;
  letter-spacing: 0.055em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    transform 0.15s,
    filter 0.15s,
    border-color 0.2s;
  touch-action: manipulation;
}
button:hover {
  filter: brightness(1.14);
  transform: translateY(-2px);
}
button:active {
  transform: translateY(3px);
}
button:focus-visible {
  outline: 3px solid white;
  outline-offset: 4px;
}
.primary {
  background: linear-gradient(#ffdb54, #ffb623);
  border-color: #ffe487;
  color: #203327;
  box-shadow:
    0 5px #b46815,
    0 9px 0 #061e20ad;
  font-size: 26px;
}
body[data-theme="hollow"] .primary {
  background: linear-gradient(#6bf6ff, #2cc8e6);
  border-color: #b4fbff;
  color: #101630;
  box-shadow:
    0 5px #225e8c,
    0 9px 0 #060a1aad;
}
.menu > button {
  width: clamp(240px, min(28vw, 44vh), 410px);
  height: min(6.6vh, 58px);
}
.menu > .primary {
  height: min(7.8vh, 72px);
  margin-top: 4px;
  margin-bottom: min(1.8vh, 16px);
}
svg {
  width: 1.05em;
  height: 1.05em;
  stroke-width: 2.4;
}
nav,
footer,
.score,
#guide {
  position: absolute;
  display: flex;
  align-items: center;
}
nav {
  right: 3%;
  top: 4%;
  gap: 12px;
}
nav button {
  width: 49px;
  height: 49px;
  border-radius: 50%;
}
footer {
  left: 3%;
  bottom: 4%;
  gap: 9px;
  font-size: 16px;
  text-shadow: 0 1px 4px black;
}
#scene {
  touch-action: none;
}
#hud {
  pointer-events: none;
}
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 48%, rgba(220, 22, 48, 0.72) 100%);
  transition: opacity 0.14s ease-out;
}
#hearts {
  position: absolute;
  left: 3%;
  top: calc(4% + 124px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 4px #051e20a8;
  font-size: 20px;
}
#hearts .heart-on {
  color: #ff4268;
  text-shadow: 0 0 8px #ff2b5e88;
}
#hearts .heart-off {
  color: #ffffff38;
}
#dash {
  right: calc(6% + 94px);
  width: 68px;
  height: 68px;
  font-size: 16px;
}
.score,
#guide {
  top: 4%;
  padding: 10px 18px;
  font: 23px Condensed;
}
.score {
  left: 3%;
}
#message {
  left: 50%;
  transform: translateX(-50%);
}
#guide {
  left: 3%;
  top: calc(4% + 63px);
}
.score svg,
#guide svg {
  color: var(--accent);
}
#message {
  position: absolute;
  bottom: 10%;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  text-align: center;
  padding: 14px 22px;
  width: max-content;
  max-width: 88%;
}
#message:empty {
  display: none;
}
dialog {
  color: inherit;
  background: #103936;
  border: 2px solid #91b594;
  border-radius: 24px;
  width: min(420px, 92vw);
  padding: 26px;
  text-align: center;
  max-height: 90dvh;
}
body[data-theme="hollow"] dialog {
  background: #141b38;
  border-color: #6de8f588;
}
dialog::backdrop {
  background: #021a1bc2;
  backdrop-filter: blur(5px);
}
h2 {
  margin: 0;
  font: 36px Condensed;
  color: var(--accent);
  text-transform: uppercase;
}
p {
  line-height: 1.4;
}
dialog button {
  width: 100%;
  padding: 10px;
  margin: 14px auto 5px;
}
dl {
  display: grid;
  grid-template-columns: 1fr 2fr;
  text-align: left;
  gap: 10px;
}
dd {
  margin: 0;
  text-align: right;
  color: var(--accent);
}
.touch {
  display: none;
}
.touch > * {
  pointer-events: auto;
  touch-action: none;
  position: absolute;
  bottom: 6%;
  border-radius: 50%;
  background: #092f2eaa;
  border: 2px solid #fff8;
}
#stick {
  left: 5%;
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
}
#stick div {
  background: var(--accent);
  width: 46px;
  height: 46px;
  border-radius: 50%;
}
#jump {
  right: 6%;
  width: 80px;
  height: 80px;
}
@media (any-pointer: coarse) {
  .touch {
    display: block;
  }
  #message {
    bottom: 6%;
    max-width: 48%;
    font-size: 16px;
  }
}
@media (any-pointer: coarse) and (orientation: portrait) {
  #message {
    bottom: auto;
    top: 21%;
    max-width: 90%;
  }
}
@media (max-width: 650px), (max-height: 500px) {
  nav button {
    width: 39px;
    height: 39px;
    font-size: 18px;
  }
  nav {
    gap: 6px;
  }
  .score,
  #guide {
    font-size: 17px;
    padding: 8px 10px;
  }
  .menu > button {
    font-size: 17px;
    height: max(38px, 6.4vh);
  }
  .menu > .primary {
    font-size: 21px;
    height: max(42px, 7.5vh);
    margin-bottom: 10px;
  }
  .picker-btn {
    font-size: 14px;
    padding: 6px 6px;
  }
  .picker-btn small {
    font-size: 10px;
  }
  footer {
    font-size: 14px;
  }
}
@media (max-aspect-ratio: 1/1) {
  #title {
    background:
      linear-gradient(0deg, #022320cc, #02232044 55%, transparent),
      var(--title-bg) 71% center/cover;
  }
  body[data-theme="hollow"] #title {
    background:
      linear-gradient(0deg, #070b1fe6, #0d153666 55%, transparent),
      var(--title-bg) 60% center/cover;
  }
  .menu {
    inset: 9% 0 9%;
    transform: none;
    font-size: min(16vw, 10.5vh);
  }
  header {
    margin-bottom: auto;
  }
  .selector-group,
  .menu > button {
    width: min(82vw, 340px);
  }
}
@media (max-width: 650px), (max-height: 500px) {
  #guide {
    top: calc(4% + 50px);
  }
}
@media (max-height: 420px) {
  .menu {
    font-size: 11vh;
  }
  footer {
    bottom: 2%;
  }
  #message {
    max-width: 50%;
  }
}

/* Chapters finished at least once */
.picker-btn.done span::after {
  content: " ✓";
  color: var(--accent);
}

/* Cutscenes: full-screen video, or a title card while a scene has no video yet */
#cutscene {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #000;
  animation: cs-in 0.35s ease-out;
}
#cutscene[hidden] {
  display: none;
}
#cutscene.leaving {
  opacity: 0;
  transition: opacity 0.35s;
}
#cutscene video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}
#cutscene.has-video video {
  display: block;
}
#cutscene .card {
  display: none;
  position: relative;
  max-width: min(760px, 86vw);
  text-align: center;
  color: #fff6da;
  text-shadow: 0 2px 12px #000c;
}
#cutscene.has-card .card {
  display: block;
}
#cutscene.has-card::before {
  content: "";
  position: absolute;
  inset: -4%;
  background: var(--backdrop) center / cover no-repeat;
  filter: brightness(0.34) saturate(1.1);
  animation: cs-drift 12s ease-out forwards;
}
#cutscene .card h2 {
  margin: 0 0 18px;
  font: clamp(26px, 5vw, 46px) Logo;
  letter-spacing: 0.04em;
  color: var(--accent);
  animation: cs-rise 0.9s ease-out both;
}
#cutscene .card p {
  margin: 0 0 12px;
  font: clamp(17px, 2.6vw, 23px) / 1.45 Barlow;
  animation: cs-rise 0.9s ease-out both;
}
#cutscene .card p:nth-child(1) {
  animation-delay: 0.7s;
}
#cutscene .card p:nth-child(2) {
  animation-delay: 1.9s;
}
#cutscene .card p:nth-child(3) {
  animation-delay: 3.1s;
}
#cutscene .skip {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: auto;
  height: auto;
  padding: 8px 16px;
  font: 15px Condensed;
  letter-spacing: 0.08em;
  color: #fff6da;
  background: #0008;
  border: 1px solid #fff4;
  border-radius: 999px;
}
@keyframes cs-in {
  from {
    opacity: 0;
  }
}
@keyframes cs-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes cs-drift {
  from {
    transform: scale(1.08);
  }
  to {
    transform: scale(1);
  }
}
