:root {
  color-scheme: dark;
  --ink: #090d0e;
  --coal: #101719;
  --wall: #1b2729;
  --tile: #31464a;
  --tile-hi: #496469;
  --paper: #e5d2b8;
  --paper-ink: #211d19;
  --cyan: #62d6d0;
  --cyan-deep: #1f8988;
  --red: #e84535;
  --red-dark: #8d211f;
  --brass: #d0ac51;
  --green: #7ace67;
  --muted: #93a0a0;
  --stroke: #060909;
  --display: "FZKai-Z03", "KaiTi", "STKaiti", serif;
  --body: "Microsoft YaHei", "PingFang SC", sans-serif;
  --utility: "Arial Narrow", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050707;
  font-family: var(--body);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(.7);
  opacity: .44;
}

[hidden] {
  display: none !important;
}

.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;
}

.app-shell {
  position: relative;
  width: min(100vw, 430px);
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  background: var(--coal);
  box-shadow: 0 0 0 1px #263436, 0 0 80px #000;
  user-select: none;
}

.screen-noise {
  position: absolute;
  z-index: 50;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(7deg, transparent 0 3px, #fff 3px 4px, transparent 4px 9px),
    repeating-linear-gradient(95deg, transparent 0 6px, #000 6px 8px, transparent 8px 14px);
  background-size: 17px 23px, 31px 19px;
}

.screen {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

/* Title */
.title-screen {
  background: #0b1113;
}

.title-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(3, 7, 8, .14) 0 28%, transparent 45%),
    linear-gradient(to bottom, transparent 40%, rgba(5, 8, 9, .64) 68%, #080c0d 100%);
}

.title-toolbar {
  position: absolute;
  z-index: 2;
  top: max(14px, env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icon-command {
  min-width: 48px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid rgba(159, 201, 201, .28);
  border-radius: 6px;
  background: rgba(7, 12, 13, .72);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .38);
  color: #e8eeee;
  font-size: 13px;
  font-weight: 700;
}

.notice-icon {
  position: relative;
  width: 17px;
  height: 20px;
  border: 2px solid var(--paper);
  transform: rotate(-3deg);
}

.notice-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 5px;
  width: 8px;
  height: 2px;
  background: var(--red);
  box-shadow: 0 5px 0 var(--paper);
}

.sound-command {
  width: 44px;
  padding: 0;
}

.speaker-icon {
  position: relative;
  display: block;
  width: 9px;
  height: 12px;
  background: #e8eeee;
}

.speaker-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -4px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-right: 0;
  border-left: 11px solid #e8eeee;
}

.speaker-icon::after {
  content: "";
  position: absolute;
  left: 18px;
  top: -4px;
  width: 8px;
  height: 16px;
  border: 2px solid var(--cyan);
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 50% 50% 0;
}

.sound-command.is-muted .speaker-icon::after {
  width: 13px;
  height: 2px;
  top: 5px;
  left: 15px;
  border: 0;
  border-radius: 0;
  background: var(--red);
  transform: rotate(-45deg);
}

.title-lockup {
  position: absolute;
  z-index: 2;
  top: clamp(96px, 16vh, 150px);
  left: 0;
  right: 0;
  text-align: center;
  filter: drop-shadow(0 8px 7px #000);
}

.title-kicker {
  margin: 0 0 2px;
  color: #b6c8c7;
  font-family: var(--utility);
  font-size: 12px;
  font-weight: 700;
}

.title-lockup h1 {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  margin: 0;
  font-family: var(--display);
  font-size: 58px;
  font-weight: 900;
  line-height: .96;
  color: #f0eee7;
  text-shadow:
    3px 0 0 #090b0b,
    -3px 0 0 #090b0b,
    0 3px 0 #090b0b,
    0 -3px 0 #090b0b;
  transform: rotate(-1deg);
}

.title-lockup h1 strong {
  color: var(--red);
  font-weight: 900;
  transform: translateY(6px) rotate(2deg);
}

.title-lockup h1::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 1px;
  bottom: -11px;
  height: 5px;
  background: var(--red-dark);
  transform: skewX(-24deg);
  box-shadow: 0 3px 0 #050707;
}

.title-subtitle {
  margin: 21px 0 0;
  color: #d6dfdb;
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
}

.start-dock {
  position: absolute;
  z-index: 3;
  left: 18px;
  right: 18px;
  bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px));
}

.character-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.character-option {
  position: relative;
  min-width: 0;
  height: 72px;
  padding: 7px 4px 5px;
  border: 1px solid rgba(156, 190, 189, .28);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(10, 16, 17, .82);
  color: #aab5b3;
  font-size: 11px;
  font-weight: 700;
}

.character-option.is-selected {
  border-color: var(--cyan);
  background: rgba(23, 65, 65, .9);
  color: #f1ffff;
  box-shadow: inset 0 -3px 0 var(--cyan-deep), 0 0 18px rgba(98, 214, 208, .16);
}

.portrait {
  position: relative;
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 4px;
  border: 2px solid #111;
  border-radius: 50%;
  background: #c7a68f;
  overflow: hidden;
}

.portrait::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -2px;
  height: 18px;
  border-radius: 50% 55% 35% 40%;
  background: #17191a;
}

.portrait::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 19px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #111;
  box-shadow: 12px 0 0 #111;
}

.portrait i {
  position: absolute;
  z-index: 2;
  left: 10px;
  top: 4px;
  width: 17px;
  height: 4px;
  background: #e9e1ce;
  transform: rotate(-8deg);
}

.portrait-intern::before { background: #515d5d; height: 13px; }
.portrait-intern i { top: 0; left: 6px; width: 24px; height: 8px; background: #d6e8e3; transform: none; }
.portrait-artist { background: #ad8872; }
.portrait-artist::before { background: #7d2c2a; }
.portrait-artist i { background: var(--brass); width: 9px; left: 14px; }

.start-button {
  width: 100%;
  height: 67px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 2px solid #030505;
  border-radius: 6px;
  background: var(--paper);
  box-shadow: inset 0 0 0 3px #9d876c, 0 6px 0 #050707, 0 11px 24px rgba(0, 0, 0, .55);
  color: #191616;
  font-family: var(--display);
  font-size: 29px;
  font-weight: 900;
  text-shadow: 0 1px 0 #fff8e8;
}

.start-button:active {
  transform: translateY(3px);
  box-shadow: inset 0 0 0 3px #9d876c, 0 3px 0 #050707;
}

.start-arrow {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-right: 12px solid var(--red);
  filter: drop-shadow(-2px 1px 0 #111);
}

.start-arrow-right {
  border-right: 0;
  border-left: 12px solid var(--red);
  filter: drop-shadow(2px 1px 0 #111);
}

.record-line {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  color: #869694;
  font-size: 11px;
}

.record-line strong { color: var(--brass); }

/* Room selection */
.select-screen {
  background: #111819;
}

.select-hud {
  position: absolute;
  z-index: 4;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px 9px 14px;
  border: 1px solid #060909;
  background: rgba(9, 14, 15, .88);
  box-shadow: inset 0 -2px 0 #283638, 0 5px 20px #000;
}

.select-hud p {
  margin: 0 0 1px;
  color: #9eb0ae;
  font-size: 10px;
}

.select-hud strong {
  color: #e9efec;
  font-family: var(--display);
  font-size: 18px;
}

.select-hud strong span {
  display: inline-block;
  min-width: 24px;
  color: var(--red);
  font-family: var(--utility);
  font-size: 26px;
  text-align: center;
  text-shadow: 0 0 12px var(--red);
}

.small-command {
  height: 34px;
  padding: 0 12px;
  border: 1px solid #608180;
  border-radius: 4px;
  background: #263a3b;
  color: #d9e6e4;
  font-size: 12px;
  font-weight: 700;
}

#selectCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.select-tip {
  position: absolute;
  z-index: 3;
  top: 90px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 40px);
  margin: 0;
  padding: 8px 14px;
  border: 1px solid rgba(164, 190, 186, .25);
  background: rgba(6, 10, 11, .72);
  color: #d6dedc;
  font-family: var(--display);
  font-size: 13px;
  transform: translateX(-50%);
}

.joystick {
  position: absolute;
  z-index: 5;
  left: 25px;
  bottom: max(31px, env(safe-area-inset-bottom));
  width: 116px;
  height: 116px;
  touch-action: none;
}

.joystick-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(190, 215, 211, .24);
  border-radius: 50%;
  background: rgba(127, 163, 160, .1);
  box-shadow: inset 0 0 25px rgba(0, 0, 0, .65);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  border: 2px solid rgba(227, 236, 233, .45);
  border-radius: 50%;
  background: rgba(195, 210, 207, .26);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
  transform: translate(-50%, -50%);
}

/* Game */
.game-screen {
  display: flex;
  flex-direction: column;
  background: #0b1011;
}

.game-hud {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  height: calc(60px + env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr 42px;
  gap: 1px;
  padding: max(8px, env(safe-area-inset-top)) 8px 7px;
  border-bottom: 2px solid #050707;
  background: #11191b;
  box-shadow: 0 4px 15px #000;
}

.resource,
.night-clock {
  min-width: 0;
  height: 43px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  background: #192426;
  box-shadow: inset 0 0 0 1px #304043;
}

.resource strong {
  overflow: hidden;
  color: #f0f4ef;
  font-family: var(--utility);
  font-size: 18px;
  text-overflow: ellipsis;
}

.coin-mark {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 2px solid #f8d975;
  border-radius: 50%;
  background: #c18323;
  box-shadow: inset 0 0 0 2px #794812, 0 1px 0 #000;
  color: #fff3a8;
  font: 900 12px var(--utility);
}

.power-mark {
  width: 15px;
  height: 26px;
  flex: 0 0 auto;
  background: var(--cyan);
  clip-path: polygon(55% 0, 100% 0, 69% 40%, 100% 40%, 28% 100%, 41% 55%, 0 55%);
  filter: drop-shadow(0 0 5px rgba(98, 214, 208, .5));
}

.night-clock {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  gap: 0;
}

.night-clock span {
  color: #9eacab;
  font-size: 9px;
}

.night-clock strong {
  color: #e6ece9;
  font: 700 15px var(--utility);
}

.hud-icon {
  width: 42px;
  height: 43px;
  display: grid;
  place-items: center;
  background: #192426;
  box-shadow: inset 0 0 0 1px #304043;
}

.pause-icon {
  width: 13px;
  height: 17px;
  border-left: 4px solid #dbe5e2;
  border-right: 4px solid #dbe5e2;
}

.mission-strip {
  position: relative;
  z-index: 2;
  flex: 0 0 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 10px;
  border-bottom: 1px solid #050707;
  background: rgba(13, 18, 19, .96);
  color: #d7ddda;
  font-family: var(--display);
  font-size: 11px;
}

.mission-strip p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mission-strip span {
  flex: 0 0 auto;
  color: var(--green);
  font-size: 9px;
}

.game-stage {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  background: #101718;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.wave-banner {
  position: absolute;
  z-index: 2;
  top: 34%;
  left: 50%;
  width: 270px;
  padding: 8px 13px 10px;
  border-top: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
  background: rgba(4, 7, 8, .88);
  color: #f2eade;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -10px) skewX(-4deg);
  pointer-events: none;
}

.wave-banner.is-showing {
  animation: banner-in 2.1s ease both;
}

.wave-banner span {
  display: block;
  font: 700 12px var(--body);
  color: #acb8b6;
}

.wave-banner strong {
  display: block;
  margin-top: 1px;
  color: var(--red);
  font: 900 28px var(--display);
  text-shadow: 2px 2px 0 #000;
}

@keyframes banner-in {
  0% { opacity: 0; transform: translate(-50%, -18px) skewX(-4deg) scale(.92); }
  15%, 70% { opacity: 1; transform: translate(-50%, 0) skewX(-4deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 8px) skewX(-4deg) scale(1.03); }
}

.action-bar {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  height: calc(84px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 6px 6px max(7px, env(safe-area-inset-bottom));
  border-top: 2px solid #030505;
  background: #11191a;
  box-shadow: 0 -5px 18px #000;
}

.action-button {
  min-width: 0;
  display: grid;
  grid-template-rows: 27px 18px 13px;
  place-items: center;
  padding: 5px 2px 3px;
  border: 1px solid #304143;
  border-radius: 4px;
  background: #1a2729;
  color: #e2e9e6;
  font-size: 11px;
  font-weight: 700;
}

.action-button:active,
.action-button.is-active {
  background: #284345;
  border-color: var(--cyan);
}

.action-button small {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--brass);
  font: 700 9px var(--utility);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.action-icon {
  position: relative;
  display: block;
  width: 28px;
  height: 24px;
}

.bed-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 0;
  bottom: 3px;
  height: 12px;
  border: 2px solid #0c1011;
  border-radius: 4px 4px 1px 1px;
  background: #a7c6c5;
  box-shadow: inset 0 4px 0 #d7e2dd;
}

.bed-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 1px;
  bottom: 0;
  height: 4px;
  border-left: 3px solid #8d5636;
  border-right: 3px solid #8d5636;
}

.door-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 0;
  width: 17px;
  height: 24px;
  border: 2px solid #080b0c;
  background: repeating-linear-gradient(90deg, #527177 0 3px, #344d53 3px 6px);
}

.door-icon::after {
  content: "";
  position: absolute;
  right: 7px;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brass);
}

.build-icon::before,
.build-icon::after {
  content: "";
  position: absolute;
  background: var(--cyan);
  box-shadow: 0 0 0 2px #0a0e0f;
}

.build-icon::before { left: 11px; top: 1px; width: 7px; height: 22px; }
.build-icon::after { left: 3px; top: 9px; width: 23px; height: 7px; }

.repair-icon::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 0;
  width: 7px;
  height: 24px;
  background: var(--green);
  transform: rotate(38deg);
  box-shadow: 0 0 0 2px #0b0e0f;
}

.repair-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 2px;
  width: 14px;
  height: 10px;
  border: 5px solid var(--green);
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(38deg);
}

/* Notice */
.modal-layer,
.pause-layer {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: none;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  background: rgba(7, 10, 11, .8);
  backdrop-filter: blur(3px);
}

.modal-layer.is-open,
.pause-layer.is-open {
  display: grid;
}

.notice-board {
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notice-paper {
  position: relative;
  max-height: calc(100svh - 130px);
  overflow: auto;
  padding: 31px 24px 25px;
  border: 3px solid #0b0b0a;
  border-radius: 3px;
  background:
    repeating-linear-gradient(1deg, rgba(72, 53, 37, .05) 0 1px, transparent 1px 9px),
    var(--paper);
  box-shadow: inset 0 0 0 2px #8f775b, 0 8px 0 #070909, 0 24px 55px #000;
  color: var(--paper-ink);
}

.notice-paper::before,
.notice-paper::after {
  content: "";
  position: absolute;
  width: 36px;
  height: 20px;
  background: rgba(162, 139, 100, .72);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .28);
}

.notice-paper::before { top: -4px; left: 22px; transform: rotate(-5deg); }
.notice-paper::after { right: 23px; bottom: -4px; transform: rotate(4deg); }

.notice-stamp {
  position: absolute;
  top: 29px;
  right: 22px;
  margin: 0;
  padding: 5px 7px;
  border: 2px solid rgba(155, 35, 29, .66);
  color: rgba(155, 35, 29, .72);
  font: 900 10px var(--display);
  transform: rotate(7deg);
}

.notice-paper h2 {
  margin: 0 0 18px;
  color: #12100e;
  font: 900 38px var(--display);
  text-align: center;
  text-shadow: 1px 1px 0 #fff3db;
}

.notice-paper ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rules;
}

.notice-paper li {
  position: relative;
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 6px;
  font: 700 14px/1.65 var(--display);
  counter-increment: rules;
}

.notice-paper li::before {
  content: counter(rules) ".";
  color: var(--red-dark);
  font-family: var(--utility);
  font-size: 15px;
  font-weight: 900;
}

.notice-confirm,
.paper-command {
  flex: 0 0 60px;
  width: 100%;
  border: 3px solid #070909;
  border-radius: 6px;
  background: var(--cyan-deep);
  box-shadow: inset 0 0 0 2px #5fbab5, 0 6px 0 #050707;
  color: #f4f1e9;
  font: 900 23px var(--display);
  text-shadow: 2px 2px 0 #111;
}

.notice-confirm:active,
.paper-command:active {
  transform: translateY(3px);
  box-shadow: inset 0 0 0 2px #5fbab5, 0 3px 0 #050707;
}

/* Sheets */
.sheet-layer {
  position: absolute;
  z-index: 70;
  inset: 0;
  display: flex;
  align-items: flex-end;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 7, .66);
  backdrop-filter: blur(2px);
}

.build-sheet,
.upgrade-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 17px 14px max(16px, env(safe-area-inset-bottom));
  border-top: 3px solid #050707;
  background: #172123;
  box-shadow: 0 -4px 0 #39494b, 0 -15px 40px #000;
  animation: sheet-up .2s ease both;
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: none; }
}

.build-sheet > header,
.upgrade-sheet > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 13px;
}

.build-sheet header p,
.upgrade-sheet header p {
  margin: 0 0 1px;
  color: var(--muted);
  font-size: 10px;
}

.build-sheet h2,
.upgrade-sheet h2 {
  margin: 0;
  color: #f0f1ea;
  font: 900 22px var(--display);
}

.sheet-close {
  width: 38px;
  height: 38px;
  border: 1px solid #3b4a4d;
  border-radius: 4px;
  background: #202e30;
  color: #d8e0de;
  font: 400 24px/1 var(--utility);
}

.build-options {
  display: grid;
  gap: 6px;
}

.build-option {
  min-width: 0;
  height: 59px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 5px 11px 5px 6px;
  border: 1px solid #334548;
  border-radius: 4px;
  background: #202e30;
  text-align: left;
}

.build-option:active { background: #294042; border-color: var(--cyan); }

.build-option > span:nth-child(2) {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.build-option strong { color: #edf2ee; font-size: 13px; }
.build-option small { overflow: hidden; color: #9aa8a6; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.build-option > b { color: var(--brass); font: 900 13px var(--utility); white-space: nowrap; }

.build-art {
  position: relative;
  width: 46px;
  height: 46px;
  display: block;
  border: 1px solid #0a0e0f;
  background: #2c4144;
}

.turret-art::before {
  content: "";
  position: absolute;
  left: 17px;
  bottom: 8px;
  width: 13px;
  height: 19px;
  border: 2px solid #0a0d0e;
  background: #946f3d;
  transform: rotate(-5deg);
}

.turret-art::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 9px;
  width: 27px;
  height: 9px;
  border: 2px solid #0a0d0e;
  background: #d8c36c;
  transform: rotate(-11deg);
}

.console-art::before {
  content: "";
  position: absolute;
  inset: 8px 7px 12px;
  border: 2px solid #080b0c;
  background: #1b272a;
  box-shadow: inset 0 0 0 4px #5bada7;
}

.console-art::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 6px;
  height: 5px;
  background: #111;
}

.repair-art::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 6px;
  width: 7px;
  height: 32px;
  background: var(--green);
  transform: rotate(36deg);
  box-shadow: 0 0 0 2px #0b0f0f;
}

.repair-art::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  width: 17px;
  height: 12px;
  border: 5px solid var(--green);
  border-right-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(36deg);
}

.charm-art::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 7px;
  width: 17px;
  height: 30px;
  border: 2px solid #111;
  background: #d0ba5f;
  box-shadow: inset 0 0 8px #f3e58e, 0 0 12px rgba(237, 220, 108, .35);
}

.charm-art::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 13px;
  width: 6px;
  height: 17px;
  border-left: 2px solid var(--red-dark);
  border-right: 2px solid var(--red-dark);
}

.mini-power {
  display: inline-block;
  width: 8px;
  height: 13px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--cyan);
  clip-path: polygon(55% 0, 100% 0, 69% 40%, 100% 40%, 28% 100%, 41% 55%, 0 55%);
}

.upgrade-preview {
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border: 1px solid #344649;
  background: #101719;
  color: #e8ece7;
  font: 900 19px var(--display);
}

.upgrade-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 11px;
}

.upgrade-stats div {
  padding: 8px 10px;
  border: 1px solid #334548;
  background: #202e30;
}

.upgrade-stats dt { color: #91a09e; font-size: 9px; }
.upgrade-stats dd { margin: 2px 0 0; color: #ecf1ed; font-size: 12px; font-weight: 700; }

.upgrade-confirm {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 17px;
  border: 2px solid #050707;
  border-radius: 5px;
  background: var(--cyan-deep);
  box-shadow: inset 0 0 0 2px #56aaa6, 0 4px 0 #050707;
  color: white;
  font-size: 14px;
  font-weight: 800;
}

.upgrade-confirm b { color: #fff0a7; font: 900 15px var(--utility); }

/* Pause and results */
.pause-panel {
  width: min(100%, 340px);
  padding: 28px 22px 23px;
  border: 3px solid #070909;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px #8f7657, 0 9px 0 #050707;
  color: var(--paper-ink);
  text-align: center;
}

.pause-panel p { margin: 0; color: #766650; font: 700 11px var(--body); }
.pause-panel h2 { margin: 4px 0 22px; font: 900 34px var(--display); }
.pause-panel .paper-command { height: 55px; }

.text-command {
  width: 100%;
  height: 40px;
  margin-top: 13px;
  background: transparent;
  color: currentColor;
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.result-screen {
  display: grid;
  place-items: center;
  padding: max(30px, env(safe-area-inset-top)) 22px max(25px, env(safe-area-inset-bottom));
  background: #101819;
}

.result-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(6, 9, 10, .25), rgba(6, 9, 10, .84)),
    url("assets/apartment-night.svg") center / cover;
  filter: saturate(.7);
}

.result-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 29px 20px 21px;
  border: 3px solid #070909;
  background: rgba(226, 209, 182, .95);
  box-shadow: inset 0 0 0 2px #8c7455, 0 8px 0 #050707, 0 25px 60px #000;
  color: var(--paper-ink);
  text-align: center;
}

.result-copy > p:first-child {
  margin: 0 0 2px;
  color: var(--red-dark);
  font-size: 11px;
  font-weight: 900;
}

.result-copy h2 {
  margin: 0 0 19px;
  font: 900 32px var(--display);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #a99171;
  border-bottom: 1px solid #a99171;
}

.result-stats div {
  min-width: 0;
  padding: 11px 3px;
  border-right: 1px solid #a99171;
}

.result-stats div:last-child { border-right: 0; }
.result-stats span { display: block; color: #75654f; font-size: 9px; }
.result-stats strong { display: block; margin-top: 3px; overflow: hidden; font: 900 15px var(--utility); text-overflow: ellipsis; }
#resultComment { margin: 17px 0; color: #564b3d; font: 700 13px/1.5 var(--display); }
.result-copy .paper-command { height: 55px; }

.toast {
  position: absolute;
  z-index: 100;
  left: 50%;
  bottom: calc(105px + env(safe-area-inset-bottom));
  max-width: calc(100% - 40px);
  padding: 9px 14px;
  border-left: 3px solid var(--cyan);
  background: rgba(6, 10, 11, .92);
  color: #eef4f0;
  box-shadow: 0 5px 20px #000;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-warning { border-left-color: var(--red); }

@media (max-height: 700px) {
  .title-lockup { top: 78px; }
  .title-lockup h1 { font-size: 48px; }
  .character-option { height: 62px; }
  .portrait { width: 30px; height: 30px; margin-bottom: 2px; }
  .start-button { height: 58px; font-size: 25px; }
  .notice-paper { padding-top: 25px; }
  .notice-paper ol { gap: 7px; }
  .notice-paper li { font-size: 12px; }
}

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