:root {
  color-scheme: dark;
  --background: #101010;
  --panel: #1d1d1d;
  --line: #d8d8d8;
  --muted: #9b9b9b;
  --text: #f5f5f5;
  --blue: #4b7ff4;
  --yellow: #efb817;
  --red: #d94e55;
  --green: #47b878;
}

/* Pyxlapse public styles */
* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

button,
textarea {
  font: inherit;
}

main {
  width: min(672px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 64px;
}

header {
  position: relative;
  padding: 0 0 7px;
  border-bottom: 1px solid #aaa;
  text-align: center;
}

.menu-button {
  position: absolute;
  z-index: 4;
  top: 7px;
  left: 8px;
  display: flex;
  width: 30px;
  height: 30px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ddd;
  cursor: pointer;
}

.menu-button span {
  display: block;
  width: 18px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.menu-button[aria-expanded="true"] span:first-child {
  transform: translateY(5.5px) rotate(45deg);
}

.menu-button[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-button[aria-expanded="true"] span:last-child {
  transform: translateY(-5.5px) rotate(-45deg);
}

.app-menu {
  position: absolute;
  z-index: 3;
  top: 42px;
  left: 4px;
  width: 180px;
  padding: 7px;
  border: 1px solid #383838;
  border-radius: 9px;
  background: #1a1a1a;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  text-align: left;
}

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

.app-menu button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #e8e8e8;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.app-menu button:hover:not(:disabled) {
  background: #2b2b2b;
}

.app-menu button:disabled {
  color: #666;
  cursor: default;
}

.menu-divider {
  height: 1px;
  margin: 5px 6px;
  background: #343434;
}

.difficulty-badge {
  position: absolute;
  top: 9px;
  right: 8px;
  min-width: 52px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.difficulty-easy {
  color: var(--green);
}

.difficulty-medium {
  color: var(--yellow);
}

.difficulty-hard {
  color: #ef646b;
}

.challenge-heading {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.challenge-heading > div {
  min-width: 168px;
}

header h1 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  letter-spacing: -0.03em;
}

header p {
  margin: 0;
  color: #aaa;
  font-size: 12px;
  line-height: 16px;
}

.challenge-arrow {
  display: flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #6f6f6f;
  border-radius: 50%;
  background: transparent;
  color: #eee;
  line-height: 0;
  cursor: pointer;
}

.challenge-arrow::before {
  content: "";
  display: block;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}

#previous-challenge::before {
  margin-left: 3px;
  transform: rotate(-135deg);
}

#next-challenge::before {
  margin-right: 3px;
  transform: rotate(45deg);
}

.challenge-arrow:hover {
  border-color: #bbb;
  background: #242424;
}

.challenge-arrow[hidden] {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

.logo {
  width: 17px;
  height: 17px;
  background:
    linear-gradient(var(--blue) 0 0) 0 0 / 7px 7px,
    linear-gradient(var(--yellow) 0 0) 10px 0 / 7px 7px,
    linear-gradient(var(--yellow) 0 0) 0 10px / 7px 7px,
    linear-gradient(var(--blue) 0 0) 10px 10px / 7px 7px;
  background-repeat: no-repeat;
}

.canvases {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 23px 32px 14px;
}

.canvases canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid #8a8a8a;
  border-radius: 8px;
  background: #111;
  cursor: pointer;
}

#target-canvas {
  border-color: var(--red);
}

#target-canvas.solved {
  border-color: var(--green);
}

.canvases.paused::after {
  content: "Paused";
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 6px 10px;
  transform: translate(-50%, -50%);
  border: 1px solid #444;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.9);
  color: #ddd;
  font-size: 11px;
  letter-spacing: 0.04em;
  pointer-events: none;
}

.playback-hint {
  position: absolute;
  z-index: 2;
  inset: 23px 32px 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  pointer-events: none;
}

.playback-hint span {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: #eee;
  text-shadow: 0 2px 8px #000;
  animation: playback-cue 4.2s ease both;
}

.playback-hint i {
  position: relative;
  display: block;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.78);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.18);
  animation: cue-ring 1.25s ease-out 0.35s 2;
}

.playback-hint i::before,
.playback-hint i::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: white;
}

.playback-hint i::before {
  left: 12px;
}

.playback-hint i::after {
  right: 12px;
}

.playback-hint small {
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.02em;
}

.playback-hint.leaving {
  opacity: 0;
  transition: opacity 220ms ease;
}

.playback-hint[hidden] {
  display: none;
}

.canvases.hinting canvas {
  animation: canvas-cue 1.25s ease-in-out 0.35s 2;
}

.playback-speed {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: -2px 0 11px;
  color: #777;
  font-size: 11px;
}

.playback-speed > span {
  margin-right: 3px;
}

.speed-button {
  padding: 4px 7px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #858585;
  font-size: 11px;
  cursor: pointer;
}

.speed-button:hover,
.speed-button.active {
  background: #292929;
  color: #eee;
}

.mobile-note {
  display: none;
}

.workspace-frame {
  margin: 0 32px;
  overflow: hidden;
  border-radius: 11px;
  background: var(--panel);
}

.workspace-header {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #303030;
}

.tabs {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 15px;
  padding: 0;
}

.tab {
  position: relative;
  align-self: stretch;
  padding: 0;
  border: 0;
  background: transparent;
  color: #929292;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -9px;
  left: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: #8995a8;
}

.panel {
  min-height: 207px;
  margin: 0;
  padding: 10px 12px 12px;
  background: transparent;
}

.workspace-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.run-button {
  padding: 9px 13px;
  border: 0;
  border-radius: 7px;
  background: #3b4352;
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.run-button:hover:not(:disabled) {
  background: #4a5568;
}

.run-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.tutorial-answer-button,
.hint-button {
  padding: 8px 10px;
  border: 1px solid #464646;
  border-radius: 7px;
  background: transparent;
  color: #c2c2c2;
  font-size: 12px;
  cursor: pointer;
}

.tutorial-answer-button:hover:not(:disabled),
.hint-button:hover:not(:disabled) {
  border-color: #777;
  color: white;
}

.tutorial-answer-button:disabled,
.hint-button:disabled {
  color: #666;
  cursor: default;
}

.tutorial-answer-button[hidden],
.hint-button[hidden] {
  display: none;
}

.editor-history {
  display: flex;
  align-items: center;
  gap: 3px;
}

.history-button,
.reset-button {
  height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #bbb;
  cursor: pointer;
}

.history-button {
  width: 31px;
  padding: 0 0 3px;
  font-size: 21px;
  line-height: 1;
}

.reset-button {
  margin-left: 4px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 650;
}

.history-button:hover:not(:disabled),
.reset-button:hover {
  background: #2c2c2c;
  color: white;
}

.history-button:disabled {
  color: #505050;
  cursor: default;
}

#code-editor {
  display: block;
  width: 100%;
  height: 185px;
  overflow: hidden;
  color: #777;
  font: 13px/23px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.monaco-editor,
.monaco-editor .overflow-guard {
  border-radius: 4px;
}

.monaco-scrollable-element > .scrollbar {
  opacity: 0 !important;
  transition: opacity 120ms ease;
}

.monaco-scrollable-element > .scrollbar.invisible {
  visibility: hidden !important;
}

.monaco-editor.is-scrolling
  .monaco-scrollable-element
  > .scrollbar:not(.invisible) {
  opacity: 1 !important;
}

.console-panel {
  min-height: 96px;
  padding: 0;
  overflow: hidden;
}

.console-status {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border-bottom: 1px solid #303030;
  color: #b7b7b7;
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.status-dot.loading {
  border: 2px solid #666;
  border-top-color: white;
  background: transparent;
  animation: spin 0.8s linear infinite;
}

.status-dot.error {
  background: var(--red);
}

#console-location {
  margin-left: auto;
  padding: 4px 7px;
  border: 1px solid #454545;
  border-radius: 4px;
  background: #292929;
  color: #ccc;
  font: inherit;
  cursor: pointer;
}

#console-output {
  margin: 0;
  min-height: 58px;
  padding: 12px 13px 16px;
  color: #f1f1f1;
  white-space: pre-wrap;
  font: 13px/22px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.help-note a {
  color: #aebdce;
}

.creator-credit {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid #303030;
  color: #777 !important;
  font-size: 12px !important;
}

.creator-credit a {
  color: #aaa;
  text-decoration: none;
}

.creator-credit a:hover {
  color: #ddd;
}

.app-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 26px;
  border: 1px solid #3c3c3c;
  border-radius: 12px;
  background: #171717;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
}

.app-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(2px);
}

.app-dialog h2 {
  margin: 0 30px 18px 0;
  font-size: 20px;
  letter-spacing: -0.025em;
}

.app-dialog p,
.how-to-steps {
  color: #b4b4b4;
  font-size: 14px;
  line-height: 1.55;
}

.app-dialog h3 {
  margin: 19px 0 8px;
  color: #e2e2e2;
  font-size: 13px;
}

.help-list {
  margin: 0;
  padding-left: 19px;
  color: #b4b4b4;
  font-size: 13px;
  line-height: 1.5;
}

.help-list li {
  margin-bottom: 8px;
  padding-left: 2px;
}

.app-dialog .help-example {
  margin: 7px 0;
  color: #aaa;
  font-size: 12px;
}

.app-dialog .help-note {
  margin: 18px 0 0;
  font-size: 12px;
}

.app-dialog code {
  color: #d8c98c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.dialog-close {
  position: absolute;
  top: 13px;
  right: 15px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #aaa;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.dialog-close:hover {
  color: white;
}

.how-to-steps {
  margin: 20px 0 24px;
  padding-left: 22px;
}

.how-to-steps li {
  margin: 0 0 12px;
  padding-left: 4px;
}

.dialog-primary {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: #3b4352;
  color: white;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.dialog-primary:hover {
  background: #4a5568;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.dialog-actions .dialog-primary,
.dialog-secondary {
  flex: 1;
}

.dialog-secondary {
  min-height: 40px;
  border: 1px solid #444;
  border-radius: 6px;
  background: transparent;
  color: #ccc;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.dialog-secondary:hover {
  border-color: #666;
  color: white;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-top: 6px;
  text-align: center;
}

.completion-kicker {
  margin: 0 0 6px;
  color: var(--green) !important;
  font-size: 11px !important;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.completion-dialog h2 {
  margin-bottom: 22px;
}

.completion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 16px 0;
  border-block: 1px solid #333;
  text-align: center;
}

.completion-grid strong,
.completion-grid span {
  display: block;
}

.completion-grid strong {
  margin-bottom: 5px;
  font-size: 24px;
}

.completion-grid span {
  color: #8f8f8f;
  font-size: 11px;
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  margin-bottom: 7px;
  font-size: 28px;
}

.stats-grid span {
  color: #929292;
  font-size: 11px;
  line-height: 1.25;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 22px;
  min-width: 160px;
  padding: 10px 14px;
  transform: translateX(-50%);
  border: 1px solid #424242;
  border-radius: 7px;
  background: #202020;
  color: white;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  text-align: center;
  font-size: 12px;
}

.toast[hidden] {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes playback-cue {
  0%,
  100% {
    opacity: 0;
    transform: translateY(5px) scale(0.96);
  }

  12%,
  76% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cue-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.24);
  }

  100% {
    box-shadow: 0 0 0 13px rgba(255, 255, 255, 0);
  }
}

@keyframes canvas-cue {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.985);
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 20px, 440px);
    padding-top: 14px;
  }

  .canvases {
    gap: 8px;
    padding: 18px 0 12px;
  }

  .playback-hint {
    inset: 18px 0 12px;
    gap: 8px;
  }

  .tabs {
    padding-inline: 0;
  }

  .panel {
    margin-inline: 0;
  }

  .workspace-frame {
    margin-inline: 0;
  }

  .workspace-header {
    flex-wrap: wrap;
  }

  .workspace-actions {
    margin-left: auto;
    gap: 2px;
  }

  .tutorial-answer-button {
    padding-inline: 7px;
  }

  .workspace-actions .reset-button {
    margin-left: 0;
    padding-inline: 6px;
  }

  .workspace-actions .run-button {
    padding-inline: 10px;
  }

  header h1 {
    font-size: 20px;
  }

  .menu-button {
    left: 0;
  }

  .difficulty-badge {
    right: 0;
    min-width: 48px;
    padding-inline: 6px;
  }

  .challenge-heading > div {
    min-width: 128px;
  }

  .app-menu {
    left: -2px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    row-gap: 22px;
  }

  .mobile-note {
    display: block;
    margin: -4px 0 12px;
    color: #777;
    text-align: center;
    font-size: 11px;
  }

  .playback-speed {
    margin-bottom: 10px;
  }
}
