:root {
  color-scheme: dark;
  font-family: "Courier New", monospace;
  background: #0b0d0e;
  color: #eee9dd;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #fff0c7;
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.4;
  cursor: wait;
}
#pit {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100svh;
  height: 100dvh;
  min-height: 320px;
  overflow: hidden;
  background: #111516;
}
.room-still,
#room,
.room-shade,
#shutter {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.room-still {
  background: #121817 url("/assets/pit-still.webp") center/cover;
  transition: opacity 0.6s;
}
.has-renderer .room-still {
  opacity: 0;
}
#room {
  display: block;
  touch-action: none;
  pointer-events: auto;
  cursor: grab;
}
#room:active {
  cursor: grabbing;
}
.room-shade {
  z-index: 1;
  background: linear-gradient(
    #05090b80,
    transparent 24%,
    transparent 65%,
    #030709b3
  );
}
#shutter {
  z-index: 5;
  background: #080b0d;
  opacity: 0;
  transition: opacity 0.42s ease;
}
.changing #shutter {
  opacity: 1;
}
.changing .doors,
.changing #anchor {
  opacity: 0.25;
  pointer-events: none;
}
.pit-header {
  z-index: 9;
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  left: max(28px, env(safe-area-inset-left));
  right: max(28px, env(safe-area-inset-right));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 18px;
  text-shadow: 0 2px 10px #000;
}
.identity-mark {
  font-size: 11px;
  letter-spacing: 0.22em;
  border: 1px solid #d7cbbd80;
  background: #090f12c9;
  padding: 9px 10px;
}
h1 {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  margin: 0;
}
.utilities {
  display: flex;
  gap: 7px;
}
.utilities button {
  height: 44px;
  min-width: 44px;
  display: grid;
  place-items: center;
  border: 1px solid #c9ceca66;
  background: #070d12d6;
  padding: 0 10px;
  font-size: 10px;
  letter-spacing: 0.06em;
}
.utilities button:hover {
  background: #363b35;
}
.utilities svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
}
[hidden] {
  display: none !important;
}
#entry {
  z-index: 7;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #0b1116d9;
  backdrop-filter: blur(18px);
  gap: 15px;
}
.entry-mark {
  font-size: 10px;
  letter-spacing: 0.5em;
  color: #acaeaa;
  margin: 0;
}
#entry h2 {
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(20px, 4vw, 34px);
  letter-spacing: 0.16em;
  margin: 12px 0 22px;
}
#entry button {
  width: 220px;
  min-height: 52px;
  border: 1px solid #b0b7ad;
  background: #1d2b2bcc;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
#entry #silent-enter {
  background: transparent;
  border-color: #616b66;
  min-height: 44px;
  font-size: 10px;
}
#entry-status {
  font-size: 10px;
  min-height: 16px;
  color: #c7b9a3;
}
.entered #entry {
  display: none;
}
body:not(.entered) .doors,
body:not(.entered) #anchor,
body:not(.entered) .position {
  visibility: hidden;
}
.room-corners {
  z-index: 2;
  position: absolute;
  inset: 98px 28px 108px;
  pointer-events: none;
  opacity: 0.3;
}
.room-corners i {
  position: absolute;
  width: 16px;
  height: 16px;
  border: solid #ddd0b4;
}
.room-corners i:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 1px 0 0 1px;
}
.room-corners i:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 1px 1px 0 0;
}
.room-corners i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-width: 0 0 1px 1px;
}
.room-corners i:nth-child(4) {
  bottom: 0;
  right: 0;
  border-width: 0 1px 1px 0;
}
.doors {
  z-index: 4;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 52px));
  width: min(600px, calc(100% - 56px));
  display: flex;
  gap: 12px;
}
.doors button {
  flex: 1;
  min-height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background: #091115e6;
  border: 1px solid #c2c2ac91;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.15em;
  backdrop-filter: blur(10px);
}
.doors button:hover {
  background: #c3bea8;
  color: #111a18;
}
.doors button > span:first-child {
  font:
    19px Arial,
    sans-serif;
}
#anchor {
  position: absolute;
  z-index: 4;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(153px, calc(env(safe-area-inset-bottom) + 132px));
  min-height: 44px;
  min-width: 110px;
  background: #0c1416d9;
  border: 1px solid #c4c3b57d;
  backdrop-filter: blur(8px);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
#anchor:hover,
#anchor[aria-pressed="true"] {
  background: #c6bd98;
  color: #101a14;
}
.position {
  z-index: 3;
  position: absolute;
  left: max(28px, env(safe-area-inset-left));
  right: max(28px, env(safe-area-inset-right));
  bottom: max(25px, calc(env(safe-area-inset-bottom) + 12px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #d5d9cbbf;
  text-shadow: 0 2px 8px #000;
}
#track {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
  text-align: center;
  text-transform: uppercase;
}
#study {
  position: absolute;
  z-index: 8;
  top: calc(68px + env(safe-area-inset-top));
  left: 0;
  right: 0;
  bottom: 0;
  background: #080e10;
}
#study-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.in-study .pit-header {
  inset: 0 0 auto;
  height: calc(68px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0
    max(18px, env(safe-area-inset-left));
  background: #0a1014;
}
.in-study .position,
.in-study .doors,
.in-study #anchor,
.in-study .room-corners {
  display: none;
}
dialog {
  max-width: 440px;
  width: calc(100% - 36px);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  background: #101b1d;
  color: #e9e4d6;
  border: 1px solid #7f9189;
  padding: 32px;
  font-size: 12px;
  box-shadow: 0 20px 100px #0009;
}
dialog::backdrop {
  background: #02090cbf;
  backdrop-filter: blur(7px);
}
dialog form {
  margin: 0;
}
dialog h2 {
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.1em;
  margin: 0 0 26px;
}
.close {
  position: absolute;
  right: 8px;
  top: 7px;
  width: 44px;
  height: 44px;
  background: none;
  border: 0;
  font-size: 26px;
}
dl {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 15px;
  margin: 0 0 26px;
}
dt {
  color: #a7b6ad;
}
dd {
  margin: 0;
  line-height: 1.6;
}
.slider {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  color: #b6c2b9;
}
.slider input {
  width: 100%;
  min-height: 32px;
  accent-color: #c2b590;
}
#audio-status {
  line-height: 1.6;
  color: #ddc5a7;
  font-size: 11px;
}
.help-actions {
  border-top: 1px solid #6c867366;
  padding-top: 20px;
  margin-top: 22px;
  display: grid;
  gap: 12px;
}
.help-actions a,
.help-actions button {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 14px;
  border: 1px solid #78958888;
  background: #1a2c26;
  font-size: 12px;
  min-height: 44px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.no-script {
  position: absolute;
  z-index: 10;
  inset: 55% 10% auto;
  background: #10191c;
  padding: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.no-script a {
  padding: 12px;
}
@media (max-width: 600px) {
  .pit-header {
    top: max(14px, env(safe-area-inset-top));
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    gap: 10px;
  }
  .identity {
    gap: 9px;
  }
  .identity-mark {
    font-size: 9px;
    padding: 8px;
  }
  h1 {
    font-size: 9px;
    letter-spacing: 0.07em;
  }
  .utilities {
    gap: 5px;
  }
  .utilities button {
    padding: 0 6px;
    min-width: 42px;
  }
  .room-corners {
    inset: 85px 16px 96px;
  }
  .doors {
    width: calc(100% - 32px);
    gap: 8px;
    bottom: max(68px, calc(env(safe-area-inset-bottom) + 48px));
  }
  .doors button {
    min-height: 58px;
    font-size: 10px;
    gap: 9px;
  }
  #anchor {
    bottom: max(142px, calc(env(safe-area-inset-bottom) + 122px));
  }
  .position {
    left: 16px;
    right: 16px;
    font-size: 8px;
    gap: 8px;
  }
  .in-study h1 {
    display: none;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .pit-header {
    top: max(9px, env(safe-area-inset-top));
  }
  .room-corners {
    inset: 66px 25px 74px;
  }
  .doors {
    bottom: max(40px, calc(env(safe-area-inset-bottom) + 28px));
    width: min(390px, calc(100% - 220px));
    left: 44%;
  }
  .doors button {
    min-height: 48px;
  }
  #anchor {
    left: auto;
    transform: none;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(42px, calc(env(safe-area-inset-bottom) + 30px));
    min-width: 78px;
  }
  .position {
    bottom: max(11px, env(safe-area-inset-bottom));
  }
  #entry {
    gap: 8px;
  }
  #entry h2 {
    margin: 3px 0 10px;
  }
  #entry button {
    min-height: 44px;
  }
  #entry-status {
    margin: 4px;
  }
  .in-study #study {
    top: 54px;
  }
  .in-study .pit-header {
    height: 54px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#music[aria-pressed="true"] {
  border-color: #d8c9a4;
  background: #354139;
}
#motion[aria-pressed="true"] {
  border-color: #a3b3b6;
}

/* A clear onward route remains outside both full-height discovery frames. */
#study-return {
  border-color: #e4d8b2;
  background: #e4d8b2;
  color: #101917;
  font-weight: bold;
  min-width: 112px;
}
.account-screen,
#account-screen {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  top: max(90px, calc(env(safe-area-inset-top) + 76px));
  bottom: max(205px, calc(env(safe-area-inset-bottom) + 190px));
  width: min(820px, calc(100% - 56px));
  overflow: auto;
  overscroll-behavior: contain;
  color-scheme: light;
  background: #e7ecf1;
  color: #243447;
  border: 1px solid #b9c7d3;
  box-shadow: 0 30px 100px #001426aa;
  font-family: Arial, sans-serif;
}
.account-toolbar {
  display: flex;
  gap: 24px;
  padding: 14px 20px;
  font-size: 12px;
  color: #cbd8e4;
  background: #163756;
  position: sticky;
  top: 0;
}
.account-toolbar span:first-child {
  letter-spacing: 3px;
  color: #9caebd;
}
.account-content {
  padding: clamp(16px, 3vw, 32px);
}
.account-label {
  font-size: 12px;
  color: #536779;
}
#account-balance {
  display: block;
  color: #a32338;
  font-size: clamp(18px, 4vw, 56px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  margin-top: 8px;
  white-space: nowrap;
}
.account-chart {
  display: block;
  width: 100%;
  height: clamp(55px, 12vh, 100px);
  margin: 12px 0 22px;
}
.account-chart path {
  fill: none;
  stroke: #cad4dd;
  stroke-width: 1;
}
.account-chart polyline {
  fill: none;
  stroke: #b33045;
  stroke-width: 2;
}
.account-ledger {
  margin-top: 10px;
  border-top: 1px solid #c4cfd8;
}
.account-ledger div {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid #ced7df;
  font-size: 12px;
}
.account-ledger time {
  font-family: "Courier New", monospace;
  color: #6a7e8f;
}
.account-ledger strong {
  margin-left: auto;
  color: #a32338;
  font-weight: normal;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  .in-study .identity-mark {
    display: none;
  }
  .in-study .pit-header {
    justify-content: center;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .in-study .identity {
    display: none;
  }
  #study-return {
    min-width: 118px;
    font-size: 11px;
  }
  #account-screen {
    width: calc(100% - 32px);
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #account-screen {
    top: 64px;
    bottom: 104px;
    width: min(640px, calc(100% - 60px));
  }
  .account-content {
    padding: 14px 20px;
  }
  .account-chart {
    height: 55px;
    margin-bottom: 12px;
  }
}

#account-character {
  float: right;
  width: clamp(54px, 10vw, 92px);
  height: 160px;
  margin: -8px 0 8px 12px;
  fill: none;
  stroke: #213548;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#account-character .account-balloon ellipse {
  fill: #a32940;
  stroke: #842136;
}
#account-character .account-beam {
  fill: #d2c08766;
  stroke: none;
}
#account-character[data-prop="balloon"] .account-torch {
  display: none;
}
#account-character[data-prop="flashlight"] .account-balloon {
  display: none;
}
#account-character[data-emotion="grief"] .account-figure-head {
  transform: rotate(-16deg);
  transform-origin: 48px 94px;
}
#account-character[data-emotion="panic"] .account-figure-head {
  transform: rotate(13deg);
  transform-origin: 48px 94px;
}
@media (max-width: 600px) {
  #account-character {
    height: 120px;
    margin-left: 6px;
  }
  #account-balance {
    font-size: clamp(16px, 3.7vw, 24px);
  }
}

/* Owner-approved statements stay readable independently of the room shaders. */
#scene-message {
  position: absolute;
  z-index: 3;
  top: max(92px, calc(env(safe-area-inset-top) + 80px));
  left: max(24px, calc(env(safe-area-inset-left) + 16px));
  right: max(24px, calc(env(safe-area-inset-right) + 16px));
  width: fit-content;
  max-width: 940px;
  max-height: calc(100% - 265px);
  margin: 0 auto;
  padding: 18px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #0a1015f5;
  color: #fff5dc;
  border-left: 4px solid #ccd8de;
  box-shadow: 0 8px 36px #0008;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(22px, 2.65vw, 38px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0.015em;
  text-align: left;
  overflow-wrap: break-word;
}
#scene-message[hidden] {
  display: none;
}
#scene-message[data-scene="laid-off"] {
  border-left-color: #dd7771;
}
@media (max-width: 600px) {
  #scene-message {
    top: max(82px, calc(env(safe-area-inset-top) + 72px));
    left: max(16px, calc(env(safe-area-inset-left) + 12px));
    right: max(16px, calc(env(safe-area-inset-right) + 12px));
    padding: 14px 16px;
    font-size: clamp(18px, 4.6vw, 26px);
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #scene-message {
    top: max(74px, calc(env(safe-area-inset-top) + 64px));
    max-height: calc(100% - 210px);
    padding: 10px 14px;
    font-size: clamp(16px, 2.4vw, 20px);
  }
}

.doors {
  max-width: 400px;
}
.doors button {
  width: 100%;
  font-family: inherit;
  text-transform: none;
}
