:root {
  color-scheme: light;
  --background: 214 45% 98%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;
  --radius: 0.45rem;
  font-family: "Inter", "Space Grotesk", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

.dark {
  color-scheme: dark;
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --popover: 222.2 84% 4.9%;
  --popover-foreground: 210 40% 98%;
  --primary: 217.2 91.2% 59.8%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --secondary: 217.2 32.6% 17.5%;
  --secondary-foreground: 210 40% 98%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --accent: 217.2 32.6% 17.5%;
  --accent-foreground: 210 40% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 40% 98%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
  --ring: 224.3 76.3% 48%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: inherit;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Smooth topbar collapse/expand on scroll */
#topbar {
  transform: translateY(0);
  opacity: 1;
  will-change: transform, opacity;
  transition:
    transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 200ms ease;
}

#topbar > div {
  will-change: transform, opacity;
  transition:
    transform 280ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 160ms ease;
}

#topbar.is-collapsed {
  transform: translateY(calc(-100% - 12px));
  opacity: 0;
  pointer-events: none;
  border-bottom-color: transparent !important;
  height: 0;
  overflow: hidden;
}

#topbar.is-collapsed > div {
  transform: translateY(-8px);
  opacity: 0;
}

#root {
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

.page-shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 16px 96px;
}

:root {
  --collection-tabs-offset: calc(var(--topbar-expanded-height, 72px) + 10px);
}

.topbar-collapsed {
  --collection-tabs-offset: 0px;
}

@media (min-width: 1024px) {
  .page-shell {
    padding: 40px 24px 120px;
  }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: hsl(var(--muted-foreground) / 0.3);
  border-radius: 999px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.modal-panel {
  background-color: hsl(var(--card));
}

.language-dropdown {
  backdrop-filter: blur(12px);
}

.dark .language-dropdown {
  background-color: hsl(var(--card) / 0.95);
  color: hsl(var(--foreground));
  border-color: hsl(var(--border) / 0.5);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.55);
}

.dark .language-dropdown__label {
  color: hsl(var(--muted-foreground));
}

.language-dropdown__option {
  text-decoration: none;
}

.dark .language-dropdown__option {
  color: hsl(var(--foreground));
}

.dark .language-dropdown__option.is-active {
  background-color: hsl(var(--primary) / 0.18);
  color: hsl(var(--foreground));
}

.dark .language-dropdown__option:not(.is-active) {
  color: hsl(var(--muted-foreground));
}

.dark .language-dropdown__option:not(.is-active):is(:hover, :focus-visible) {
  background-color: hsl(var(--muted) / 0.4);
  color: hsl(var(--foreground));
}

.prompt-input {
  --home-prompt-shadow: 0 15px 40px rgba(15, 23, 41, 0.08);
  scrollbar-width: none;
  overflow: hidden;
  overscroll-behavior: contain;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.prompt-input::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.prompt-input:focus,
.prompt-input:focus-visible {
  --home-prompt-shadow:
    0 0 0 2px rgba(159, 178, 216, 0.8),
    0 0 0 12px rgba(228, 235, 248, 0.55),
    0 18px 48px rgba(159, 178, 216, 0.12),
    0 30px 90px rgba(12, 18, 33, 0.08);
  border-color: #9fb2d8;
  box-shadow:
    0 0 0 2px rgba(159, 178, 216, 0.8),
    0 0 0 12px rgba(228, 235, 248, 0.55),
    0 18px 48px rgba(159, 178, 216, 0.12),
    0 30px 90px rgba(12, 18, 33, 0.08);
}

.dark .prompt-input:focus,
.dark .prompt-input:focus-visible {
  --home-prompt-shadow:
    0 0 0 2px hsl(var(--ring) / 0.8),
    0 0 0 12px hsl(var(--primary) / 0.2),
    0 18px 48px hsl(var(--primary) / 0.18),
    0 30px 90px hsl(var(--foreground) / 0.08);
  border-color: hsl(var(--ring));
  box-shadow:
    0 0 0 2px hsl(var(--ring) / 0.8),
    0 0 0 12px hsl(var(--primary) / 0.2),
    0 18px 48px hsl(var(--primary) / 0.18),
    0 30px 90px hsl(var(--foreground) / 0.08);
}

.click-press {
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.click-press:active {
  transform: translateY(1px) scale(0.995);
  box-shadow:
    0 4px 10px rgba(17, 24, 39, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.5) inset;
  filter: brightness(0.98);
}

.font-hero {
  font-family: "Plus Jakarta Sans", "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
  font-weight: 800;
}

.hero-section {
  background-color: transparent;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.hero-description {
  transition: color 0.2s ease;
}

.home-prompt-input {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    height 280ms cubic-bezier(0.16, 1, 0.3, 1),
    padding 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.home-prompt-dock {
  position: static;
  top: auto;
  z-index: auto;
  padding: 0;
}

.home-prompt-dock__inner {
  width: 100%;
}

.home-prompt-input {
  height: 12rem;
  padding-top: 2rem;
  padding-bottom: 6rem;
}

.home-prompt-dock .home-prompt-controls {
  left: 2rem;
  right: 2rem;
  bottom: 2rem;
}

.home-hero-wrapper {
  display: block;
  gap: 0;
}

@media (max-height: 880px) {
  .home-prompt-input {
    height: 10.5rem;
    padding-top: 1.75rem;
    padding-bottom: 4.5rem;
  }

  .home-prompt-dock .home-prompt-controls {
    bottom: 1.75rem;
  }
}

@media (max-height: 760px) {
  .home-prompt-input {
    height: 9rem;
    padding-top: 1.5rem;
    padding-bottom: 4rem;
  }

  .home-prompt-dock .home-prompt-controls {
    bottom: 1.5rem;
  }
}

@keyframes home-prompt-dock-in {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes home-prompt-dock-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-12px); }
}

/* dock-in / dock-out animations no longer used */

@keyframes prompt-fill-glow {
  0% {
    box-shadow: var(--home-prompt-shadow);
  }
  50% {
    box-shadow:
      var(--home-prompt-shadow),
      0 0 0 2px rgba(42, 79, 140, 0.22),
      0 10px 26px rgba(42, 79, 140, 0.10);
  }
  100% {
    box-shadow: var(--home-prompt-shadow);
  }
}

@keyframes prompt-fill-glow-strong {
  0% {
    box-shadow: var(--home-prompt-shadow);
    transform: translateZ(0);
  }
  40% {
    box-shadow:
      var(--home-prompt-shadow),
      0 0 0 4px rgba(42, 79, 140, 0.28),
      0 0 0 16px rgba(42, 79, 140, 0.14),
      0 16px 34px rgba(42, 79, 140, 0.16);
  }
  100% {
    box-shadow: var(--home-prompt-shadow);
  }
}

@keyframes prompt-fill-glow-dark {
  0% {
    box-shadow: var(--home-prompt-shadow);
  }
  50% {
    box-shadow:
      var(--home-prompt-shadow),
      0 0 0 2px rgba(120, 162, 255, 0.20),
      0 10px 26px rgba(0, 0, 0, 0.28);
  }
  100% {
    box-shadow: var(--home-prompt-shadow);
  }
}

@keyframes prompt-fill-glow-strong-dark {
  0% {
    box-shadow: var(--home-prompt-shadow);
    transform: translateZ(0);
  }
  40% {
    box-shadow:
      var(--home-prompt-shadow),
      0 0 0 4px rgba(120, 162, 255, 0.28),
      0 0 0 16px rgba(120, 162, 255, 0.16),
      0 16px 34px rgba(0, 0, 0, 0.22);
  }
  100% {
    box-shadow: var(--home-prompt-shadow);
  }
}

.home-prompt-dock.is-fill-animating .home-prompt-input {
  animation: prompt-fill-glow 360ms ease-out;
}

.home-prompt-dock.is-fill-animating-strong .home-prompt-input {
  animation: prompt-fill-glow-strong 520ms ease-out;
}

.dark .home-prompt-dock.is-fill-animating .home-prompt-input {
  animation-name: prompt-fill-glow-dark;
}

.dark .home-prompt-dock.is-fill-animating-strong .home-prompt-input {
  animation-name: prompt-fill-glow-strong-dark;
}

.gen-result-thumb {
  width: 100%;
  max-width: 25%;
}

@media (max-width: 640px) {
  .gen-result-thumb {
    max-width: 100%;
  }
}

.reference-upload {
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.aspect-select-grid {
  background: #edeff3;
}

.aspect-option {
  border: 1px solid transparent;
}

.aspect-option-active {
  background: #fefefe;
  border-color: hsl(var(--primary) / 0.5);
  box-shadow:
    0 10px 25px rgba(34, 64, 117, 0.2),
    0 0 0 1px rgba(15, 23, 42, 0.05);
}

.dark .aspect-select-grid {
  background: rgba(255, 255, 255, 0.05);
}

.dark .aspect-option {
  border-color: rgba(255, 255, 255, 0.08);
}

.dark .aspect-option-active {
  background: rgba(255, 255, 255, 0.05);
  border-color: hsl(var(--primary));
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.05);
}

.aspect-option .aspect-visual {
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.aspect-option-active .aspect-visual {
  transform: translateY(1px);
  border-color: rgba(49, 71, 127, 0.5);
}

.dark .aspect-option .aspect-visual {
  border-color: rgba(255, 255, 255, 0.12);
}

.dark .aspect-option-active .aspect-visual {
  border-color: rgba(120, 162, 255, 0.5);
}

.dark .hero-section {
  background-color: #040816;
  color: #f4f6ff;
}

.dark .hero-description {
  color: #f8f9ff;
}

.dark .home-prompt-input {
  background-color: #11182d;
  border-color: #3f4a75;
  color: #f4f6ff;
  --home-prompt-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.dark .home-prompt-input::placeholder {
  color: #c9d0ee;
}

.dark .reference-upload {
  background-color: #111b33;
  border-color: #3f4a75;
  color: #cdd6ff;
}

.dark .reference-upload span,
.dark .reference-upload button {
  color: inherit;
}

/* Slightly tighten global radii */
.rounded-xl { border-radius: 0.55rem !important; }
.rounded-2xl { border-radius: 0.8rem !important; }
.rounded-3xl { border-radius: 1rem !important; }
