:root {
  --ink: #111;
  --muted: #8a8a8f;
  --line: #e2e2e6;
  --bg: #f5f5f7;
  --accent: #111;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.create {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  text-align: center;
}
header { margin-bottom: 36px; }
.wordmark { font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
h1 { font-size: clamp(28px, 6vw, 44px); letter-spacing: -0.02em; margin: 0 0 8px; }
.tag { color: var(--muted); margin: 0 0 28px; font-size: 16px; }

.dropzone {
  position: relative;
  min-height: 240px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.dropzone:hover { border-color: #c9c9cf; }
.dropzone:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.12); }
.dropzone.drag { border-color: var(--accent); background: #fafafa; transform: scale(1.005); }

/* The hidden attribute must win over the display rules below. */
.dz-empty[hidden], .dz-preview[hidden] { display: none; }

.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; color: var(--muted); }
.dz-arrow {
  width: 52px; height: 52px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; line-height: 1; border-radius: 50%;
  background: var(--bg); color: var(--ink);
}
.dz-title { font-size: 18px; font-weight: 700; color: var(--ink); margin: 0; }
.dz-sub { font-size: 13px; margin: 0; }

.dz-preview { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; width: 100%; }
.pk {
  position: relative; margin: 0;
  aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line);
}
.pk img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk:not(.filled) img { display: none; }
.pk .badge {
  position: absolute; top: 8px; left: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
  background: rgba(255, 255, 255, 0.94); color: #111;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.pk-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
  border: 2px dashed var(--line); border-radius: 12px;
}
.pk.filled .pk-empty { display: none; }
.swap {
  width: 40px; height: 40px; border-radius: 50%;
  font: inherit; font-size: 18px; line-height: 1;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  cursor: pointer; transition: transform 0.2s, border-color 0.15s;
}
.swap:hover:not(:disabled) { border-color: var(--accent); transform: rotate(180deg); }
.swap:disabled { opacity: 0.3; cursor: not-allowed; }

.dz-status { font-size: 13px; color: var(--muted); margin-top: 12px; }

#create {
  margin-top: 24px;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  padding: 14px 32px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
}
#create:disabled { opacity: 0.35; cursor: not-allowed; }
#create:not(:disabled):active { transform: translateY(1px); }
.limits { color: var(--muted); font-size: 13px; margin-top: 14px; }

#result {
  margin-top: 36px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: left;
}
.done { font-weight: 700; margin: 0 0 14px; }
.linkrow { display: flex; gap: 8px; }
.linkrow input {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
}
.linkrow button,
.extras button {
  font: inherit;
  font-weight: 600;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.linkrow button { background: var(--accent); color: #fff; border-color: var(--accent); }
.extras { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.sharecard { margin: 16px 0 0; text-align: center; }
.sharecard img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.sharecard #download {
  font: inherit; font-weight: 600; margin-top: 10px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer;
}
.sharecard figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.admin { font-size: 13px; color: var(--muted); margin: 18px 0 0; }
.admin a { color: var(--ink); }
.actions { margin: 14px 0 0; font-size: 14px; }
.actions a { color: var(--ink); font-weight: 600; text-decoration: none; }
button.link {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}
.err { color: #c0322b; font-weight: 600; margin-top: 16px; }
