:root{
  --paper:#f6f1e7;
  --paper2:#efe7d6;
  --ink:#2b2b2b;
  --gold:#c29a3b;
  --gold-d:#a07e26;
  --red:#b51f1f;
  --red-d:#8d1414;
  --line:#e0d6bf;
  --shadow:0 8px 28px rgba(70,50,10,.12);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--ink);
  background:var(--paper);
  background-image:radial-gradient(circle at 20% 10%,#fffdf8 0,transparent 45%),
                   radial-gradient(circle at 90% 90%,#fff 0,transparent 40%);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}

.wrap{max-width:760px;margin:0 auto;padding:0 16px 48px;
  padding-bottom:calc(48px + env(safe-area-inset-bottom))}

/* ---- HERO ---- */
.hero{text-align:center;padding:18px 0 6px}
.hero-img{
  width:100%;max-width:360px;height:auto;border-radius:14px;
  box-shadow:var(--shadow);border:1px solid var(--line);
}

/* ---- CARD ---- */
.card{
  background:#fffdf8;
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:24px 20px;
  margin-top:18px;
}

h1{
  font-family:Georgia,"Times New Roman",serif;
  font-size:1.6rem;line-height:1.2;margin:.1em 0 .4em;color:var(--red);
  font-weight:700;
}
h2{font-family:Georgia,serif}
.lead{margin:.2em 0 1.2em;color:#5a5040}
.note{font-size:.82rem;color:#8a7f6a;margin-top:14px}
.tiny{font-size:.78rem;color:#9a8f78}

/* ---- FORM ---- */
.upload-form{display:flex;flex-direction:column;gap:14px}
.field span{display:block;font-size:.9rem;margin-bottom:6px;color:#5a5040;font-weight:600}
.field input{
  width:100%;padding:14px 14px;font-size:1rem;border:1px solid var(--line);
  border-radius:12px;background:#fff;color:var(--ink);
}
.field input:focus{outline:none;border-color:var(--gold);box-shadow:0 0 0 3px rgba(194,154,59,.18)}

.dropzone{
  position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:8px;text-align:center;
  border:2px dashed var(--gold);border-radius:16px;
  background:linear-gradient(#fffef9,#f9f3e6);
  padding:30px 16px;cursor:pointer;color:#6a5f48;transition:.15s;
}
.dropzone:active{transform:scale(.99)}
.dropzone.has-files{border-style:solid;border-color:var(--red);background:#fdf3f1}
.dropzone input[type=file]{position:absolute;inset:0;opacity:0;cursor:pointer}
.dz-icon{font-size:2.2rem;line-height:1;color:var(--gold-d)}
.dz-text{font-size:1.02rem;font-weight:600;color:#4a4030}
.dz-text small{font-weight:400;color:#8a7f6a}
.dz-count{font-size:.9rem;color:var(--red);font-weight:700}

.btn{
  appearance:none;border:none;cursor:pointer;
  background:linear-gradient(180deg,var(--red),var(--red-d));
  color:#fff;font-size:1.08rem;font-weight:700;
  padding:15px 18px;border-radius:14px;
  box-shadow:0 6px 16px rgba(141,20,20,.28);
  transition:.12s;
}
.btn:active{transform:translateY(1px)}

.btn-sm{
  display:inline-block;text-decoration:none;background:#fff;border:1px solid var(--line);
  color:var(--red);padding:8px 14px;border-radius:10px;font-weight:600;font-size:.9rem;
}

/* ---- ALERTS ---- */
.alert{padding:12px 14px;border-radius:12px;margin-bottom:14px;font-size:.95rem}
.alert.ok{background:#eef7ec;border:1px solid #cfe8c8;color:#2f6b2a}
.alert.err{background:#fceeee;border:1px solid #f0cccc;color:#9d2020}

/* ---- GALLERY ---- */
.gallery-title{font-size:1.15rem;margin:24px 0 12px;color:#4a4030;display:flex;align-items:center;gap:8px}
.badge{background:var(--gold);color:#fff;font-size:.78rem;font-weight:700;
  padding:2px 9px;border-radius:20px}
.gallery{
  display:grid;grid-template-columns:repeat(3,1fr);gap:8px;
}
.thumb{display:block;aspect-ratio:1/1;border-radius:10px;overflow:hidden;
  background:#eee;border:1px solid var(--line)}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.empty{color:#8a7f6a;text-align:center;padding:18px}

.uploader-block{border-top:1px solid var(--line);padding-top:8px;margin-top:8px}
.admin-head{display:flex;justify-content:space-between;align-items:center;gap:10px}

/* ---- OVERLAY UPLOAD ---- */
.overlay{
  position:fixed;inset:0;z-index:1000;
  display:none;align-items:center;justify-content:center;padding:24px;
  background:rgba(43,38,28,.55);backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
}
.overlay.show{display:flex;animation:fade .2s ease}
@keyframes fade{from{opacity:0}to{opacity:1}}
.overlay-card{
  background:#fffdf8;border:1px solid var(--line);border-radius:20px;
  box-shadow:var(--shadow);padding:30px 26px;width:100%;max-width:340px;text-align:center;
}
.spinner{
  width:54px;height:54px;margin:0 auto 18px;border-radius:50%;
  border:5px solid #f0e6cf;border-top-color:var(--red);
  animation:spin 1s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.ov-status{font-weight:700;color:#4a4030;margin:0 0 14px;font-size:1.05rem}
.progress{
  height:14px;border-radius:10px;background:#f0e6cf;overflow:hidden;border:1px solid var(--line);
}
.progress-bar{
  height:100%;width:0;border-radius:10px;
  background:linear-gradient(90deg,var(--gold),var(--red));
  transition:width .25s ease;
}
.ov-pct{font-weight:700;color:var(--red);margin:10px 0 2px;font-size:1.1rem;min-height:1.1rem}
.ov-hint{font-size:.82rem;color:#8a7f6a;margin:6px 0 0}

.shake{animation:shake .4s}
@keyframes shake{
  0%,100%{transform:translateX(0)}
  20%,60%{transform:translateX(-7px)}
  40%,80%{transform:translateX(7px)}
}
.btn[disabled]{opacity:.6;pointer-events:none}

/* ---- FOOTER ---- */
.foot{text-align:center;margin-top:22px;color:#7a6f58}
.foot p{margin:4px 0}

@media(min-width:520px){
  h1{font-size:1.9rem}
  .gallery{grid-template-columns:repeat(4,1fr)}
}
