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

body {
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
  background: #1a1a2e;
  color: #fff;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 16px 40px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 12px 0 16px;
}

header h1 {
  background: linear-gradient(135deg, #fff8ad, #ffd700 45%, #ff8c00);
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
}

.subtitle {
  margin-top: 2px;
  color: #8e8ea6;
  font-size: 13px;
}

.sample-section {
  margin-bottom: 16px;
  border-radius: 16px;
  overflow: hidden;
  background: #111;
}

.sample-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.upload-area {
  padding: 48px 20px;
  border: 2px dashed #46465d;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s;
}

.upload-area:hover,
.upload-area.dragging {
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.06);
}

.upload-area:active {
  transform: scale(0.98);
}

.upload-icon {
  display: block;
  margin-bottom: 12px;
  font-size: 48px;
}

.upload-area p {
  color: #b2b2c6;
  font-size: 15px;
}

.privacy-note {
  margin: 10px 0 14px;
  color: #a7a7bd;
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
}

.preflight-tools {
  margin: 10px 0 0;
}

.preflight-tools .btn-icon {
  min-height: 40px;
}

.mono-note {
  max-width: 340px;
  margin: 8px auto 0;
  color: #9a9ab1;
  text-align: center;
  font-size: 11px;
  line-height: 1.55;
}

.preview-section {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
  background: #111;
}

.preview-section canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}

.hdr-preview {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.processing {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 215, 0, 0.2);
  border-top-color: #ffd700;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.processing p {
  color: #ffd700;
  font-size: 14px;
}

.drag-guide {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: drag-guide-fade-in 0.4s ease-out;
}

.drag-guide.fade-out {
  animation: drag-guide-fade-out 0.6s ease-out forwards;
}

.drag-guide-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 28px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.drag-guide-icon {
  font-size: 32px;
  animation: drag-guide-bounce 1.2s ease-in-out infinite;
}

.drag-guide-text {
  color: #fff;
  white-space: nowrap;
  font-size: 13px;
}

@keyframes drag-guide-bounce {
  0%,
  to {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

@keyframes drag-guide-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes drag-guide-fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.hint {
  margin: 0 0 4px;
  color: #606077;
  text-align: center;
  font-size: 11px;
}

.edit-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.btn-icon {
  width: 100%;
  padding: 6px 14px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #aaaabd;
  font-size: 13px;
  white-space: nowrap;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
}

.btn-icon[aria-pressed="true"] {
  background: rgba(255, 215, 0, 0.18);
  color: #ffe66d;
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.36);
}

.btn-icon:active {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(0.92);
}

.hashtag-hint {
  margin: 4px 0;
  color: #9090a4;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.5;
  transition: color 0.2s;
}

.hashtag-hint:active,
.hashtag-hint strong {
  color: #ffd700;
}

.output-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
  animation: actions-in 0.24s ease-out;
}

@keyframes actions-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 44px;
  padding: 12px 8px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.2s;
}

.btn:active {
  transform: scale(0.95);
}

.btn-tweet {
  border: 1px solid #333348;
  background: #000;
  color: #fff;
}

.btn-share {
  background: linear-gradient(135deg, #00b4d8, #0077b6);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
}

.toast {
  pointer-events: none;
  position: fixed;
  bottom: 40px;
  bottom: calc(40px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 100;
  padding: 10px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1a2e;
  opacity: 0;
  font-size: 14px;
  font-weight: 600;
  transition:
    opacity 0.3s,
    transform 0.3s;
  transform: translate(-50%, 20px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.inspiration-reference {
  margin-top: 32px;
  text-align: center;
}

.inspiration-label {
  margin-bottom: 12px;
  color: #8e8ea6;
  font-size: 13px;
}

.reference-link {
  color: #ffd700;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.reference-link:hover {
  text-decoration: underline;
}

.commercial-note {
  margin: 22px 0 18px;
  color: #a7a7bd;
  font-size: 12px;
  line-height: 1.7;
}

.commercial-note h2 {
  margin-bottom: 10px;
  color: #fff;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.commercial-note p + p {
  margin-top: 6px;
}

footer {
  margin-top: auto;
  padding: 18px 0 24px;
  background: transparent;
  color: #a7a7bd;
  text-align: center;
}

footer p {
  margin: 0;
  color: #a7a7bd;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.7;
}

.footer-creator-link {
  display: inline-block;
  padding: 1px 7px 2px;
  border-radius: 999px;
  background: #1d9bf0;
  color: #fff;
  font-weight: 1000;
  text-decoration: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 12px rgba(29, 155, 240, 0.55);
}

.footer-creator-link:hover {
  background: #fff;
  color: #ff8c00;
}

.hidden {
  display: none !important;
}

:focus-visible {
  outline: 2px solid #ffd700;
  outline-offset: 3px;
}
