:root {
  color-scheme: dark;
  --bg: #050609;
  --panel: #0b0d12;
  --line: rgba(255,255,255,.11);
  --muted: #8b909c;
  --cyan: #4de7ff;
  --violet: #8d65ff;
  --white: #f5f7fb;
}

* { box-sizing: border-box; }
html { background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  background:
    radial-gradient(circle at 15% 20%, rgba(77,231,255,.1), transparent 30rem),
    radial-gradient(circle at 88% 75%, rgba(141,101,255,.12), transparent 30rem),
    var(--bg);
  font-family: Inter, Arial, sans-serif;
}

button, input { font: inherit; }

.demo-nav {
  width: min(1240px, calc(100% - 3rem));
  min-height: 5rem;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .66rem;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.demo-nav a {
  display: flex;
  gap: .8rem;
  align-items: center;
  color: var(--white);
  text-decoration: none;
}

.demo-nav a span { color: var(--cyan); font-size: 1rem; }

main {
  width: min(1240px, calc(100% - 3rem));
  margin: auto;
  padding: 6rem 0;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, .55fr);
  gap: 4rem;
  align-items: end;
  margin-bottom: 4rem;
}

.eyebrow {
  margin: 0 0 2rem;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.eyebrow i {
  display: inline-block;
  width: .46rem;
  height: .46rem;
  margin-right: .6rem;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 1.2rem var(--cyan);
}

h1 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(3.6rem, 7.5vw, 7.8rem);
  font-weight: 400;
  line-height: .8;
  letter-spacing: -.065em;
}

h1 em { color: var(--cyan); font-weight: 400; }

.intro > p {
  margin: 0;
  color: var(--muted);
  font-size: .97rem;
  line-height: 1.85;
}

.tool {
  display: grid;
  grid-template-columns: minmax(20rem, .7fr) minmax(0, 1.3fr);
  min-height: 42rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.5rem;
  background: rgba(8, 10, 14, .86);
}

.controls {
  padding: clamp(1.25rem, 3vw, 2.6rem);
  border-right: 1px solid var(--line);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .7rem;
}

.control-grid label {
  position: relative;
  color: var(--muted);
  font-size: .64rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.control-grid input {
  width: 100%;
  margin-top: .65rem;
  padding: .85rem .8rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  outline: 0;
  color: var(--white);
  background: #090b10;
}

.control-grid input:focus { border-color: var(--cyan); }
.control-grid label small { position: absolute; right: .7rem; bottom: .92rem; color: var(--muted); }

.drop-zone {
  min-height: 19rem;
  margin-top: 2rem;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  border: 1px dashed rgba(77,231,255,.38);
  border-radius: 1rem;
  cursor: pointer;
  text-align: center;
  background: linear-gradient(145deg, rgba(77,231,255,.05), rgba(141,101,255,.05));
  transition: border-color .25s ease, transform .25s ease;
}

.drop-zone:hover { border-color: var(--cyan); transform: translateY(-2px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone__icon {
  width: 3.2rem;
  height: 3.2rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(77,231,255,.45);
  border-radius: 50%;
  color: var(--cyan);
  font-size: 1.5rem;
}
.drop-zone strong { font-size: .86rem; }
.drop-zone small { color: var(--muted); font-size: .68rem; }

.actions {
  margin-top: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

#status { color: var(--muted); font-size: .68rem; }

.actions button {
  padding: .85rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--cyan);
  border-radius: 999px;
  cursor: pointer;
  color: #031114;
  background: var(--cyan);
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.actions button:disabled { cursor: not-allowed; opacity: .35; }

.output { min-width: 0; padding: clamp(1rem, 2vw, 1.8rem); }

.output__head {
  display: flex;
  justify-content: space-between;
  padding: .3rem .15rem 1.2rem;
  color: var(--muted);
  font-size: .64rem;
  letter-spacing: .17em;
  text-transform: uppercase;
}

#count { color: var(--cyan); }

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

.preview figure {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background:
    linear-gradient(45deg, #151820 25%, transparent 25%),
    linear-gradient(-45deg, #151820 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #151820 75%),
    linear-gradient(-45deg, transparent 75%, #151820 75%),
    #0e1117;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.preview img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; image-rendering: pixelated; }
.preview figcaption { padding: .55rem .65rem; overflow: hidden; color: var(--muted); font-size: .59rem; text-overflow: ellipsis; white-space: nowrap; background: rgba(5,6,9,.82); }

.empty {
  min-height: 34rem;
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  border: 1px dashed var(--line);
  border-radius: 1rem;
  color: var(--muted);
  font-size: .76rem;
}

.empty img { width: 5rem; opacity: .45; image-rendering: pixelated; }

@media (max-width: 840px) {
  .demo-nav, main { width: min(100% - 2rem, 42rem); }
  .demo-nav > span { display: none; }
  main { padding: 3.5rem 0 6rem; }
  .intro { grid-template-columns: 1fr; gap: 1.5rem; }
  h1 { font-size: clamp(3.4rem, 16vw, 5.8rem); }
  .tool { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .control-grid { grid-template-columns: 1fr 1fr; }
  .control-grid label:last-child { grid-column: 1 / -1; }
  .drop-zone { min-height: 14rem; }
  .actions { align-items: stretch; flex-direction: column; }
  .actions button { justify-content: space-between; }
}
