:root {
  touch-action: none;
}

body {
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.kate-case {
  --case-scale: 1;
  --case-downscale: 1;
  --screen-scale: 1;
  --base-screen-width: 800px;
  --base-screen-height: 480px;
  --screen-width: 800px;
  --screen-height: 480px;

  position: absolute;
  top: 0px;
  left: 0px;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  --red: #faaaaa;
  --blue: #69c;
  --grey: #e8ebecff;
  --dark-grey: #ddd;
}

.kate-case * {
  box-sizing: border-box;
}

.kc-body {
  user-select: none;
  scale: var(--case-downscale);
  flex-shrink: 0;
  flex-grow: 0;
}

.kc-body.scale-to-fit {
  scale: var(--case-scale);
}

.kc-screen-container {
  position: relative;
}

.kc-screen {
  position: relative;
  z-index: 1;
  width: var(--screen-width);
  height: var(--screen-height);
  background: #2f2f2f;
  outline: 6px solid #5f5f5f;
  user-select: auto;
  overflow: hidden;
  overflow: clip;
  border-radius: 5px;
}

#kate-version {
  position: absolute;
  font-size: 10px;
  font-family: sans-serif;
  font-weight: bold;
  width: 70px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: right;
  color: #fafafa;
  text-shadow: -1px -1px 0px rgba(0, 0, 0, 0.1);
}

#kate-branding {
  position: absolute;
  translate: 220px 516px;
  width: 800px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Roboto";
  font-weight: bold;
  letter-spacing: 3px;
  font-size: 14px;
  color: oklch(from var(--red) 0.6 c h);
  text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.4);
}

.kc-resources-container {
  width: calc(var(--screen-width) + 2px);
  overflow: hidden;
  height: 32px;
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 999;
  display: flex;
  justify-content: right;
}

#kate-resources {
  background: #5f5f5f;
  color: #fafafa;
  border-bottom-left-radius: 26px;
  height: 26px;
  width: min-content;
  padding: 0 8px 0 20px;
  overflow: hidden;
  border: 2px solid #5f5f5f;
  transition: padding-right 0.1s ease-out, background 0.1s ease-out;
  display: flex;
  flex-direction: row;
  justify-content: right;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 16px;
  box-sizing: border-box;
  --rbg: #5f5f5f;
  border-width: 3px;
}

#kate-resources:empty {
  padding-right: 0px;
}

.trusted-mode #kate-resources {
  color: #2f2f2f;
  background: var(--red);
  border-top-color: var(--red);
  border-right-color: var(--red);
  --rbg: var(--red);
}

#kate-resources .kate-resource {
  width: 16px;
  height: 16px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.kate-resource-screen-recording {
  background: #f21;
  border: 1px solid #fafafa;
  border-radius: 100%;
}

.kate-current-process-indicator {
  font-family: "Font Awesome 6 Free";
}

.kate-current-process-indicator[data-trusted]::before {
  content: "\f023";
  display: block;
}

.kate-current-process-indicator:not([data-trusted])::before {
  content: "\f219";
  display: block;
}

.kate-resource-gc {
  font-family: "Font Awesome 6 Free";
}

.kate-resource-gc::before {
  content: "\f1b8";
  display: block;
}

.kate-resource-temporary-file {
  font-family: "Font Awesome 6 Free";
}

.kate-resource-temporary-file::before {
  content: "\f15b";
  display: block;
}

.kate-resource-transient-storage {
  font-family: "Font Awesome 6 Free";
}

.kate-resource-transient-storage::before {
  content: "\f0a0";
  display: block;
  position: absolute;
  top: 0px;
  left: 0px;
  font-size: 14px;
}

.kate-resource-transient-storage::after {
  content: "\f017";
  display: block;
  font-size: 9px;
  position: absolute;
  bottom: 0px;
  right: 0px;
  text-shadow: -1px -1px 0 var(--rbg), 0px -1px 0 var(--rbg), -1px 0 0 var(--rbg);
}

.kate-resource-low-storage {
  font-family: "Font Awesome 6 Free";
}

.kate-resource-low-storage::before {
  content: "\f0a0";
  display: block;
  position: absolute;
  top: 0px;
  left: 0px;
  font-size: 14px;
}

.kate-resource-low-storage::after {
  content: "\f071";
  display: block;
  font-size: 9px;
  position: absolute;
  bottom: 0px;
  right: 0px;
  text-shadow: -1px -1px 0 var(--rbg), 0px -1px 0 var(--rbg), -1px 0 0 var(--rbg);
}

#kate-loading {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  justify-content: end;
  align-items: end;
  padding: 2rem;
  background: #2f2f2f;
  color: #fafafa;
  font-size: 24px;
  font-weight: bold;
  box-sizing: border-box;
}

/* electron */
.kc-body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-app-region: drag;
}

.kc-shoulder,
.kc-dpad,
.kc-screen,
.kc-button,
.kc-small-button {
  -webkit-app-region: no-drag;
}

/* running games (FIXME: move elsewhere) */
.kate-game-frame {
  width: 100%;
  height: 100%;
  border: none;
  overflow: hidden;
  overflow: clip;
}

.kate-game-frame-defaults {
  width: var(--screen-width);
  height: var(--screen-height);
}

/* image scaling */
.kate-case img {
  image-rendering: pixelated;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* handheld mode */
.kate-case[data-case-type="handheld"] .kc-body {
  width: 1240px;
  height: 540px;
  border-radius: 120px 120px 60px 60px;
  background: var(--red);
  box-shadow: 0px 5px 0px #c99;
}

.kate-case[data-case-type="handheld"] #kate-version {
  transform-origin: top left;
  translate: 210px 521px;
}

.kate-case[data-case-type="handheld"] .kc-screen-container {
  position: absolute;
  transform-origin: top left;
  translate: 220px 30px;
}

.kc-shoulder {
  position: absolute;
  width: 220px;
  height: 130px;
  overflow: hidden;
  transform-origin: top left;
}

.kc-shoulder .kc-shoulder-button {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 220px;
  height: 120px;
  background: var(--blue);
  border-radius: 20px;
  transform-origin: top left;
  transition: translate 50ms ease-out;
}

.kc-shoulder-hide {
  display: block;
  width: 340px;
  height: 240px;
  background: var(--red);
  border-radius: 120px;
  position: absolute;
  translate: 0px 0px;
  transform-origin: top left;
  box-shadow: 0px -1px 2px rgba(0, 0, 0, 0.25);
}

.kc-shoulder-left .kc-shoulder-button {
  translate: 0px 0px;
}

.kc-shoulder-left.down .kc-shoulder-button {
  translate: 10px 10px;
}

.kc-shoulder-right {
  translate: 1020px 0px;
}

.kc-shoulder-right.down .kc-shoulder-button {
  translate: -10px 10px;
}

.kc-shoulder-right .kc-shoulder-hide {
  translate: -120px 0px;
}

.kc-dpad {
  position: absolute;
  touch-action: none;
  transform-origin: top left;
  translate: 0px 160px;
  width: 220px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kc-dpad::before {
  content: "";
  display: block;
  position: absolute;
  pointer-events: none;
  touch-action: none;
  width: 175px;
  height: 175px;
  border-radius: 100%;
  background: rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25), 1px 1px 1px #fff;
}

.kc-dpad-button {
  width: 50px;
  height: 50px;
  position: absolute;
  background: var(--grey);
  box-shadow: inset 1px 1px 1px #fff, 1px 1px 1px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kc-dpad-button.down {
  background: #ddd;
  box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.2), 1px 1px 1px #fff;
}

.kc-dpad-button::before {
  content: "";
  border: 12px solid #4f4f4f;
  display: block;
  width: 0px;
  height: 0px;
  position: absolute;
}

.kc-dpad-up::before {
  border-color: transparent transparent #4f4f4f transparent;
  translate: 0 -12px;
}

.kc-dpad-right::before {
  border-color: transparent transparent transparent #4f4f4f;
  translate: 12px;
}

.kc-dpad-down::before {
  border-color: #4f4f4f transparent transparent transparent;
  translate: 0 12px;
}

.kc-dpad-left::before {
  border-color: transparent #4f4f4f transparent transparent;
  translate: -12px 0;
}

.kc-dpad-up {
  translate: 0px -50px;
  border-radius: 15px 15px 0 0;
}

.kc-dpad-right {
  translate: 50px 0;
  border-radius: 0 15px 15px 0;
}

.kc-dpad-down {
  translate: 0 50px;
  border-radius: 0 0 15px 15px;
}

.kc-dpad-left {
  translate: -50px 0;
  border-radius: 15px 0 0 15px;
}

.kc-dpad-background {
  position: absolute;
  width: 52px;
  height: 52px;
  background: var(--grey);
}

.kc-thumb {
  pointer-events: none;
  touch-action: none;
  position: absolute;
  width: 60px;
  height: 60px;
  top: 70px;
  left: 30px;
  background: var(--blue);
  border-radius: 100%;
  box-shadow: inset 1px 1px 1px #fff, 1px 1px 2px 1px rgba(0, 0, 0, 0.2);
  display: none;
}

.kc-dpad.down .kc-thumb {
  background: #9af;
}

.kc-faces {
  position: absolute;
  transform-origin: top left;
  translate: 1020px 255px;
  width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.kc-faces-background {
  border-radius: 100%;
  width: 140px;
  height: 140px;
  position: absolute;
  background: rgba(0, 0, 0, 0.1);
  box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.25), 1px 1px 1px #fff;
}

.kc-special {
  position: absolute;
  transform-origin: top left;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.kc-button {
  width: 65px;
  height: 65px;
  border-radius: 100%;
  font-size: 45px;
  line-height: 65px;
  color: transparent;
  background-position: center center;
  background-size: contain;
  background-repeat: no-repeat;
}

.kc-small-button {
  width: 45px;
  height: 45px;
  border-radius: 100%;
  font-size: 20px;
  line-height: 45px;
  color: transparent;
  background-color: #f7f1d8;
  background-position: center center;
  background-size: 80%;
  background-repeat: no-repeat;
}

.kc-button,
.kc-small-button {
  box-shadow: inset 1px 1px 1px #fff, 1px 1px 1px rgba(0, 0, 0, 0.2);
}

.kc-button.down,
.kc-small-button.down {
  filter: brightness(75%);
  box-shadow: 1px 1px 1px #fff, inset 1px 1px 1px rgba(0, 0, 0, 0.2);
}

.kc-berry {
  background-image: url("../img/case/berry.png");
  position: absolute;
  translate: 170px 390px;
}

.kc-capture {
  background-image: url("../img/case/capture.png");
  position: absolute;
  translate: 1070px 390px;
}

.kc-menu {
  background-image: url("../img/case/menu.png");
  position: absolute;
  translate: 0px -65px;
  rotate: 90deg;
  height: 60px;
}

.kc-ok {
  background-image: url("../img/case/ok.png");
  position: absolute;
  translate: 65px 0;
}

.kc-cancel {
  background-image: url("../img/case/cancel.png");
  position: absolute;
  translate: 0px 65px;
}

.kc-sparkle {
  background-image: url("../img/case/sparkle.png");
  position: absolute;
  translate: -65px 0;
}

.kc-whiskers {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 150px;
  position: absolute;
  translate: -10px 385px;
  rotate: 27deg;
  flex-direction: column;
  gap: 20px;
}

.kc-whiskers i {
  display: block;
  height: 20px;
  width: 175px;
  background: rgba(0, 0, 0, 0.025);
  border-radius: 20px;
  box-shadow: 1px 1px 1px #fff, inset 1px 1px 1px rgba(0, 0, 0, 0.2);
}

.kc-whiskers i:nth-child(2) {
  width: 125px;
  height: 15px;
}

.kc-whiskers i:nth-child(3) {
  width: 75px;
  height: 10px;
}

.kc-whiskers.kc-whiskers-right {
  translate: 1050px 385px;
  rotate: -27deg;
}

/* tv mode */
.kate-case[data-case-type="tv"] .kc-body {
  padding: 32px;
  border-radius: 20px;
  background: var(--red);
  box-shadow: 0px 5px 0px #c99;
  box-sizing: border-box;
}

.kate-case[data-case-type="tv"] .kc-virtual {
  display: none;
}

.kate-case[data-case-type="tv"] #kate-version {
  bottom: 10px;
  right: 32px;
  font-size: 11px;
  width: max-content;
}

.kate-case[data-case-type="tv"] #kate-branding {
  translate: 0px;
  font-size: 15px;
  bottom: 0px;
  left: 35px;
  width: calc(100% - 70px);
  height: 26px;
}

/* fullscreen mode */
.kate-case[data-case-type="fullscreen"] .kc-virtual {
  display: none;
}

.kate-case[data-case-type="fullscreen"] .kc-body {
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  scale: 1;
}

.kate-case[data-case-type="fullscreen"] .kc-screen-container {
  width: var(--screen-width);
  height: var(--screen-height);
  outline: none;
}

.kate-case[data-case-type="fullscreen"] .kc-body.scale-to-fit .kc-screen-container {
  scale: var(--case-scale);
}

.kate-case[data-case-type="fullscreen"] .kc-resources-container {
  width: 100%;
  top: 0px;
  right: 0px;
}

.kate-case[data-case-type="fullscreen"] #kate-resources {
  border-top: none;
  border-right: none;
}

.kate-case[data-case-type="fullscreen"] #kate-version {
  display: none;
}

.kate-case[data-case-type="fullscreen"] #kate-branding {
  display: none;
}
