:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --world-green: #3f8f2f;
  --world-green-dark: #246523;
  --world-ink: #102635;
  --world-line: rgba(16, 38, 53, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  width: 100%;
}

body {
  background: #a9c7cc;
  color: var(--world-ink);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.world-shell,
.world-stage {
  height: 100%;
  inset: 0;
  position: fixed;
  width: 100%;
}

.world-stage canvas {
  display: block;
  height: 100%;
  touch-action: none;
  width: 100%;
}

.world-topbar {
  align-items: center;
  background: rgba(247, 250, 248, 0.84);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 7px;
  box-shadow: 0 10px 34px rgba(16, 38, 53, 0.14);
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  left: 1rem;
  min-height: 54px;
  padding: 0.4rem 0.5rem;
  position: fixed;
  right: 1rem;
  top: 1rem;
  z-index: 20;
}

.world-back,
.world-icon-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--world-line);
  border-radius: 50%;
  color: var(--world-ink);
  cursor: pointer;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  padding: 0;
  width: 38px;
}

.world-back svg,
.world-icon-button svg {
  fill: currentColor;
  height: 19px;
  width: 19px;
}

.world-heading {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  min-width: 0;
}

.world-heading img {
  height: 34px;
  object-fit: contain;
  width: 64px;
}

.world-heading span {
  display: grid;
  min-width: 0;
}

.world-heading strong {
  font-size: 0.96rem;
  line-height: 1.1;
}

.world-heading small {
  color: #637782;
  font-size: 0.72rem;
  margin-top: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-live {
  align-items: center;
  color: #286d2a;
  display: inline-flex;
  font-size: 0.72rem;
  gap: 0.35rem;
}

.world-live::before {
  animation: worldPulse 1.8s ease-out infinite;
  background: #36a34a;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(54, 163, 74, 0.4);
  content: "";
  height: 8px;
  width: 8px;
}

.world-top-actions {
  align-items: center;
  display: flex;
  gap: 0.4rem;
}

.world-toolbar {
  align-items: center;
  background: rgba(247, 250, 248, 0.86);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 7px;
  bottom: 1rem;
  box-shadow: 0 12px 32px rgba(16, 38, 53, 0.14);
  display: flex;
  gap: 0.35rem;
  left: 50%;
  max-width: calc(100vw - 10rem);
  padding: 0.42rem;
  position: fixed;
  transform: translateX(-50%);
  z-index: 18;
}

.world-filter {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #526873;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  gap: 0.35rem;
  min-height: 34px;
  padding: 0.35rem 0.7rem;
  white-space: nowrap;
}

.world-filter svg {
  fill: currentColor;
  height: 16px;
  width: 16px;
}

.world-filter[aria-pressed="true"] {
  background: #e2f1df;
  border-color: rgba(63, 143, 47, 0.35);
  color: var(--world-green-dark);
}

.world-joystick {
  bottom: 1rem;
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(2, 42px);
  left: 1rem;
  position: fixed;
  z-index: 18;
}

.world-joystick button {
  align-items: center;
  background: rgba(247, 250, 248, 0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 38, 53, 0.16);
  color: var(--world-ink);
  cursor: pointer;
  display: flex;
  font-size: 1rem;
  justify-content: center;
  padding: 0;
}

.world-joystick button:first-child {
  border-radius: 6px 6px 2px 2px;
  grid-column: 2;
}

.world-joystick button:nth-child(2) {
  border-radius: 6px 2px 2px 6px;
  grid-column: 1;
  grid-row: 2;
}

.world-joystick button:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.world-joystick button:nth-child(4) {
  border-radius: 2px 6px 6px 2px;
  grid-column: 3;
  grid-row: 2;
}

.world-detail {
  background: rgba(250, 252, 250, 0.94);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 7px;
  box-shadow: 0 20px 54px rgba(16, 38, 53, 0.22);
  display: grid;
  gap: 0.6rem;
  max-height: calc(100vh - 7.5rem);
  overflow: auto;
  padding: 1rem;
  position: fixed;
  right: 1rem;
  top: 5.8rem;
  width: min(340px, calc(100vw - 2rem));
  z-index: 22;
}

.world-detail[hidden] {
  display: none;
}

.world-detail-close {
  align-items: center;
  background: transparent;
  border: 0;
  color: #526873;
  cursor: pointer;
  display: flex;
  font-size: 1.35rem;
  height: 30px;
  justify-content: center;
  padding: 0;
  position: absolute;
  right: 0.55rem;
  top: 0.45rem;
  width: 30px;
}

.world-detail-type {
  color: var(--world-green-dark);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.world-detail h2 {
  font-size: 1rem;
  margin: 0;
  padding-right: 1.8rem;
}

.world-detail p {
  color: #526873;
  font-size: 0.84rem;
  line-height: 1.45;
  margin: 0;
}

.world-detail-author {
  align-items: center;
  display: flex;
  font-size: 0.78rem;
  gap: 0.45rem;
}

.world-detail-author img {
  border: 1px solid var(--world-line);
  border-radius: 50%;
  height: 30px;
  object-fit: cover;
  width: 30px;
}

.world-detail-link {
  align-items: center;
  background: var(--world-green-dark);
  border-radius: 5px;
  color: #fff;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  justify-content: center;
  min-height: 36px;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
}

.world-loader {
  align-items: center;
  background: #eff5f2;
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  transition: opacity 0.35s ease;
  z-index: 40;
}

.world-loader.done {
  opacity: 0;
  pointer-events: none;
}

.world-loader-box {
  align-items: center;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  width: min(300px, calc(100vw - 2rem));
}

.world-loader-box img {
  height: 80px;
  object-fit: contain;
  width: 150px;
}

.world-loader-box p {
  color: #526873;
  font-size: 0.82rem;
  margin: 0;
}

.world-progress {
  background: #d7e2dc;
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
  width: 100%;
}

.world-progress span {
  background: var(--world-green);
  display: block;
  height: 100%;
  transition: width 0.25s ease;
  width: 8%;
}

.world-attribution {
  background: rgba(247, 250, 248, 0.72);
  border-radius: 3px;
  bottom: 0.25rem;
  color: #526873;
  font-size: 0.62rem;
  padding: 0.2rem 0.35rem;
  position: fixed;
  right: 0.35rem;
  text-decoration: none;
  z-index: 17;
}

.world-error {
  background: #fff;
  border: 1px solid #d14343;
  border-radius: 7px;
  color: #8f2020;
  left: 50%;
  max-width: calc(100vw - 2rem);
  padding: 1rem;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 420px;
  z-index: 50;
}

@keyframes worldPulse {
  70% {
    box-shadow: 0 0 0 7px rgba(54, 163, 74, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(54, 163, 74, 0);
  }
}

@media (max-width: 720px) {
  .world-topbar {
    left: 0.5rem;
    right: 0.5rem;
    top: 0.5rem;
  }

  .world-heading img {
    height: 29px;
    width: 52px;
  }

  .world-heading small {
    max-width: 42vw;
  }

  .world-live {
    display: none;
  }

  .world-toolbar {
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
    max-width: calc(100vw - 1rem);
    overflow-x: auto;
    scrollbar-width: none;
    width: max-content;
  }

  .world-toolbar::-webkit-scrollbar {
    display: none;
  }

  .world-filter {
    font-size: 0;
    height: 38px;
    justify-content: center;
    padding: 0;
    width: 42px;
  }

  .world-filter svg {
    height: 19px;
    width: 19px;
  }

  .world-joystick {
    bottom: calc(4.4rem + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, 38px);
    grid-template-rows: repeat(2, 38px);
    left: 0.55rem;
  }

  .world-detail {
    border-radius: 7px 7px 0 0;
    bottom: 0;
    left: 0;
    max-height: 48dvh;
    right: 0;
    top: auto;
    width: 100%;
  }

  .world-attribution {
    bottom: calc(4.15rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  .world-heading strong {
    font-size: 0.86rem;
  }

  .world-heading small {
    max-width: 34vw;
  }

  .world-top-actions {
    gap: 0.2rem;
  }

  .world-icon-button {
    height: 34px;
    width: 34px;
  }
}

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