:root{
  --bg:#ffffff;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border: rgba(15, 23, 42, .10);
  --shadow: 0 18px 50px rgba(15,23,42,.08);
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color:var(--text);
}
.wrap{max-width:1200px;margin:0 auto;padding:26px 16px 80px}
.top h1{margin:0;font-size:26px;letter-spacing:.2px}
.sub{margin:6px 0 0;color:var(--muted)}
.card{
  margin-top:18px;
  padding:16px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow);
}
.row{display:flex;gap:10px;align-items:center;margin-top:10px}
input{
  flex:1;
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
}
button{
  padding:12px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  cursor:pointer;
}
button:hover{border-color: rgba(15,23,42,.22)}
.err{margin-top:10px;color:#b91c1c}
.hint{color:var(--muted);margin:10px 0 0;font-size:13px}

.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px;margin-top:18px}
.coll{
  display:flex;flex-direction:column;gap:12px;
  padding:14px;
  border-radius:16px;
  background:#fff;
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  text-align:left;
}
.coll .preview{
  width:100%;aspect-ratio:16/10;overflow:hidden;border-radius:14px;
  border:1px solid var(--border);
  background:#f1f5f9;
  display:flex;align-items:center;justify-content:center;
}
.coll img{width:100%;height:100%;object-fit:cover;display:block}
.coll h3{margin:0;font-size:18px}
.coll p{margin:0;color:var(--muted);font-size:13px}

.bar{display:flex;gap:12px;align-items:center;margin-top:18px}
#ctitle{margin:0;font-size:22px;font-weight:600}

/* Masonry / collage layout (variable sizes) */
.cards{
  column-count: 3;
  column-gap: 18px;
  margin-top: 18px;
}
@media (max-width: 980px){ .cards{column-count:2} }
@media (max-width: 640px){ .cards{column-count:1} }

.pcard{
  position:relative;
  border-radius:18px;
  overflow:hidden;
  border:1px solid var(--border);
  background:#fff;
  box-shadow:var(--shadow);
  margin:0 0 18px;
  break-inside: avoid;
}

/* Postcard itself: keep natural aspect ratio */
.pcard img.main{
  width:100%;
  height:auto;
  display:block;
}

/* Stamp overlay covers the whole postcard on hover/tap */
.pcard img.stamp{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  object-fit: contain;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(2px);
  padding: 18px;
  opacity:0;
  transition: opacity .12s ease;
}
.pcard:hover img.stamp,
.pcard.show-stamp img.stamp{
  opacity:1;
}

.foot{margin-top:48px;color:var(--muted)}
