*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fff;
  --text: #111;
  --muted: #8e8e8e;
  --border: #dbdbdb;
  --accent: #0095f6;
  --tab-active: #111;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 935px;
  margin: 0 auto;
  padding: 0 0 60px;
}

/* ── Profile Header ── */
.profile-header {
  display: flex;
  align-items: flex-start;
  gap: 40px;
  padding: 30px 16px 24px;
}

.profile-avatar { flex-shrink: 0; }

.profile-avatar img,
.avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 600;
  color: var(--muted);
}

.profile-info h1 {
  font-size: 20px;
  font-weight: 300;
  margin-bottom: 12px;
}

.profile-info h1 .handle {
  font-weight: 600;
  font-size: 20px;
}

.stats {
  display: flex;
  gap: 24px;
  font-size: 14px;
  margin-bottom: 8px;
}

.stats span strong { font-weight: 600; }

.archive-note { font-size: 12px; color: var(--muted); }
.archive-note a { color: var(--accent); text-decoration: none; }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-top: 1px solid var(--border);
}

.tabs a {
  flex: 1;
  text-align: center;
  padding: 14px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  border-top: 1px solid transparent;
  margin-top: -1px;
}

.tabs a.active {
  color: var(--tab-active);
  border-top-color: var(--tab-active);
}

/* ── Toolbar (Search + Sort) ── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.toolbar input[type=search] {
  flex: 1;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fafafa;
  outline: none;
  min-width: 0;
}

.toolbar input[type=search]:focus {
  border-color: var(--muted);
  background: #fff;
}

.toolbar select {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fafafa;
  cursor: pointer;
  outline: none;
  white-space: nowrap;
}

.result-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 60px;
  text-align: right;
}

/* ── Grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin-top: 3px;
}

.grid-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: #f0f0f0;
}

.grid-item img,
.grid-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .15s;
}

.grid-item:hover img,
.grid-item:hover video { opacity: .85; }

.video-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
  pointer-events: none;
}

.empty {
  text-align: center;
  padding: 60px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox[hidden] { display: none; }

.lb-media {
  max-width: min(90vw, 700px);
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-media img,
.lb-media video {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 2px;
}

.lb-caption {
  color: #fff;
  text-align: center;
  padding: 16px 24px;
  max-width: min(90vw, 700px);
}

#lb-date {
  font-size: 12px;
  color: #aaa;
  display: block;
  margin-bottom: 6px;
}

#lb-text {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 100px;
  overflow-y: auto;
}

.lb-close,
.lb-prev,
.lb-next {
  position: fixed;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  opacity: .8;
  transition: opacity .15s;
  padding: 8px;
}

.lb-close { top: 16px; right: 16px; font-size: 22px; }
.lb-prev  { left: 12px;  top: 50%; transform: translateY(-50%); font-size: 42px; }
.lb-next  { right: 12px; top: 50%; transform: translateY(-50%); font-size: 42px; }

.lb-close:hover,
.lb-prev:hover,
.lb-next:hover { opacity: 1; }

/* ── Mobile ── */
@media (max-width: 600px) {
  .profile-header { gap: 20px; padding: 20px 12px; }
  .profile-avatar img,
  .avatar-placeholder { width: 72px; height: 72px; }
  .profile-info h1 { font-size: 16px; }
  .stats { gap: 16px; }
  .toolbar { padding: 8px; }
  .toolbar select { font-size: 12px; }
  .lb-prev { left: 4px; }
  .lb-next { right: 4px; }
}
