* { box-sizing: border-box; }

body {
  margin: 0;
  background: #fff;
  color: #1a1a1a;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

#handle {
  width: 220px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

/* --- account typeahead --- */
.ta-anchor { position: relative; display: inline-block; }

.ta-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 280px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  z-index: 50;
}
.ta-list.open { display: block; }

.ta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.ta-item.active { background: #f0f0f0; }

.ta-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5e5e5;
  object-fit: cover;
  flex-shrink: 0;
}

.ta-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.ta-handle { color: #888; }

.max-label { font-size: 12px; color: #666; }
#max-images { width: 60px; padding: 5px 6px; border: 1px solid #ccc; border-radius: 4px; }

button {
  padding: 6px 14px;
  border: 1px solid #1a1a1a;
  border-radius: 4px;
  background: #1a1a1a;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: default; }
button.ghost { background: #fff; color: #1a1a1a; }

.readouts { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: #666; }
#stats { font-variant-numeric: tabular-nums; }

main { padding: 24px; }

/* --- scrapbook field: absolutely-positioned pieces, organic scatter --- */
#field {
  position: relative;
  min-height: 200px;
}

.piece {
  position: absolute;
  display: block;
  transform: rotate(var(--rot, 0deg));
  /* left/top animate so the end-of-run settle pass visibly shuffles the
     sheet tight; fresh pieces get left/top before insertion, so they don't
     slide in from the corner. */
  transition: transform 0.18s ease, left 0.7s ease, top 0.7s ease;
  animation: drop-in 0.35s ease-out backwards;
}
.piece img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.18));
}
.piece:hover {
  transform: rotate(var(--rot, 0deg)) scale(1.12);
  z-index: 100 !important;
}

@keyframes drop-in {
  from { opacity: 0; transform: rotate(var(--rot, 0deg)) scale(0.5); }
  to   { opacity: 1; transform: rotate(var(--rot, 0deg)) scale(1); }
}

/* --- reject drawer keeps a flat flow layout --- */
#reject-field {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.cutout {
  display: block;
  height: auto;
  transition: transform 0.15s;
}
.cutout:hover { transform: scale(1.12); position: relative; z-index: 5; }

#reject-panel {
  display: none;
  margin-top: 32px;
  border-top: 2px dashed #d33;
  padding-top: 12px;
}
#reject-panel.open { display: block; }
#reject-panel h2 { font-size: 14px; color: #d33; }
#reject-panel .hint { font-weight: normal; color: #999; }
#reject-field { background: #f6eaea; border-radius: 8px; padding: 12px; }
#reject-field .cutout { opacity: 0.75; }
