:root {
  --ink-950: #0b1f1c;
  --ink-800: #163a34;
  --ink-600: #2a5c52;
  --ink-400: #5a8a7e;
  --ink-200: #b7d0c8;
  --ink-50: #f3f7f5;
  --tide: #1f8a70;
  --tide-soft: rgba(31, 138, 112, 0.14);
  --surface: rgba(255, 255, 255, 0.72);
  --line: rgba(22, 58, 52, 0.12);
  --shadow-soft: 0 18px 50px rgba(11, 31, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--ink-50);
  color: var(--ink-950);
  overflow-x: hidden;
}

/* Atmospheric wash — soft photo-lab light, not flat */
.atmosphere {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 700px at 8% -10%, rgba(43, 168, 138, 0.22), transparent 55%),
    radial-gradient(900px 600px at 92% 8%, rgba(120, 160, 190, 0.18), transparent 50%),
    radial-gradient(700px 500px at 50% 110%, rgba(31, 138, 112, 0.12), transparent 55%),
    linear-gradient(180deg, #eef5f2 0%, #f3f7f5 42%, #e8f0ec 100%);
}

.atmosphere::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.font-800 {
  font-weight: 800;
}

.view {
  display: none;
  opacity: 0;
  transform: translateY(10px);
}

.view.is-visible {
  display: block;
  animation: rise-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-stage {
  position: relative;
  padding-top: 0.5rem;
}

.hero-stage::before {
  content: '';
  position: absolute;
  left: -12%;
  top: -18%;
  width: 70%;
  height: 120%;
  z-index: -1;
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.09), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='500' viewBox='0 0 800 500'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop stop-color='%231f8a70' stop-opacity='0.15'/%3E%3Cstop offset='1' stop-color='%235a8a7e' stop-opacity='0.02'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='800' height='500' fill='url(%23g)'/%3E%3Cpath d='M0 320 C120 260 180 400 320 340 C460 280 520 180 680 220 C760 240 800 280 800 280 L800 500 L0 500 Z' fill='%23163a34' fill-opacity='0.05'/%3E%3C/svg%3E")
      center / cover no-repeat;
  border-radius: 0;
  opacity: 1;
}

.tab-btn {
  border: 0;
  background: transparent;
  color: var(--ink-400);
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  position: relative;
  transition: color 0.2s ease;
}

.tab-btn:hover {
  color: var(--ink-800);
}

.tab-btn.is-active {
  color: var(--ink-950);
}

.tab-btn.is-active::after {
  content: '';
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.15rem;
  height: 2px;
  background: var(--tide);
  transform-origin: left center;
  animation: underline-in 0.35s ease forwards;
}

@keyframes underline-in {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.dropzone {
  position: relative;
  display: block;
  width: 100%;
  max-width: 40rem;
  cursor: pointer;
  border: 1.5px dashed rgba(22, 58, 52, 0.28);
  background: var(--surface);
  backdrop-filter: blur(10px);
  padding: 2.25rem 1.75rem;
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    transform 0.25s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  outline: none;
  border-color: var(--tide);
  background: rgba(255, 255, 255, 0.88);
}

.dropzone.is-dragover {
  border-color: var(--tide);
  border-style: solid;
  background: rgba(31, 138, 112, 0.08);
  transform: translateY(-2px);
}

.dropzone-ring {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(31, 138, 112, 0.12), transparent 70%);
  background-size: 200% 100%;
}

.dropzone.is-dragover .dropzone-ring,
.dropzone.is-busy .dropzone-ring {
  opacity: 1;
  animation: sheen 1.4s linear infinite;
}

@keyframes sheen {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.kbd {
  display: inline-block;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-600);
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
}

.btn-primary,
.btn-ghost,
.copy-btn,
.delete-btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}

.btn-primary {
  background: var(--ink-950);
  color: #f7fbf9;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
}

.btn-primary:hover {
  background: var(--ink-800);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-800);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
}

.btn-ghost:hover {
  border-color: var(--ink-400);
  background: rgba(255, 255, 255, 0.55);
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-950);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.75rem 0.9rem;
}

.field:focus {
  outline: 2px solid var(--tide-soft);
  border-color: var(--tide);
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(22, 58, 52, 0.06);
  padding: 0.1em 0.35em;
}

/* Result rows — interaction containers, not marketing cards */
.result-item {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
  animation: rise-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 720px) {
  .result-item {
    grid-template-columns: 160px 1fr;
    gap: 1.5rem;
    align-items: start;
  }
}

.result-thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: rgba(22, 58, 52, 0.06);
  display: block;
}

.result-links {
  display: grid;
  gap: 0.65rem;
}

.link-row {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.link-row label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-400);
}

.link-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-800);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.55rem 0.65rem;
}

.copy-btn {
  background: var(--tide-soft);
  color: var(--tide);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  white-space: nowrap;
}

.copy-btn:hover,
.copy-btn.is-copied {
  background: var(--tide);
  color: #fff;
}

.progress-bar {
  height: 3px;
  width: 100%;
  max-width: 40rem;
  background: rgba(22, 58, 52, 0.08);
  overflow: hidden;
}

.progress-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--tide);
  transition: width 0.25s ease;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 960px) {
  .gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.gallery-item {
  position: relative;
  background: transparent;
  animation: rise-in 0.4s ease both;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  background: rgba(22, 58, 52, 0.06);
  transition: transform 0.35s ease;
}

.gallery-item:hover img {
  transform: scale(1.02);
}

.gallery-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.gallery-actions .copy-btn,
.gallery-actions .delete-btn {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  padding: 0.45rem 0.35rem;
}

.delete-btn {
  background: transparent;
  border: 1px solid rgba(140, 50, 40, 0.25);
  color: #8c3228;
}

.delete-btn:hover {
  background: rgba(140, 50, 40, 0.08);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(11, 31, 28, 0.35);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

.overlay[hidden] {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.settings-panel {
  width: min(100%, 26rem);
  background: #f7fbf9;
  border: 1px solid var(--line);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  animation: rise-in 0.3s ease;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 60;
  transform: translateX(-50%) translateY(0);
  background: var(--ink-950);
  color: #f3f7f5;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.7rem 1.1rem;
  box-shadow: var(--shadow-soft);
  animation: toast-in 0.3s ease;
}

.toast[hidden] {
  display: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

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