:root {
  color-scheme: dark;
  font: 15px/1.35 system-ui, "Segoe UI", sans-serif;
  color: #f6ead4;
  background: #17121a;
  --box-night: #17121a;
  --box-plum: #291d29;
  --box-panel: #35252f;
  --box-walnut: #6b4935;
  --box-walnut-dark: #392a32;
  --box-amber: #efbd72;
  --box-focus: #ffe0a2;
  --box-linen: #f6ead4;
  --box-muted: #d0c1aa;
  --box-olive: #c6cd94;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--box-night); }

body {
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  background: var(--box-night);
}

.box {
  position: relative;
  width: min(960px, 100vw);
  margin-inline: auto;
}

.box-play {
  position: relative;
  isolation: isolate;
  width: 100%;
  background: #171e25;
  box-shadow:
    0 0 0 3px var(--box-walnut),
    0 0 0 5px var(--box-walnut-dark),
    0 6px 0 5px #120d13,
    0 15px 34px #09070bb8;
}

#world-canvas {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 3 / 2;
  image-rendering: pixelated;
  background: #171e25;
  touch-action: manipulation;
}

.world-gpu-canvas {
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  image-rendering: pixelated;
  pointer-events: none;
}

.box-reveal {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.box-reveal:focus-visible {
  outline: 3px solid var(--box-focus);
  outline-offset: -7px;
  box-shadow: inset 0 0 0 5px #17121a99;
}

.box-controls {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.box-controls > * { pointer-events: auto; }
.box-brand { pointer-events: none; }

.box-menu > summary,
.box-menu-panel button,
.box-menu-panel summary,
.box-menu-panel a,
.box-status button { position: relative; }

.box-controls button,
.box-controls summary,
.box-menu-panel a,
.box-status button {
  --touch-hit-x: 3px;
  --touch-hit-y: 3px;
}

.box-controls button::after,
.box-controls summary::after,
.box-menu-panel a::after,
.box-status button::after {
  position: absolute;
  z-index: 1;
  top: calc(0px - 1px - var(--touch-hit-y));
  left: calc(0px - 1px - var(--touch-hit-x));
  width: calc(100% + 2px + var(--touch-hit-x) + var(--touch-hit-x));
  height: calc(100% + 2px + var(--touch-hit-y) + var(--touch-hit-y));
  border-radius: 7px;
  background: transparent;
  content: "";
  pointer-events: auto;
}

#world-pause, #box-hide { --touch-hit-x: 1px; --touch-hit-y: 2px; }

button:not(.box-reveal), summary, select, .box-links a {
  min-width: 44px;
  min-height: 44px;
  padding: 7px 11px;
  border: 1px solid #a0784b;
  border-radius: 4px;
  color: var(--box-linen);
  background: var(--box-panel);
  box-shadow: inset 0 1px 0 #fff3d21a, 0 3px 0 #170f16;
  font: 600 14px/1.2 system-ui, "Segoe UI", sans-serif;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
}

button:not(.box-reveal):hover, summary:hover, select:hover, .box-links a:hover {
  border-color: #d4a15e;
  background-color: #493442;
}

button:not(.box-reveal):active, button[aria-pressed="true"], details[open] > summary {
  border-color: var(--box-focus);
  background-color: #66442c;
  box-shadow: inset 0 1px 0 #fff3d235, 0 1px 0 #170f16;
  transform: translateY(2px);
}

button:not(.box-reveal):disabled, select:disabled { opacity: .62; cursor: default; }

:focus-visible {
  outline: 3px solid var(--box-focus);
  outline-offset: 2px;
}

#world-canvas:focus-visible,
#world-canvas:focus-visible ~ .world-gpu-canvas {
  outline: 3px solid var(--box-focus);
  outline-offset: -5px;
}

.box-brand {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  max-width: min(250px, calc(100% - 230px));
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 1px solid #a0784b;
  border-radius: 4px;
  background: #211820ed;
  box-shadow: inset 0 1px 0 #fff3d219, 0 3px 0 #170f16;
  color: var(--box-linen);
}

.box-mark {
  position: relative;
  flex: 0 0 18px;
  width: 18px;
  height: 16px;
  margin-top: 4px;
  border: 2px solid #e7b56d;
  background: #874e59;
  box-shadow: 0 2px 0 #151018;
}

.box-mark::before {
  position: absolute;
  top: -6px;
  left: 1px;
  width: 4px;
  height: 4px;
  background: #efbd72;
  box-shadow: 8px 0 #efbd72;
  content: "";
}

.box-mark::after {
  position: absolute;
  top: 4px;
  left: 3px;
  width: 2px;
  height: 2px;
  background: #1b121a;
  box-shadow: 6px 0 #1b121a, 3px 4px #f3d09b;
  content: "";
}

.box-brand-copy { min-width: 0; }
.box-brand h1 {
  overflow: hidden;
  margin: 0;
  color: #ffe8bd;
  font: 600 19px/1 Georgia, "Times New Roman", serif;
  letter-spacing: .01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.box-brand p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--box-olive);
  font: 600 11px/1.1 system-ui, "Segoe UI", sans-serif;
  letter-spacing: .025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.box-left, .box-right {
  position: absolute;
  bottom: 11px;
  width: 50px;
  height: 50px;
  padding: 0;
  border-color: #c19358;
  background: #382630ed;
  color: #ffe0a2;
  font: 700 29px/1 Georgia, "Times New Roman", serif;
  text-shadow: 0 1px #24141d;
}

.box-left { left: 10px; }
.box-right { left: 68px; }
[data-world-hold] { touch-action: none; user-select: none; }

#world-location-action {
  position: absolute;
  bottom: 11px;
  left: 50%;
  max-width: min(360px, calc(100% - 160px));
  transform: translateX(-50%);
  overflow: hidden;
  border-color: #b9bd7f;
  background: #41452eed;
  color: #f4f0d7;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#world-pause {
  position: absolute;
  top: 10px;
  right: 66px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 77px;
  background: #30232aed;
}

.box-pause-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 12px;
  width: 12px;
  height: 14px;
  color: #f3c676;
}

.box-pause-mark::before {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 3px;
  height: 12px;
  background: currentColor;
  box-shadow: 6px 0 currentColor;
  content: "";
}

#world-pause[aria-pressed="true"] .box-pause-mark::before {
  top: 0;
  left: 2px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid currentColor;
  background: transparent;
  box-shadow: none;
}

#box-hide {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  background: #30232aed;
}

.box-hide-mark {
  position: relative;
  display: block;
  width: 17px;
  height: 11px;
  border: 2px solid #f3c676;
  border-radius: 7px / 5px;
}

.box-hide-mark::before {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: -4px;
  width: 21px;
  height: 2px;
  background: #f3c676;
  box-shadow: 0 1px #30232a;
  transform: rotate(-35deg);
  content: "";
}

.box-hide-mark::after {
  position: absolute;
  top: 2px;
  left: 5px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #f3c676;
  content: "";
}

.box-menu {
  position: absolute;
  z-index: 4;
  top: 10px;
  left: 10px;
}

.box-menu > summary, .box-settings > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: min(172px, calc(100vw - 26px));
  list-style: none;
  color: #f6e8ce;
  background: #30232aed;
  font-size: 13px;
}

.box-menu > summary::-webkit-details-marker,
.box-settings > summary::-webkit-details-marker { display: none; }

.box-map-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 13px;
  width: 13px;
  height: 15px;
  border: 1px solid #eac37f;
  background: #7a623e;
  clip-path: polygon(0 18%, 35% 0, 65% 15%, 100% 0, 100% 82%, 65% 100%, 35% 82%, 0 100%);
}

.box-menu-panel {
  position: absolute;
  z-index: 8;
  top: calc(100% + 8px);
  left: 0;
  width: min(430px, calc(100vw - 16px));
  max-height: min(74svh, 540px);
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #be8e53;
  border-radius: 4px;
  background: #211820f7;
  box-shadow: 0 5px 0 #130d14, 0 12px 30px #08060abd, inset 0 1px 0 #fff2d31a;
  scrollbar-color: #9e7449 #211820;
}

.box-menu-heading {
  margin: 0 0 10px;
  color: #f5ddaf;
  font: 600 19px/1.1 Georgia, "Times New Roman", serif;
}

.box-menu-group { margin-top: 12px; }
.box-menu-group h3 {
  margin: 0 0 6px;
  color: var(--box-olive);
  font: 700 11px/1.15 system-ui, "Segoe UI", sans-serif;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.box-scenes, .box-actions, .box-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.box-scenes button { flex: 1 1 42%; }
.box-scenes button[aria-pressed="true"] {
  border-color: #cbd098;
  background: #4b5035;
  color: #fff5d7;
}

.box-actions button { flex: 1 1 120px; }
.box-actions, .box-settings, .box-links { margin-top: 8px; }
.box-menu-group .box-actions { margin-top: 0; }

.box-actions label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 4px 6px;
  border: 1px solid #59444a;
  border-radius: 4px;
  color: var(--box-muted);
  background: #2a2028;
}

.box-actions select {
  max-width: 155px;
  padding-inline: 8px;
  background: #382a32;
}

.box-actions input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--box-olive);
}

.box-settings { padding-top: 8px; border-top: 1px solid #5b4349; }
.box-settings > summary { width: 100%; justify-content: flex-start; }
.box-renderer-status { margin: 8px 0 0; color: var(--box-olive); font-size: 12px; }

.box-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f3d7a5;
  text-decoration-color: #d5ad70;
  text-underline-offset: .2em;
}

.box[data-ui="hidden"] .box-controls,
.box[data-ui="hidden"] .box-description,
.box[data-ui="hidden"] .market-ui {
  display: none !important;
}

.box[data-ui="hidden"] .box-play { box-shadow: none; }

.box-status {
  position: absolute;
  z-index: 9;
  top: 8px;
  left: 50%;
  width: max-content;
  max-width: min(90%, 420px);
  padding: 8px 12px;
  transform: translateX(-50%);
  border: 1px solid #d0a061;
  border-radius: 4px;
  background: #241a22f5;
  box-shadow: 0 3px 0 #130d14, 0 8px 18px #09070aaa;
  text-align: center;
}

.box-status p { margin: 0; color: #f8edd9; }
.box-status button { margin-top: 7px; border-color: #d6ae6b; background: #62412c; }

.box-description {
  margin: 14px 0 0;
  color: var(--box-muted);
  font-size: .9rem;
  text-align: center;
}

.box-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@supports selector(.box-menu-group:has(.box-actions:empty)) {
  .box-menu-group:has(.box-actions:empty) { display: none; }
}

@media (max-width: 510px) and (max-height: 380px) {
  body { min-height: 0; overflow: hidden; }
  .box { width: 100vw; margin: 0; }
  .box-play { box-shadow: none; }
  .box-description { display: none; }
  .box-controls { position: absolute; inset: 0; display: block; }
  .box-brand {
    top: 6px;
    left: calc(50% + 20px);
    max-width: min(176px, calc(100% - 318px));
    gap: 6px;
    padding: 4px 5px;
  }
  .box-brand h1 { font-size: 17px; }
  .box-brand p { font-size: 10px; }
  .box-menu { top: 6px; left: 6px; }
  .box-menu > summary { max-width: min(160px, calc(100vw - 26px)); }
  #world-pause { top: 6px; right: 56px; min-width: 72px; }
  #box-hide { top: 6px; right: 6px; width: 48px; height: 48px; }
  .box-left, .box-right { bottom: 6px; width: 56px; height: 56px; }
  .box-left { left: 6px; }
  .box-right { left: 68px; }
  #world-location-action {
    right: auto;
    bottom: 6px;
    left: 50%;
    width: min(260px, calc(100% - 144px));
    max-width: none;
    min-height: 48px;
    transform: translateX(calc(-50% + 63px));
  }
  .box-menu[open] { z-index: 8; }
  .box-menu-panel {
    max-height: min(calc(100vw * 2 / 3 - 62px), calc(100svh - 62px));
    width: min(430px, calc(100vw - 12px));
  }
  .box-menu > summary, #world-pause, #box-hide,
  .box-controls > button { background-color: #251b23ee; }
  .box-scenes button, .box-actions button { min-height: 44px; }
}

@media (max-width: 440px) and (max-height: 380px) {
  .box-menu > summary {
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
    gap: 0;
    overflow: hidden;
    font-size: 0;
  }
  .box-menu > summary .box-map-mark { flex: 0 0 13px; }
  .box-brand { left: 50%; max-width: max(0px, calc(100% - 240px)); }
  .box-brand h1 { font-size: 15px; }
  .box-brand p { max-width: 84px; }
  #world-pause { right: 56px; min-width: 60px; padding-inline: 7px; }
  #world-pause .box-pause-mark { display: none; }
}

@media (max-width: 510px) and (min-height: 381px) {
  body { display: block; min-height: 100svh; padding-block: 10px; }
  .box { width: min(100%, 480px); padding-inline: 8px; }
  .box-play { box-shadow: 0 0 0 2px var(--box-walnut), 0 0 0 4px var(--box-walnut-dark), 0 5px 0 4px #120d13; }
  .box-controls {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(44px, 1fr)) repeat(2, 44px);
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid #76563d;
    border-radius: 4px;
    background: #291f28;
    box-shadow: inset 0 1px 0 #fff3d219, 0 3px 0 #130d14;
    pointer-events: auto;
  }
  .box-controls > * { position: static !important; transform: none !important; }
  .box-controls > button { position: relative !important; inset: auto !important; }
  .box-brand {
    grid-column: 1 / 3;
    grid-row: 1;
    justify-self: start;
    max-width: 100%;
    padding: 2px 3px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .box-brand h1 { font-size: 18px; }
  .box-menu { grid-column: 4; grid-row: 1; justify-self: end; }
  .box-menu > summary { width: 44px; padding-inline: 0; overflow: hidden; font-size: 0; gap: 0; }
  #world-pause { grid-column: 3 / -1; grid-row: 2; width: 100%; }
  #box-hide { grid-column: 3; grid-row: 1; }
  .box-left { grid-column: 1; grid-row: 2; width: 100%; position: static; }
  .box-right { grid-column: 2; grid-row: 2; width: 100%; position: static; }
  #world-location-action { grid-column: 1 / -1; grid-row: 3; width: 100%; max-width: none; white-space: normal; }
  .box-menu-panel {
    position: fixed;
    top: 8px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-height: none;
    z-index: 20;
  }
  .box-description { margin-top: 12px; padding-inline: 3px; text-align: left; }
}

@media (min-width: 511px) {
  .box-menu-panel { max-height: min(72svh, 620px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
