:root {
  --ink: #14201a;
  --ink-soft: #2a3b32;
  --paper: #e8efe6;
  --paper-2: #d5e2d4;
  --leaf: #1f7a4c;
  --leaf-deep: #145a38;
  --accent: #0e5f7a;
  --line: rgba(20, 32, 26, 0.14);
  --shadow: 0 18px 50px rgba(20, 32, 26, 0.12);
  --radius: 14px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #b8d4c4 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #f0d5c4 0%, transparent 50%),
    linear-gradient(165deg, #f4f7f2 0%, var(--paper) 45%, #dce8dc 100%);
  line-height: 1.5;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.05;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.top,
main,
footer {
  position: relative;
  z-index: 1;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  max-width: 960px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--leaf) 0%, #0e5f7a 100%);
  box-shadow: 0 0 0 3px rgba(31, 122, 76, 0.18);
  animation: pulse 3.2s ease-in-out infinite;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem) 4rem;
}

.hero {
  min-height: min(68vh, 560px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 0 3rem;
  animation: rise 0.7s ease-out both;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  letter-spacing: -0.035em;
  line-height: 1.05;
  color: var(--ink);
}

.lede {
  max-width: 34rem;
  margin: 0 0 1.75rem;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  color: var(--ink-soft);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background: var(--leaf);
  color: #f4faf6;
  box-shadow: 0 10px 28px rgba(31, 122, 76, 0.28);
}

.btn.primary:hover {
  background: var(--leaf-deep);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.wide {
  width: 100%;
  margin-top: 0.5rem;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.hint {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.8;
}

.workspace {
  animation: rise 0.45s ease-out both;
}

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}

.file-name {
  font-weight: 600;
  word-break: break-all;
}

.linkish {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.panel,
.results {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.options {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  animation: open 0.28s ease-out both;
}

@media (min-width: 720px) {
  .options {
    grid-template-columns: 1fr 1fr;
  }
}

fieldset {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(232, 239, 230, 0.45);
}

legend {
  padding: 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
  font-size: 0.95rem;
  cursor: pointer;
}

.status {
  min-height: 1.4em;
  margin: 0.85rem 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.results {
  margin-top: 1.25rem;
  animation: rise 0.4s ease-out both;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 0.88rem;
  font-weight: 600;
}

.actions {
  margin-bottom: 1rem;
}

.file-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.file-list a {
  color: var(--leaf-deep);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.file-list a:hover {
  border-bottom-color: currentColor;
}

.preview-block h2 {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.preview-card {
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  background: #f7faf6;
  border: 1px solid var(--line);
  overflow-x: auto;
}

.preview-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.preview-card th,
.preview-card td {
  border-bottom: 1px solid var(--line);
  padding: 0.35rem 0.45rem;
  text-align: left;
  white-space: nowrap;
}

.preview-card th {
  font-weight: 700;
  color: var(--ink-soft);
}

.warnings {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--accent);
  font-size: 0.9rem;
}

footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem) 2rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  opacity: 0.8;
}

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

@keyframes open {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(31, 122, 76, 0.18);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(14, 95, 122, 0.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
