:root {
  --bg: #f7f6f4;
  --text: #1b1b1b;
  --muted: #7a7a7a;
  --card: #ffffff;
  --accent: #111111;
  --border: #e6e3de;
  --danger: #b42318;
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

body {
  margin: 0;
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", "Marker Felt", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--site-background, none);
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  z-index: -1;
  pointer-events: none;
}

.topbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
}

.topbar form {
  margin: 0;
}

.hero {
  text-align: center;
  padding: 48px 16px;
}

.hero h1 {
  font-size: clamp(48px, 10vw, 96px);
  margin: 0 0 8px;
  font-family: "Dancing Script", cursive;
  font-weight: 400;
  color: var(--accent);
}

.hero p {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
}

.filters {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 24px 16px;
  flex-wrap: wrap;
}

.chip {
  background: transparent;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--card);
  border-color: var(--accent);
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 24px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  transition: transform 0.2s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.card img,
.card video {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.card figcaption {
  padding: 16px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.card .title {
  flex: 1;
  font-weight: 600;
}

.card .meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.card .desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.lightbox.hidden { display: none; }

.lightbox-inner {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  gap: 12px;
  flex-direction: column;
}

.lightbox-media {
  position: relative;
  display: inline-block;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 16px;
  transition: transform 0.3s ease;
  transform-origin: center;
  cursor: zoom-in;
}

.lightbox-inner video {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 16px;
  display: block;
}

@media (min-width: 700px) {
  .lightbox-inner img.zoomed {
    transform: scale(2);
    cursor: zoom-out;
    max-width: none;
    max-height: none;
  }
}

.lightbox-caption {
  color: #f2f2f2;
  text-align: center;
}

.lightbox-caption h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.lightbox-caption p {
  margin: 4px 0;
  font-size: 14px;
  color: #ccc;
}

.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

button {
  font-family: inherit;
  font-size: 14px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  background: #000;
}

button.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

button.ghost:hover {
  background: var(--card);
  border-color: var(--accent);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #8b1a12;
}

button.danger.small {
  padding: 6px 12px;
  font-size: 12px;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: var(--card);
  border-radius: 16px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal.modal-large {
  max-width: 900px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
}

.icon-button {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.icon-button:hover {
  color: var(--text);
  background: transparent;
}

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

.modal-form input[type="text"],
.modal-form textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
}

.modal-form textarea {
  resize: vertical;
  min-height: 60px;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent);
}

.drop-zone input[type="file"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-preview {
  margin-bottom: 12px;
}

.drop-preview.hidden {
  display: none;
}

.drop-preview img,
.drop-preview video {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
  margin: 0 auto;
}

.drop-filename {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.admin-section-title {
  margin: 24px 20px 12px;
  font-size: 18px;
}

.admin-section-divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 20px 12px;
}

.admin-section-header h3 {
  margin: 0;
  font-size: 18px;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.admin-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

@media (max-width: 600px) {
  .admin-item {
    grid-template-columns: 1fr;
  }
}

.admin-thumb {
  position: relative;
}

.admin-thumb img,
.admin-thumb video {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
}

.visible-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  cursor: pointer;
}

.visible-toggle input[type="checkbox"] {
  cursor: pointer;
}

.admin-actions {
  display: flex;
  gap: 8px;
}

.admin-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.admin-fields input,
.admin-fields textarea,
.admin-fields select {
  font-family: inherit;
  font-size: 13px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.background-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.background-card {
  position: relative;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  transition: border-color 0.2s ease;
}

.background-card.active {
  border-color: var(--accent);
}

.background-select {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}

.background-select input[type="radio"] {
  cursor: pointer;
}

.background-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
}

.background-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.background-filename {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  white-space: nowrap;
}

.site-footer {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer p {
  margin: 0 0 8px;
}

.link-button {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

.link-button:hover {
  color: var(--text);
  background: none;
}

.modal-body {
  padding: 20px;
}

.tos-content h3 {
  margin-top: 0;
  font-size: 20px;
}

.tos-content h4 {
  margin-top: 20px;
  margin-bottom: 8px;
  font-size: 16px;
}

.tos-content p,
.tos-content ul {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

.tos-content ul {
  padding-left: 24px;
}

.tos-content li {
  margin-bottom: 8px;
}
