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

body {
  min-height: 100vh;
  background: #f5f5f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111;
}

header {
  padding: 24px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #ddd;
  background: #fff;
}

header a {
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #888;
  text-decoration: none;
}

header a:hover { color: #111; }

header span {
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #111;
}

.sep { color: #ccc; }

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 32px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.panel {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #888;
}

.drop-zone {
  flex: 1;
  min-height: 320px;
  border: 1px dashed #ccc;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.drop-zone:hover,
.drop-zone.over {
  border-color: #111;
  background: #fafafa;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone svg { color: #ccc; }

.drop-zone p {
  font-size: 13px;
  color: #aaa;
  text-align: center;
}

.drop-zone p strong { color: #555; font-weight: 500; }

.preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 2px;
  display: none;
}

.output-area {
  flex: 1;
  min-height: 320px;
  border: 1px solid #eee;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  position: relative;
  overflow: hidden;
}

.output-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 2px;
}

.placeholder-text {
  font-size: 13px;
  color: #ccc;
  letter-spacing: 0.03em;
}

.placeholder-text.error { color: #c0746a; }

.spinner {
  display: none;
  width: 28px;
  height: 28px;
  border: 2px solid #eee;
  border-top-color: #111;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn {
  padding: 12px 24px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-start;
}

.btn:hover { background: #333; border-color: #333; }
.btn:disabled { background: #ccc; border-color: #ccc; cursor: default; }

.download-link {
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #888;
  text-decoration: none;
  display: none;
}

.download-link:hover { color: #111; }

.bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 768px) {
  header {
    padding: 16px 20px;
    gap: 10px;
  }

  main {
    grid-template-columns: 1fr;
    padding: 20px;
    gap: 16px;
  }

  .drop-zone {
    min-height: 200px;
  }

  .output-area {
    min-height: 200px;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .bottom-row {
    flex-wrap: wrap;
    gap: 12px;
  }
}
