/* ============================================================
   Gradient Generator PWA – Styles
   Liquid glass theme optimised for iPhone 17/18 Pro
   (393×852 logical viewport, Dynamic Island safe areas)
   ============================================================ */

/* ----------------------------------------------------------
   Design Tokens
   ---------------------------------------------------------- */
:root {
  --bg:             #10121d;
  --surface:        rgba(255, 255, 255, 0.075);
  --surface-hover:  rgba(255, 255, 255, 0.13);
  --glass:          rgba(255, 255, 255, 0.12);
  --glass-blur:     blur(24px) saturate(155%);
  --accent:         linear-gradient(135deg, #8b7cff 0%, #63d9d2 100%);
  --accent-start:   #a99dff;
  --accent-end:     #79e9df;
  --text-primary:   #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --border:         rgba(255, 255, 255, 0.17);
  --radius-card:    22px;
  --radius-btn:     16px;
  --radius-lg:      30px;
  --font-stack:     -apple-system, BlinkMacSystemFont, 'SF Pro Display', system-ui, sans-serif;
  --ease:           cubic-bezier(0.4, 0, 0.2, 1);
  --transition:     all 0.3s var(--ease);
}

/* ----------------------------------------------------------
   Global Reset & Base
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-stack);
  overflow: hidden;
  height: 100dvh;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Fallback for browsers that don't support dvh */
@supports not (height: 100dvh) {
  body {
    height: 100vh;
  }
  #app {
    height: 100vh;
  }
}

/* ----------------------------------------------------------
   #app Root Container
   ---------------------------------------------------------- */
#app {
  width: 100%;
  height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* ----------------------------------------------------------
   Screen System – slide transitions
   ---------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateX(30px);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.screen.exit-left {
  transform: translateX(-30px);
}

/* ----------------------------------------------------------
   Screen: Home (#screen-home)
   ---------------------------------------------------------- */
.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px;
  padding-top: calc(40px + env(safe-area-inset-top));
}

/* Hero */
.home-hero {
  text-align: center;
  margin-bottom: 48px;
  position: relative;
}

.hero-gradient-bg {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle at center,
    rgba(102, 126, 234, 0.25) 0%,
    rgba(118, 75, 162, 0.15) 35%,
    transparent 70%
  );
  opacity: 0.3;
  animation: slow-rotate 20s linear infinite;
  pointer-events: none;
}

@keyframes slow-rotate {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.app-icon {
  font-size: 64px;
  margin-bottom: 16px;
  display: block;
}

h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

h1 span {
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin-top: 12px;
  max-width: 280px;
  margin-inline: auto;
  line-height: 1.45;
}

/* Home Actions */
.home-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 340px;
  margin: 0 auto;
  width: 100%;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  color: var(--text-primary);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-stack);
}

.btn-action:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.1);
}

/* Icon wrappers inside action buttons */
.btn-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
}

/* Camera button icon */
.btn-icon-wrap.camera,
.btn-action:first-child .btn-icon-wrap {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

/* Upload button icon */
.btn-icon-wrap.upload,
.btn-action:nth-child(2) .btn-icon-wrap {
  background: linear-gradient(135deg, #f093fb, #f5576c);
}

.btn-text strong {
  display: block;
  font-size: 16px;
}

.btn-text span {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

/* Footer */
.home-footer {
  text-align: center;
  margin-top: 32px;
}

.home-footer p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
}

/* ----------------------------------------------------------
   Screen: Camera (#screen-camera)
   ---------------------------------------------------------- */
#camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.camera-top-bar {
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top));
}

.camera-bottom-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 20px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

/* Round utility button (close, flip, flash) */
.btn-round {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-round:active {
  transform: scale(0.92);
}

/* Capture button */
.btn-capture {
  width: 72px;
  height: 72px;
  border-radius: 36px;
  background: transparent;
  border: 4px solid white;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.capture-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s var(--ease);
}

.btn-capture:active .capture-inner {
  transform: scale(0.85);
}

/* ----------------------------------------------------------
   Shared Screen Header
   ---------------------------------------------------------- */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.btn-nav {
  background: none;
  border: none;
  color: var(--accent-start);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  font-family: var(--font-stack);
  transition: opacity 0.2s;
}

.btn-nav:active {
  opacity: 0.6;
}

.screen-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.header-spacer {
  width: 60px;
}

/* ----------------------------------------------------------
   Screen: Editor (#screen-editor)
   ---------------------------------------------------------- */
.editor-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.photo-container {
  position: relative;
  margin: 16px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: #111;
  aspect-ratio: 4 / 3;
  max-height: 300px;
}

#photo-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Touch-point indicator on the photo */
.touch-indicator {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: opacity 0.2s;
}

.touch-indicator.hidden {
  opacity: 0;
}

.touch-indicator.active {
  opacity: 1;
}

/* ----------------------------------------------------------
   Mode Tabs (editor sub-navigation)
   ---------------------------------------------------------- */
.mode-tabs {
  display: flex;
  gap: 4px;
  margin: 0 16px;
  background: var(--surface);
  border-radius: var(--radius-btn);
  padding: 4px;
}

.mode-tab {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-stack);
  text-align: center;
}

.mode-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.mode-icon {
  margin-right: 4px;
}

/* ----------------------------------------------------------
   Mode Panels
   ---------------------------------------------------------- */
.mode-panel {
  display: none;
  padding: 16px;
}

.mode-panel.active {
  display: block;
}

.panel-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Control rows inside panels */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.control-row label {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-val {
  font-size: 14px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

/* ----------------------------------------------------------
   AI Recommended Palette Grid
   ---------------------------------------------------------- */
.recommended-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.palette-strip {
  min-height: 56px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 8px 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-btn);
  cursor: pointer;
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.8);
  -webkit-tap-highlight-color: transparent;
}

.palette-strip:active {
  transform: scale(0.98);
}

.palette-strip-label {
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
}

.rec-palette {
  height: 56px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
  overflow: hidden;
}

.rec-palette.selected {
  border-color: var(--accent-start);
}

.rec-palette:active {
  transform: scale(0.96);
}

/* ----------------------------------------------------------
   Palette Section
   ---------------------------------------------------------- */
.palette-section {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.palette-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 10px;
}

.palette-colors {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.color-swatch {
  width: 64px;
  height: 56px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  position: relative;
  transition: transform 0.2s var(--ease);
}

.color-swatch:active {
  transform: scale(0.9);
}

/* Remove badge on swatch hover */
.color-swatch .swatch-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ff4757;
  color: var(--text-primary);
  font-size: 11px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.95;
  transition: opacity 0.2s;
}

.color-swatch:hover .swatch-remove {
  opacity: 1;
}

.swatch-label {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  overflow: hidden;
  color: #fff;
  font-size: 9px;
  text-align: center;
  text-shadow: 0 1px 3px #000;
  white-space: nowrap;
}

/* Mini gradient preview stripe */
.gradient-mini-preview {
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ----------------------------------------------------------
   Buttons – Primary / Secondary / Small
   ---------------------------------------------------------- */
.btn-primary {
  display: block;
  width: calc(100% - 32px);
  margin: 16px;
  padding: 16px;
  background: var(--accent);
  border: none;
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-stack);
  text-align: center;
}

.btn-primary:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.btn-primary:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.btn-secondary {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  transition: var(--transition);
  font-family: var(--font-stack);
  text-align: center;
}

.btn-secondary:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.12);
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
}

/* ----------------------------------------------------------
   Screen: Gradient (#screen-gradient)
   ---------------------------------------------------------- */
.gradient-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.gradient-preview-wrap {
  position: relative;
  margin: 16px;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  max-height: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.gradient-preview {
  width: 100%;
  height: 100%;
  transition: filter 0.3s var(--ease);
}

.grain-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0;
}

.vignette-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 20px;
}

/* Gradient controls panel */
.gradient-controls {
  padding: 16px;
}

.control-group {
  margin-bottom: 16px;
}

.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
}

.val-badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Gradient type toggle buttons */
.type-btns {
  display: flex;
  gap: 6px;
}

.type-btn {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-stack);
  text-align: center;
}

.type-btn.active {
  background: rgba(102, 126, 234, 0.2);
  border-color: var(--accent-start);
  color: var(--accent-start);
}

.type-btn:active {
  transform: scale(0.96);
}

/* ----------------------------------------------------------
   Range Inputs (custom thumb & track)
   ---------------------------------------------------------- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 11px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: none;
  cursor: pointer;
}

/* ----------------------------------------------------------
   Screen: Export (#screen-export)
   ---------------------------------------------------------- */
.export-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.export-preview {
  margin: 16px auto;
  border-radius: var(--radius-card);
  overflow: hidden;
  aspect-ratio: 9 / 16;
  width: min(calc(100% - 32px), 280px);
  max-height: 300px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.export-options {
  padding: 0 16px;
}

.export-options h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.4);
  margin: 20px 0 10px;
}

/* Resolution grid */
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.res-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 10px;
  background: var(--surface);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  gap: 4px;
  font-family: var(--font-stack);
}

.res-btn.active {
  border-color: var(--accent-start);
  background: rgba(102, 126, 234, 0.1);
}

.res-btn:active {
  transform: scale(0.96);
}

.res-icon {
  font-size: 24px;
}

.res-name {
  font-size: 14px;
  font-weight: 600;
}

.res-size {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* Format toggle buttons */
.format-btns {
  display: flex;
  gap: 8px;
}

.format-btn {
  flex: 1;
  padding: 12px;
  background: var(--surface);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-stack);
  text-align: center;
}

.format-btn.active {
  border-color: var(--accent-start);
  color: var(--accent-start);
  background: rgba(102, 126, 234, 0.1);
}

.format-btn:active {
  transform: scale(0.96);
}

/* Download button extra bottom margin for safe area */
.btn-download {
  margin-bottom: calc(16px + env(safe-area-inset-bottom)) !important;
}

/* ----------------------------------------------------------
   Loading Overlay
   ---------------------------------------------------------- */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s var(--ease);
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading:not(.hidden) {
  opacity: 1;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-start);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading p {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   Toast Notification
   ---------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  color: var(--text-primary);
  z-index: 200;
  transition: all 0.3s var(--ease);
  white-space: nowrap;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

.toast:not(.hidden) {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------
   Utility: Generic .hidden
   Applied via JS – uses display:none for structural elements
   (toast & loading use their own opacity-based .hidden)
   ---------------------------------------------------------- */
.hidden:not(.toast):not(.loading) {
  display: none !important;
}

/* ----------------------------------------------------------
   Responsive – wider-than-iPhone viewports
   ---------------------------------------------------------- */
@media (min-width: 430px) {
  #app {
    max-width: 430px;
    margin: 0 auto;
    position: relative;
    /* Add a subtle border on desktop for framing */
    box-shadow: 0 0 80px rgba(102, 126, 234, 0.08);
  }

  h1 {
    font-size: 48px;
  }

  .subtitle {
    font-size: 17px;
    max-width: 320px;
  }

  .btn-action {
    font-size: 16px;
  }
}

/* ----------------------------------------------------------
   Accessibility: reduce motion
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .screen {
    transition: none;
  }

  .hero-gradient-bg {
    animation: none;
  }
}

/* ----------------------------------------------------------
   Liquid glass finish
   ---------------------------------------------------------- */
body {
  background: #10121d;
}

#app {
  isolation: isolate;
  background:
    radial-gradient(ellipse at 10% 8%, rgba(95, 117, 255, 0.23), transparent 38%),
    radial-gradient(ellipse at 88% 35%, rgba(72, 221, 207, 0.12), transparent 34%),
    radial-gradient(ellipse at 62% 96%, rgba(177, 106, 245, 0.17), transparent 42%),
    linear-gradient(155deg, #141725 0%, #10121d 54%, #171421 100%);
}

.screen {
  background: transparent;
}

.hero-gradient-bg {
  top: -60%;
  left: -38%;
  width: 176%;
  height: 210%;
  opacity: 0.8;
  filter: blur(22px);
  background:
    radial-gradient(ellipse at 42% 44%, rgba(105, 126, 255, 0.44), transparent 38%),
    radial-gradient(ellipse at 60% 52%, rgba(75, 224, 210, 0.22), transparent 34%),
    radial-gradient(ellipse at 51% 65%, rgba(195, 113, 245, 0.2), transparent 40%);
}

.home-hero {
  margin-bottom: 38px;
}

.app-icon {
  width: 78px;
  height: 78px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 26px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.7), transparent 27%),
    linear-gradient(145deg, rgba(174, 157, 255, 0.82), rgba(92, 218, 209, 0.68) 58%, rgba(175, 117, 245, 0.7));
  box-shadow: 0 18px 54px rgba(102, 114, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.62);
  font-size: 42px;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

h1 {
  letter-spacing: -1.8px;
  text-shadow: 0 4px 32px rgba(0, 0, 0, 0.2);
}

h1 span {
  background: linear-gradient(105deg, #c0b4ff 4%, #86f0e1 92%);
  -webkit-background-clip: text;
  background-clip: text;
}

.subtitle {
  color: rgba(239, 241, 255, 0.66);
}

.btn-action,
.screen-header,
.mode-tabs,
.res-btn,
.format-btn,
.type-btn,
.val-badge {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 32px rgba(3, 5, 17, 0.16);
  backdrop-filter: blur(24px) saturate(155%);
  -webkit-backdrop-filter: blur(24px) saturate(155%);
}

.btn-action {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 16px 18px;
}

.btn-action::before,
.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 48%;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), transparent);
}

.btn-action:active,
.res-btn:active,
.format-btn:active,
.type-btn:active {
  transform: scale(0.975);
  background-color: rgba(255, 255, 255, 0.12);
}

.btn-icon-wrap,
.btn-icon-wrap.camera,
.btn-action:first-child .btn-icon-wrap {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: linear-gradient(145deg, rgba(177, 164, 255, 0.8), rgba(96, 217, 211, 0.48));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 20px rgba(79, 101, 226, 0.22);
}

.btn-action:nth-child(2) .btn-icon-wrap {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(145deg, rgba(255, 159, 210, 0.74), rgba(171, 131, 255, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), 0 8px 20px rgba(176, 94, 199, 0.2);
}

.btn-text span,
.home-footer p {
  color: rgba(234, 237, 255, 0.54);
}

.screen-header {
  flex-shrink: 0;
  border-width: 0 0 1px;
  background: rgba(20, 22, 35, 0.56);
}

.btn-nav {
  color: #a9e8e3;
}

.photo-container,
.gradient-preview-wrap,
.export-preview {
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.mode-tabs {
  border-radius: 18px;
  padding: 5px;
}

.mode-tab {
  min-height: 42px;
  color: rgba(239, 241, 255, 0.58);
}

.mode-tab.active {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(140deg, rgba(168, 152, 255, 0.32), rgba(100, 220, 208, 0.17));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 5px 18px rgba(7, 9, 25, 0.2);
}

.mode-panel {
  padding-top: 14px;
}

.panel-hint,
.control-group label,
.control-row label {
  color: rgba(239, 241, 255, 0.69);
}

.palette-section,
.gradient-controls {
  margin: 8px 16px 0;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
}

.palette-section {
  border-top-color: rgba(255, 255, 255, 0.09);
}

.palette-section h3,
.export-options h3 {
  color: rgba(228, 232, 255, 0.55);
}

.color-swatch {
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 7px 18px rgba(0, 0, 0, 0.2);
}

.gradient-preview-wrap {
  box-shadow: 0 24px 70px rgba(4, 7, 20, 0.38), 0 0 50px rgba(111, 111, 255, 0.1);
}

.gradient-controls {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.control-group {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.val-badge {
  color: #c8fff4;
  border-radius: 999px;
}

.type-btn,
.res-btn,
.format-btn {
  color: rgba(244, 245, 255, 0.72);
}

.type-btn.active,
.res-btn.active,
.format-btn.active {
  color: #f9f8ff;
  border-color: rgba(176, 165, 255, 0.64);
  background: linear-gradient(145deg, rgba(166, 150, 255, 0.25), rgba(88, 223, 209, 0.12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 7px 22px rgba(88, 106, 225, 0.13);
}

.res-size,
.format-btn {
  color: rgba(235, 238, 255, 0.62);
}

.btn-primary {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(110deg, #8976f5 0%, #6e9ce9 48%, #4cc9c0 100%);
  box-shadow: 0 12px 32px rgba(100, 122, 242, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.btn-primary:disabled {
  filter: saturate(0.45);
}

.btn-secondary {
  border-color: rgba(255, 255, 255, 0.19);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.btn-round {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 8px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.loading {
  background: rgba(13, 15, 25, 0.58);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(45, 49, 70, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 12px 36px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #b1fff1;
  outline-offset: 3px;
}

@supports not (backdrop-filter: blur(1px)) {
  .btn-action,
  .screen-header,
  .mode-tabs,
  .res-btn,
  .format-btn,
  .type-btn,
  .val-badge,
  .btn-secondary,
  .btn-round,
  .toast {
    background-color: rgba(43, 46, 68, 0.94);
  }
}

@media (prefers-reduced-transparency: reduce) {
  .btn-action,
  .screen-header,
  .mode-tabs,
  .res-btn,
  .format-btn,
  .type-btn,
  .val-badge,
  .btn-secondary,
  .btn-round,
  .toast {
    background: rgba(37, 40, 58, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ----------------------------------------------------------
   Frutiger Aero – clear sky, water light and glossy glass
   ---------------------------------------------------------- */
:root {
  --bg: #d8f4fb;
  --surface: rgba(255, 255, 255, 0.48);
  --surface-hover: rgba(255, 255, 255, 0.72);
  --glass: rgba(255, 255, 255, 0.56);
  --accent: linear-gradient(135deg, #36c8d1 0%, #57a9e8 55%, #75d5cc 100%);
  --accent-start: #168eaa;
  --accent-end: #51c6ca;
  --text-primary: #173c50;
  --text-secondary: rgba(28, 70, 88, 0.7);
  --border: rgba(255, 255, 255, 0.68);
}

body {
  color: #173c50;
  background: linear-gradient(160deg, #d9f4ff, #b9e9f2 55%, #c5eee5);
}

#app {
  background:
    radial-gradient(ellipse at 14% 8%, rgba(255, 255, 255, 0.92), transparent 27%),
    radial-gradient(ellipse at 88% 16%, rgba(179, 237, 250, 0.72), transparent 32%),
    radial-gradient(ellipse at 83% 88%, rgba(110, 214, 205, 0.28), transparent 39%),
    linear-gradient(165deg, #e7faff 0%, #cbeff8 47%, #a8dfdf 100%);
}

#screen-home,
#screen-editor,
#screen-gradient,
#screen-export {
  color: #173c50;
  background: transparent;
}

#screen-home .home-content {
  background:
    radial-gradient(ellipse at 50% 8%, rgba(255, 255, 255, 0.88), transparent 42%),
    radial-gradient(ellipse at 12% 30%, rgba(255, 255, 255, 0.48), transparent 32%),
    radial-gradient(ellipse at 88% 33%, rgba(175, 235, 249, 0.58), transparent 38%),
    radial-gradient(ellipse at 78% 95%, rgba(89, 205, 195, 0.32), transparent 46%),
    linear-gradient(165deg, #eafaff 0%, #d2f2f8 50%, #b7e9e4 100%);
}

#screen-home .home-content::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 210px;
  height: 210px;
  top: 12%;
  right: -88px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.06) 68%, transparent 72%);
  filter: blur(1px);
}

#screen-home .home-content::after {
  opacity: 0.1;
}

#screen-home .hero-gradient-bg {
  opacity: 0.72;
  filter: blur(30px);
  background:
    radial-gradient(ellipse at 42% 44%, rgba(91, 218, 224, 0.46), transparent 39%),
    radial-gradient(ellipse at 62% 52%, rgba(255, 255, 255, 0.7), transparent 36%),
    radial-gradient(ellipse at 51% 65%, rgba(121, 211, 232, 0.34), transparent 42%);
}

#screen-home h1 {
  color: #17455b;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.76);
}

#screen-home h1 span {
  background: linear-gradient(105deg, #149eae 4%, #41b7cb 52%, #36a8ac 96%);
  -webkit-background-clip: text;
  background-clip: text;
}

#screen-home .subtitle {
  color: rgba(30, 76, 96, 0.76);
}

#screen-home .btn-action,
.screen-header,
.mode-tabs,
.res-btn,
.format-btn,
.type-btn,
.val-badge,
.btn-secondary {
  color: #19475b;
  border-color: rgba(255, 255, 255, 0.76);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(233, 250, 255, 0.44));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94), 0 9px 24px rgba(48, 124, 147, 0.12);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

#screen-home .btn-action {
  border-radius: 24px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 14px 30px rgba(42, 133, 151, 0.16);
}

#screen-home .btn-action::before,
.btn-primary::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
}

#screen-home .btn-icon-wrap,
#screen-home .btn-icon-wrap.camera,
#screen-home .btn-action:first-child .btn-icon-wrap {
  color: #147d95;
  border-color: rgba(255, 255, 255, 0.88);
  background: linear-gradient(145deg, #e3fbff, #aee9f2 66%, #91d9e5);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.92), 0 6px 18px rgba(50, 151, 170, 0.2);
}

#screen-home .btn-action:nth-child(2) .btn-icon-wrap {
  color: #367fa1;
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #f4ffff, #cdeefa 65%, #a6d9ef);
}

#screen-home .btn-text span {
  color: rgba(31, 76, 95, 0.68);
}

.screen-header {
  border-bottom-color: rgba(255, 255, 255, 0.65);
}

.screen-header h2,
.control-row label,
.control-group label {
  color: #19475b;
}

.btn-nav {
  color: #087f9d;
}

.photo-container,
.gradient-preview-wrap,
.export-preview {
  border-color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 40px rgba(32, 100, 123, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.mode-tab {
  color: rgba(30, 76, 96, 0.66);
}

.mode-tab.active {
  color: #15506a;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(194, 241, 248, 0.74));
  box-shadow: inset 0 1px 0 #fff, 0 3px 12px rgba(55, 139, 158, 0.13);
}

.panel-hint,
.palette-section h3,
.export-options h3 {
  color: rgba(29, 75, 94, 0.68);
}

.palette-section,
.gradient-controls {
  border-color: rgba(255, 255, 255, 0.66);
  background: rgba(245, 253, 255, 0.34);
}

.palette-section h3,
.export-options h3 {
  color: #438092;
}

.color-swatch {
  border-color: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.44), 0 5px 14px rgba(26, 92, 112, 0.16);
}

.control-group {
  border-color: rgba(255, 255, 255, 0.7);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(227, 249, 252, 0.4));
}

.val-badge {
  color: #087f9d;
}

.type-btn,
.res-btn,
.format-btn {
  color: #285c70;
}

.type-btn.active,
.res-btn.active,
.format-btn.active {
  color: #075d77;
  border-color: rgba(47, 179, 194, 0.7);
  background: linear-gradient(145deg, rgba(230, 253, 255, 0.96), rgba(159, 226, 237, 0.62));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 5px 14px rgba(54, 151, 173, 0.14);
}

.res-size,
.format-btn {
  color: rgba(37, 91, 111, 0.72);
}

.btn-primary {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.86);
  background: linear-gradient(115deg, #31c1c9 0%, #36a9d5 52%, #48c9b8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), 0 12px 28px rgba(27, 143, 170, 0.24);
  text-shadow: 0 1px 4px rgba(7, 87, 111, 0.24);
}

.btn-secondary {
  border-color: rgba(255, 255, 255, 0.86);
}

.btn-round {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(21, 96, 119, 0.38);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 8px 24px rgba(10, 74, 94, 0.16);
}

.loading {
  color: #17475d;
  background: rgba(220, 247, 251, 0.78);
}

.toast {
  color: #17475d;
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(246, 253, 255, 0.88);
  box-shadow: inset 0 1px 0 #fff, 0 12px 30px rgba(34, 111, 135, 0.18);
}

button:focus-visible,
[role="button"]:focus-visible {
  outline-color: #087f9d;
}

#screen-camera {
  --camera-ambient-color: #68d5d4;
  background:
    radial-gradient(ellipse at 22% 24%, var(--camera-ambient-color), transparent 58%),
    #a9e7ed;
}

#screen-camera #camera-feed {
  filter: saturate(0.96) contrast(1.02);
}

#screen-camera .camera-ambient {
  mix-blend-mode: screen;
}

@media (prefers-reduced-transparency: reduce) {
  #screen-home .btn-action,
  .screen-header,
  .mode-tabs,
  .res-btn,
  .format-btn,
  .type-btn,
  .val-badge,
  .btn-secondary {
    background: rgba(240, 252, 255, 0.98);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Finger-drawn gradient path controls */
.gradient-preview-wrap.custom-shape-active {
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}

.shape-gradient-canvas,
.gradient-path-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.shape-gradient-canvas {
  z-index: 1;
}

.gradient-path-canvas {
  z-index: 3;
}

.grain-overlay {
  z-index: 2;
}

.vignette-overlay {
  z-index: 4;
}

.custom-shape-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.custom-shape-tools p {
  color: rgba(238, 232, 220, 0.66);
  font-size: 12px;
  line-height: 1.4;
}

.custom-shape-tools .btn-secondary {
  width: auto;
  flex: 0 0 auto;
  padding: 8px 12px;
}

.type-btns {
  gap: 5px;
}

.type-btn {
  min-width: 0;
  padding: 10px 5px;
  font-size: 12px;
}

@media (max-width: 360px) {
  .type-btn {
    font-size: 11px;
    padding-inline: 3px;
  }
}

@media (prefers-contrast: more) {
  .btn-action,
  .screen-header,
  .mode-tabs,
  .res-btn,
  .format-btn,
  .type-btn,
  .btn-secondary,
  .btn-round {
    border-color: rgba(255, 255, 255, 0.48);
  }
}

/* ----------------------------------------------------------
   Warm pastel home + camera color atmosphere
   ---------------------------------------------------------- */
#screen-home {
  color: #49372e;
  background: #fff8ef;
}

#screen-home .home-content {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 18% 22%, rgba(255, 212, 177, 0.78), transparent 48%),
    radial-gradient(ellipse at 83% 35%, rgba(255, 224, 208, 0.84), transparent 46%),
    radial-gradient(ellipse at 55% 92%, rgba(248, 224, 187, 0.72), transparent 50%),
    linear-gradient(150deg, #fff9f1 0%, #fff3eb 52%, #fdf2df 100%);
}

#screen-home .home-content::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

#screen-home .home-content > * {
  z-index: 1;
}

#screen-home .hero-gradient-bg {
  background:
    radial-gradient(ellipse at 42% 44%, rgba(255, 190, 145, 0.48), transparent 39%),
    radial-gradient(ellipse at 62% 52%, rgba(255, 215, 190, 0.5), transparent 36%),
    radial-gradient(ellipse at 51% 65%, rgba(245, 222, 184, 0.42), transparent 42%);
}

#screen-home h1 {
  color: #49372e;
  text-shadow: 0 3px 24px rgba(130, 83, 54, 0.08);
}

#screen-home h1 span {
  background: linear-gradient(105deg, #c97855 4%, #de9c69 55%, #ba795c 96%);
  -webkit-background-clip: text;
  background-clip: text;
}

#screen-home .subtitle {
  color: rgba(83, 62, 50, 0.7);
}

#screen-home .btn-action {
  color: #4b382f;
  border-color: rgba(255, 255, 255, 0.78);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.76), rgba(255, 250, 245, 0.54));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 12px 32px rgba(155, 102, 70, 0.1);
  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}

#screen-home .btn-action::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent);
}

#screen-home .btn-icon-wrap,
#screen-home .btn-icon-wrap.camera,
#screen-home .btn-action:first-child .btn-icon-wrap {
  color: #a85e43;
  border-color: rgba(213, 148, 112, 0.25);
  background: linear-gradient(145deg, #ffe0c9, #f8c7aa);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 7px 18px rgba(165, 101, 69, 0.12);
}

#screen-home .btn-action:nth-child(2) .btn-icon-wrap {
  color: #9b694b;
  border-color: rgba(209, 161, 112, 0.25);
  background: linear-gradient(145deg, #fae4be, #f4d3b4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 7px 18px rgba(165, 121, 69, 0.1);
}

#screen-home .btn-text span {
  color: rgba(83, 62, 50, 0.62);
}

#screen-camera {
  --camera-ambient-color: #e8bba0;
  background:
    radial-gradient(ellipse at 22% 24%, var(--camera-ambient-color), transparent 58%),
    #d8bca9;
}

#screen-camera #camera-feed {
  position: relative;
  z-index: 0;
  opacity: 0.9;
  filter: saturate(0.88);
}

#screen-camera .camera-ambient {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 18% 24%, color-mix(in srgb, var(--camera-ambient-color), transparent 40%), transparent 64%),
    radial-gradient(ellipse at 82% 78%, color-mix(in srgb, var(--camera-ambient-color), #f2c9a9 55%), transparent 62%);
  mix-blend-mode: soft-light;
  transition: background-color 900ms ease;
}

#screen-camera .camera-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
}

#screen-camera .camera-ui {
  z-index: 2;
}

@media (prefers-reduced-transparency: reduce) {
  #screen-home .btn-action {
    background: rgba(255, 250, 245, 0.97);
  }
  #screen-camera #camera-feed {
    opacity: 1;
  }
}

/* Final home and live-camera colors after the earlier warm pastel pass. */
#screen-home .home-content {
  background:
    radial-gradient(ellipse at 50% 8%, rgba(255, 255, 255, 0.88), transparent 42%),
    radial-gradient(ellipse at 12% 30%, rgba(255, 255, 255, 0.48), transparent 32%),
    radial-gradient(ellipse at 88% 33%, rgba(175, 235, 249, 0.58), transparent 38%),
    radial-gradient(ellipse at 78% 95%, rgba(89, 205, 195, 0.32), transparent 46%),
    linear-gradient(165deg, #eafaff 0%, #d2f2f8 50%, #b7e9e4 100%);
}

#screen-home .hero-gradient-bg {
  opacity: 0.72;
  filter: blur(30px);
  background:
    radial-gradient(ellipse at 42% 44%, rgba(91, 218, 224, 0.46), transparent 39%),
    radial-gradient(ellipse at 62% 52%, rgba(255, 255, 255, 0.7), transparent 36%),
    radial-gradient(ellipse at 51% 65%, rgba(121, 211, 232, 0.34), transparent 42%);
}

#screen-home h1 {
  color: #17455b;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.76);
}

#screen-home h1 span {
  background: linear-gradient(105deg, #149eae 4%, #41b7cb 52%, #36a8ac 96%);
  -webkit-background-clip: text;
  background-clip: text;
}

#screen-home .subtitle {
  color: rgba(30, 76, 96, 0.76);
}

#screen-home .btn-action {
  color: #19475b;
  border-color: rgba(255, 255, 255, 0.76);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(233, 250, 255, 0.44));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96), 0 14px 30px rgba(42, 133, 151, 0.16);
}

#screen-home .btn-icon-wrap,
#screen-home .btn-icon-wrap.camera,
#screen-home .btn-action:first-child .btn-icon-wrap {
  color: #147d95;
  border-color: rgba(255, 255, 255, 0.88);
  background: linear-gradient(145deg, #e3fbff, #aee9f2 66%, #91d9e5);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.92), 0 6px 18px rgba(50, 151, 170, 0.2);
}

#screen-home .btn-action:nth-child(2) .btn-icon-wrap {
  color: #367fa1;
  border-color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, #f4ffff, #cdeefa 65%, #a6d9ef);
}

#screen-home .btn-text span {
  color: rgba(31, 76, 95, 0.68);
}

#screen-camera {
  --camera-ambient-color: #68d5d4;
  background:
    radial-gradient(ellipse at 22% 24%, var(--camera-ambient-color), transparent 58%),
    #a9e7ed;
}

#screen-camera #camera-feed {
  filter: saturate(0.96) contrast(1.02);
}

#screen-camera .camera-ambient {
  mix-blend-mode: screen;
}

@media (prefers-reduced-transparency: reduce) {
  #screen-home .btn-action {
    background: rgba(240, 252, 255, 0.98);
  }
}

/* ----------------------------------------------------------
   Cinematic editorial direction, inspired by David Whyte's
   immersive poetry experience. The generated gradient remains vivid.
   ---------------------------------------------------------- */
:root {
  --bg: #171713;
  --surface: rgba(238, 231, 214, 0.075);
  --surface-hover: rgba(238, 231, 214, 0.13);
  --glass: rgba(238, 231, 214, 0.1);
  --accent: linear-gradient(125deg, #b59868 0%, #8c9a76 100%);
  --accent-start: #d5c39b;
  --accent-end: #a7b096;
  --text-primary: #eee8dc;
  --text-secondary: rgba(238, 232, 220, 0.65);
  --border: rgba(238, 231, 214, 0.16);
}

body {
  color: #eee8dc;
  background: #171713;
}

#app {
  background:
    radial-gradient(ellipse at 50% 7%, rgba(124, 104, 70, 0.23), transparent 34%),
    radial-gradient(ellipse at 13% 67%, rgba(66, 84, 66, 0.17), transparent 38%),
    radial-gradient(ellipse at 93% 92%, rgba(143, 111, 68, 0.13), transparent 33%),
    linear-gradient(158deg, #1c1b16 0%, #171713 52%, #191a15 100%);
}

#screen-home,
#screen-editor,
#screen-gradient,
#screen-export {
  color: #eee8dc;
  background: transparent;
}

#screen-home .home-content {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 17%, rgba(132, 110, 75, 0.24), transparent 39%),
    radial-gradient(ellipse at 16% 72%, rgba(63, 79, 61, 0.18), transparent 39%),
    radial-gradient(ellipse at 88% 88%, rgba(139, 105, 65, 0.14), transparent 36%),
    linear-gradient(160deg, #201e18 0%, #171713 54%, #1b1b16 100%);
}

#screen-home .home-content::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto -18% 8%;
  height: 34%;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(189, 158, 105, 0.16), transparent 70%);
  filter: blur(34px);
}

#screen-home .home-content::after {
  z-index: -1;
  opacity: 0.16;
}

#screen-home .home-hero {
  margin-bottom: 44px;
}

#screen-home .hero-gradient-bg {
  top: -45%;
  left: -42%;
  width: 184%;
  height: 190%;
  opacity: 0.68;
  filter: blur(38px);
  background:
    radial-gradient(ellipse at 42% 45%, rgba(179, 146, 91, 0.3), transparent 39%),
    radial-gradient(ellipse at 61% 51%, rgba(104, 126, 94, 0.22), transparent 37%),
    radial-gradient(ellipse at 51% 68%, rgba(170, 133, 82, 0.16), transparent 43%);
}

#screen-home .home-kicker {
  margin-bottom: 21px;
  color: rgba(213, 195, 155, 0.8);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
}

#screen-home h1 {
  color: #eee8dc;
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  font-size: clamp(48px, 13vw, 64px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.98;
  text-shadow: 0 4px 34px rgba(0, 0, 0, 0.32);
}

#screen-home h1 span {
  background: linear-gradient(105deg, #dfcb9f 2%, #c4b080 53%, #aab397 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

#screen-home .subtitle {
  margin-top: 22px;
  color: rgba(238, 232, 220, 0.68);
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0.01em;
}

#screen-home .btn-action,
.screen-header,
.mode-tabs,
.res-btn,
.format-btn,
.type-btn,
.val-badge,
.btn-secondary {
  color: #eee8dc;
  border-color: rgba(238, 231, 214, 0.15);
  background: linear-gradient(145deg, rgba(238, 231, 214, 0.105), rgba(238, 231, 214, 0.045));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 12px 30px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(22px) saturate(115%);
  -webkit-backdrop-filter: blur(22px) saturate(115%);
}

#screen-home .btn-action {
  border-radius: 18px;
  padding: 17px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 30px rgba(0, 0, 0, 0.17);
}

#screen-home .btn-action::before,
.btn-primary::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent);
}

#screen-home .btn-icon-wrap,
#screen-home .btn-icon-wrap.camera,
#screen-home .btn-action:first-child .btn-icon-wrap,
#screen-home .btn-action:nth-child(2) .btn-icon-wrap {
  color: #e1cfaa;
  border-color: rgba(221, 203, 164, 0.25);
  background: linear-gradient(145deg, rgba(180, 151, 103, 0.55), rgba(96, 111, 83, 0.56));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 6px 18px rgba(0, 0, 0, 0.16);
}

#screen-home .btn-text span {
  color: rgba(238, 232, 220, 0.57);
}

.screen-header {
  border-bottom-color: rgba(238, 231, 214, 0.1);
  background: rgba(25, 24, 19, 0.68);
}

.screen-header h2,
.control-row label,
.control-group label {
  color: #eee8dc;
}

.btn-nav {
  color: #c9b487;
}

.photo-container,
.gradient-preview-wrap,
.export-preview {
  border-color: rgba(238, 231, 214, 0.2);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.mode-tab {
  color: rgba(238, 232, 220, 0.54);
}

.mode-tab.active {
  color: #f2ead8;
  border: 1px solid rgba(218, 199, 157, 0.2);
  background: linear-gradient(135deg, rgba(174, 145, 94, 0.26), rgba(105, 125, 92, 0.2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 5px 16px rgba(0, 0, 0, 0.16);
}

.panel-hint,
.palette-section h3,
.export-options h3 {
  color: rgba(238, 232, 220, 0.55);
}

.palette-section,
.gradient-controls {
  border-color: rgba(238, 231, 214, 0.1);
  background: rgba(238, 231, 214, 0.035);
}

.control-group {
  border-color: rgba(238, 231, 214, 0.08);
  background: rgba(238, 231, 214, 0.035);
}

.val-badge {
  color: #e0d0ab;
}

.type-btn,
.res-btn,
.format-btn {
  color: rgba(238, 232, 220, 0.74);
}

.type-btn.active,
.res-btn.active,
.format-btn.active {
  color: #f1e8d5;
  border-color: rgba(204, 178, 126, 0.6);
  background: linear-gradient(145deg, rgba(164, 135, 86, 0.24), rgba(87, 105, 75, 0.18));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 7px 22px rgba(0, 0, 0, 0.14);
}

.res-size,
.format-btn {
  color: rgba(238, 232, 220, 0.55);
}

.btn-primary {
  color: #171713;
  border: 1px solid rgba(231, 214, 174, 0.52);
  background: linear-gradient(115deg, #d0b77e 0%, #bba16f 55%, #a8b093 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.44), 0 12px 30px rgba(0, 0, 0, 0.22);
  text-shadow: none;
}

.btn-secondary {
  border-color: rgba(238, 231, 214, 0.15);
}

.btn-round {
  color: #f1eadc;
  border-color: rgba(238, 231, 214, 0.28);
  background: rgba(28, 27, 22, 0.58);
}

.loading {
  color: #eee8dc;
  background: rgba(20, 19, 16, 0.78);
}

.toast {
  color: #eee8dc;
  border-color: rgba(238, 231, 214, 0.18);
  background: rgba(38, 36, 29, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 36px rgba(0, 0, 0, 0.28);
}

input[type="range"] {
  accent-color: #c5ab77;
}

#screen-camera {
  --camera-ambient-color: #7c805e;
  background:
    radial-gradient(ellipse at 24% 20%, var(--camera-ambient-color), transparent 60%),
    #191a15;
}

#screen-camera #camera-feed {
  opacity: 0.92;
  filter: saturate(0.78) contrast(1.04);
}

#screen-camera .camera-ambient {
  mix-blend-mode: soft-light;
}

button:focus-visible,
[role="button"]:focus-visible {
  outline-color: #d9c28f;
}

@media (max-width: 360px) {
  #screen-home h1 {
    font-size: 46px;
  }
  #screen-home .home-actions {
    gap: 12px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  #screen-home .btn-action,
  .screen-header,
  .mode-tabs,
  .res-btn,
  .format-btn,
  .type-btn,
  .val-badge,
  .btn-secondary {
    background: rgba(36, 34, 27, 0.97);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
