:root {
  --ink: #20182d;
  --muted: #746c7d;
  --paper: #fffdf9;
  --purple: #6d3ed2;
  --purple-dark: #4f27a4;
  --coral: #ff6577;
  --yellow: #ffc857;
  --mint: #5fd5bc;
  --line: #e8e1ee;
  --danger: #b3263a;
  --shadow: 0 18px 50px rgba(41, 22, 67, .12);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #f6f1fb; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 200, 87, .34), transparent 28rem),
    radial-gradient(circle at 100% 18%, rgba(109, 62, 210, .19), transparent 34rem),
    linear-gradient(150deg, #fff9ef 0%, #f8f2ff 55%, #eefaf7 100%);
  font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--purple-dark); }
button, input, textarea { font: inherit; }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.site-header { padding: 22px 0 10px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 900; letter-spacing: -.03em; font-size: 1.15rem; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; color: white; background: var(--purple); border-radius: 13px 13px 18px 12px; transform: rotate(-3deg); box-shadow: 0 8px 22px rgba(109, 62, 210, .28); }
.brand-mark span { transform: rotate(3deg); font-size: 1.2rem; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.main { padding: 20px 0 56px; }
.card { background: rgba(255, 253, 249, .96); border: 1px solid rgba(232,225,238,.9); border-radius: 24px; box-shadow: var(--shadow); }
.upload-card { max-width: 680px; margin: 12px auto 0; overflow: hidden; }
.event-band { min-height: 158px; padding: 34px 30px 30px; color: white; background: linear-gradient(135deg, var(--purple-dark), var(--purple) 58%, #8a58e8); position: relative; isolation: isolate; overflow: hidden; }
.event-band::before, .event-band::after { content: ""; position: absolute; border-radius: 999px; z-index: -1; }
.event-band::before { width: 170px; height: 170px; right: -34px; top: -82px; border: 26px solid rgba(255,255,255,.12); }
.event-band::after { width: 95px; height: 95px; left: -35px; bottom: -65px; background: var(--coral); opacity: .8; }
.eyebrow { margin: 0 0 6px; font-size: .83rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(2rem, 8vw, 3.65rem); line-height: .98; letter-spacing: -.06em; }
.event-date { display: inline-flex; margin-top: 16px; padding: 7px 11px; border: 1px solid rgba(255,255,255,.27); border-radius: 999px; background: rgba(255,255,255,.1); font-weight: 750; }
.upload-body { padding: 26px 26px 30px; }
.welcome { margin: 0 0 22px; font-size: 1.05rem; color: #50475a; }

.drop-zone { display: block; border: 2px dashed #c9b8e5; border-radius: 20px; padding: 27px 20px; text-align: center; background: #fbf8ff; cursor: pointer; transition: .18s ease; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--purple); background: #f5efff; transform: translateY(-1px); }
.drop-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 12px; background: white; color: var(--purple); border-radius: 18px; box-shadow: 0 8px 20px rgba(78,39,164,.13); }
.drop-title { display: block; font-size: 1.12rem; font-weight: 900; }
.drop-help { display: block; margin-top: 4px; color: var(--muted); font-size: .92rem; }
.file-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.previews { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 16px 0 0; }
.preview { aspect-ratio: 1; overflow: hidden; border-radius: 13px; background: #ede7f1; position: relative; }
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-count { grid-column: 1 / -1; margin: 2px 0 0; color: var(--muted); font-size: .9rem; font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 17px; gap: 8px; border: 0; border-radius: 13px; color: white; background: var(--purple); text-decoration: none; font-weight: 850; cursor: pointer; box-shadow: 0 8px 18px rgba(109,62,210,.18); transition: .18s ease; }
.btn:hover { background: var(--purple-dark); transform: translateY(-1px); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(109,62,210,.25); outline-offset: 2px; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-ghost { color: var(--purple-dark); background: #eee5ff; box-shadow: none; }
.btn-ghost:hover { color: white; }
.btn-light { color: var(--ink); background: white; box-shadow: none; border: 1px solid var(--line); }
.btn-light:hover { color: white; }
.btn-danger { background: var(--danger); }
.btn-small { min-height: 38px; padding: 7px 11px; font-size: .89rem; border-radius: 10px; }
.btn[disabled] { opacity: .65; cursor: wait; transform: none; }
.fine-print { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: .82rem; }
.gallery-link { margin-top: 11px; }

.alert { margin: 0 0 18px; padding: 13px 15px; border-radius: 14px; font-weight: 700; }
.alert-success { color: #12604e; background: #ddf7ef; border: 1px solid #b7e9dc; }
.alert-error { color: #8f2636; background: #fff0f1; border: 1px solid #f2c8cf; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

.landing { min-height: calc(100vh - 115px); display: grid; place-items: center; }
.landing-card { max-width: 720px; padding: clamp(28px, 7vw, 60px); text-align: center; position: relative; overflow: hidden; }
.landing-card h1 { color: var(--purple-dark); }
.landing-card p { max-width: 540px; margin: 20px auto 26px; color: #5b5263; font-size: 1.1rem; }
.sparkles { display: flex; justify-content: center; gap: 12px; margin-bottom: 22px; }
.sparkles i { display: block; width: 14px; height: 30px; border-radius: 10px; transform: rotate(24deg); background: var(--coral); }
.sparkles i:nth-child(2) { background: var(--yellow); transform: translateY(-9px) rotate(-18deg); }
.sparkles i:nth-child(3) { background: var(--mint); transform: rotate(12deg); }

.auth-card { max-width: 460px; padding: 28px; margin: 34px auto; }
.auth-card h1, .panel-title h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.field { margin-bottom: 17px; }
.field label { display: block; margin-bottom: 7px; font-weight: 800; }
.field input, .field textarea { width: 100%; border: 1px solid #d8cede; border-radius: 12px; padding: 12px 13px; color: var(--ink); background: white; }
.field textarea { min-height: 92px; resize: vertical; }
.field small { display: block; color: var(--muted); margin-top: 5px; }
.check { display: flex; align-items: center; gap: 9px; margin: 15px 0; font-weight: 750; }
.check input { width: 19px; height: 19px; accent-color: var(--purple); }

.panel-title { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 12px 0 24px; }
.panel-title p { margin: 5px 0 0; color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: minmax(270px, .8fr) minmax(0, 1.5fr); gap: 20px; align-items: start; }
.panel-card { padding: 22px; }
.panel-card h2 { margin: 0 0 17px; font-size: 1.25rem; }
.events { display: grid; gap: 12px; }
.event-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.event-row h3 { margin: 0 0 4px; font-size: 1rem; }
.meta { color: var(--muted); font-size: .88rem; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 850; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #32b592; }
.status.off::before { background: #b6acbb; }

.detail-grid { display: grid; grid-template-columns: 310px minmax(0,1fr); gap: 20px; align-items: start; }
.qr-card { text-align: center; }
.qr-card img { width: min(100%, 250px); aspect-ratio: 1; border-radius: 16px; background: white; border: 10px solid white; box-shadow: 0 8px 26px rgba(31,22,45,.12); }
.share-link { width: 100%; margin: 13px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #faf8fc; color: #665e6c; font-size: .82rem; }
.gallery-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.gallery-head h2 { margin: 0; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 15px; overflow: hidden; background: #eae4ee; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-actions { position: absolute; inset: auto 7px 7px 7px; display: flex; gap: 6px; justify-content: flex-end; opacity: 0; transform: translateY(5px); transition: .18s; }
.photo:hover .photo-actions, .photo:focus-within .photo-actions { opacity: 1; transform: none; }
.icon-btn { display: grid; place-items: center; width: 37px; height: 37px; border: 0; border-radius: 10px; color: var(--ink); background: rgba(255,255,255,.94); cursor: pointer; text-decoration: none; box-shadow: 0 5px 12px rgba(0,0,0,.12); }

.public-gallery-wrap { max-width: 1040px; margin: 8px auto 0; }
.gallery-hero { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; padding: 27px 28px; border-radius: 23px; color: white; background: linear-gradient(135deg, var(--purple-dark), var(--purple) 60%, #8a58e8); box-shadow: var(--shadow); }
.gallery-hero h1 { font-size: clamp(2rem, 7vw, 3.8rem); }
.gallery-hero p:last-child { margin: 10px 0 0; opacity: .86; font-weight: 750; }
.public-gallery { columns: 4 190px; column-gap: 12px; }
.public-photo { display: block; width: 100%; margin: 0 0 12px; padding: 0; border: 0; border-radius: 15px; overflow: hidden; background: #e7dfee; cursor: zoom-in; break-inside: avoid; box-shadow: 0 7px 20px rgba(40,22,63,.09); }
.public-photo img { display: block; width: 100%; height: auto; min-height: 120px; object-fit: cover; transition: transform .22s ease, filter .22s ease; }
.public-photo:hover img { transform: scale(1.025); filter: saturate(1.06); }
.gallery-empty { max-width: 620px; margin: 65px auto 0; }
.gallery-empty h2 { margin: 0; color: var(--ink); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 26px 0 0; font-weight: 800; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 54px 18px 24px; background: rgba(18, 11, 27, .94); }
.lightbox[hidden] { display: none; }
.lightbox img { display: block; max-width: min(1200px, 96vw); max-height: 88vh; border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.45); }
.lightbox-close { position: fixed; top: 12px; right: 15px; width: 43px; height: 43px; border: 1px solid rgba(255,255,255,.35); border-radius: 50%; color: white; background: rgba(255,255,255,.1); font-size: 2rem; line-height: 1; cursor: pointer; }

@media (max-width: 820px) {
  .admin-grid, .detail-grid { grid-template-columns: 1fr; }
  .panel-title { align-items: start; flex-direction: column; }
  .qr-card { order: 2; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1120px); }
  .site-header { padding-top: 13px; }
  .brand { font-size: 1rem; }
  .brand-mark { width: 36px; height: 36px; }
  .event-band { padding: 29px 21px 25px; min-height: 145px; }
  .upload-body, .panel-card, .auth-card { padding: 19px; }
  .previews { grid-template-columns: repeat(3, 1fr); }
  .gallery { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .event-row { grid-template-columns: 1fr; }
  .event-row .btn { width: 100%; }
  .header-actions .btn { min-height: 40px; padding: 8px 11px; font-size: .85rem; }
  .photo-actions { opacity: 1; transform: none; }
  .gallery-hero { align-items: stretch; flex-direction: column; padding: 23px 19px; }
  .gallery-hero .btn { width: 100%; }
  .public-gallery { columns: 2 130px; column-gap: 8px; }
  .public-photo { margin-bottom: 8px; border-radius: 11px; }
  .pagination { flex-wrap: wrap; font-size: .9rem; }
}

@media print {
  body { background: white; }
  .no-print, .site-header { display: none !important; }
  .card { border: 0; box-shadow: none; }
}
