:root {
  --bg-color: #f1f3f4;
  --modal-bg: #fff;
  --text-color: #202124;
  --border-color: #ddd;
  --tab-active-color: #1a73e8;
  --item-active-bg: #e0effd;
  --item-border: #ccc;
  --btn-bg: #1a73e8;
  --btn-text: #fff;
  --btn-hover-bg: #0d5bba;
  --btn-cancel-bg: #fff;
  --btn-cancel-text: #333;
  --btn-cancel-hover-bg: #f1f1f1;
  --scrollbar-thumb: #969696;
  --scrollbar-track: #e8e8e8;
  --switch-width: 36px;
  --switch-height: 20px;
  --switch-padding: 2px;
  --switch-bg-off: #ccc;
  --switch-bg-on: var(--tab-active-color);
  --switch-knob-color: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #202124;
    --modal-bg: #1e1e1e;
    --text-color: #e8eaed;
    --border-color: #2d2e2f;
    --tab-active-color: #8ab4f8;
    --item-active-bg: #114977;
    --item-border: #37393b;
    --btn-bg: #6a95dc;
    --btn-text: #202124;
    --btn-hover-bg: #6b9df5;
    --btn-cancel-bg: #2d2f31;
    --btn-cancel-text: #e8eaed;
    --btn-cancel-hover-bg: #363838;
    --scrollbar-thumb: #676767;
    --scrollbar-track: #333;
    --switch-bg-off: #5f6368;
    --switch-bg-on: #215ab7;
    --switch-knob-color: #fff;
  }
}
body {
  font-family: system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue","Noto Sans","Liberation Sans",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
  background: transparent;
  color: var(--text-color);
  display: flex;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
.modal {
  background: var(--modal-bg);
  border-radius: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.linux-border .modal {
  border: 1px solid var(--border-color);
}
.modal-header {
  -webkit-app-region: drag;
  app-region: drag;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: normal;
  color: var(--text-color);
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}
.tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  cursor: pointer;
  user-select: none;
  color: var(--text-color);
}
.tab.active {
  border-bottom: 3px solid var(--tab-active-color);
  font-weight: bold;
  color: var(--tab-active-color);
}
.modal-content {
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 12px;
  height: 100%;
  overflow-y: auto;
}
.item {
  width: 100%;
  border: 1px solid var(--item-border);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s;
  max-width: 240px;
  background: var(--modal-bg);
}
.item.selected {
  border-color: var(--tab-active-color);
  background-color: var(--item-active-bg);
  font-weight: bold;
}
.item .item-preview {
  height: 100px;
  background-color: #000;
}
.item .item-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.item-label {
  display: flex;
  padding: 6px;
  font-size: small;
  text-align: center;
  color: var(--text-color);
  max-width: 100%;
  align-items: center;
  justify-content: center;
}
.item-label > img {
  width: 13px;
  height: 13px;
  margin-right: 6px;
}
.item-label > span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.modal-footer {
  text-align: right;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
}
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: .2s linear background-color;
}
.btn.cancel {
  background: var(--btn-cancel-bg);
  color: var(--btn-cancel-text);
}
.btn.share {
  background: var(--btn-bg);
  color: var(--btn-text);
  transition: 0.2s;
}
.btn.share:disabled {
  opacity: 0.5;
  filter: grayscale(30%);
  cursor: not-allowed;
}
.switch {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
}
/* Hide default checkbox */
.switch input[type="checkbox"] {
  height: 0;
  width: 0;
  visibility: hidden;
  position: absolute;
}
/* Group the buttons together on the right */
.footer-buttons {
  display: flex;
  gap: 8px;
}
/* Scrollbar styling for WebKit browsers */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 5px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

@media (min-width: 290px) {
  .item {
    width: calc(50% - 8px);
  }
}

@media (min-width: 540px) {
  .item {
    width: calc(33.3332% - 10px);
  }
}

@media (min-width: 790px) {
  .item {
    width: calc(25% - 11px);
  }
}

@media (min-width: 1040px) {
  .item {
    width: calc(20% - 12px);
  }
}

/* Create the switch container */
.switch label {
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 8px;
  position: relative;
}

/* Create toggle switch */
.switch label::before {
  content: '';
  display: inline-block;
  width: var(--switch-width);
  height: var(--switch-height);
  background: var(--switch-bg-off);
  border-radius: var(--switch-height);
  position: relative;
  transition: background-color 0.2s;
}

/* Create the knob/circle */
.switch label::after {
  content: '';
  position: absolute;
  width: calc(var(--switch-height) - var(--switch-padding) * 2);
  height: calc(var(--switch-height) - var(--switch-padding) * 2);
  border-radius: 50%;
  background: var(--switch-knob-color);
  top: calc((var(--switch-height) - (var(--switch-height) - var(--switch-padding) * 2)) / 2);
  left: var(--switch-padding);
  transition: 0.2s;
}

/* Move the knob when checked */
.switch input:checked + label::before {
  background: var(--switch-bg-on);
}

.switch input:checked + label::after {
  left: calc(var(--switch-width) - var(--switch-height) + var(--switch-padding));
}

/* Focus style for accessibility */
.switch input:focus + label::before {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.btn:focus {
  outline: none;
}

.btn.cancel:hover {
  background: var(--btn-cancel-hover-bg);
}

.btn.share:hover:not(:disabled) {
  background: var(--btn-hover-bg);
}