:root {
  color-scheme: light;
  font-family: Chicago, Geneva, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: auto;
  background: #777;
}

.hypermaus-app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 8px;
}

.card-viewport {
  position: relative;
  flex: 0 0 auto;
}

.card-stage {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  transform-origin: top left;
  background: #fff;
  color: #000;
  image-rendering: pixelated;
  isolation: isolate;
}

.card-content,
.card-image,
.parts-layer,
.flash-layer {
  position: absolute;
  inset: 0;
}

.card-content {
  z-index: 1;
}

.outgoing-card-snapshot {
  z-index: 0;
  pointer-events: none;
}

.card-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-drag: none;
}

.parts-layer {
  z-index: 2;
}

.parts-layer.show-hotspots .button-style-0 {
  outline: 1px dashed #000;
  outline-offset: -1px;
  background: rgb(255 255 255 / 45%);
}

.part {
  position: absolute;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: #000;
  background: transparent;
  font-family: Chicago, Geneva, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
  white-space: pre-wrap;
  user-select: none;
}

button.part {
  appearance: none;
  cursor: default;
}

button.part[aria-disabled="true"] {
  color: #777;
}

.part-label {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  text-align: inherit;
  pointer-events: none;
}

.part-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  pointer-events: none;
}

.part-icon-fallback {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  line-height: 1;
  pointer-events: none;
}

.button-style-0 {
  background: transparent;
}

.button-style-1,
.button-style-2,
.button-style-3,
.button-style-4,
.button-style-8,
.button-style-9,
.button-style-10,
.button-style-11 {
  display: grid;
  place-items: center;
  padding: 1px 4px;
  background: #fff;
  border: 1px solid #000;
  text-align: center;
}

.button-style-3,
.button-style-8,
.button-style-9 {
  border-radius: 8px;
}

.button-style-4 {
  box-shadow: 3px 3px 0 #000;
}

.button-style-8,
.button-style-9 {
  border-width: 2px;
  box-shadow: inset -1px -1px 0 #888, inset 1px 1px 0 #fff;
}

.button-style-10 {
  border-radius: 50%;
}

.button-style-5,
.button-style-6 {
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: left;
}

.button-style-5::before,
.button-style-6::before {
  content: "";
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 1px solid #000;
  background: #fff;
}

.button-style-6::before {
  border-radius: 50%;
}

.part.hilite:not(.button-style-0),
.part:active:not(.button-style-0) {
  color: #fff;
  background: #000;
  box-shadow: none;
}

.button-style-5.hilite::before,
.button-style-6.hilite::before {
  background: #000;
  box-shadow: inset 0 0 0 2px #fff;
}

.part.field {
  overflow: hidden;
  padding: 1px 2px;
  line-height: 1.15;
  user-select: text;
}

.part.field[contenteditable="true"] {
  cursor: text;
}

.part.field-style-1,
.part.field-style-2,
.part.field-style-4 {
  background: #fff;
  border: 1px solid #000;
}

.part.field-style-4 {
  overflow: auto;
}

.flash-layer {
  z-index: 4;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  mix-blend-mode: difference;
}

.flash-layer.flashing {
  animation: hypercard-flash 160ms steps(2, end);
}

@keyframes hypercard-flash {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

.hypercard-dialog,
.quit-panel {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgb(255 255 255 / 35%);
}

.hypercard-dialog[hidden],
.quit-panel[hidden] {
  display: none;
}

.dialog-panel,
.quit-panel > * {
  font: 12px Chicago, Geneva, "Helvetica Neue", Arial, sans-serif;
}

.dialog-panel,
.quit-panel {
  color: #000;
}

.dialog-panel {
  min-width: min(330px, 92%);
  max-width: 92%;
  padding: 14px;
  border: 2px solid #000;
  border-radius: 7px;
  background: #fff;
  box-shadow: 3px 3px 0 rgb(0 0 0 / 45%);
}

#dialogMessage {
  display: block;
  margin-bottom: 12px;
  white-space: pre-wrap;
  text-align: center;
}

.dialog-input {
  width: 100%;
  height: 24px;
  margin: 0 0 10px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font: inherit;
}

.dialog-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.dialog-choice,
#restartButton {
  min-width: 72px;
  min-height: 24px;
  padding: 2px 10px;
  border: 2px solid #000;
  border-radius: 6px;
  background: #fff;
  color: #000;
  font: inherit;
}

.quit-panel {
  align-content: center;
  background: #fff;
  text-align: center;
}

.quit-panel p {
  margin: 0 0 12px;
}

.stack-menu {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  display: flex;
  width: 100%;
  height: 24px;
  padding: 1px 10px;
  border-bottom: 1px solid #000;
  background: #fff;
  color: #000;
  font: 13px Chicago, Geneva, "Helvetica Neue", Arial, sans-serif;
}

.stack-menu[hidden] {
  display: none;
}

.stack-menu details {
  position: relative;
}

.stack-menu summary {
  min-width: 72px;
  padding: 3px 10px;
  list-style: none;
  text-align: center;
  cursor: default;
}

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

.stack-menu details[open] summary {
  color: #fff;
  background: #000;
}

.stack-menu button {
  position: absolute;
  top: 22px;
  left: 0;
  min-width: 150px;
  padding: 4px 18px;
  border: 1px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font: inherit;
  text-align: left;
  white-space: nowrap;
}

.stack-menu button:hover,
.stack-menu button:focus-visible {
  color: #fff;
  background: #000;
  outline: 0;
}

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