body.tools-page {
  background: #111;
  color: #fff;
  font-family: "Space Mono", monospace;
  margin: 0;
}

body.tools-page button,
body.tools-page input,
body.tools-page textarea,
body.tools-page select {
  font-family: "Space Mono", monospace;
}

body.tools-page .flash-message.flash-warning-face {
  background: #ffdf4e;
  color: #111;
  box-shadow:
    0 0 0 1px rgba(255, 223, 78, 0.25),
    0 4px 6px rgba(0, 0, 0, 0.14),
    0 1px 3px rgba(0, 0, 0, 0.12);
}

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

a {
  color: #fff;
}

img {
  display: block;
  max-width: 100%;
}

.tools-shell {
  margin: 0 auto;
  max-width: 960px;
  padding: 0 24px 0;
}

.tools-hero {
  margin-bottom: 40px;
  text-align: center;
}

.tools-back-link {
  align-items: center;
  background-color: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.55);
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 500;
  gap: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.25rem;
  padding: 0.25rem 1rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.tools-back-link:hover {
  background-color: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.22);
  color: rgba(255, 255, 255, 0.85);
}

.tools-hero-title {
  font-family: "Tiny5", sans-serif;
  font-size: clamp(2.85rem, 4.8vw, 3.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 24px 0 12px;
}

.tools-hero-subtitle {
  color: rgba(255, 255, 255, 0.55);
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 610px;
  text-wrap: balance;
}

@media (max-width: 768px) {
  .tools-hero-subtitle {
    font-size: 0.89rem;  
  }
}

.tools-hero-free {
  align-items: center;
  background-color: #7dff8a;
  border: 1px solid #63e46f;
  border-radius: 11px;
  color: #000;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  gap: 0.5rem;
  letter-spacing: -0.02em;
  line-height: 1.25rem;
  margin: 14px 0 0;
  padding: 0.25rem 1rem;
}

@media (max-width: 768px) {
  .tools-hero-free {
    font-size: 0.775rem;
  }
}

.tools-hero-free-emoji {
  display: inline-block;
  filter: saturate(0) invert(1);
  margin-right: 4px;
}

.tools-header,
.tool-page-section,
.tool-card {
  margin-bottom: 24px;
}

.tools-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.tool-preview-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tool-card {
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 14px;
  color: inherit;
  display: block;
  overflow: hidden;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.tool-card:hover {
  border-color: rgb(255 255 255 / 0.25);
}

.tool-card-hero {
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.tool-card-hero img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.tool-card--remove-background .tool-card-hero,
.tool-card--face-extractor .tool-card-hero,
.tool-card--flawless-victory-meme .tool-card-hero {
  background-color: #202020;
  background-image:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
}

.tool-card-body {
  padding: 20px 24px 24px;
}

.tool-card-emoji {
  display: block;
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 14px;
}

.tool-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}

.tool-card-description {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  letter-spacing: -0.02em;
  line-height: 1.5;
  margin: 0;
}

.tool-card-meta {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.8rem;
  letter-spacing: -0.02em;
  line-height: 1.4;
  margin: 12px 0 0;
}

.tool-card-cta {
  align-items: center;
  background-color: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 11px;
  color: #f3f4f6;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25rem;
  margin-top: 16px;
  padding: 0.4rem 1rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.tool-card:hover .tool-card-cta {
  background-color: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.22);
}

.tool-page-section,
[data-result-wrap],
[data-preview-wrap] {
  border: 0;
  padding: 0;
}

.tools-coming-soon {
  color: rgba(255, 255, 255, 0.62);
  font-size: 1rem;
  line-height: 1.65;
  margin: 0 auto 24px;
  max-width: 680px;
  text-align: center;
}

.tools-coming-soon p {
  margin: 0;
}

.tools-coming-soon p + p {
  margin-top: 10px;
}

.flawless-victory-form {
  margin: 0 auto 24px;
  max-width: 980px;
}

.flawless-victory-controls {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr);
  margin: 18px 0 24px;
}

.flawless-victory-controls[hidden] {
  display: none !important;
}

.flawless-victory-editor-row {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  width: 100%;
}

.flawless-victory-labels {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.flawless-victory-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flawless-victory-field span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.flawless-victory-field input {
  background: rgb(255 255 255 / 0.04);
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 11px;
  color: #fff;
  font-size: 0.95rem;
  min-height: 46px;
  outline: none;
  padding: 0 14px;
}

.flawless-victory-field input:focus {
  border-color: rgb(255 255 255 / 0.26);
}

.flawless-victory-accent-row {
  align-items: start;
  display: grid;
  gap: 10px;
  justify-items: start;
  width: 100%;
}

.flawless-victory-accent-label {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.color-picker-button {
  width: 100%;
  height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background-color: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  margin-top: 0 !important;
  min-height: 44px;
  padding: 0;
  flex-shrink: 0;
}

.color-picker-button:hover {
  border-color: rgb(255 255 255 / 0.22);
}

.color-picker-button .color-preview {
  position: absolute;
  inset: 8px;
  border-radius: 7px;
}

.flawless-victory-preview-wrap {
  background: #fff;
}

.flawless-victory-result[hidden] {
  display: none;
}

.is-hidden {
  display: none !important;
}

.tools-upload-section {
  margin: 1rem 0;
}

.tools-upload-cluster {
  margin: 0 auto;
  max-width: 980px;
  position: relative;
}

.tools-upload-pair {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.tools-form-loading {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
  left: 50%;
  margin: 0;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
}

.tools-form-loading[hidden] {
  display: none;
}

.tools-upload-pair .tools-upload-section {
  margin: 0;
}

.tools-upload-pair .tools-upload-dropzone-wrapper {
  max-width: none;
}

.tools-upload-pair .tools-upload-dropzone {
  min-height: 200px;
}

.tools-upload-pair .tools-upload-content {
  min-height: 168px;
}

@media (max-width: 640px) {
  .flawless-victory-editor-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tools-grid {
    gap: 12px;
  }

  .tool-card {
    margin-bottom: 0;
  }

  .tools-upload-pair {
    grid-template-columns: 1fr;
  }

  .tools-form-loading {
    flex-direction: column;
  }

  .flawless-victory-controls {
    gap: 16px;
  }

  .flawless-victory-accent-row {
    justify-content: space-between;
  }

}

.tools-upload-dropzone-wrapper {
  background: #171717;
  border: 2px dashed rgb(255 255 255 / 0.12);
  border-radius: 28px;
  cursor: pointer;
  margin: 0 auto;
  max-width: 820px;
  padding: 1rem;
  position: relative;
  text-align: center;
}

.tools-upload-dropzone {
  background: #202020;
  border: 2px solid #323232;
  border-radius: 18px;
  min-height: 320px;
  padding: 1rem;
  position: relative;
  transition: all 0.3s ease;
  width: 100%;
}

.tools-upload-dropzone-wrapper--transparent .tools-upload-dropzone {
  background-color: #202020;
  background-image:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
}

.tools-upload-dropzone-wrapper--transparent .tools-upload-dropzone.has-preview {
  background-image: none;
}

.tools-upload-dropzone-wrapper:hover .tools-upload-dropzone {
  background: #252525;
  border-color: #595959;
}

.tools-upload-dropzone-wrapper--transparent:hover .tools-upload-dropzone:not(.has-preview) {
  background-color: #202020;
  background-image:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
  border-color: #4b4b4b;
}

.tools-upload-dropzone-wrapper[data-dragging="true"] .tools-upload-dropzone {
  background: #2a211a;
  border-color: #ff912d;
  transform: scale(1.02);
}

.tools-upload-dropzone-wrapper[data-disabled="true"]:not([data-loading="true"]) {
  cursor: not-allowed;
  opacity: 0.55;
}

.tools-upload-dropzone-wrapper[data-loading="true"] {
  opacity: 1;
}

.tools-upload-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  justify-content: center;
  min-height: 286px;
}

.tools-upload-icon {
  color: #d1d5db;
  height: 48px;
  transition: color 0.3s ease;
  width: 48px;
}

.tools-upload-dropzone-wrapper:hover .tools-upload-icon,
.tools-upload-dropzone-wrapper[data-dragging="true"] .tools-upload-icon {
  color: #ff912d;
}

.tools-upload-text {
  color: #f3f4f6;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.tools-upload-subtext {
  color: #9ca3af;
  font-size: 0.875rem;
  margin: 0;
}

@media (max-width: 640px) {
  .tools-upload-content {
    gap: 0.75rem;
  }

  .tools-upload-text {
    font-size: 0.95rem;
    line-height: 1.2;
  }

  .tools-upload-subtext {
    font-size: 0.72rem;
    line-height: 1.35;
  }
}

.tools-upload-preview {
  flex: 1;
  height: 100%;
  min-height: 286px;
  width: 100%;
}

.tools-upload-preview img {
  border-radius: 12px;
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.tools-upload-preview.is-portrait {
  align-items: center;
  display: flex;
  justify-content: center;
}

.tools-upload-preview.is-portrait img {
  height: auto;
  margin: 0 auto;
  max-height: 60svh;
  object-fit: contain;
  width: auto;
  max-width: 100%;
}

.tools-upload-dropzone.has-preview .tools-upload-icon,
.tools-upload-dropzone.has-preview .tools-upload-subtext {
  display: none;
}

.tools-upload-dropzone.has-preview .tools-upload-text:not([data-preview-label="floating"]) {
  display: none;
}

.tools-upload-dropzone.has-preview .tools-upload-text[data-preview-label="floating"] {
  background: rgb(17 17 17 / 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 500;
  left: 12px;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  position: absolute;
  bottom: 12px;
  text-transform: uppercase;
  z-index: 1;
}

.tools-upload-dropzone.has-preview .tools-upload-content {
  gap: 0;
}

.tools-file-input {
  cursor: pointer;
  height: 100%;
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
  z-index: 2;
}

.tools-file-input:disabled {
  cursor: not-allowed;
}

.tools-upload-loading-spinner {
  align-items: center;
  background: rgb(17 17 17 / 0.62);
  border-radius: 18px;
  display: none;
  flex-direction: column;
  gap: 16px;
  inset: 0;
  justify-content: center;
  position: absolute;
  z-index: 3;
}

.tools-upload-spinner {
  animation: spin 1s linear infinite;
  border: 3px solid rgba(255, 145, 45, 0.1);
  border-radius: 50%;
  border-top-color: #ff912d;
  height: 40px;
  width: 40px;
}

.tools-upload-loading-text {
  align-items: center;
  color: #d1d5db;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  justify-content: center;
}

.tools-upload-loading-label {
  color: #d1d5db;
}

.tools-upload-loading-timer {
  align-items: center;
  background: #fff;
  border-radius: 999px;
  color: #111;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  min-width: 58px;
  padding: 7px 12px;
}

.tools-upload-dropzone.loading .tools-upload-loading-spinner {
  display: flex;
}

.tools-upload-dropzone.loading .tools-upload-text {
  display: none;
}

.tools-upload-dropzone.is-processing .tools-upload-content {
  opacity: 0.38;
}

.tools-upload-dropzone.loading:not(.has-preview) .tools-upload-content {
  visibility: hidden;
}

.tools-page main button {
  align-items: center;
  background-color: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 11px;
  color: #f3f4f6;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  justify-content: center;
  letter-spacing: -0.02em;
  margin-top: 16px;
  min-height: 44px;
  padding: 0 1.25rem;
  transition: all 0.2s ease;
  user-select: none;
  width: 100%;
}

.tools-page main button:hover {
  background-color: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.22);
}

.tools-page main button:active {
  background-color: rgb(255 255 255 / 0.13);
}

.tools-page main button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.tools-actions {
  margin-top: 16px;
}

.tools-actions p {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.875rem;
  margin: 12px 0 0;
}

.tools-turnstile {
  display: flex;
  justify-content: center;
  margin-top: 42px;
}

.tools-usage-count {
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  margin: 12px 0 0;
  text-align: center;
}

.tools-compare-wrap {
  position: relative;
}

.tools-compare-wrap.is-portrait {
  margin-inline: auto;
  max-width: min(100%, calc(60svh * var(--portrait-image-ratio, 0.75)));
}

.tools-compare {
  --divider-width: 2px;
  --divider-color: #fff;
  --default-handle-color: #fff;
  --default-handle-opacity: 1;
  background-color: #202020;
  background-image:
    linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
    linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  background-size: 28px 28px;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 14px;
  display: block;
  overflow: hidden;
  width: 100%;
}

.tools-compare:focus,
.tools-compare:focus-visible,
.tools-compare *:focus,
.tools-compare *:focus-visible {
  box-shadow: none !important;
  outline: none !important;
}

.tools-compare img {
  display: block;
  height: auto;
  width: 100%;
}

.tools-compare-wrap.is-portrait .tools-compare,
.tools-compare-wrap.is-portrait .tools-compare img {
  max-height: 60svh;
}

.tools-compare-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  line-height: 1;
  padding: 0;
  position: absolute;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  text-transform: uppercase;
  top: 14px;
  z-index: 2;
}

.tools-compare-label-left {
  left: 14px;
}

.tools-compare-label-right {
  right: 14px;
}

.tools-result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.tools-result-actions a,
.tools-result-actions button {
  -webkit-appearance: none;
  align-items: center;
  appearance: none;
  background-color: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 11px;
  box-sizing: border-box;
  color: #f3f4f6;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-top: 0;
  min-height: 48px;
  padding: 0 24px;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
  user-select: none;
  width: auto;
  white-space: nowrap;
}

.tools-result-actions button {
  background-color: rgb(255 255 255 / 0.06);
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: 11px;
  color: #f3f4f6;
  display: inline-flex;
  margin-top: 0;
  min-height: 48px;
  padding: 0 24px;
  width: auto;
}

.tools-page main .tools-result-actions button,
.tools-page main .tools-result-actions .tools-download-btn {
  width: auto;
}

.tools-result-actions a:hover,
.tools-result-actions button:hover {
  background-color: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.22);
}

.tools-result-actions a:active,
.tools-result-actions button:active {
  background-color: rgb(255 255 255 / 0.13);
}

.flawless-victory-controls .tools-result-actions {
  margin-top: 6px;
}

.tools-result-image-wrap {
  background: #202020;
  border: 1px solid rgb(255 255 255 / 0.1);
  border-radius: 14px;
  overflow: hidden;
}

.tools-result-image {
  display: block;
  height: auto;
  width: 100%;
}

.tools-download-btn {
  background: #ff912d !important;
  border-color: #ff912d !important;
  color: #111 !important;
}

.tools-download-btn:hover {
  background: #e87d1c !important;
  border-color: #e87d1c !important;
}

.tools-download-btn:active {
  background: #d4711a !important;
  border-color: #d4711a !important;
}

.tools-page .color-picker-v2-container {
  background: #161616;
  border-color: rgb(255 255 255 / 0.14);
  box-shadow: 0 20px 48px rgb(0 0 0 / 0.45);
  color: #fff;
}

.tools-page .color-picker-v2-gradient {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.tools-page .hue-slider-v2::-webkit-slider-thumb {
  background: #fff;
  border-color: rgb(0 0 0 / 0.8);
}

.tools-page .hue-slider-v2::-moz-range-thumb {
  background: #fff;
  border-color: rgb(0 0 0 / 0.8);
}

.tools-page .color-preset-v2-swatch {
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
}

.tools-page .color-dropper-preset-v2 {
  background-color: rgb(255 255 255 / 0.08);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
}

.tools-page .color-dropper-preset-v2:hover {
  background-color: rgb(255 255 255 / 0.14);
}

.tools-page .color-dropper-preset-v2:active {
  background-color: rgb(255 255 255 / 0.18);
}

.tools-page .color-presets-v2-shadow-right,
.tools-page .color-preset-v2s-shadow-right {
  background: linear-gradient(to right, rgb(22 22 22 / 0), rgb(22 22 22 / 0.92));
}

.tools-page .color-presets-v2-shadow-left,
.tools-page .color-preset-v2s-shadow-left {
  background: linear-gradient(to left, rgb(22 22 22 / 0), rgb(22 22 22 / 0.92));
}

[data-status] {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.875rem;
  min-height: 0;
  text-align: center;
}

[data-status][data-error="true"] {
  color: #ff8a8a;
}

[data-result-wrap] {
  margin-top: 40px;
}
