@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap");
@import url("@vscode/codicons/dist/codicon.css");

:root {
  --code-font-family: var(
    --vscode-editor-font-family,
    JetBrains Mono,
    Consolas,
    "Courier New",
    monospace
  );
  --code-font-weight: var(--vscode-editor-font-weight, normal);
  --code-font-size: var(--vscode-editor-font-size, 14px);
  --code-font-variant-ligatures: contextual;

  --ui-font-family: var(
    --vscode-font-family,
    system-ui,
    "Ubuntu",
    "Droid Sans",
    sans-serif
  );
  --ui-font-weight: var(--vscode-font-weight, normal);
  --ui-font-size: var(--vscode-font-size, 13px);

  --color-green: light-dark(#00c300, #00ff00);
  --color-red: light-dark(#c80a00, #f85149);
  --color-blue: light-dark(#006d90, #add8e6);
  --color-muted: var(
    --vscode-disabledForeground,
    light-dark(rgba(97, 97, 97, 0.5), rgba(204, 204, 204, 0.5))
  );
  --color-bright: light-dark(black, white);

  --panel-background: var(
    --vscode-panel-background,
    light-dark(#f8f8f8, #181818)
  );
  --panel-separator: var(
    --vscode-menu-separatorBackground,
    light-dark(#d4d4d4, #454545)
  );

  --foreground: var(--vscode-foreground, light-dark(#3b3b3b, #ccc));
  --background: var(--vscode-editor-background, light-dark(#fff, #1f1f1f));

  --list-row-height: calc(var(--code-font-size) * 1.33);
  --list-row-hover-background: var(
    --vscode-list-hoverBackground,
    light-dark(#f2f2f2, #2a2d2e)
  );
  --list-row-selection-background: var(
    --vscode-list-inactiveSelectionBackground,
    light-dark(#e4e6f1, #37373d)
  );
  --list-row-highlight-background: var(
    --vscode-list-activeSelectionBackground,
    light-dark(#e8e8e8, #04395e)
  );

  --line-number-foreground: var(--vscode-editorLineNumber-foreground, #6e7681);

  --button-background-color: var(
    --vscode-button-secondaryBackground,
    light-dark(#e5e5e5, #313131)
  );
  --button-foreground-color: var(
    --vscode-button-secondaryForeground,
    light-dark(#3b3b3b, #ccc)
  );
  --button-border-color: var(
    --vscode-button-border,
    light-dark(rgba(0, 0, 0, 0.1), rgba(255, 255, 255, 0.07))
  );
  --button-hover-background-color: var(
    --vscode-button-secondaryHoverBackground,
    light-dark(#cccccc, #3c3c3c)
  );
  --button-active-background-color: var(
    --vscode-toolbar-activeBackground,
    light-dark(rgba(166, 166, 166, 0.31), rgba(99, 102, 103, 0.31))
  );
  --button-disabled-foreground-color: var(
    --vscode-disabledForeground,
    light-dark(rgba(97, 97, 97, 0.5), rgba(204, 204, 204, 0.5))
  );
  --focus-border-color: var(--vscode-focusBorder, light-dark(#005fb8, #0078d4));

  --input-background-color: var(
    --vscode-input-background,
    light-dark(#fff, #313131)
  );
  --input-foreground-color: var(
    --vscode-input-foreground,
    light-dark(#3b3b3b, #ccc)
  );
  --input-border-color: var(--vscode-input-border, light-dark(#cecece, #3c3c3c));
  --input-placeholder-foreground-color: var(
    --vscode-input-placeholderForeground,
    light-dark(#767676, #989898)
  );

  --checkbox-background-color: var(
    --vscode-settings-checkboxBackground,
    light-dark(#f8f8f8, #313131)
  );
  --checkbox-foreground-color: var(
    --vscode-settings-checkboxForeground,
    light-dark(#3b3b3b, #ccc)
  );
  --checkbox-border-color: var(
    --vscode-settings-checkboxBorder,
    light-dark(#cecece, #3c3c3c)
  );

  --menu-border: var(--vscode-menu-border, light-dark(#cecece, #454545));
  --menu-foreground: var(--vscode-menu-foreground, light-dark(#3b3b3b, #ccc));
  --menu-background: var(--vscode-menu-background, light-dark(#fff, #1f1f1f));
  --menu-selection-foreground: var(--vscode-menu-selectionForeground, #fff);
  --menu-selection-background: var(
    --vscode-menu-selectionBackground,
    light-dark(#005fb8, #0078d4)
  );
  --menu-separator-background: var(
    --vscode-menu-separatorBackground,
    light-dark(#d4d4d4, #454545)
  );

  --widget-shadow: var(
    --vscode-widget-shadow,
    light-dark(rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.36))
  );

  color-scheme: light dark;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  color: var(--foreground);
  font-family: var(--ui-font-family);
  font-weight: var(--ui-font-weight);
  font-size: var(--ui-font-size);
  background-color: var(--background);
  overflow: hidden;

  &.vscode-light,
  &.vscode-high-contrast-light {
    color-scheme: light;
  }
  &.vscode-dark,
  &.vscode-high-contrast-dark {
    color-scheme: dark;
  }

  &.decomp-me-dark,
  &.decomp-me-light {
    --code-font-family: var(Jetbrains Mono, Menlo, Monaco, monospace);
    --ui-font-size: .8rem;
  }
  &.decomp-me-dark {
    --panel-background: hsl(300deg 5% 9.5%);
    --background: rgb(22, 22, 24);
    --foreground: #fff9;
    --color-bright: #f9f9f9;
    color-scheme: dark;
  }
  &.decomp-me-light {
    --code-font-family: var(Jetbrains Mono, Menlo, Monaco, monospace);
    --ui-font-size: .8rem;
    --panel-background: #fdfcfd;
    --background: #fdfcfd;
    --foreground: rgb(51, 51, 51);
    --color-bright: #000000e6;
    color-scheme: light;
  }
}

#root {
  display: flex;
  flex-flow: column;
  height: 100%;
  overflow: hidden;
}

.loading-root {
  height: 100vh;
  width: 100vw;
  background-color: var(--panel-background);
}

.content {
  flex: 1;
  display: flex;
  min-height: 100vh;
  line-height: 1.1;
  text-align: center;
  flex-direction: column;
  justify-content: center;

  h1 {
    font-size: 3.6rem;
    font-weight: 700;
  }

  p {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.5;
  }
}

button {
  display: flex;
  background-color: var(--button-background-color);
  color: var(--button-foreground-color);
  border: 1px solid var(--button-border-color);
  border-radius: 3px;
  cursor: pointer;

  font-family: var(--ui-font-family);
  font-weight: var(--ui-font-weight);
  font-size: var(--ui-font-size);

  &:hover {
    background-color: var(--button-hover-background-color);
  }

  &:focus {
    opacity: 1;
    outline-color: var(--focus-border-color);
    outline-offset: -1px;
    outline-style: solid;
    outline-width: 1px;
  }

  &:active {
    outline: 0 !important;
    background-color: var(--button-active-background-color);
  }

  &:disabled {
    color: var(--button-disabled-foreground-color);
  }

  > .codicon {
    height: 18px;
  }
}

input {
  background-color: var(--input-background-color);
  color: var(--input-foreground-color);
  border: 1px solid var(--input-border-color);
  border-radius: 3px;

  font-family: var(--ui-font-family);
  font-weight: var(--ui-font-weight);
  font-size: var(--ui-font-size);

  &::placeholder {
    color: var(--input-placeholder-foreground-color);
  }

  &:focus {
    border-color: var(--focus-border-color);
    outline: none;
  }
}

input[type="checkbox"] {
  appearance: none;
  border: 1px solid var(--checkbox-border-color);
  border-radius: 3px;
  height: 1.2em;
  margin-left: 0;
  margin-right: 0.5em;
  padding: 0;
  width: 1.2em;
  background-color: var(--checkbox-background-color);
  color: var(--checkbox-foreground-color);
  cursor: pointer;
  font: normal normal normal 16px / 1 codicon;

  &:checked {
    background-color: var(--checkbox-background-color);

    &::before {
      content: "\eab2";
      display: block;
      text-align: center;
      line-height: 1.2em;
    }
  }

  &:focus {
    border-color: var(--focus-border-color);
  }
}

select {
  background-color: var(--input-background-color);
  color: var(--input-foreground-color);
  border: 1px solid var(--input-border-color);
  border-radius: 3px;
  margin-left: 0.5em;

  font-family: var(--ui-font-family);
  font-weight: var(--ui-font-weight);
  font-size: var(--ui-font-size);

  &:focus {
    border-color: var(--focus-border-color);
    outline: none;
  }
}
