* {
  box-sizing: border-box;
}
:root {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --radius: 0.5rem;
}
:root.light {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  background-image: linear-gradient(
    to bottom right,
    hsl(var(--background)),
    hsl(var(--background)),
    hsl(var(--muted) / 0.2)
  );
}
/* Decorative background elements */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
body::before {
  background: radial-gradient(
      circle at 25% 0%,
      rgba(59, 130, 246, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 75% 100%,
      rgba(6, 182, 212, 0.1) 0%,
      transparent 50%
    );
}
header {
  position: relative;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  backdrop-filter: blur(8px);
  background: hsl(var(--background) / 0.8);
  z-index: 10;
}
.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem;
}
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-icon-wrapper {
  position: relative;
}
.logo-icon-blur {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 0.75rem;
  filter: blur(8px);
  opacity: 0.5;
}
.logo-icon {
  position: relative;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  padding: 0.625rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
}
.logo-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  color: white;
}
.logo-text h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(to right, #2563eb, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo-text p {
  margin: 0;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.privacy-badge {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: hsl(var(--muted) / 0.5);
  border-radius: 9999px;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.privacy-badge .dot {
  width: 0.5rem;
  height: 0.5rem;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@media (min-width: 640px) {
  .privacy-badge {
    display: flex;
  }
}
main {
  position: relative;
  flex: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
  z-index: 1;
}
.app {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}
.content-grid {
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 1024px) {
  .app:has(.content-grid) {
    max-width: 1600px;
  }
}
.hero-section {
  text-align: center;
  padding: 2rem 0;
}
.hero-section h2 {
  margin: 0 0 1rem;
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
@media (min-width: 768px) {
  .hero-section h2 {
    font-size: 3rem;
  }
}
.hero-section p {
  margin: 0 auto;
  max-width: 42rem;
  font-size: 1.125rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.75;
}
h1 {
  margin: 0 0 12px;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
}
p {
  /* margin: 0 0 16px; */
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  border: none;
  outline: none;
}
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
button:disabled {
  pointer-events: none;
  opacity: 0.5;
}
/* Primary gradient button */
button.primary,
#captureButton,
#downloadButton {
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: white;
  height: 2.5rem;
  padding: 0 2rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
button.primary:hover,
#captureButton:hover,
#downloadButton:hover {
  background: linear-gradient(135deg, #2563eb, #0891b2);
}
/* Outline button */
button.outline,
#uploadButton,
#nativeShareButton {
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  height: 2.5rem;
  padding: 0 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
button.outline:hover,
#uploadButton:hover,
#nativeShareButton:hover {
  background: hsl(var(--muted) / 0.5);
  color: hsl(var(--foreground));
}
/* Ghost button */
button.ghost {
  background: transparent;
  color: hsl(var(--muted-foreground));
  height: 2.5rem;
  padding: 0 1rem;
}
button.ghost:hover {
  background: hsl(var(--muted) / 0.5);
  color: hsl(var(--foreground));
}
/* Small button */
button.sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
}
/* Large button */
button.lg {
  height: 2.5rem;
  padding: 0 2rem;
}
.card {
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card) / 0.5);
  backdrop-filter: blur(8px);
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.upload-zone {
  position: relative;
  border: 2px dashed hsl(var(--border));
  transition: all 300ms ease;
  background: hsl(var(--card) / 0.5);
  backdrop-filter: blur(8px);
}
.upload-zone.dragging {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.05);
  transform: scale(1.02);
}
.upload-zone:hover:not(.dragging) {
  border-color: hsl(var(--primary) / 0.5);
}
.upload-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1.5rem;
}
.upload-icon-wrapper {
  position: relative;
}
.upload-icon-blur {
  position: absolute;
  inset: 0;
  background: hsl(var(--primary) / 0.2);
  border-radius: 50%;
  filter: blur(32px);
}
.upload-icon {
  position: relative;
  background: hsl(var(--primary) / 0.1);
  padding: 1.5rem;
  border-radius: 1rem;
}
.upload-icon svg {
  width: 3rem;
  height: 3rem;
  color: hsl(var(--primary));
}
.upload-text h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
}
.upload-text p {
  margin: 0;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  max-width: 28rem;
}
.upload-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.upload-support-text {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}
.select-wrap {
  display: grid;
  grid-template-columns: auto;
  gap: 0.5rem;
  color: hsl(var(--foreground));
  font-size: 0.875rem;
}
.select-wrap span {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}
.select-wrap select,
.select-wrap input[type="number"],
.select-wrap input[type="text"] {
  display: flex;
  height: 2.25rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: all 150ms ease;
  outline: none;
}
.select-wrap select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}
.select-wrap select option {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.select-wrap select:focus,
.select-wrap input:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: hsl(var(--ring));
}
.select-wrap select {
  min-width: 220px;
}
.select-wrap input[type="number"] {
  min-width: 160px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: hsl(var(--foreground));
  font-size: 0.875rem;
  height: 2.25rem;
  padding: 0.5rem 0.625rem;
}
.checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  cursor: pointer;
  transition: all 150ms ease;
  appearance: none;
  position: relative;
  flex-shrink: 0;
}
.checkbox input[type="checkbox"]:checked {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}
.checkbox input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}
.checkbox input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.checkbox input[type="checkbox"]:hover {
  border-color: hsl(var(--ring));
}
.shadow-toggle-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  height: 36px;
  padding: 0 1rem;
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 150ms ease;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.shadow-toggle-button:hover {
  background: hsl(var(--muted) / 0.5);
  border-color: hsl(var(--ring));
}
.shadow-toggle-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: hsl(var(--ring));
}
.shadow-toggle-button input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  cursor: pointer;
  transition: all 150ms ease;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  margin: 0;
}
.shadow-toggle-button input[type="checkbox"]:checked {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}
.shadow-toggle-button input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: hsl(var(--primary-foreground));
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}
.shadow-toggle-button input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.shadow-toggle-button input[type="checkbox"]:hover {
  border-color: hsl(var(--ring));
}
.shadow-toggle-button span {
  flex: 1;
  text-align: left;
}
#saveSettings {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  padding: 0 0.75rem;
  font-size: 0.875rem;
  height: 2.25rem;
  transition: all 150ms ease;
}
#saveSettings:hover {
  background: hsl(var(--muted) / 0.5);
  border-color: hsl(var(--ring));
}
#saveSettings:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: hsl(var(--ring));
}
.status {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  min-height: 1.2em;
}
.status.error {
  color: #ef4444;
}
.preview {
  margin-top: 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: 0.75rem;
  overflow: hidden;
  background: hsl(var(--card) / 0.5);
  backdrop-filter: blur(8px);
}
.preview img {
  display: block;
  width: 100%;
  height: auto;
}
.share-row {
  margin-top: 0.75rem;
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}
.share-row.visible {
  display: flex;
}
.background-extra {
  margin-top: 0.625rem;
  padding: 1rem;
  background: hsl(var(--muted) / 0.5);
  border: 1px solid hsl(var(--border));
  border-radius: 0.625rem;
  display: grid;
  gap: 0.5rem;
}
.background-extra .title {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  font-weight: 500;
  letter-spacing: 0.01em;
}
.background-extra .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.background-extra input[type="text"] {
  flex: 1 1 220px;
  min-width: 0;
}
#imageControls {
  display: grid;
}
.background-extra[hidden] {
  display: none !important;
}
footer {
  position: relative;
  border-top: 1px solid hsl(var(--border) / 0.5);
  backdrop-filter: blur(8px);
  background: hsl(var(--background) / 0.8);
  z-index: 10;
}
.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.5rem;
}
.footer-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
@media (min-width: 640px) {
  .footer-content {
    flex-direction: row;
  }
}
.credit {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  pointer-events: auto;
  user-select: none;
}
@media (min-width: 640px) {
  .credit {
    text-align: end;
  }
}
.credit a {
  color: hsl(var(--primary));
  text-decoration: underline;
}
.credit a:hover {
  color: hsl(var(--primary) / 0.8);
}
/* Grid layout for main content */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 0 auto;
}
@media (min-width: 1024px) {
  .content-grid {
    grid-template-columns: 3fr 2fr;
  }
}
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.controls-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.controls-card {
  padding: 1.5rem;
  background: hsl(var(--card) / 0.5);
  backdrop-filter: blur(8px);
}
.controls-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.controls-title-icon {
  padding: 0.5rem;
  background: hsl(var(--primary) / 0.1);
  border-radius: 0.5rem;
}
.controls-title-icon svg {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--primary));
}
.controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) {
  .controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.control-group select,
.control-group input[type="number"] {
  height: 2.25rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  padding: 0 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: all 150ms ease;
  outline: none;
}
.control-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}
.control-group select:focus,
.control-group input:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
  border-color: hsl(var(--ring));
}
.control-group select option {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}
.control-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.control-label-icon {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--muted-foreground));
}
.separator {
  height: 1px;
  background: hsl(var(--border));
  margin: 1.5rem 0;
}
.theme-toggle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 150ms ease;
}
.theme-toggle:hover {
  background: hsl(var(--muted) / 0.5);
  border-color: hsl(var(--ring));
}
.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}
.theme-toggle .sun-icon {
  display: none;
}
:root.light .theme-toggle .sun-icon {
  display: block;
}
:root.light .theme-toggle .moon-icon {
  display: none;
}

/* Background preview grid */
.background-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.75rem;
}

.background-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: calc(var(--radius) - 2px);
  border: 2px solid hsl(var(--input));
  cursor: pointer;
  transition: all 150ms ease;
  overflow: hidden;
  background: hsl(var(--muted));
  padding: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto;
}

.background-preview-item:hover {
  transform: scale(1.05);
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.background-preview-item.selected {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary));
}

.background-preview-item .preview-square {
  width: 100%;
  height: 100%;
  border-radius: calc(var(--radius) - 4px);
}

.background-preview-item .preview-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.25rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 500;
  text-align: center;
  background: hsl(var(--background) / 0.95);
  color: hsl(var(--foreground));
  backdrop-filter: blur(4px);
  border-radius: 0 0 calc(var(--radius) - 4px) calc(var(--radius) - 4px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.background-preview-item.selected .preview-label {
  background: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
}

/* Background selector */
.background-selector {
  margin-top: 1rem;
}

/* Collapsible sections */
.collapsible-section {
  margin-top: 0.75rem;
}

.collapsible-section:first-child {
  margin-top: 0;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: hsl(var(--muted) / 0.3);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  user-select: none;
  transition: all 150ms ease;
}

.collapsible-header:hover {
  background: hsl(var(--muted) / 0.5);
  border-color: hsl(var(--ring));
}

.collapsible-header h3 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.collapsible-header svg {
  width: 1rem;
  height: 1rem;
  color: hsl(var(--muted-foreground));
  transition: transform 200ms ease;
}

.collapsible-section.expanded .collapsible-header svg {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 300ms ease;
  padding-top: 0;
}

.collapsible-section.expanded .collapsible-content {
  max-height: 2000px;
  padding-top: 0.75rem;
}
