:root {
  --primary-color: #28e98c;
  --primary-rgb: 40, 233, 140;
  --bg-dark: #121212;
  --bg-card: #1f1f1f;
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --glass-border: rgba(255, 255, 255, 0.08);
  --radius-md: 16px;
  --radius-lg: 24px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(var(--primary-rgb), 0.12), transparent 28rem),
    var(--bg-dark);
  color: var(--text-main);
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.tool-shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 3rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
  color: var(--primary-color);
  transform: translateX(-3px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  border: 1px solid var(--glass-border);
  padding: 0.5rem 1.25rem;
  border-radius: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.section-title i {
  color: var(--primary-color);
}

.hero h1 {
  font-size: clamp(2.75rem, 8vw, 5rem);
  line-height: 1;
  margin-bottom: 1rem;
}

.hero p {
  max-width: 720px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.hero-stat {
  min-width: 12rem;
  border: 1px solid rgba(var(--primary-rgb), 0.35);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: rgba(var(--primary-rgb), 0.07);
  text-align: center;
}

.hero-stat strong,
.hero-stat span {
  display: block;
}

.hero-stat strong {
  color: var(--primary-color);
  font-size: 1.3rem;
}

.hero-stat span {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 1.5rem;
}

.panel {
  background: rgba(31, 31, 31, 0.78);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.25);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drop-zone {
  min-height: 18rem;
  border: 1px dashed rgba(var(--primary-rgb), 0.45);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.drop-zone.is-dragging,
.drop-zone:hover {
  border-color: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.06);
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary-color);
  font-size: 2.1rem;
}

.drop-zone strong {
  font-size: 1.15rem;
}

.drop-zone small,
.notice,
.range-row label,
.preview-header span,
.metrics dt {
  color: var(--text-muted);
}

.range-row {
  display: grid;
  gap: 0.75rem;
}

.range-row label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.range-row label span {
  color: var(--primary-color);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary-color);
}

button,
.download-link {
  min-height: 3.25rem;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #07120c;
  background: var(--primary-color);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

button:hover,
.download-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(var(--primary-rgb), 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.download-link {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid rgba(var(--primary-rgb), 0.35);
}

.download-link[hidden] {
  display: none;
}

.preview-panel {
  display: grid;
  gap: 1.25rem;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.preview-header h2 {
  font-size: 1.4rem;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.03);
}

.status-pill.is-success {
  color: var(--primary-color);
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(var(--primary-rgb), 0.08);
}

.status-pill.is-warning {
  color: #f5d76e;
  border-color: rgba(245, 215, 110, 0.35);
  background: rgba(245, 215, 110, 0.08);
}

.preview-frame {
  min-height: 22rem;
  border-radius: var(--radius-md);
  background: #171717;
  border: 1px solid var(--glass-border);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  max-height: 30rem;
  object-fit: contain;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.empty-state i {
  color: var(--primary-color);
  font-size: 3rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.metrics div {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.025);
}

.metrics dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.35rem;
}

.metrics dd {
  font-weight: 600;
}

.notice {
  margin-top: 1rem;
  min-height: 1.6rem;
}

.notice.is-warning {
  color: #f5d76e;
}

canvas {
  display: none;
}

@media (max-width: 860px) {
  .hero,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .hero-stat {
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .tool-shell {
    width: min(100% - 1rem, 1120px);
    padding-top: 1rem;
    padding-inline: 0.75rem;
  }

  .panel {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .drop-zone {
    min-height: 14rem;
  }

  .preview-header {
    flex-direction: column;
  }

  .preview-frame {
    min-height: 16rem;
  }

  .metrics {
    grid-template-columns: 1fr;
  }
}
