: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,
select {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
.primary-btn,
.secondary-btn {
  cursor: pointer;
  transition: 0.2s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
label:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  min-height: 76px;
  padding: 14px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
  background: #131510;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand > span:last-child {
  color: var(--accent);
}

.brand-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #14170f;
  font-size: 22px;
  font-weight: 900;
}

.back-link {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.back-link:hover {
  color: var(--accent);
}

.container {
  width: min(1120px, 90%);
  margin: 0 auto;
}

.hero {
  padding: 64px 0 38px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid #3b4a29;
  border-radius: 30px;
  color: var(--accent);
  background: #1a2113;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.hero h1 {
  margin: 18px 0 10px;
  font-size: clamp(36px, 6vw, 58px);
  line-height: 1.12;
  letter-spacing: -2px;
}

.hero h1 span {
  color: var(--accent);
}

.hero > p {
  max-width: 620px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
}

.workspace {
  margin-bottom: 64px;
}

.upload-box {
  padding: 38px 20px;
  border: 2px dashed #424a39;
  border-radius: 20px;
  background: var(--panel);
  text-align: center;
  transition: 0.2s ease;
}

.upload-box.drag-over {
  border-color: var(--accent);
  background: #202719;
}

.upload-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 17px;
  background: #29351c;
  color: var(--accent);
  font-size: 36px;
  line-height: 1;
}

.upload-box h2 {
  margin: 0 0 6px;
  font-size: 23px;
}

.upload-box > p {
  color: var(--muted);
  font-size: 14px;
}

.small-note {
  margin-top: 14px;
  font-size: 12px !important;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 800;
}

.primary-btn {
  background: var(--accent);
  color: #161a10;
}

.primary-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-btn {
  border-color: var(--border);
  background: var(--panel-light);
  color: var(--text);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 34px 0 18px;
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.image-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

.image-card img {
  display: block;
  width: 100%;
  height: 165px;
  object-fit: contain;
  padding: 8px;
  background: #0b0c0a;
}

.image-card-info {
  padding: 12px;
}

.image-card-info strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.image-card-info small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.image-card-actions {
  display: flex;
  gap: 7px;
  padding: 0 12px 12px;
}

.image-card-actions button {
  flex: 1;
  min-height: 35px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-light);
  color: var(--text);
  font-size: 12px;
}

.image-card-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.setting-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.setting-card h3 {
  margin: 0 0 18px;
  font-size: 16px;
}

.setting-card > label:not(.check-row) {
  display: block;
  margin: 15px 0 7px;
  color: var(--muted);
  font-size: 13px;
}

.setting-card select,
.setting-card input[type="text"] {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #11130f;
  color: var(--text);
}

.setting-card input[type="color"] {
  width: 100%;
  height: 43px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #11130f;
  cursor: pointer;
}

.setting-card select:focus,
.setting-card input:focus {
  border-color: var(--accent);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 19px;
  font-size: 14px;
  cursor: pointer;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.setting-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 30px 0;
}

.large-btn {
  min-height: 52px;
  padding: 13px 32px;
  font-size: 16px;
}

#progressText {
  color: var(--muted);
  font-size: 13px;
}

.download-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  border: 1px solid #40512a;
  border-radius: 15px;
  background: #1a2113;
}

.download-area strong {
  color: var(--accent);
  font-size: 17px;
}

.download-area p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.message {
  margin-top: 18px;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 14px;
}

.message.error {
  border: 1px solid #6e3434;
  background: #2a1717;
  color: #ffaaaa;
}

.message.success {
  border: 1px solid #40512a;
  background: #1a2113;
  color: var(--accent);
}

.info-section {
  padding: 36px 0 55px;
  border-top: 1px solid var(--border);
}

.info-section > h2 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 27px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.steps article {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--panel);
}

.steps article > span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.steps h3 {
  margin: 8px 0;
  font-size: 17px;
}

.steps p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.privacy-note {
  margin: 28px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

footer {
  padding: 23px 15px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 850px) {
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid .setting-card:last-child {
    grid-column: 1 / -1;
  }

  .steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 65px;
    padding: 12px 5%;
  }

  .brand {
    font-size: 18px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 19px;
  }

  .back-link {
    font-size: 12px;
  }

  .container {
    width: 92%;
  }

  .hero {
    padding: 45px 0 28px;
  }

  .hero h1 {
    letter-spacing: -1px;
  }

  .hero > p {
    font-size: 14px;
  }

  .upload-box {
    padding: 30px 15px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .inline-actions {
    width: 100%;
  }

  .inline-actions .secondary-btn {
    flex: 1;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-grid .setting-card:last-child {
    grid-column: auto;
  }

  .setting-card {
    padding: 18px;
  }

  .download-area {
    align-items: flex-start;
    flex-direction: column;
  }

  .download-area .primary-btn {
    width: 100%;
  }

  .large-btn {
    width: 100%;
  }

  .image-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .image-card img {
    height: 125px;
  }

  .image-card-info {
    padding: 9px;
  }

  .image-card-actions {
    padding: 0 9px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}