:root {
  color-scheme: light;
  background: #dceef0;
  --stage-ratio: 1.5;
  --focus-color: rgba(255, 250, 198, 0.96);
  --focus-glow: rgba(255, 206, 72, 0.58);
  --ticket-cream: #fff4d6;
  --ticket-paper: #fffaf0;
  --cocoa: #563e2b;
  --cocoa-soft: #806345;
  --teal: #177b7d;
  --teal-dark: #0b5658;
  --sunny: #f2c94c;
  --orange: #df6d2f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  overflow: hidden;
  background: #dceef0;
}

.account-dock {
  position: absolute;
  z-index: 8;
  top: 1.45%;
  left: 1.55%;
  display: block;
  width: 5.9%;
  height: 10.9%;
  color: var(--cocoa);
  font-family: "Fredoka", "Noto Sans SC", sans-serif;
}

.account-dock[hidden] {
  display: none;
}

.account-dock:not([open]) .account-panel,
.account-action[hidden] {
  display: none;
}

.account-summary {
  display: grid;
  width: 100%;
  height: 100%;
  padding: 0;
  place-items: start center;
  grid-template-rows: 72% 28%;
  color: var(--cocoa);
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.account-summary::-webkit-details-marker {
  display: none;
}

.account-avatar {
  display: grid;
  width: 70%;
  aspect-ratio: 1;
  place-items: center;
  color: var(--ticket-cream);
  border: clamp(2px, .17vw, 3px) solid rgba(255, 250, 214, .94);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, .32), transparent 20%),
    linear-gradient(160deg, #2ca5a2 4%, #177b7d 65%, #12676a 100%);
  border-radius: 50%;
  box-shadow:
    inset 0 clamp(-4px, -.28vw, -2px) 0 rgba(7, 67, 69, .42),
    0 clamp(3px, .28vw, 5px) 0 var(--teal-dark),
    0 clamp(6px, .55vw, 10px) clamp(4px, .42vw, 8px) rgba(50, 64, 48, .18);
  transition: transform 160ms ease, filter 160ms ease;
}

.account-avatar svg {
  width: 55%;
  height: 55%;
}

.account-summary-label {
  align-self: start;
  color: #58432f;
  font: 700 clamp(8px, .69vw, 13px)/1 "Fredoka", "Noto Sans SC", sans-serif;
  text-shadow:
    0 1px 0 rgba(255, 249, 220, .96),
    0 0 clamp(4px, .4vw, 8px) rgba(255, 249, 220, .92);
}

.account-summary:hover .account-avatar,
.account-summary:focus-visible .account-avatar,
.account-dock[open] .account-avatar {
  filter: saturate(1.08) brightness(1.05);
  transform: translateY(-2%) scale(1.06);
}

.account-summary:focus-visible {
  border-radius: 50%;
  outline: clamp(2px, .18vw, 4px) solid rgba(255, 206, 72, .82);
  outline-offset: clamp(2px, .18vw, 4px);
}

.account-panel {
  position: absolute;
  top: 102%;
  left: -2%;
  display: grid;
  width: clamp(148px, 12.6vw, 216px);
  padding: clamp(9px, .75vw, 13px);
  border: clamp(1px, .1vw, 2px) solid rgba(128, 99, 69, .34);
  border-radius: 17px 21px 18px 22px;
  gap: clamp(7px, .55vw, 10px);
  background:
    linear-gradient(90deg, transparent 0 4%, rgba(219, 179, 113, .2) 4.5% 5%, transparent 5.5% 94.5%, rgba(219, 179, 113, .2) 95% 95.5%, transparent 96%),
    linear-gradient(165deg, rgba(255, 251, 236, .98), rgba(247, 226, 184, .98));
  box-shadow:
    0 clamp(3px, .3vw, 6px) 0 rgba(139, 101, 55, .28),
    0 clamp(10px, .9vw, 18px) clamp(10px, 1vw, 22px) rgba(61, 50, 35, .2);
  font-family: "Noto Sans SC", sans-serif;
  font-size: clamp(9px, .68vw, 12px);
  transform: rotate(-.45deg);
}

.account-panel::before {
  position: absolute;
  top: -7px;
  left: 12%;
  width: 14px;
  height: 14px;
  content: "";
  border-top: 1px solid rgba(128, 99, 69, .3);
  border-left: 1px solid rgba(128, 99, 69, .3);
  background: #fff9e9;
  transform: rotate(45deg);
}

.account-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
}

.account-name-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 5px;
}

.account-name-row strong {
  overflow: hidden;
  font-family: "Fredoka", "Noto Sans SC", sans-serif;
  font-size: 1.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-label {
  flex: 0 0 auto;
  color: var(--cocoa-soft);
}

.membership-tier {
  width: max-content;
  max-width: 100%;
  padding: 1px 6px;
  overflow: hidden;
  color: var(--teal-dark);
  background: rgba(23, 123, 125, .13);
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.membership-tier.is-full {
  color: #8b481e;
  background: rgba(242, 201, 76, .38);
}

.account-action {
  display: grid;
  min-height: clamp(28px, 2vw, 34px);
  padding: 0 clamp(8px, .65vw, 12px);
  place-items: center;
  border: 1px solid rgba(11, 86, 88, .18);
  border-radius: 11px 14px 12px 13px;
  color: var(--ticket-cream);
  background: linear-gradient(180deg, #249396, #177b7d);
  box-shadow: 0 clamp(2px, .2vw, 4px) 0 var(--teal-dark);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.account-action:hover,
.account-action:focus-visible {
  color: #fff9dc;
  background: linear-gradient(180deg, #2ba5a8, #188487);
  outline: 3px solid rgba(37, 138, 141, .42);
  outline-offset: 2px;
}

.account-panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.world-home {
  position: relative;
  isolation: isolate;
  display: grid;
  width: 100vw;
  height: 100dvh;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
}

.soft-backdrop {
  position: absolute;
  z-index: -2;
  inset: -2vmax;
  background:
    linear-gradient(rgba(224, 242, 241, 0.06), rgba(241, 225, 176, 0.06)),
    url("./open/endless-island-monster-v1.png") center / cover no-repeat;
  filter: blur(clamp(6px, 1vw, 14px)) saturate(0.92) contrast(0.96);
  transform: scale(1.035);
}

@media (min-aspect-ratio: 5/3) {
  .soft-backdrop {
    background:
      linear-gradient(rgba(224, 242, 241, 0.06), rgba(241, 225, 176, 0.06)),
      url("./open/endless-island-monster-v1.png") center / cover no-repeat;
  }
}

.soft-backdrop::after {
  position: absolute;
  inset: 0;
  content: "";
  background: rgba(232, 242, 229, 0.04);
}

.world-stage {
  position: relative;
  width: min(100vw, calc(100dvh * var(--stage-ratio)));
  max-height: 100dvh;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  box-shadow: 0 0 42px rgba(46, 79, 75, 0.14);
  animation: reveal-world 520ms cubic-bezier(0.22, 0.78, 0.25, 1) both;
}

.world-picture,
.world-art {
  display: block;
  width: 100%;
  height: 100%;
}

.world-picture {
  position: absolute;
  inset: 0;
}

.world-art {
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.world-link {
  position: absolute;
  z-index: 2;
  display: block;
  border-radius: 34% 34% 48% 48%;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.wordplay-link {
  --ring-x: 49.2%;
  --ring-y: 60.9%;
  --ring-size: 44%;
  top: 34%;
  left: 5.1%;
  width: 18.1%;
  height: 29%;
}

.world-mode-ticket {
  position: absolute;
  left: 50%;
  top: -8.5%;
  display: flex;
  min-width: clamp(92px, 8.8vw, 136px);
  padding: clamp(5px, .42vw, 8px) clamp(10px, .72vw, 14px);
  align-items: center;
  justify-content: center;
  gap: clamp(5px, .48vw, 9px);
  color: #fff9df;
  background:
    radial-gradient(circle at 8px 50%, transparent 4px, #25894f 4.5px),
    radial-gradient(circle at calc(100% - 8px) 50%, transparent 4px, #25894f 4.5px),
    linear-gradient(180deg, #35a864, #25894f);
  border: clamp(2px, .16vw, 3px) solid rgba(255, 250, 220, .92);
  border-radius: 13px 17px 14px 16px;
  box-shadow:
    0 clamp(3px, .28vw, 5px) 0 #176d3b,
    0 clamp(7px, .68vw, 12px) clamp(7px, .8vw, 15px) rgba(24, 63, 39, .23);
  font: 800 clamp(10px, .72vw, 14px)/1 "Noto Sans SC", sans-serif;
  letter-spacing: .04em;
  transform: translateX(-50%) rotate(-1deg);
  white-space: nowrap;
  pointer-events: none;
}

.world-mode-ticket small {
  padding-left: clamp(5px, .45vw, 8px);
  border-left: 1px solid rgba(255, 249, 220, .56);
  font: 700 clamp(8px, .56vw, 11px)/1 "Fredoka", sans-serif;
  letter-spacing: .08em;
}

.world-link:hover .world-mode-ticket,
.world-link:focus-visible .world-mode-ticket {
  background:
    radial-gradient(circle at 8px 50%, transparent 4px, #2eaa60 4.5px),
    radial-gradient(circle at calc(100% - 8px) 50%, transparent 4px, #2eaa60 4.5px),
    linear-gradient(180deg, #45bd74, #2e9558);
}

.alphabet-link {
  --ring-x: 48.8%;
  --ring-y: 66.3%;
  --ring-size: 42%;
  top: 34.2%;
  left: 29.2%;
  width: 17.7%;
  height: 27.8%;
}

.reader-link {
  --ring-x: 49.4%;
  --ring-y: 66.6%;
  --ring-size: 42%;
  top: 35.2%;
  left: 54.7%;
  width: 17.5%;
  height: 27.8%;
}

.numbers-link {
  --ring-x: 50.4%;
  --ring-y: 75%;
  --ring-size: 44%;
  top: 34%;
  left: 76.1%;
  width: 17.2%;
  height: 28.5%;
}

.future-feature-nav {
  position: absolute;
  z-index: 3;
  left: 28.52%;
  bottom: 0.9%;
  display: grid;
  width: 42.9%;
  height: 12.7%;
  grid-template-columns: 26.1% 24.7% 24.4% 24.8%;
}

.top-feature-nav {
  position: absolute;
  z-index: 4;
  top: 1.65%;
  left: 81.7%;
  display: grid;
  width: 17.8%;
  height: 10.7%;
  grid-template-columns: repeat(3, 1fr);
}

.app-mode-button {
  position: absolute;
  z-index: 8;
  top: 1.45%;
  left: 76.15%;
  display: grid;
  width: 5.35%;
  height: 10.9%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  place-items: start center;
  grid-template-rows: 72% 28%;
  color: var(--cocoa);
  background: transparent;
  border: 0;
  font-family: "Fredoka", "Noto Sans SC", sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-mode-button:focus-visible {
  border-radius: 50%;
  outline: none;
}

.app-mode-button:focus-visible .app-mode-icon {
  outline: clamp(2px, .18vw, 4px) solid rgba(255, 206, 72, .72);
  outline-offset: clamp(2px, .18vw, 4px);
}

.app-mode-button:hover .app-mode-icon {
  filter: saturate(1.08) brightness(1.05);
  transform: translateY(-2%) scale(1.06);
}

.app-mode-button:active .app-mode-icon {
  box-shadow:
    inset 0 clamp(-3px, -.24vw, -2px) 0 rgba(7, 67, 69, .36),
    0 clamp(1px, .12vw, 2px) 0 var(--teal-dark);
  transform: translateY(4%) scale(.98);
}

.app-mode-button[aria-pressed="true"] .app-mode-icon {
  color: #705020;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, .45), transparent 21%),
    linear-gradient(160deg, #ffe884 4%, #f2c94c 68%, #dda52a 100%);
  box-shadow:
    inset 0 clamp(-4px, -.28vw, -2px) 0 rgba(143, 94, 17, .3),
    0 clamp(3px, .28vw, 5px) 0 #a9781b,
    0 clamp(6px, .55vw, 10px) clamp(4px, .42vw, 8px) rgba(50, 64, 48, .18);
}

.app-mode-icon {
  display: grid;
  width: 76%;
  aspect-ratio: 1;
  place-items: center;
  color: var(--ticket-cream);
  border: clamp(2px, .17vw, 3px) solid rgba(255, 250, 214, .94);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, .32), transparent 20%),
    linear-gradient(160deg, #2ca5a2 4%, #177b7d 65%, #12676a 100%);
  box-shadow:
    inset 0 clamp(-4px, -.28vw, -2px) 0 rgba(7, 67, 69, .42),
    0 clamp(3px, .28vw, 5px) 0 var(--teal-dark),
    0 clamp(6px, .55vw, 10px) clamp(4px, .42vw, 8px) rgba(50, 64, 48, .18);
  font: 700 clamp(14px, 1.35vw, 24px)/1 sans-serif;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 120ms ease;
}

.app-mode-label {
  align-self: start;
  color: #58432f;
  font: 700 clamp(8px, .69vw, 13px)/1 "Fredoka", "Noto Sans SC", sans-serif;
  text-shadow:
    0 1px 0 rgba(255, 249, 220, .96),
    0 0 clamp(4px, .4vw, 8px) rgba(255, 249, 220, .92);
}

.app-stage-shell {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  background: #071c35;
}

.app-stage-shell[hidden] {
  display: none;
}

.app-stage-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #071c35;
}

.future-feature-nav button,
.top-feature-nav button {
  position: relative;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.future-feature-nav button {
  border-radius: 22% 22% 0 0;
}

.top-feature-nav button {
  border-radius: 40%;
}

.future-feature-nav button::after {
  position: absolute;
  inset: 10% 12% 12%;
  content: "";
  border: clamp(2px, .18vw, 4px) solid transparent;
  border-radius: 24%;
  opacity: 0;
  transform: translateY(3%) scale(.92);
  transition: opacity 150ms ease, transform 160ms ease, border-color 150ms ease, background 150ms ease;
}

.future-feature-nav button:hover::after,
.future-feature-nav button:focus-visible::after {
  border-color: rgba(255, 250, 198, .94);
  background: rgba(255, 244, 214, .18);
  box-shadow: 0 0 clamp(14px, 1.8vw, 34px) rgba(255, 206, 72, .58);
  opacity: 1;
  transform: translateY(0) scale(1);
}

.future-feature-nav button:focus-visible {
  outline: none;
}

.future-feature-nav button:active::after {
  transform: translateY(3%) scale(.94);
}

.top-feature-nav button::after {
  position: absolute;
  top: 0;
  left: 17%;
  width: 66%;
  aspect-ratio: 1;
  content: "";
  border: clamp(2px, .18vw, 4px) solid transparent;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.88);
  transition: opacity 150ms ease, transform 160ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.top-feature-nav button:hover::after,
.top-feature-nav button:focus-visible::after {
  border-color: rgba(255, 250, 198, .96);
  box-shadow:
    0 0 0 clamp(3px, .35vw, 7px) rgba(255, 255, 255, .22),
    0 0 clamp(14px, 1.8vw, 34px) rgba(255, 206, 72, .62);
  opacity: 1;
  transform: scale(1.04);
}

.top-feature-nav button:focus-visible {
  outline: none;
}

.top-feature-nav button:active::after {
  transform: scale(.94);
}

.coming-soon-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--cocoa);
  background: transparent;
  border: 0;
  font-family: "Noto Sans SC", sans-serif;
}

.coming-soon-dialog::backdrop {
  background: rgba(22, 42, 43, .7);
  backdrop-filter: blur(6px);
}

.coming-soon-ticket {
  position: relative;
  overflow: hidden;
  padding: 34px 32px 28px;
  text-align: center;
  background: var(--ticket-paper);
  border: 2px solid #e7cfa3;
  border-radius: 28px;
  box-shadow: 0 24px 70px rgba(12, 36, 38, .36);
}

.coming-soon-ticket::before {
  position: absolute;
  inset: 13px;
  content: "";
  pointer-events: none;
  border: 1px dashed #d8bb87;
  border-radius: 20px;
}

.coming-soon-stamp {
  position: absolute;
  top: 24px;
  right: 23px;
  padding: 6px 9px;
  color: var(--orange);
  border: 3px solid currentColor;
  border-radius: 10px;
  font: 700 11px/1 "Fredoka", sans-serif;
  letter-spacing: .1em;
  transform: rotate(7deg);
}

.coming-soon-star {
  position: relative;
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  place-items: center;
  color: var(--ticket-cream);
  background: var(--teal);
  border-radius: 22px;
  box-shadow: 0 6px 0 var(--teal-dark);
  font-size: 30px;
}

.coming-soon-kicker {
  position: relative;
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .12em;
}

.coming-soon-dialog h2 {
  position: relative;
  margin: 0;
  font: 700 clamp(26px, 6vw, 36px)/1.2 "Fredoka", "Noto Sans SC", sans-serif;
}

.coming-soon-dialog p:not(.coming-soon-kicker) {
  position: relative;
  margin: 12px 0 22px;
  color: var(--cocoa-soft);
  line-height: 1.7;
}

#coming-soon-close {
  position: relative;
  width: 100%;
  min-height: 48px;
  color: var(--ticket-cream);
  background: var(--teal);
  border: 0;
  border-radius: 15px;
  box-shadow: 0 5px 0 var(--teal-dark);
  font: 700 16px/1 "Noto Sans SC", sans-serif;
  cursor: pointer;
}

#coming-soon-close:hover,
#coming-soon-close:focus-visible {
  background: #1b8b8d;
  outline: 4px solid var(--sunny);
  outline-offset: 3px;
}

.tap-ring {
  position: absolute;
  left: var(--ring-x, 50%);
  top: var(--ring-y, 74%);
  width: var(--ring-size, 42%);
  aspect-ratio: 1;
  border: clamp(3px, 0.3vw, 6px) solid transparent;
  border-radius: 50%;
  box-shadow:
    0 0 0 0 transparent,
    inset 0 0 0 0 transparent;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.88);
  transition:
    opacity 160ms ease,
    transform 180ms cubic-bezier(0.22, 0.8, 0.25, 1.2),
    box-shadow 180ms ease,
    border-color 180ms ease;
  pointer-events: none;
}

.world-link:hover .tap-ring,
.world-link:focus-visible .tap-ring {
  border-color: var(--focus-color);
  box-shadow:
    0 0 0 clamp(5px, 0.7vw, 12px) rgba(255, 255, 255, 0.34),
    0 0 clamp(18px, 2.3vw, 40px) clamp(5px, 0.8vw, 14px) var(--focus-glow),
    inset 0 0 18px rgba(255, 255, 255, 0.34);
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.04);
}

.world-link:active .tap-ring {
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 clamp(3px, 0.45vw, 8px) rgba(255, 255, 255, 0.34),
    0 0 clamp(12px, 1.6vw, 26px) clamp(3px, 0.5vw, 9px) var(--focus-glow);
  opacity: 1;
  transform: translate(-50%, -50%) scale(0.93);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes reveal-world {
  from {
    opacity: 0;
    transform: scale(1.018);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (orientation: portrait) {
  body {
    overflow-y: auto;
  }

  .world-home {
    height: auto;
    min-height: 100svh;
  }

  .world-stage {
    width: 100vw;
  }

}

/*
 * Wide screens use one continuous 7:3 panorama. The original 3:2 artwork is
 * pixel-locked in its center, so the interactive areas are positioned from
 * viewport height instead of stretching with viewport width.
 */
@media (min-aspect-ratio: 5 / 3) and (orientation: landscape) {
  .soft-backdrop {
    display: none;
  }

  .world-stage {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    aspect-ratio: auto;
    box-shadow: none;
  }

  .world-art {
    object-fit: cover;
    object-position: center;
  }

  .account-dock {
    left: calc(50% - 72.675dvh);
    width: 8.85dvh;
  }

  .wordplay-link {
    left: calc(50% - 67.35dvh);
    width: 27.15dvh;
  }

  .alphabet-link {
    left: calc(50% - 31.2dvh);
    width: 26.55dvh;
  }

  .reader-link {
    left: calc(50% + 7.05dvh);
    width: 26.25dvh;
  }

  .numbers-link {
    left: calc(50% + 39.15dvh);
    width: 25.8dvh;
  }

  .future-feature-nav {
    left: calc(50% - 32.22dvh);
    width: 64.35dvh;
  }

  .top-feature-nav {
    left: calc(50% + 47.55dvh);
    width: 26.7dvh;
  }

  .app-mode-button {
    left: calc(50% + 39.225dvh);
    width: 8.025dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .world-stage {
    animation: none;
  }

  .tap-ring {
    transition: none;
  }

  .future-feature-nav button::after {
    transition: none;
  }

  .top-feature-nav button::after {
    transition: none;
  }

  .account-avatar,
  .app-mode-icon {
    transition: none;
  }
}
