*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #05060a;
  --surface: #14151d;
  --accent: #0d6efd;
  --accent-soft: rgba(13, 110, 253, 0.12);
  --border-subtle: #2a2b34;
  --text-main: #f7f7f7;
  --text-muted: #a0a3af;
}

/* ========== GLOBAL LAYOUT (mobile first) ========== */

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1b1c26 0, #05060a 55%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 8px; /* comfortable on phones */
}

/* Main app container */

.wrapper {
  width: 100%;
  max-width: 620px; /* phone & small tablet width */
  background: linear-gradient(135deg, #181923, #101119);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.65);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ========== CONTROLS (form) ========== */

.controls {
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
}

.controls input[type="text"],
.controls input[type="file"] {
  width: 100%;
  padding: 9px 11px;
  margin: 0;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: #0c0d13;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.controls input[type="text"]:focus,
.controls input[type="file"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  background: #101119;
}

/* File input simplified but compact */
.controls input[type="file"] {
  padding: 6px 6px;
}

/* Download button */

#downloadBtn {
  margin-top: 12px;
  width: 100%; /* full width on phones */
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 20px rgba(13, 110, 253, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    background-color 0.12s ease;
}

#downloadBtn::after {
  content: "⬇";
  font-size: 13px;
}

#downloadBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 24px rgba(13, 110, 253, 0.45);
  background: #0b5ed7;
}

#downloadBtn:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(13, 110, 253, 0.35);
}

/* ========== PREVIEW CARD ========== */

.card {
  background: #f5f5f5;
  color: #000;
  padding: 14px;
  text-align: center;
  border-radius: 14px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45);
}

.image-container {
  background: #ffffff;
  padding: 14px;
  display: inline-block;
  max-width: 100%;
  border-radius: 6px;
}

.image-container img {
  display: block;
  max-width: 100%;
  height: auto;
}

.caption {
  font-size: 12px;
  color: #666;
  margin-top: 12px;
}

.caption span {
  font-weight: 600;
}

/* ========== RESPONSIVE BREAKPOINTS ========== */

/* Small tablets / large phones (portrait & landscape) */

@media (min-width: 520px) {
  body {
    padding: 18px 10px;
  }

  .wrapper {
    max-width: 720px;
    padding: 18px 16px;
    gap: 20px;
  }

  #downloadBtn {
    width: auto;         /* not forced full width */
    align-self: flex-start;
  }

  .card {
    padding: 16px;
  }

  .image-container {
    padding: 18px;
  }

  .caption {
    font-size: 13px;
    margin-top: 14px;
  }
}

/* Tablets and small laptops: 2 columns (form + preview) */

@media (min-width: 800px) {
  body {
    padding: 24px 18px;
  }

  .wrapper {
    max-width: 960px;
    padding: 22px 24px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr);
    gap: 28px;
  }

  .controls {
    font-size: 14px;
  }

  .controls input[type="text"],
  .controls input[type="file"] {
    font-size: 14px;
    padding: 8px 11px;
  }

  #downloadBtn {
    margin-top: 14px;
  }

  .card {
    align-self: center;
    padding: 20px;
  }

  .image-container {
    padding: 22px;
  }
}

/* Larger desktops: more breathing space */

@media (min-width: 1120px) {
  body {
    padding: 32px 24px;
  }

  .wrapper {
    max-width: 1040px;
    padding: 24px 26px;
    gap: 32px;
  }

  .card {
    padding: 22px;
  }
}
