:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f7f4ef;
  color: #24211c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: rgba(255, 252, 246, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(58, 48, 38, 0.08);
}

.brand {
  font-weight: 800;
  text-decoration: none;
}

nav {
  display: flex;
  gap: 14px;
}

nav a {
  text-decoration: none;
  font-size: 14px;
  color: #5b5348;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 22px 14px 48px;
}

.page.narrow {
  width: min(720px, 100%);
}

.hero {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, #fffaf2, #eee3d4);
  box-shadow: 0 18px 50px rgba(70, 55, 38, 0.08);
}

.hero.compact {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

h1, h2, p { margin-top: 0; }

h1 { margin-bottom: 8px; font-size: clamp(28px, 7vw, 48px); }
h2 { margin-bottom: 12px; }
p { color: #756b5d; line-height: 1.65; }

.card {
  border-radius: 22px;
  padding: 18px;
  background: #fffdf9;
  border: 1px solid rgba(68, 55, 40, 0.08);
  box-shadow: 0 14px 36px rgba(70, 55, 38, 0.06);
}

.form-card {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

label, .select-label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: #51483d;
}

input, select, button {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(58, 48, 38, 0.16);
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 18px auto 0;
  min-width: 160px;
  border: 0;
  background: #2d2013;
  color: #fffaf2;
  font-weight: 800;
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.status {
  margin: 14px 4px;
  color: #6d6255;
}

.gallery {
  column-count: 1;
  column-gap: 8px;
}

.gallery-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 8px;
  overflow: hidden;
  break-inside: avoid;
  border-radius: 18px;
  background: #e8dfd2;
  box-shadow: 0 12px 34px rgba(42, 35, 28, 0.09);
}

.gallery-card button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.gallery-card img {
  display: block;
  width: 100%;
  height: auto;
}

.file-list {
  margin: 0;
  padding-left: 18px;
  color: #655b4d;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}

.preview-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 14px;
  background: #eee3d4;
}

.result {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #4d4439;
}

.admin-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.admin-card {
  overflow: hidden;
  border-radius: 18px;
  background: #fffdf9;
  border: 1px solid rgba(68, 55, 40, 0.08);
}

.admin-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eee3d4;
}

.admin-card-body {
  padding: 12px;
}

.danger {
  width: 100%;
  border: 0;
  background: #9d2b22;
  color: white;
  font-weight: 800;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 18, 15, 0.86);
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 999px;
  background: #fffaf2;
  color: #251c15;
  font-size: 28px;
}

.hidden { display: none !important; }

@media (min-width: 480px) {
  .gallery { column-count: 2; column-gap: 10px; }
  .gallery-card { margin-bottom: 10px; }
}

@media (min-width: 768px) {
  .page { padding: 34px 22px 64px; }
  .gallery { column-count: 3; column-gap: 14px; }
  .gallery-card { margin-bottom: 14px; border-radius: 22px; }
}

@media (min-width: 1200px) {
  .gallery { column-count: 4; column-gap: 16px; }
  .gallery-card { margin-bottom: 16px; }
}

@media (max-width: 640px) {
  .hero.compact { display: grid; align-items: stretch; }
}
