:root {
  --bg: #10120f;
  --panel: #191c17;
  --panel-light: #20241d;
  --border: #30362b;
  --text: #f4f6ef;
  --muted: #a4aa9a;
  --accent: #b8f34a;
  --accent-dark: #9bd32d;
  --danger: #ff7777;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
.upload-area:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  min-height: 72px;
  padding: 14px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 800;
}

.brand strong {
  color: var(--accent);
}

.brand-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--bg);
  font-size: 22px;
  font-weight: 900;
}

.back-link {
  color: var(--muted);
  font-size: 14px;
}

.back-link:hover {
  color: var(--accent);
}

.container {
  width: min(1080px, 92%);
  margin: 0 auto;
}

.hero {
  padding: 54px 0 34px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid #46552e;
  border-radius: 30px;
  background: #1a2113;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.hero h1 {
  margin: 17px 0 10px;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.15;
  letter-spacing: -1.5px;
}

.hero h1 span {
  color: var(--accent);
}

.hero > p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
}

.privacy-note {
  margin-top: 18px;
  color: #c3d5a9;
  font-size: 13px;
}

.tool-card {
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}

.upload-area {
  min-height: 300px;
  padding: 35px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed #46513b;
  border-radius: 15px;
  background: var(--panel-light);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover,
.upload-area.drag-over {
  border-color: var(--accent);
  background: #23291c;
}

.upload-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #2b3820;
  color: var(--accent);
  font-size: 34px;
  font-weight: 700;
}

.upload-area h2 {
  margin: 15px 0 3px;
  font-size: 23px;
}

.upload-area p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.upload-area small {
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.secondary-button {
  min-height: 45px;
  padding: 11px 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.2s, background 0.2s;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #15180f;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--panel-light);
  color: var(--text);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.editor {
  padding-top: 10px;
}

.editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.editor-heading h2 {
  margin: 0;
  font-size: 22px;
}

.editor-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.preview-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #141711;
}

.preview-card h3,
.background-controls h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.preview-box {
  min-height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: #22251f;
}

.preview-box img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.checkerboard {
  background-color: #f2f2f2;
  background-image:
    linear-gradient(45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(-45deg, #d8d8d8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8d8d8 75%),
    linear-gradient(-45deg, transparent 75%, #d8d8d8 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

#resultPlaceholder {
  max-width: 80%;
  color: #45483f;
  text-align: center;
  font-size: 13px;
}

.background-controls {
  margin-top: 24px;
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.color-button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-light);
  color: var(--text);
  font-size: 13px;
}

.color-button:hover,
.color-button.selected {
  border-color: var(--accent);
  color: var(--accent);
}

.progress-wrap {
  margin-top: 24px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-light);
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 20px;
  background: #363a30;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

#statusText {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 25px;
}

.error-message {
  margin: 18px 0 0;
  padding: 12px;
  border: 1px solid #6d3434;
  border-radius: 10px;
  background: #2a1717;
  color: var(--danger);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.info-section {
  padding: 55px 0;
}

.info-section > h2 {
  margin: 0 0 23px;
  text-align: center;
  font-size: 27px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-grid article {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.info-grid article > span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.info-grid h3 {
  margin: 8px 0 5px;
  font-size: 17px;
}

.info-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.disclaimer {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.footer {
  padding: 23px 5%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 24px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer a:hover {
  color: var(--accent);
}

[hidden] {
  display: none !important;
}

@media (max-width: 650px) {
  .topbar {
    min-height: 62px;
    padding: 12px 4%;
  }

  .brand {
    font-size: 18px;
  }

  .brand-icon {
    width: 33px;
    height: 33px;
    font-size: 19px;
  }

  .back-link {
    font-size: 12px;
  }

  .hero {
    padding: 38px 0 25px;
  }

  .hero > p {
    font-size: 14px;
  }

  .tool-card {
    padding: 13px;
    border-radius: 15px;
  }

  .upload-area {
    min-height: 265px;
    padding: 25px 12px;
  }

  .upload-area h2 {
    font-size: 20px;
  }

  .upload-area p {
    font-size: 13px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .preview-box {
    min-height: 200px;
  }

  .editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .action-row {
    flex-direction: column;
  }

  .action-row button,
  .editor-heading button {
    width: 100%;
  }

  .color-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .color-button {
    padding: 8px 5px;
    font-size: 12px;
  }

  .info-section {
    padding: 38px 0;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-grid article {
    padding: 17px;
  }
}