:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #666b73;
  --line: #e6e2db;
  --paper: #fffaf3;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --rose: #d9466f;
  --shadow: 0 16px 45px rgba(32, 33, 36, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.page {
  min-height: 100vh;
  padding: 20px clamp(14px, 4vw, 32px) 48px;
}
.shell {
  width: min(980px, 100%);
  margin: 0 auto;
}
.party-hero {
  padding: 28px 0 18px;
}
.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
h1 {
  margin: 8px 0 8px;
  font-size: clamp(2rem, 11vw, 4.8rem);
  line-height: .98;
  letter-spacing: 0;
}
.date, .muted { color: var(--muted); }
.description {
  max-width: 38rem;
  font-size: 1.1rem;
  line-height: 1.45;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 22px;
}
.btn {
  border: 0;
  border-radius: 8px;
  padding: 13px 18px;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.danger { background: #b42318; }
.btn.small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: .9rem;
}
.count {
  margin: 20px 0 12px;
  font-weight: 800;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.photo-tile {
  border: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #ede8df;
  aspect-ratio: 1;
  position: relative;
}
.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 8px 7px;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.68));
}
.empty {
  border: 1px dashed #cfc7bb;
  border-radius: 8px;
  padding: 28px 18px;
  color: var(--muted);
  background: rgba(255,255,255,.58);
}
.notice {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.uploader {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, .42);
  display: none;
  align-items: end;
  z-index: 20;
}
.uploader.open { display: flex; }
.sheet {
  width: 100%;
  background: #fff;
  border-radius: 8px 8px 0 0;
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow: auto;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 1.2rem;
}
.dropzone {
  display: block;
  margin: 16px 0;
  border: 1px dashed #bdb5aa;
  border-radius: 8px;
  padding: 22px;
  text-align: center;
  background: #fffaf3;
  font-weight: 700;
}
.dropzone input { display: none; }
.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
}
progress {
  width: 100%;
  height: 12px;
  accent-color: var(--accent);
}
.status { min-height: 24px; color: var(--muted); }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0,0,0,.92);
  display: none;
  place-items: center;
}
.lightbox.open { display: grid; }
.lightbox img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}
.lightbox .nav, .lightbox .close {
  position: fixed;
  border: 0;
  background: rgba(255,255,255,.14);
  color: #fff;
  border-radius: 8px;
}
.lightbox .close { top: 14px; right: 14px; width: 44px; height: 44px; }
.lightbox .prev, .lightbox .next {
  top: 50%;
  width: 44px;
  height: 56px;
  transform: translateY(-50%);
  font-size: 1.4rem;
}
.lightbox .prev { left: 10px; }
.lightbox .next { right: 10px; }

.admin-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(32,33,36,.05);
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}
.field span {
  font-size: .86rem;
  color: var(--muted);
  font-weight: 700;
}
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
}
input[type="checkbox"] {
  width: auto;
  min-height: 0;
}
textarea { min-height: 88px; resize: vertical; }
.event-list {
  display: grid;
  gap: 8px;
}
.event-row {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
}
.event-row.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.qr {
  width: 160px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.photo-admin {
  position: relative;
}
.photo-admin a {
  display: block;
  width: 100%;
  height: 100%;
}
.photo-admin .btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
}
.login {
  width: min(420px, 100%);
  margin: 10vh auto 0;
}

@media (min-width: 680px) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .sheet {
    width: min(620px, calc(100% - 32px));
    margin: 0 auto 16px;
    border-radius: 8px;
  }
}
@media (max-width: 780px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-top { align-items: flex-start; flex-direction: column; }
}
